Sin , Cos , Tan , ArcSin , ArcCos , ArcTan , Exp , Ln , Sqrt , Abs , Sign , Complex , Re , Im , I , Conjugate , Arg , ! , Bin , Sum , Average , Factorize , Min , Max , IsZero , IsRational , Numer , Denom , Commutator , Taylor , InverseTaylor , ReversePoly , BigOh , Newton , D , Diverge , Curl , Integrate , Simplify , RadSimp , Rationalize , Solve , SuchThat , Eliminate , PSolve , Random , VarList , Limit , TrigSimpCombine , LagrangeInterpolant , Fibonacci .

# Calculus

###

Trigonometric functions

Standard math library

##### Calling Sequence:

Sin(x)
Cos(x)
Tan(x)
ArcSin(x)
ArcCos(x)
ArcTan(x)

##### Parameters:

x - some number

##### Description:

These functions represent the trigonometric functions and their inverses. Yacas leaves them alone even if x is a number, trying to keep the result as exact as possible. The floating point approximations of these functions can be forced by using the N(...) functions.

Yacas knows some trigonometric identities, so it can simplify to exact results even if N is not used. This is the case when the arguments are of the form Pi, Pi/2 etcetera.

##### Examples:

    In> Sin(1)
    Out> Sin(1);
    In> N(Sin(1),20)
    Out> 0.84147098480789650665;
    In> Sin(Pi/4)
    Out> Sqrt(2)/2;

##### See Also:

N , Pi .

###

Exp(x), Ln(x)

Standard math library

##### Calling Sequence:

Exp(x)
Ln(x)

##### Parameters:

x - a number

##### Description:

Calculate e^x, or its inverse, ln(x), respectively.

##### Examples:

    In> Exp(2)
    Out> Exp(2);
    In> Ln(%)
    Out> 2;

###

Sqrt

Standard math library

##### Calling Sequence:

Sqrt(x)

##### Parameters:

x - anumber

##### Description:

Calculate the square root of x.

##### Examples:

    In> Sqrt(16)
    Out> 4;
    In> Sqrt(15)
    Out> Sqrt(15);
    In> N(Sqrt(15))
    Out> 3.8729833462;

###

Abs, Sign

Standard math library

##### Calling Sequence:

Abs(x)
Sign(x)

##### Parameters:

x - a number

##### Description:

Abs(x) returns the absolute value of a number. Abs(x)*Sign(x) should always be equal to x. Sign(x) returns 1 if the number is positive or zero, -1 otherwise.

##### Examples:

    In> Abs(-2)
    Out> 2;
    In> Sign(-2)
    Out> -1;

###

Complex numbers

Standard math library

##### Calling Sequence:

Complex(x,y)
Re(z)
Im(z)
I
Conjugate(expression)
Arg(z)

##### Parameters:

x - a real number
y - a real number
z - a real or complex number
expression - an expression containing complex numbers

##### Description:

Complex(x,y) represents a complex number x+I*y, where I is a pure imaginary number, I = Sqrt(-1). Re(z) returns the real part of a complex number, and Im(z) returns the imaginary part. Conjugate returns the complex conjugate of an expression. It does this by replacing all occurrences of Complex(a,b) in the expression with Complex(a,-b). This operation assumes all unbound variables are real-valued.

Complex(x,y) is the internal representation of a complex number in Yacas.

Arg returns the angle a for which the complex number is amp*(Cos(angle) + I*Sin(angle)). As such it returns an angle from -Pi to +Pi.

##### Examples:

    In> z := 2+3*I
    Out> Complex(2,3);
    In> Re(z)
    Out> 2;
    In> Im(z)
    Out> 3;
    In> Arg(Exp(I*Pi/3))
    Out> Pi/3;

###

Factorial and binomial numbers

Standard math library

##### Calling Sequence:

n!, Bin(n,m)

##### Parameters:

n - a positive integer
m - a positive integer

##### Description:

n! evaluates to n*(n-1)*(n-2)*....*1. Bin(n,m) evaluates to n!/(n!*(n-m)!).

##### Examples:

    In> 10!
    Out> 3628800;
    In> Bin(10,4)
    Out> 210;
    In> (10!)/((6!)*(4!))
    Out> 210;
    In> (3/2)!
    Out> (3*Sqrt(Pi))/4;

###

Sums and products.

Standard math library

##### Calling Sequence:

Sum(var,from,to,body)
Sum(list)
Average(list)
Factorize(var,from,to,body)
Factorize(list)

