Ask Your Question

Nicolas M Thiéry's profile - activity

2015-01-12 12:47:58 +0200 received badge  Famous Question (source)
2013-10-02 13:45:56 +0200 received badge  Necromancer (source)
2013-09-24 17:53:02 +0200 answered a question Keyboard layout in Sage appliance

Here are some instructions we used last fall during a Sage workshop in a French speaking country; they might be outdated since then ...

Switch to the text console:

CTRL-ALT-F1

Log in:

login: sage
password: sage

Switch to user gui (might not be needed anymore)::

sudo su - gui

Edit the xinitrc file::

nano .xinitrc

Add the following line, just before the last line that starts google-chrome::

setxkbmap fr

Reboot:

reboot
2013-09-06 07:09:20 +0200 received badge  Nice Answer (source)
2013-09-02 03:53:11 +0200 answered a question Problem with AbelianGroup.cayley_graph ()

Thanks for the report! That's a trivial not implemented feature: this abelian group should be in the finite group category. It would then take advantage of the "semigroup_genrators" implemented there which uses the fact that, for a finite group, the group generators are also semigroup generators.

I have made this #15140.

In the mean time, you can do:

ag2.semigroup_generators = ag2.group_generators
ag2.cayley_graph()
2013-08-13 09:54:59 +0200 answered a question Can SAGE calculate with projective (indecomposable) A-modules (A is a finite dimensional Q-algebra)?

Aladin Virmaux has written some code (ported from Florent Hivert's implementation in MuPAD) that computes the Cartan matrix of a finite dimensional algebra by constructing orthogonal idempotents and building the sandwiches e_i A e_j. The code is meant to go into Sage at some point, but it still needs polishing and has a couple dependencies.

Probably something could be extracted out of it for your need, but I don't expect it to do better than the naive implementation: building the a basis of the projective module e_i A by repeated multiplication on the right by the generators and so on.

If your algebra is the algebra of a monoid or semigroup, let us know for there we have much more under hand :-)

What kind of dimension do you have in mind?

2013-08-12 17:54:47 +0200 received badge  Editor (source)
2013-08-12 17:53:04 +0200 answered a question injecting names into global namespace doesn't work with doctest

sage.misc.misc.inject_variable might be your friend.

2013-07-01 08:32:23 +0200 received badge  Great Question (source)
2013-06-07 12:19:26 +0200 received badge  Notable Question (source)
2012-10-15 11:30:06 +0200 answered a question is a parent like a set?

Yes! A parent indeed models a mathematical set, more often than not endowed with some structure (a ring, a poset, a vector space, ...).

In your case, you want to implement a class that inherits from Parent, and sets its category to Rings() during the initialization. We don't have yet a minimal example of implementation of a ring, but you can already look at:

sage: S = Monoids()
sage: M = S.example()
sage: M??
2012-10-06 09:49:31 +0200 received badge  Popular Question (source)
2011-12-04 03:14:16 +0200 received badge  Teacher (source)
2011-12-04 03:14:16 +0200 received badge  Necromancer (source)
2011-09-01 15:45:12 +0200 received badge  Good Question (source)
2011-09-01 14:15:30 +0200 received badge  Nice Question (source)
2011-08-26 19:03:20 +0200 received badge  Student (source)
2011-08-26 03:25:04 +0200 answered a question substitute expression instead of formal function symbol

Hugh Thomas pointed me to the following. When writting:

sage: foo = function('foo',x)

foo is actually foo(x). However, in h, and in particular in pieces like D[0](foo)'', it's not onlyfoo(x)'' that we want to replace, but ``foo''. So a trick is to store the result of function('foo',x) in another variable. And now, substituting with substitute function will work::

sage: var('a b x')
sage: f = function('foo',x)
sage: g = a*foo(x) + b*foo(x)^2
sage: h = diff(g, x)
sage: bar(x) = a*x + b
sage: h.substitute_function(foo, bar)
2*(a*x + b)*a*b + a^2

Now, some questions:

  • Is there a way to recover foo from foo(x)? Something like foo(x).unapply()? Worst come to worst, one can use: sage.symbolic.function_factory.function('foo')

  • Should substitute_function support:

    sage: h.substitute_function(foo(x), bar)

Moral: side effects, like those with function, are ugly ...

2011-08-25 10:24:25 +0200 asked a question Substitute formal function by an expression in a differential equation

This is a follow up to substitute expression instead of formal function symbol. I tried to no avail to apply the workaround proposed there for the following application where I build a differential equation involving a formal function P:

  sage: x,y = var('x,y')
  sage: P = function('P',x,y)
  sage: z = var('z')
  sage: C = function('C',z)
  sage: equation = P(x=z,y=C) == 0
  sage: dequation = diff(equation, z)

and then I would want to substitute P by a specific expression:

  sage: Q(x,y) = y^2 - y + x
  sage: dequation.substitute_function(P,Q)

But whatever I tried, I got:

   D[0](C)(z)*D[1](P)(z, C(z)) + D[0](P)(z, C(z)) == 0

Is there a natural syntax to achieve this? If not, should this be a ticket?

Thanks!

2011-08-25 07:54:41 +0200 received badge  Supporter (source)