-
-
Notifications
You must be signed in to change notification settings - Fork 641
Description
The following does not work:
sage: x = var('x')
sage: f = function('y', x)
sage: desolve(diff(y,x)-y == 0,y)
Traceback (click to the left of this block for traceback)
...
TypeError
altough y
is automatically injected to the gobal namespace.
This is because y
is of the wrong type:
sage: f, type(f)
(y(x), sage.symbolic.expression.Expression)
sage: y, type(y)
(y, sage.symbolic.function_factory.NewSymbolicFunction)
It works with f
:
sage: desolve(diff(f,x)-f == 0,f)
c*e^x
This is confusing, especially, since in the docstring of function
under "Note" you can find
The new function is both returned and automatically injected into the global namespace.
Therefore, it is not absurd to assume that this automatically injected variable is the one I want to use, i.e. the one you would get by y = function('y', x)
(similar to the var
-command).
(If this is behavior of function
is (really) on purpose, then at least the error message of desolve
should be more clearifying and give a hint.)
Component: symbolics
Keywords: desolve function
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/15025