##### Parameters:

var - a variable to iterate over
from - integer value to iterate from
to - integer value to iterate upto
body - expression to evaluate for each iteration
list - list of values to iterate over

##### Description:

Sum returns the sum of a list of values. Factorize returns the product of a list of values. Average returns the average of a list of values.

Iteration can either proceed over the elements of a list passed in, or by evaluating 'body' by iterating variable 'var' from value 'from' upto 'to'. 'to' should be greater than or equal to from.

##### Examples:

    In> Sum(i,1,3,i)
    Out> 6;
    In> Sum({1,2,3})
    Out> 6;
    In> Sum(1 .. 3)
    Out> 6;
    In> Average(1 .. 3)
    Out> 2;
    In> Factorize(i,1,3,i)
    Out> 6;
    In> Factorize({1,2,3})
    Out> 6;
    In> Factorize(1 .. 3)
    Out> 6;

##### See Also:

Max , Min .

###

Minimum and maximum values

Standard math library

##### Calling Sequence:

Min(x,y)
Min(list)
Max(x,y)
Max(list)

##### Parameters:

x - a number
y - a number
list - a list of numbers

##### Description:

Min and Max return the minimum and maximum value of their arguments respectively. Min and max can either be called with two numbers as arguments, or with a list of numbers.

##### Examples:

    In> Min(2,3)
    Out> 2;
    In> Max(2,3)
    Out> 3;
    In> Min(5 .. 15)
    Out> 5;
    In> Max(5 .. 15)
    Out> 15;

##### See Also:

Sum , Average .

###

IsZero(x)

IsZero(x) : Returns wether x is zero or not.

###

Rational numbers

Standard math library

##### Calling Sequence:

IsRational(r)
Numer(r)
Denom(r)

##### Parameters:

r - a rational number or expression

##### Description:

Rational numbers are anything like a/b, or 2/5. IsRational returns True if the argument is a rational expression, and False otherwise. Numer and Denom return the numerator and denominator of a rational expression, respectively.

##### Examples:

    In> IsRational(a)
    Out> False;
    In> IsRational(a/b)
    Out> True;
    In> Numer(a/b)
    Out> a;
    In> Denom(a/b)
    Out> b;

###

Commutator

Internal function
Standard math library

##### Calling Sequence:

Commutator(a,b)

##### Parameters:

a - a mathematical object
b - a mathematical object

##### Description:

Return "a b - b a". For numbers and such this is zero, for matrices in general it isn't.

##### Examples:

    In> Commutator(2,3)
    Out> 0;
    In> m1:=Identity(3)
    Out> {{1,0,0},{0,1,0},{0,0,1}};
    In> m1[1][2] := a
    Out> True;
    In> m2:=Identity(3)
    Out> {{1,0,0},{0,1,0},{0,0,1}};
    In> m2[2][2] := a
    Out> True;
    In> Commutator(m1,m2)
    Out> {{0,a^2-a,0},{0,0,0},{0,0,0}};

###

Taylor

Standard math library

##### Calling Sequence:

Taylor(var,at,order)expression

##### Parameters:

var - variable
at - point to get taylor series around
order - order of approximation
expression - expression to get taylor series for

##### Description:

Return the Taylor series expansion of function "expression", with respect to variable "var", around "var=at", upto order "order".

##### Examples:

    In> Taylor(x,0,9)Sin(x)

         3    5      7       9
        x    x      x       x
    x - -- + --- - ---- + ------
        6    120   5040   362880

    Out>

##### See Also:

InverseTaylor , ReversePoly , BigOh .

###

InverseTaylor

Standard math library

##### Calling Sequence:

InverseTaylor(var,at,degree) expression

##### Parameters:

var - variable
at - point to get inverse taylor series around
order - order of approximation
expression - expression to get inverse taylor series for

##### Description:

InverseTaylor builds a taylor series expansion of the inverse of function func, with respect to variable var around value, upto degree. InverseTaylor uses the function ReversePoly to perform the task.

##### Examples:

    In> exp1 := Taylor(x,0,7)Sin(x)

         3    5      7
        x    x      x
    x - -- + --- - ----
        6    120   5040

    Out>
    In> exp2 := InverseTaylor(x,0,8)ArcSin(x)

     5      7     3
    x      x     x
    --- - ---- - -- + x
    120   5040   6

    Out>
    In> Simplify(exp1-exp2)

    0

    Out>

##### See Also:

ReversePoly , Taylor , BigOh .

