Le vendredi 19 août 2016 20:24:24 UTC+2, Nils Bruin a écrit : > > > Personally, I'm comfortable with the basic representation choices made in > https://trac.sagemath.org/ticket/21286 . >
Thanks for this ticket. > 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. > 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. 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. > This leaves general printing style. The latex side of things here is > simple. D[0,1](f)(x,y) should just be typeset as > > \frac{\partial^2}{\partial x\partial y} f(x,y) > > 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} > If the function is univariate we could replace \partial with "d". > +1 (with the possibility to use \mathrm{d} instead of d) > > I'd be a little hesitant to use this notation in "repr" because the use of > "d" as a variable is not so far fetched and would lead to a horrible > representation > > repr( diff(f(d1,d2),d1,d2) ) = "(d^2/dd1 dd2)f(d1,d2)" > > and in general it leads to an uncomfortable number of parentheses in > unfortunate places. So I'd probably gravitate towards producing "parsable" > representations, i.e., just > > diff(f(d1,d2),d1,d2) > > perhaps not elegant, but certainly understandable and unsurprising, since > it's what the user probably typed in. > I agree; IMHO what is really important is to have a nice LaTeX output (i.e. with \partial etc..); for text output, one can live with diff(...). > [we could check the symbol names for the presence of "d"s, but that would > probably lead to code that's trying to be too smart for its own good. It > would still leave us with an uncomfortable number of parentheses, since the > operator (written as a fraction) would need parentheses to be delimited > properly] > > First and second derivatives of univariate functions could easily be > printed as f'(x) and f''(x) [or perhaps f"(x) ]. It does make it more > tricky to cut/paste these into programming environments, though, because > the quotes might need quoting. > > Yes, but this could be left as an option to the user. Best wishes, Eric. -- 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.