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)
Exp(x) : Calculate e^x.
Ln(x)
Ln(x) : Calculate natural logarithm of x.
Sqrt(x)
Sqrt(x) : calculate the square root of x.
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, -1 otherwise.
Examples:
In> Abs(-2)
Out> 2;
In> Sign(-2)
Out> -1;
|
See Also:
Complex(x,y)
This represents a complex number x+I*y.
Re(z)
Return real part of complex number z.
Im(z)
Return imaginary part of complex number z.
I
This is the pure imaginary number I (for which i*I=-1).
You can type 2+I*3, which would evaluate to
Complex(2,3). Re and Im return the real and
imaginary parts of a number respectively.
n!
Factorial. n! evaluates to n*(n-1)*(n-2)*....*1.
Bin(n,m)
Bin(n,m) evaluates to n!/(n!*(n-m)!)
Sum(var,from,to,body) and Sum({list})
Sum(var,from,to,body) :
Sum does a summation over "body", setting variable "var"
from "from" upto and including "to", incrementing it by 1 each
time.
Sum({list}) : calculate the sum of the elements in a list.
Example : Sum({1,2,3}) evaluates to 6.
Average({list})
Average({list}) : calculate the average of the elements in a list.
Example : Average({1,2,3}) evaluates to 2.
Factorize(var,from,to,body) and Factorize({list})
Factorize(var,from,to,body) :
Factorize does a factorization over "body", setting variable "var"
from "from" upto and including "to", incrementing it by 1 each
time.
Factorize({list}) : calculate the product of the elements in a list.
Example : Factorize({1,2,3}) evaluates to 6.
Min(x,y), Min({...}), Max(x,y) and Max({...})
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.
IsZero(x)
IsZero(x) : Returns wether x is zero or not.
IsRational(r)
IsRational(r) : Rational numbers are anything like a/b, or 2/5.
Numer(r)
Numer(r) : Return numerator of a rational number.
Denom(r)
Denom(r) : Return denominator of a rational number.
Commutator(a,b)
Commutator(a,b) :
Return "a b - b a". For numbers and such this is
zero, for matrices in general it isn't.
Taylor(var,var0,order)function
Taylor(var,var0,order)function :
Return the Taylor series expansion of function "function", with
respect to variable "var", around "var=var0", upto order "order".
InverseTaylor(var,value,degree) func
InverseTaylor(var,value,degree) func : build 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.
ReversePoly(f,g,var,newvar,degree)
ReversePoly(f,g,var,newvar,degree) :
Given polynomials f(var) and h(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.
Newton(function,variable,initial,accuracy)
Newton(function,variable,initial,accuracy) :
Find a zero of "function", as a function of "variable",
starting around value "initial", and continuing until
the value for "variable" is maximally "accuracy" away
from the correct value.
D(variable)expression
D(variable) expression :
Calculate analytic derivative of an expression. "D(x) Sin(x);"
"Cos(x);".
The D operator is also threaded:
"D({x,y,z}) Sin(x*y)" will return {Cos(x*y)*y,Cos(x*y)*x,0}
Alternatively, you can call D with "D(variable,n)expression".
In that case the n-th derivative will be taken.
Diverge(vector, basis)
Diverge(vector, basis) : Calculate the divergence of
a vector.
Example: "Diverge(FillList(x*y,3),{x,y,z})" will return
{y,x,0}
Curl(vector, basis)
Curl(vector, basis) : Calculate the curl of a vector.
Example: "Curl(FillList(x*y,3),{x,y,z})" will return
{x,-y,y-x}
Integrate(var,from,to) body
Integrate(var,from,to) body : integrate body 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.
Simplify(expr)
Simplify(expr) : Simplify tries to simplify an expression as much
as possible. It does this by grouping powers within terms, and then
grouping like terms.
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(expr)
Rationalize(expr) : convert every real number in expr into a rational
number.
Conjugate(expr)
Conjugate(expr) : return the conjugate of expr (given that all
variables are real or integer).
Solve(expr1==expr2,variable)
Solve(expr1==expr2,variable) :
A very simple solver. It can for now solve expressions where the variable
to be solved for only occurs once.
"Solve(a+x*y==z,x);" would evaluate to "(z-a)/y".
Solve can solve simple sets of equations. 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.
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(var,replace,function)
Eliminate(var,replace,function) : replace all instances of
var in function with relpace
and call Simplify on the resulting expression.
PSolve(expr,var)
PSolve(expr) : solve expr=0 with respect to variable var, treating
it expr as a polynomial. It currently solves upto degree 2.
Pi()
Pi() : Returns pi to the current precision.
Fibonacci(n)
Fibonacci(n) : Calculate Fibonacci number "n".
Random()
Random() : Returns a random number between 0 and 1.
VarList(expression)
VarList(expression) : Returns a list with all the variables
"expression" depends on. Example: "VarList(Sin(x));" should
return "{x};".
Limit(variable,value) function
Limit(variable,value)function : determine the
value "function" converges to when "variable"
goes to "value" from positive infinity.
Examples :
"Limit(x,0) Sin(x)/x;" evaluates to "1", and
"Limit(x,0) (Sin(x)-Tan(x))/(x^3);" evaluates to "-1/2".
TrigSimpCombine(expression)
TrigSimpCombine(expression) :
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.
LagrangeInterpolant({xlist},{ylist},var)
LagrangeInterpolant({xlist},{ylist},var) :
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. For three terms this is:
In> PrettyForm(LagrangeInterpolant(MakeVector(x,3),MakeVector(y,3),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> True; |