#17958: implement declare_var, deprecate (None)var
-----------------------------+------------------------
       Reporter:  rws        |        Owner:
           Type:  defect     |       Status:  new
       Priority:  major      |    Milestone:  sage-6.6
      Component:  symbolics  |   Resolution:
       Keywords:             |    Merged in:
        Authors:             |    Reviewers:
Report Upstream:  N/A        |  Work issues:
         Branch:             |       Commit:
   Dependencies:             |     Stopgaps:
-----------------------------+------------------------

Comment (by nbruin):

 Replying to [comment:42 vbraun]:
 > Even right row you are not **supposed** to use `var` in library code,
 but there is nothing stopping you. Programmatically generated symbolic
 variables should always be declared as `x = SR.var('x')`. This is already
 spelled out in the current `var` docstring.

 Is that spelled out? I looked at sage.calculus.var.var? (that's the var
 that also occurs at top-level) and didn't find it there. I don't think a
 programmatic approach to injecting `x1,...,x10` is so bad.

 A possible scenario:
 {{{
 sage: A=var(''.join('x%d '%i for i in [1..10]))
 sage: L=sum(A[i]^(i+1) for i in [0..9])^2
 sage: L.expand().coefficient(x4^4)
 2*x10^10 + 2*x9^9 + 2*x8^8 + 2*x7^7 + 2*x6^6 + 2*x5^5 + 2*x3^3 + 2*x2^2 +
 2*x1
 }}}
 which actually illustrates a genuine use of "inject as well as return".
 D'oh.

--
Ticket URL: <http://trac.sagemath.org/ticket/17958#comment:46>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to