On Thu, Jul 19, 2012 at 5:15 AM, Brad <[email protected]> wrote:
> Hi,
>
> I have an application in which many symbolic variables (close to 100) need
> to be defined.
>
> I am aware that one can do
>
> x,y,z = sympy.symbols('x y z')
>
> or
>
> x = sympy.Symbol('x'); y = sympy.Symbol('y'); z = sympy.Symbol('z')
>
> For my application, many of the symbol names are very close in spelling, so
> it takes a great deal of care to assure that the exact same variable name is
> used on the left-hand and right-hand sides of the assignment.
>
> Is there a way to assign them in a more automatic and potentially error free
> manner?

Do you know that you can do

>>> v=var('v:100')
>>> v[0]
v0

or

(x,y,z)=symbols('x,y,z')

(The last form is like what you've done except I used comma delimiters
on the left -- which are needed for python but are optional as
delimeters for symbols.)

/c

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to