###

ReversePoly

Standard math library

##### Calling Sequence:

ReversePoly(f,g,var,newvar,degree)

##### Parameters:

f - a function of one free variable 'var'
g - a function of one free variable 'var'
var - a variable
newvar - a new variable to express the result in
degree - The degree of the required solution

##### Description:

Given polynomials f(var) and g(var), determine a polynomial h(newvar) for which h(f(var)) = g(var). The resulting polynomial will be of degree degree. The only requirement is that the first derivative of f should not be zero.

This function is used to determine the taylor series expansion of a function: if g(var)=var, then h(f(var))=var, so h will be the inverse of f.

##### Examples:

    In> f(x):=Eval(Expand((1+x)^4))
    Out> True;
    In> g(x) := x^2
    Out> True;
    In> h(y):=Eval(ReversePoly(f(x),g(x),x,y,8))
    Out> True;
    In> BigOh(h(f(x)),x,8)
    Out> x^2;
    In> h(x)
    Out> (-2695*(x-1)^7)/131072+(791*(x-1)^6)/32768+(-119*(x-1)^5)/4096+(37*(x-1)^4)/1024+(-3*(x-1)^3)/64+(x-1)^2/16;

##### See Also:

InverseTaylor , Taylor , BigOh .

###

BigOh

Standard math library

##### Calling Sequence:

BigOh(poly,var,degree)

##### Parameters:

poly - a univariate polynomial
var - a free variable
degree - positive integer

##### Description:

BigOh drops all terms of order degree or higher in a given polynomial poly in variable var. .

##### Examples:

    In> BigOh(1+x+x^2+x^3,x,2)
    Out> x+1;

##### See Also:

Taylor , InverseTaylor .

###

Newton

Standard math library

##### Calling Sequence:

Newton(expression,variable,initial,accuracy)

##### Parameters:

expression - an expression to find a zero for
variable - free variable to adjust to find a zero
initial - initial value to use in the search
accuracy - minimum required accuracy of the result

##### Description:

Find a zero of "expression", as a function of "variable", starting around value "initial", and continuing until the value for "variable" is maximally "accuracy" away from the correct value.

##### Examples:

    In> Newton(Sin(x),x,3,0.0001)
    Out> 3.1415926535;

###

Derivatives

Standard math library

##### Calling Sequence:

D(var)expression
D(list)expression
D(var,n)expression

##### Parameters:

var - variable
list - a list of variables
expression - expression to take derivative of
n - order of derivative

##### Description:

Calculate analytic derivative of an expression. The D operator is threaded. Alternatively, D can be invoked with "D(variable,n)expression". In that case the n-th derivative will be taken.

##### Examples:

    In> D(x)Sin(x*y)
    Out> y*Cos(x*y);
    In> D({x,y,z})Sin(x*y)
    Out> {y*Cos(x*y),x*Cos(x*y),0};
    In> D(x,2)Sin(x*y)
    Out> -Sin(x*y)*y^2;
    In> D(x){Sin(x),Cos(x)}
    Out> {Cos(x),-Sin(x)};

##### See Also:

Integrate , Taylor .

###

Diverge and Curl

Standard math library

##### Calling Sequence:

Diverge(vector, basis)
Curl(vector, basis)

##### Parameters:

vector - a vector
basis - a list of variables

##### Description:

Diverge(vector, basis) will calculate the divergence of a vector. Curl(vector, basis) calculate the curl of a vector.

##### Examples:

    In> Diverge({x*y,x*y,x*y},{x,y,z})
    Out> {y,x,0};
    In> Curl({x*y,x*y,x*y},{x,y,z})
    Out> {x,-y,y-x};

##### See Also:

D .

###

Integrate

Standard math library

##### Calling Sequence:

Integrate(var,from,to) expression
Integrate(var) expression

##### Parameters:

var - variable to integrate over
from - value to integrate from
to - value to integrate upto
expression - expression to integrate over

##### Description:

Integrate an expression over variable var=from to var=to. Some simple integration rules have currently been implemented. Transcendental functions, polynomials, products of transcendental functions and polynomials, and rational functions.

##### Examples:

    In> Integrate(x,a,b)Cos(x)
    Out> Sin(b)-Sin(a);
    In> Integrate(x)Cos(x)
    Out> Sin(x)+C9;

##### See Also:

D .

###

Simplify

Internal function
Standard math library

##### Calling Sequence:

Simplify(expression)

##### Parameters:

expression - an expression

