Introduction to Simpy (simulation py)-03

Gaurav Kumar
6 min readNov 8, 2023

SymPy — Function class

In the past two articles we have seen the basics of simpy, declaring variables and handling expressions. Notable examples include evaluating derivatives and Integrations.

Now, let’s proceed to use functions.

The SymPy package includes the Function class found in the sympy.core.function module. This class serves as the foundation for various mathematical functions and also acts as a constructor for undefined function classes.

Following categories of functions are inherited from Function class −

  • Functions for complex number
  • Trigonometric functions
  • Functions for integer number
  • Combinatorial functions
  • Other miscellaneous functions

Functions for complex number

This set of functions is defined in sympy.functions.elementary.complexes module.

re

This function returns real part of an expression −

from sympy import * 
re(5+3*I)
Output:
5
re(I)
Output:
0
Im
im(5+3*I)

--

--

Gaurav Kumar
Gaurav Kumar

No responses yet