Unpacking doesn't work for defining a function
I want to define a fonction of n parmeters who gives $a R/(a+b)p_x$.
If I construct the tuple of variable :
vard = var('a, b, p_x,p_y, R')
I was expecting that
Dx(*vard) = a R/(a+b)p_x
would be understud by Sagemath since *vard
unpacks the tuple. But obviously it's not the case. Where am I wrong ?
See this. Bur remember :
Python has no macroes. Whatsoever.
The preparser is a Sage-ONLY facility, easing the creation of so-called "callable sybolic expresion", another Sage-ONLY facility.
Do not confuse syntactic sugar and structural works.
BTW, remember that "Syntactic sugar causes cancer of the semicolon" (Alan Perlis).
BTW, something somewhat related to what you seem to aim to achieve is doable by this crock :
But remember that playing with string representations is not guiaranteed to work :
Python has no guarantee that
eval(read(print(x))==x
(which is a central requirement of Lisp...).Fidgeting with strings representation may sometimes be useful, but is usually a swell way to shoot yourself (and not in the foot...). You'd bette work with the methods allowing to modify the internal structure of your objects (and reinvent Lisp in passing...).