##### Description:

Simplify tries to simplify an expression as much as possible. It does this by grouping powers within terms, and then grouping like terms.

##### Examples:

    In> a*b*a^2/b-a^3
    Out> (b*a^3)/b-a^3;
    In> Simplify(a*b*a^2/b-a^3)
    Out> 0;

##### See Also:

TrigSimpCombine , RadSimp .

###

RadSimp

Standard math library

##### Calling Sequence:

RadSimp(expression)

##### Parameters:

expression - an expression containing nested radicals

##### Description:

RadSimp tries to unnest nested radicals. It does this using a simple brute force method, and tries to write it out as an expression of the form Sqrt(e1) + Sqrt(e2) + ... .

##### Examples:

    In> RadSimp(Sqrt(9+4*Sqrt(2)))
    Out> 1+Sqrt(8);
    In> RadSimp(Sqrt(5+2*Sqrt(6))+Sqrt(5-2*Sqrt(6)))
    Out> Sqrt(12);
    In> RadSimp(Sqrt(14+3*Sqrt(3+2*Sqrt(5-12*Sqrt(3-2*Sqrt(2))))))
    Out> 3+Sqrt(2);

##### See Also:

Simplify .

###

Rationalize

Standard math library

##### Calling Sequence:

Rationalize(expression)

##### Parameters:

expression - an expression containing real numbers

##### Description:

Convert every real number in expr into a rational number. This is useful when a calculation needs to be done on floating point numbers and the algorithm is unstable. Converting the floating point numbers to rational numbers will force calculations to be done with infinite precision (by using rational numbers as representations).

##### Examples:

    In> {1.2,3.123,4.5}
    Out> {1.2,3.123,4.5};
    In> Rationalize(%)
    Out> {6/5,3123/1000,9/2};

###

Solve

Internal function
Standard math library

##### Calling Sequence:

Solve(eq,var)
Solve(eqlist,varlist)

##### Parameters:

eq - single identity equation
var - single variable
eqlist - list of identity equations
varlist - list of variables

##### Description:

Solve tries to solve (a set of) equations for (a set of) variables. Pass the equations in a list, as well as the variables to be solved for. The solver will then use SuchThat, in combination with Eliminate, to simplify the equations. This suffices for all linear equations and a large group of simple non-linear equations. When the variable argument receives a list of variables to solve for, Solve returns a list of results, with each result being a solution to the set of equations.

##### Examples:

    In> Solve(a+x*y==z,x)
    Out> (z-a)/y;
    In> Solve({a*x+y==0,x+z==0},{x,y})
    Out> {{-z,z*a}};

##### See Also:

SuchThat , Subst , Eliminate .

###

SuchThat

Standard math library

##### Calling Sequence:

SuchThat(expression,variable)

##### Parameters:

expression - an expression to solve for
variable - subexpression to look for

##### Description:

SuchThat(expression,var) : try to find a simple expression for variable var, given the equality expression=0. This function basically only handles expressions where the variable only occurs once. It does its work by applying the inverse of the top function, until the variable is reached. Variable can also refer to an expression, in which case it will try to eliminate for that expression.

##### Examples:

    In> SuchThat(a+b*x,x)
    Out> (-a)/b;
    In> SuchThat(Cos(a)+Cos(b)^2,Cos(b))
    Out> (-Cos(a))^(1/2);
    In> Expand(a*x+b*x+c,x)
    Out> c+(a+b)*x;
    In> SuchThat(%,x)
    Out> (-c)/(a+b);

##### See Also:

Solve , Subst , Simplify .

###

Eliminate

Standard math library

##### Calling Sequence:

Eliminate(original,replace,expression)

##### Parameters:

original - expression
replace - expression
expression - expression

##### Description:

Replace all instances of `original` in `expression` with `replace` and call Simplify on the resulting expression.

##### Examples:

    In> Subst(Cos(b),c)(Sin(a)+Cos(b)^2/c)

                2
               c
    Sin( a ) + --
               c

    Out>
    In> Eliminate(Cos(b),c,Sin(a)+Cos(b)^2/c)

    Sin( a ) + c

    Out>

##### See Also:

SuchThat , Subst .

###

PSolve

Standard math library

##### Calling Sequence:

PSolve(expr,var)

##### Parameters:

expr - an expression
var - a variable

##### Description:

solve expr=0 with respect to variable var, treating it expr as a polynomial. It currently solves upto degree 3.

