I have encountered this independently, and it's a major source of headache.

Wouldn't a more useful representation of a(b) be something like 
FunctionCall(a, b) [I obviously used FunctionCall a mock name here]? That 
would allow to keep a in the list of atoms, and would create a 
representation of the expression that is easier to parse.
While syntactically a function call does resemble a class instance, I 
cannot think of useful applications of class hierarchy in this case. A 
function doesn't implement any methods of its own, and so there is nothing 
meaningful for its calls to reuse.

Does the above make sense?
On a more practical note, what is 'the official' way to get all the free 
symbols from an expression, including functions? There's 
expr.atoms(Function), but it's rather hard to parse, and the closest I got 
to get the name from a(b).func.__name__ and check if type(type(a(b)) is and 
UndefinedFunction.

Best,
Anton Akhmerov

On Monday, October 28, 2013 6:16:16 PM UTC+1, Aaron Meurer wrote:
>
> This is correct. type() in Python basically means "class of". 
> Function('x') creates a class, called "x". When you apply it to t, it 
> creates an instance of that class. The class of the class (i.e., metaclass) 
> is UndefinedFunction. 
>
> Aaron Meurer
>
> On Oct 28, 2013, at 11:01 AM, Jason Moore <moore...@gmail.com 
> <javascript:>> wrote:
>
> I'm curious why x(t) in the following code doesn't display any type:
>
> In [9]: x = sympy.symbols('x', cls=sympy.Function)
>
> In [10]: type(x)
> Out[10]: sympy.core.function.UndefinedFunction
>
> In [11]: t = sympy.symbols('t')
>
> In [12]: t
> Out[12]: t
>
> In [13]: type(x(t))
> Out[13]: x
>
> Jason
> moorepants.info
> +01 530-601-9791
>  
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+un...@googlegroups.com <javascript:>.
> To post to this group, send email to sy...@googlegroups.com <javascript:>.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/7fc55a01-a8e5-4e22-abc0-64e423a4107e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to