I mean, the implementation of top-level var, of course.

On Sun, 6 Mar 2022 at 23:35, G. M.-S. <lists....@gmail.com> wrote:

>
> Thanks, Nils.
>
> A further question is thus how to do something like
> v0,...,v*k*=SR.var('v', n=*k*)
> when *k* varies.
>
> Should I look at the implementation of SR.var?
>
> Guillermo
>
> On Sun, 6 Mar 2022 at 19:26, Nils Bruin <nbr...@sfu.ca> wrote:
>
>> On Sunday, 6 March 2022 at 09:13:42 UTC-8 list...@gmail.com wrote:
>>
>>>
>>> Beginner's questions, I guess.
>>>
>>> Some time ago, Emmanuel Charpentier wrote
>>>
>>> var("v", n=2)
>>>
>>> which gives
>>>
>>> (v0, v1)
>>>
>>> Where is this documented?  I have been unable to find keywords for var
>>> other than domain and latex_name.  Are there any others?
>>>
>>
>> This is documented on SR.var , which is slightly different from the
>> top-level "var" you are referring to. It looks like the documentation on
>> the top-level one wasn't updated when the feature was added to SR.var.
>> Since top-level var just wraps SR.var, it automatically got the feature too.
>>
>>
>>> Another question:
>>> I have learnt to write
>>> x,y,z=var('x,y,z')
>>>
>>
>> You can do that, but with the top-level var it's not necessary (this is
>> exactly where it differs from SR.var) :
>> it will inject bindings for the created symbols in the current name
>> space. This is a hack that is convenient for interactive use. In library
>> code, you must use SR.var instead, in which case you have to write
>>
>> x,y,z = SR.var('x,y,z')
>>
>> ( with just "SR.var('x,y,z')" you'd create the symbols but you wouldn't
>> bind them to anything).
>>
>> Is it possible to do the same for
>>> v0,v1,v2=var('v', n=3)
>>> without having to write explicitly the LHS?
>>>
>>
>> Yes, that already works. If you use
>>
>> var('v', n=3)
>>
>> the names v0,v1,v2 in your current scope will be bound to the newly
>> created symbols.
>>
>> There's been discussion about this when it was implemented:
>>
>> https://trac.sagemath.org/ticket/22813
>>
>
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CANnG18-qtiW4%3DYxC2RQznLt1g%2BYEa6VvQhu8byt3aiifsbWtsg%40mail.gmail.com.

Reply via email to