##### Examples:

    In> PSolve(b*x+a,x)
    Out> -a/b;
    In> PSolve(c*x^2+b*x+a,x)
    Out> {(Sqrt(b^2-4*c*a)-b)/(2*c),(-(b+Sqrt(b^2-4*c*a)))/(2*c)};

##### See Also:

Solve , Factor .

###

Pi

Internal function

##### Calling Sequence:

Pi()

##### Description:

Returns pi to the current precision. Usually this function will not be called directly. The constant 'Pi' can (and should) be used to represent pi, so simplification rules can do work. Then when the function N is invoked Pi will be replaced with the value returned by Pi().

##### Examples:

    In> Pi()
    Out> 3.14159265358979323846;
    In> Precision(40)
    Out> True;
    In> Pi()
    Out> 3.1415926535897932384626433832795028841971;

##### See Also:

N , Pi .

###

Random

Standard math library

##### Calling Sequence:

Random()

##### Description:

Returns a random number between 0 and 1.

###

VarList

Standard math library

##### Calling Sequence:

VarList(expression)

##### Parameters:

expression - an expression

##### Description:

Returns a list with all the variables "expression" depends on.

##### Examples:

    In> VarList(Sin(x))
    Out> {x};
    In> VarList(x+a*y)
    Out> {x,a,y};

##### See Also:

IsFreeOf .

###

Limit

Standard math library

##### Calling Sequence:

Limit(variable,value) expression
Limit(variable,value,direction) expression

##### Parameters:

variable - a variable
value - a number
direction - a direction (Left or Right)
expression - an expression

##### Description:

Determine the value "expression" converges to when "variable" goes to "value".

You can also specify a direction for the limit, Left or Right. Specifying Right will take the limit from positive Infinity, and Left will take the limit from -Infinity.

##### Examples:

    In> Limit(x,0) Sin(x)/x
    Out> 1;
    In> Limit(x,0) (Sin(x)-Tan(x))/(x^3)
    Out> -1/2;
    In> Limit(x,0)1/x
    Out> Undefined;
    In> Limit(x,0,Left)1/x
    Out> -Infinity;
    In> Limit(x,0,Right)1/x
    Out> Infinity;

###

TrigSimpCombine

Standard math library

##### Calling Sequence:

TrigSimpCombine(expression)

##### Parameters:

expression - an expression

##### Description:

This is the module that does the trigonometric simplification: Cos(...)*Sin(...) -> Cos(...)+Sin(...)

It also tries to simplify the resulting expression as much as possible, trying to combine all like terms.

This function is used in for instance Integrate, to bring down the expression into a simpler form that can be integrated easily.

##### Examples:

    In> TrigSimpCombine(Cos(a)^2+Sin(a)^2)

    1

    Out>
    In> TrigSimpCombine(Cos(a)^2-Sin(a)^2)

    Cos( 2 * a )

    Out>
    In> TrigSimpCombine(Cos(a)^2*Sin(b))

    Sin( b )   Sin( -2 * a + b )   Sin( -2 * a - b )
    -------- + ----------------- - -----------------
       2               4                   4

    Out>

##### See Also:

Simplify , Integrate .

###

LagrangeInterpolant

Standard math library

##### Calling Sequence:

LagrangeInterpolant(xlist,ylist,var)

##### Parameters:

xlist - list of values
ylist - list f values
var - free variable for resulting polynomial

##### Description:

Given a set of points (x_i,y_i) with all nonzero y_i, find the polynomial that goes through these points. The first argument passed to the function should be the list of x_i values, the second one should be the list of y_i values, and the third argument should be the variable used to build up the polynomial.

This routine uses the Lagrange interpolant formula to build up the polynomial.

##### Examples:

    In> LagrangeInterpolant({x1,x2,x3},{y1,y2,y3},x)

    y1 * ( x - x2 ) * ( x - x3 )   y2 * ( x - x1 ) * ( x - x3 )
    ---------------------------- + ----------------------------
     ( x1 - x2 ) * ( x1 - x3 )      ( x2 - x1 ) * ( x2 - x3 )

      y3 * ( x - x1 ) * ( x - x2 )
    + ----------------------------
       ( x3 - x1 ) * ( x3 - x2 )

    Out>

###

Fibonacci

Standard math library

##### Calling Sequence:

Fibonacci(n)

##### Parameters:

n - an integer

##### Description:

Calculate Fibonacci number "n".

##### Examples:

    In> Fibonacci(4)
    Out> 3;
    In> Fibonacci(8)
    Out> 21;