On Saturday, August 20, 2016 at 6:13:16 AM UTC-7, Eric Gourgoulhon wrote:
>
>  
>
>> I'd be hesitant to go any further. Using leibnitz notation in general 
>> requires temporary variables, e.g.
>>
>> D[0,1](f)(x+y,x-y) = diff(f(t1,t2),t1,t2) |_[t1=x+y,t2=x-y]
>>
>> I don't think the RHS is more readable than the LHS after the small 
>> hurdle of understanding what D[0,1] means.
>>
>
> correcting myself: we could already do a little better with

diff(f(t1,t2),t1,t2)(t1=x+y,t2=x-y)

which still looks painful to me.

Indeed, but something closer to standard textbook notation should be
> diff(f, u, v)(x+y, x-y)
> which assumes that f is a function of two variables, u and v.
>

Pynac does have the notion of arity:

sage: function('f',nargs=3)
f
sage: f(1,2)
TypeError: Symbolic function f takes exactly 3 arguments (2 given)

but this information doesn't survive round-trips to, for instance, maxima, 
because it's a "hidden" attribute: you can't see it from the function 
identifier itself:

sage: F=f(x,x,x).simplify().operator()
sage: F(1)
f(1)
sage: f == F
False

this means in practice that specified-arity functions are poorly supported. 
(we could improve this support by embedding the arity in the identifier 
used in maxima, or by storing this info on an attribute that gets 
reexamined when the symbol gets retranslated into sage)

Usually, in textbooks, one does not write
> diff(f(u,v), u,v)(x+y,x-y)
> because it has already been specified that f is a function of (u,v) (in 
> this order). I don't know if it is possible to have something like this in 
> Pynac, i.e. to have default variables (or at least variable identifiers 
> other than 0, 1, ...) for symbolic functions. For instance 
> f = function('f', variables=(u,v))
> diff(f,x)(x,y) would then return an error, while diff(f,u)(x,y) would work.
>

Yes, this would indeed be another solution, and one that would be 
unambiguous (and would probably fully cover your chart-centered 
applications!). Presently, diff(f,x,y) is an error anyway, because "diff" 
takes expressions, not (symbolic) functions. It is basically 
straightforward to extend "diff" to also provide an interface to 
FDerivativeOperator, and have it look whether symbols can be looked up to 
correspond to parameter positions. Whether this functionality should be 
wrapped into "diff" or into another operator (D perhaps? D[x,y](f) wouldn't 
look so bad and is much more compact)

We would somehow have to make sure to preserve this info through our 
interface to maxima (via maxima and maxima_lib). We could do that by 
encoding everything in the symbol name, e.g.,

function('f',vars=(x,y)) becomes 
"_SAGE_FUNCTION_ARITY_2_VARIABLES_x_x_NAME_f" or we could use the 
sage.symbolic.function.sfunctions_serial_dict (presently not exposed) to 
translate a function into an opaque but unambiguous identifier like 
"_SAGE_FUNCTION_143" for functions that do have specified arity and/or 
variable names associated with them.
 
I think this is a very viable idea and worth a ticket. It's also quite a 
bit of work, so I'm not so sure it will actually happen unless someone with 
the required skills steps up to implement it.


> Again, it would be nice (i.e. closer to textbooks) to have the possibility 
> to omit the final (x,y)  and to put f in the numerator, i.e. to have
> \frac{\partial^2 f}{\partial  x\partial y}
>
>
There's a difference there: d^2 f/dxdy would be the *function* in x,y and 
d^2f/dxdy (x,y) is the expression that results from evaluating that 
function at (x,y). I don't think we can suppress that difference in our 
notation.
 

-- 
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