ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 23 Dec 2011 20:09:36 +0100Taylor expansion twice for a general function cause problem?https://ask.sagemath.org/question/8568/taylor-expansion-twice-for-a-general-function-cause-problem/Hi,
I met a problem when expanding a general function twice:
y = var('y')
f = function('f',var('x'))
g = f(x=var('eps')*y)
h = taylor(g, eps, 0, 1)
taylor(h, eps, 0, 1)
The last expression ends up with an error: NotImplementedError: arguments must be distinct variables
Is it a bug or I got anything wrong? Thanks!
Fri, 16 Dec 2011 15:13:28 +0100https://ask.sagemath.org/question/8568/taylor-expansion-twice-for-a-general-function-cause-problem/Answer by gabriel for <p>Hi, </p>
<p>I met a problem when expanding a general function twice:</p>
<pre><code>y = var('y')
f = function('f',var('x'))
g = f(x=var('eps')*y)
h = taylor(g, eps, 0, 1)
taylor(h, eps, 0, 1)
</code></pre>
<p>The last expression ends up with an error: NotImplementedError: arguments must be distinct variables</p>
<p>Is it a bug or I got anything wrong? Thanks!</p>
https://ask.sagemath.org/question/8568/taylor-expansion-twice-for-a-general-function-cause-problem/?answer=13063#post-id-13063Hello, I'm new to Sage and running into the same problem as you. I think this error happens when the object that you want to Taylor expand has a derivative that is evaluated at a specified point:
x = var('x')
u = function('u', x)
v(x) = u.diff(x)
taylor(u(x = 0), x, 0, 2) #works
taylor(v(x), x, 0, 2) #works
taylor(v(x = 0), x, 0, 2) #doesn't work
`v(0) = D[0](u)(0)` seems to be the problem, just like, in your case, there is a `D[0](f)(0)` in the Taylor expansion of `g`
So my guess is that issue resides in how derivatives evaluated at a fixed point are passed to Maxima..
Fri, 23 Dec 2011 20:09:36 +0100https://ask.sagemath.org/question/8568/taylor-expansion-twice-for-a-general-function-cause-problem/?answer=13063#post-id-13063