Differentiation inverse function. How it is correct?

210 views
Skip to first unread message

alien308

unread,
Sep 18, 2010, 6:20:29 AM9/18/10
to sage-s...@googlegroups.com
x = var("x")
d = function("d",x)
diff(x, d)

output:
Traceback (click to the left of this block for traceback)
...
TypeError: argument symb must be a symbol

kcrisman

unread,
Sep 18, 2010, 9:42:17 PM9/18/10
to sage-support


On Sep 18, 6:20 am, alien308 <alien3...@gmail.com> wrote:
> x = var("x")
> d = function("d",x)
> diff(x, d)
>

Did you intend to differentiate x with respect to d? The error
message is totally unhelpful, though presumably this derivative
doesn't make sense 'as is'.

If you instead do

sage: diff(d,x)
D[0](d)(x)

Which is probably what you want, though the representation leaves
something to be desired (which is a long-standing debate on several
Trac tickets).

But there are other issues here, at least to me - maybe someone can
explain this:

If you don't do let d = function("d", x), but just do function("d",x),
you get a different error. The error comes from trying to make d an
element of the symbolic ring, which perhaps isn't a bug per se, though
at the very least the error message for such a case could be more
helpful.

Moreover,

sage: diff(d,x)

gives an error

TypeError:

Not even an error message! Although

sage: function?

doesn't say you can do this (not assign function("d",x) to a Python
variable), it also doesn't say you can't.

- kcrisman

kcrisman

unread,
Sep 18, 2010, 9:43:57 PM9/18/10
to sage-support
Actually, the subject of your email now makes a little more sense.
But I don't think that one can define an inverse function quite this
easily! That would indeed be *very* obscure notation! I don't know
if we can define a symbolic inverse of this kind yet, or whether that
would even be easy - much less to differentiate it. Anyone?

- kcrisman

On Sep 18, 6:20 am, alien308 <alien3...@gmail.com> wrote:

alien308

unread,
Sep 19, 2010, 12:50:51 AM9/19/10
to sage-support
Thanks.

Nils Bruin

unread,
Sep 19, 2010, 12:44:59 PM9/19/10
to sage-support
On Sep 18, 6:43 pm, kcrisman <kcris...@gmail.com> wrote:
> Actually, the subject of your email now makes a little more sense.
> But I don't think that one can define an inverse function quite this
> easily!  That would indeed be *very* obscure notation!  I don't know
> if we can define a symbolic inverse of this kind yet, or whether that
> would even be easy - much less to differentiate it.  Anyone?

Finding an expression for the derivative of an inverse is part of most
first calculus courses:

Suppose that f : R -> R is a differentiable function and that y=f(x).
Suppose that g : R -> R is an inverse to f, i.e., x=g(y).
Find an expression for g'(y) in terms of f'(x). [HINT: use the chain
rule on f(g(y) or g(f(x))]

One usually continues with stating the inverse function theorem to
conclude that if this computation doesn't rule out the existence of a
differentiable inverse, then the inverse exists locally, an expression
for which you can now find by integration [so, probably rather hard to
do in general on a symbolic level]

TianWei

unread,
Sep 19, 2010, 3:03:22 PM9/19/10
to sage-support
I might be misunderstanding this whole thread, but I think kcrisman is
looking for a generic way to express the inverse of a symbolic
function, perhaps similarly to the way Mathematica's "InverseFunction"
works:

http://reference.wolfram.com/mathematica/ref/InverseFunction.html

I don't know what sort of features are available in Sage or any of its
standard packages that could provide this sort of functionality.

Then again, I might have gotten this all wrong.

-- Tianwei

kcrisman

unread,
Sep 19, 2010, 9:39:57 PM9/19/10
to sage-support
Well, the original poster's reply was pretty concise, so I'm not even
sure whether I understood the point of the thread :) But hopefully I
did. It seemed that this is what the poster wanted.

- kcrisman
Reply all
Reply to author
Forward
0 new messages