Both are special methods defined of subclasses of Function. eval is a
classmethod that tells what explicit values should be evaluated. If
eval is undefined, or returns None, the function will remain
unevaluated. For instance, with

class MyFunc(Function):
    @classmethod
    def eval(cls, arg):
        if arg == 0:
            return 0

then MyFunc(0) will return 0, but any other argument, like MyFunc(1),
will remain unevaluated. eval also tells Function how many arguments
the function takes.

fdiff is the derivative of *just* the function, without using the
chain rule. According to a comment in the code for
Function._eval_derivative, f(x).diff(s) -> x.diff(s) * f.fdiff(1)(s).
In fact, if you read the code for that method you should completely
understand how fdiff works. I believe the argindex argument handles
the case when the function has multiple arguments (like atan2).

Aaron Meurer


On Sat, Dec 27, 2014 at 6:07 AM, utpal kumar Jha <[email protected]> wrote:
> i went through all of the docs and then found a link to test interface which
> i am unable to figure out as to how the test_function_series(1/2/3) are
> implementing sin,cos and tan functions respectively . if someone could
> provide an insight of fdiff() and eval() functions i would appreciate it .
>
> https://github.com/sympy/sympy/blob/master/sympy/functions/elementary/tests/test_interface.py
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/95df166a-d742-4544-a098-5551c109f5ec%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LH7w4tf8ork95ATesyc23yn9rtJj5j_%2B1XjfuBdCoe2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to