On Monday, February 29, 2016 at 2:56:06 PM UTC-8, William wrote:
>
> Hi, 
>
> Somebody doing differential equations sent me this code, which you can 
> run in a fresh sage-6.9 session: 
>
> var('x,y') 
> y    = function('y')(x) 
> eqn  = diff(x^2+y^2==25,x) 
> sol0 = solve(eqn, diff(y,x)) 
> sol1 = sol0[0].subs({x:3}) 
> sol1.subs({y(3):4}) 
>
> The *last line* outputs: 
>
> D[0](y)(3) == (-3/4) 
> 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=...) 
> See http://trac.sagemath.org/5930 for details. 
>   exec compile(block+'\n', '', 'single') in namespace, locals 
>
> I have some problems with this: 
>
>  (1) trac #5930 hasn't been touched in *7 years*, and doesn't mention 
> subs anywhere.  Maybe referencing 5930 was a typo? 
>

The patch mentions subs. I'm not an expert in this, but I think it's the 
right ticket.
 

>  (2) The actual substitution above is *NOT* function-call syntax -- 
> it's passing in a dictionary, which seems like a very reasonable way 
> to do substitution in general and should never get deprecated.  So why 
> is that deprecation warning appearing?  Is it actually coming from 
> some other code inside the library? 
>

Regarding points (2) and (3), the warning comes from the "y(3)" part of the 
line, not the "subs" part of the line. I think if you replace the last line 
with "sol1.subs({y.subs(x=3):4})", no warning.
  

>  (3) The suggestion to "use named arguments instead, like EXPR(x=..., 
> y=...)" seems confusing to me, since it's impossible to specify y(3) 
> as a named argument.  Also, it assumes that a variable is the same as 
> its string, which is a bad assumption to make and just begs for bugs; 
> using a dictionary (or ==) is always safer and should be preferred, 
> right? 
>

> William 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to