2020년 3월 28일 토요일 오전 12시 1분 34초 UTC+9, S.Y. Lee 님의 말:
>
> I don't think that a*x**2 + b*x + c.is actually considered a 'Function', 
> but just as an 'Expression' in sympy.
> And literally you can just apply (a*x**2 + b*x + c).subs({a: 1}) to do 
> evaluations with respect to any variables. 
>
> On Friday, March 27, 2020 at 6:09:10 PM UTC+9, Jisoo Song wrote:
>>
>> Let's think of general quadratic function: a*x**2 + b*x + c. Commonly, 
>> this function is represented as f(x) = a*x**2 + b*x + c.
>> However, we can also write it as f(x; a,b,c), which implies that a,b and 
>> c can also be replaced by other values.
>> Does sympy have algorithm for such notation, so that `f(x, 
>> evaluate=False)` returns `f(x; a,b,c)`?
>>
>
 a*x**2 + b*x + c is clearly not a function, but `f(x)` which returns ` a*x
**2 + b*x + c` is, a function.
We can write a code like this:

class f(Function):
    @classmethod
    def eval(cls, x):
        return a*x**2 + b*x + c

What I wanted to do was to generate another function class from f, which 
will have 1 for `a` so that it can return x**2 + b*x + c when called.
I think this will need some metaclass-related tweaks by now.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/dd16c358-99ca-4e62-908b-ee9d3004f430%40googlegroups.com.

Reply via email to