The setup:
sage: var('x y')
sage: F = sin(x^2 + y^2) * cos(y) * exp(-0.5*(x^2+y^2))
sage: G=F.derivative(x,x); G
-3.00000000000000*x^2*e^(-(0.500000000000000*(y^2 +
x^2)))*cos(y)*sin(y^2 + x^2) -
1.00000000000000*e^(-(0.500000000000000*(y^2 + x^2)))*cos(y)*sin(y^2 +
x^2) - 4.00000000000000*x^2*e^(-(0.500000000000000*(y^2 +
x^2)))*cos(y)*cos(y^2 + x^2) + 2*e^(-(0.500000000000000*(y^2 +
x^2)))*cos(y)*cos(y^2 + x^2)
Then the following takes a long time, between 5 and 10 seconds on my
2.4 GHz Intel iMac.
sage: G(1.2, 1.2)
0.193703001636676
(I tried using 'timeit(G(1.2, 1.2))' but got: AttributeError:
'SymbolicArithmetic' object has no attribute 'find'.)
Why is it so slow, and are there any tricks I can use to speed it up?
I'd like to use these calculations in a class (graphing the degree 2
Taylor approximation to a function in two variables), but if it takes
minutes to compute all of the relevant first and second derivatives,
it's annoying. (If a student says, "Let's see what happens if we
compute the Taylor polynomial at a different point", I'd like to be
able to oblige them.)
John
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---