On Sunday, August 3, 2014 8:56:40 PM UTC-7, Nasser M. Abbasi wrote:
>
> I am a sage newbie so please be easy on me.
>
> In sage, to make a differential equation one must write, as shown here
> http://www.sagemath.org/doc/reference/calculus/sage/calculus/desolvers.html
>
> sage: x = var('x')sage: y = function('y', x)sage: desolve(diff(y,x) + y - 1,
> y)
>
> My question is only about the third line above. I'd like to write this as
>
>
> sage: desolve( diff(y(x),x) + y(x) - 1, y(x))
>
> If you look at the output you see that that IS basically what you're
typing:
sage: function('y',x)
y(x)
so when you type
sage: y=function('y',x)
then when you type "y", sage is actually seeing "y(x)". You can do
sage: y=function('y')
sage: desolve( diff(y(x),x) + y(x) - 1, y(x))
(_C + e^x)*e^(-x)
which ensures that what you type corresponds a little more closely to what
sage is seeing. (note that here y gets bound to "the function y" rather
than "the function y evaluated at x").
Three reasons:
> 1. It is makes it more clear which is the dependent and the independent
> variable
> 2. It makes it easy to copy my Maple differential equations as is
> to sage since that is the way Maple specifies it also.
> 3. it is closer to how textbooks write differential equations.
>
>
yep. all good reasons and in fact sage DOES require its input to be of that
form.
/home/me/data/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2834:
> DeprecationWarning: Substitution using function-call syntax and
> unnamed arguments is deprecated and will be removed from a future
> release of Sage; you can use named arguments instead,
> like EXPR(x=..., y=...)
>
> Does this mean this syntax y(x) will be removed from sage? Why? and is
> it possible to keep it?
>
>
No. this error gets triggered by what is essentially
sage: y=function('y')
sage: y(x)(x)
Sage is not complaining about "y evaluated at x". It is complaining that
you're evaluating the result of that at x again.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.