Calculus¶
General Functions¶
Calculus functions.
-
class
simula.calculus.functions.
Function
(var, expression=None)¶ Definition of a mathematical function.
EXAMPLES:
simula : x = var('x') simula : f = function(x, x^2-2x+1); f Function defined by x |--> x^2 - 2x + 1 simula : f(2x) 4x^2 - 4x + 1 simula : 3f Function defined by x |--> 3x^2 - 6x + 3 simula : factor(f(x)) (x - 1)^2 simula : g = function("g"); g X |--> g(X) # We can simplify the definition of a function simula : x, y = var('x, y') simula : h(x, y) = x^2-y^2-x*y-2; h Function defined by (x, y) |--> x^2 - x*y - y^2 - 2 simula : h(1,-2) -3 simula : h(10, 0) 98 simula : diff(h(x, y), x) 2x - y
-
as_expr
()¶ Returns the expression of
self
.
-
compose
(g, *args)¶ Composition function of f and g i.e x –> f o g (x)
- Parameters
g – Function
-
critical_points
(field=RR)¶ Returns the critical points of
self
.
-
critical_points_ambigus
(field=RR)¶ Returns the critical points ambigus of
self
.
-
gradient
()¶ Returns the gradient function of
self
.
-
hessian
()¶ Returns the hessian function of
self
.
-
hessian_matrix
()¶ Returns the hessian matrix of
self
.
-
jacobian
()¶ Returns the jacobian function of
self
.
-
jacobian_matrix
()¶ Returns the jacobian matrix of
self
.
-
local_extrema
(field=RR)¶ Returns the local extrema of
self
.
-
local_maxima
(field=RR)¶ Returns the local maxima of
self
.
-
local_minima
(field=RR)¶ Returns the local minima of
self
.
-
saddle_points
(field=RR)¶ Returns the saddle points of
self
.
-
-
class
simula.calculus.functions.
FunctionPiecewise
(var, *expr)¶ Representation of a piecewise function.
EXAMPLES:
simula : x = var("x") simula : f = FunctionPiecewise(x, (2x-1, x<0), (3x, True)); f x |--> 2x - 1 if x < 0 and 3x if True simula : f(1) 3 simula : f(3) 27 simula : f(-2) -5 simula : n = var('n', "NN") simula : f(n) 3n simula : y = var('y', "ZZ*-") simula : f(y) 2y - 1
-
class
simula.calculus.functions.
O
(expr, *args, **kwargs)¶ Big O notation.
EXAMPLES:
simula : O(x + x^2) O(x) simula : O(x^3-x^2) O(x^2) simula : O(5x^5) O(x^5) simula : O(x^5-x-4) O(1)
-
simula.calculus.functions.
canonical_form
(expr, var=None)¶ Returns the canonical form of a second degree equation.
-
simula.calculus.functions.
coefficients
(expr, *args)¶ Returns the coefficients of a polynomial.
-
simula.calculus.functions.
cyclotomic_polynomial
(n, var=None)¶ Returns the cyclotomic polynomial of order
n
.- Parameters
n – an integer
var – (optional) a variable
-
simula.calculus.functions.
degree
(expr, *args)¶ Returns the degree of a polynomial.
-
simula.calculus.functions.
derivative
(f, var=None, *args)¶ Returns the derivative of
f
with respect tovar
.
-
simula.calculus.functions.
derivative_number
(func, var, point=None)¶ Returns the derivative number of
func
at pointpoint
.
-
simula.calculus.functions.
diff
(f, var, *args, **kwargs)¶ Returns the differentiation of
f
with respect to symbols.
-
simula.calculus.functions.
discriminant
(f, *args, **kwargs)¶ Returns the discriminant of``f``.
-
simula.calculus.functions.
div
(f, g, *args, **kwargs)¶ Returns the quotient and remainder of the division of
f
byg
.
-
simula.calculus.functions.
exp
(x)¶ Returns the exponential of
x
i.e. \(e^x\).
-
simula.calculus.functions.
expand
(f, **kwargs)¶ Returns the expansion of
f
.
-
simula.calculus.functions.
expand_trig
(f, *args)¶ Returns the trigonometric expansion of
f
.
-
simula.calculus.functions.
factor
(expr, *args, **kwargs)¶ Factors an expression
f
.
-
simula.calculus.functions.
function
¶ alias of
simula.calculus.functions.Function
-
simula.calculus.functions.
function_composition
(f, g, *args)¶ Composite function of f and g i.e x—-> f o g.
- Parameters
f (simula.calculus.functions.Function) – Function
g ((<class 'simula.calculus.functions.Function'>, <class 'sympy.core.expr.Expr'>)) – Function
-
simula.calculus.functions.
gcd
(f, g, **kwargs)¶ Returns the gcd of
f
andg
.
-
simula.calculus.functions.
gcdex
(f, g, **kwargs)¶ Extended Euclidean algorithm of
f
andg
.
-
simula.calculus.functions.
homogenize
(f, var, *, symbols=None)¶ Returns the homogenization of
f
with respect tovar
.
-
simula.calculus.functions.
inflection_point
(func, var=None)¶ Returns Points d’inflexion de la fonction “func”
-
simula.calculus.functions.
integrate
(f, *symbols, **kwargs)¶ Integrates
f
with respect tosymbols
.
-
simula.calculus.functions.
lcm
(f, g, **kwargs)¶ Returns the lcm of
f
andg
.
-
simula.calculus.functions.
limit
(f, x, x0, *, dir='+-')¶ Returns the limit of
f
whenx --> x0
.
-
simula.calculus.functions.
limit_left
(f, x, x0)¶ Returns the limit from the left of
f
whenx --> x0
.
-
simula.calculus.functions.
limit_right
(f, x, x0)¶ Returns the limit from the right of
f
whenx --> x0
.
-
simula.calculus.functions.
ln
(a, *args)¶ Returns the natural logarithm \(\ln(a)\) or \(\log(a)\).
-
simula.calculus.functions.
log
(a, *args)¶ Returns the natural logarithm \(\ln(a)\) or \(\log(a)\).
-
simula.calculus.functions.
logb
(a, b)¶ Returns the logarithm of
a
in baseb
.
-
simula.calculus.functions.
partial
(f, var, *args, **kwargs)¶ Returns the differentiation of
f
with respect to symbols.
-
simula.calculus.functions.
poly
(expr, *args, **kwargs)¶ Returns
expr
as a polynomial.
-
simula.calculus.functions.
primitive
(f, var=None)¶ Returns the primitive of
f
.
-
simula.calculus.functions.
product
(expr, *symbols, **kwargs)¶ Computes the product of
expr
with respect tosymbols
.
-
simula.calculus.functions.
real_roots
(func, var=None)¶ Returns the real roots of
func
.
-
simula.calculus.functions.
roots
(f, *args, **kwargs)¶ Returns the complex roots of
f
.
-
simula.calculus.functions.
series
(f, x=None, x0=0, n=6, *, dir='+')¶ Returns the series expansion of
f
of ordern
around pointx = x0
.
-
simula.calculus.functions.
simplify
(f, **kwargs)¶ Reduces
f
.
-
simula.calculus.functions.
sqrt
(expr)¶ Returns the square root of
f
.
-
simula.calculus.functions.
summation
(expr, *symbols, **kwargs)¶ Computes the summation of
expr
with respect tosymbols
.
-
simula.calculus.functions.
taylor_polynomial
(f, x=None, x0=0, n=6, *, dir='+')¶ Returns the taylor polynomial of
f
of ordern
around point x = x0.
-
simula.calculus.functions.
trigsimp
(f, **kwargs)¶ Reduces the trigonometric expression
f
.
-
simula.calculus.functions.
trunc
(f, n, *gens, **args)¶ Reduces
f
modulo a constantn
.
Sequences¶
Representation of sequences :
Sequence
ArithmeticSequence
GeometricSequence
ArithmeticoGeometricSequence
-
class
simula.calculus.sequense.
ArithmeticGeometricSequence
(a, b, *, ics=None)¶ Representation of a arithmetic-geometric sequence
U(n+1) = aU(n) + b
.EXAMPLES:
simula : n = var('n') simula : U = ArithmeticGeometricSequence(1, 3, ics=(1, 5)); U n |--> 3n + 2 simula : U(n+1) == U(n) + 3 True simula : U(1) 5
-
class
simula.calculus.sequense.
ArithmeticSequence
(terms=None, *, r=None)¶ Representation of an arithmetic sequence
U(n+1) = U(n) + r
.EXAMPLES:
simula : n = var('n') simula : U = ArithmeticSequence((0, 1), r=5) simula : U n |--> 5n + 1 simula : U(n+1) - U(n) 5 simula : V = ArithmeticSequence(((0, 1), (2, 10))); V n |--> 9n/2 + 1 simula : V(2) 10
-
class
simula.calculus.sequense.
GeometricSequence
(terms=None, q=None)¶ Representation of a geometric sequence
U(n+1) = qU(n)
.EXAMPLES:
simula : n = var('n') simula : U = GeometricSequence((1, 3), q=5); n |--> 3*5^n/5 simula : simplify(U(n+1) / U(n)) 5 simula : V = GeometricSequence(((1, 3), (2, 10))); V n |--> 10^(n - 1)*3^(2 - n) simula : simplify(V(n+1) / V(n)) 10/3
-
class
simula.calculus.sequense.
Sequence
(var, expression=None)¶ Representation of a sequence.
EXAMPLES:
simula : n = var('n') simula : Un = sequence(n, n^3-3n-1) simula : Un n |--> n^3 - 3n - 1 simula : Un(1), Un(2) (-3, 1) simula : Un.is_convergente() False simula : Un.limit() oo
-
is_convergente
()¶ Tests if
self
is convergent.EXAMPLES:
simula : n = var('n') simula : Vn = sequence(n, (n-1)/(2n^2-1)) simula : Vn n |--> (n - 1)/(2n^2 - 1) simula : Vn.is_convergente() True
-
limit
()¶ Returns the limit of
self
.EXAMPLES:
simula : n = var('n') simula : Vn = sequence(n, (n-1)/(2n^2-1)) simula : Vn n |--> (n - 1)/(2n^2 - 1) simula : Un.limit() oo
-
-
simula.calculus.sequense.
limit_sequence
(Un, *args)¶ Returns the limit of
Un
at infinity.
-
simula.calculus.sequense.
sequence
¶ alias of
simula.calculus.sequense.Sequence