Note also that function('f')(y, x) does not actually create a function with named arguments. It is an ordinary symbolic expression that evaluates the undefined function f of unspecified arity. Unbound variables in ordinary symbolic expression use alphabetical order. https://trac.sagemath.org/ticket/32227 attempts to deprecate calling "arguments" on such expressions.
To create a function with named arguments, you would have to use callable symbolic expressions: sage: x, y = var('x y') sage: function('f')(y, x).function(y, x) (y, x) |--> f(y, x) sage: _.arguments() On Tuesday, March 8, 2022 at 9:06:20 AM UTC-8 Matthias Koeppe wrote: > Yes, callable symbolic expressions need a lot of fixes. See meta-ticket > https://trac.sagemath.org/ticket/28434 > > On Tuesday, March 8, 2022 at 7:23:15 AM UTC-8 Eric Gourgoulhon wrote: > >> Hi, >> >> We have currently >> >> sage: x, y = var('x y') >> sage: fyx = function('f')(y, x) >> sage: fyx.arguments() >> (x, y) >> >> which is just the reverse of the expected output. >> >> Similarly, we have >> >> sage: atan2(y,x).arguments() >> (x, y) >> >> Taking a look at the code, one sees that fyx.arguments() calls >> fyx.variables(), which returns a "sorted tuple of variables that occur in >> this expression" (according to the documentation). The "sorted" action >> explains the result. But the latter remains plain false. >> >> Note that SymPy provides the correct result: >> >> sage: fyx._sympy_().args >> (y, x) >> sage: atan2(y,x)._sympy_().args >> (y, x) >> >> 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 view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/0def2d95-132b-492c-9006-df09383ea63en%40googlegroups.com.