Excellent. Thank you Alex! /hpon
On 13 Mar, 09:16, Alex Ghitza <aghi...@gmail.com> wrote: > Hi, > > On Fri, Mar 13, 2009 at 7:09 PM, hpon <peter.norli...@gmail.com> wrote: > > > Hi, > > > What is the easiest way to make a mathematical substitution in Sage? > > > For example: We have > > > eqn1 = F == a + b > > I'm not sure I understand what you are trying to do in this line. If you > just want to define F as the sum of a and b, use > > var('a b') # to tell Sage that a and b are symbolic > variables > F = a + b > > > > > and would like to use a = 0 and b = 3 to calculate F. > > Now F is a symbolic expression, and you can perform substitutions easily as > follows: > > F.substitute(a=0, b=3) # and Sage will answer: 3 > > If you do F.substitute? you will get the documentation for the substitution > method, with more examples of usage. > > Best, > Alex > > -- > Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne -- > Australia --http://www.ms.unimelb.edu.au/~aghitza/ --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---