Replace
F = Function('F')(x)
with
F = Function('F')

On Fri, Jul 26, 2013 at 1:21 PM, Alan Bromborsky <[email protected]>wrote:

> Consider the code -
>
> from sympy import symbols, exp, Function
>
> def f(x):
>     return x**2
>
> def g(y):
>     return 2*exp(y)
>
> def add(f,g):
>     def sumfg(x):
>         return f(x)+g(x)
>     return sumfg
>
> def mul(f,g):
>     def prodfg(x):
>         return f(g(x))
>     return prodfg
>
> x = symbols('x',real=True)
>
> fxg = mul(f,g)
>
> print fxg(x)
>
> F = Function('F')(x)
>
> print mul(g,F)(x)
>
>
> The output is -
>
> 4*exp(2*x)
> Traceback (most recent call last):
>   File "ftest.py", line 27, in <module>
>     print mul(g,F)(x)
>   File "ftest.py", line 16, in prodfg
>     return f(g(x))
> TypeError: 'F' object is not callable
>
> One would like the second output to be -
>
> 2*exp(F(x))
>
> What am I doing wrong?
>
> --
> 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+unsubscribe@**googlegroups.com<sympy%[email protected]>
> .
> To post to this group, send email to [email protected].
> Visit this group at 
> http://groups.google.com/**group/sympy<http://groups.google.com/group/sympy>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to