Professional Documents
Culture Documents
Maths Lab Syntax
Maths Lab Syntax
Factorial (number)
A=number
A.ndigits()
Number.is_prime()
If it will be prime the output will be true if it will not be prime the output will be false
List(prime(1,50))
Gcd(num1, num2)
Lcm(num1,num2)
Sin(45).n()
f=given equation
• Show(diff(d, x or y)
• Show(diff(equation, x or y)
Show(integrate(equation, x or y))
var('a,b,c')
x2=(-b-sqrt(b**2-4*a*c))/(2*a)
return(x1,x2)
Then we'll take a quadratic equation will take out a b and c from that equation and we will use the
quad (a,b,c)
2 3.PLOTTING
Var('given variables')
f=given equation
Where can change colour, figure size, give title or legend lable to the curve, can change the
thickness, can even edit the axes also
Show(p1+p2+p3+p4)
We will use different colours to show the plot of different curves properly.
Data=[data given]
Scatter_plot(data)
var('given variables')
f(given variables)=equation
implicit_plot(f, points for which you have to plot the equation, color, figsize, etc etc)
Var('t')
Parametric_plot([equation 1, equation 2], (t, points for which we have to plot the curve))
7. Polar plots
Var('t')
Polar_plot([equation 1, equation 2], (t, points for which we have to plot the curve))
8. Vector plot
Plot(A, figsize)
9. 3D plotting
Var('given variables')
f=given equation
Var('given variables')
F=given equation
Var('given variables')
F=given equation
Show(diff(f,x)(given points))
var('given variables')
f(x,y)=given equation
show(f)
show('dy/dx=',-diff(f,x)/diff(f,y))
5. Local maxima and minima
F.find_local_maxima()
F.find_local_minima()
Var()
F=equation
Show(pf)
Then we will differentiate the given equation and will plot both the curve in the same graph
D=diff(f,x)
Show(d)
Show(pd+pf, figsize)
Then by observing the graph we can write the intervals of increasing and decreasing function
cpts=solve(d2f==0, x, solution_dict=true)
cpts
infl=solve(d2f==0,x,solution_dict=true)
infl
We can take out the derivatives of an equation at different orders and we can plot those all curves in
a single graph to determine concave up and concave down points
1. Defining a matrix
CDF (Complex Dence Field) defines all entries in matrix is a complex number
2. Matrix operations
Define matrix P
Define matrix Q
For transpose
show('P Q = ',P*Q.transpose())
3. Syntax for finding determinant transpose a inverse adjoint of a matrix
Define matrix R
R.det()
R.inverse()
R.inverse()
R.adjugate()
R.trace()
Define variables
A=matrix([equation points])
B=vector([])
C=A.augment(B)
Show('C=',C)
rank(A)==rank(C)
Define matrix U
Show matrix()
U.transpose().echelon_form()
A=matrix()
p(x)=A.characteristic_polynomial(x)
show('p(x)=', p(x))
P(x).roots()
E=A.eigenvalues()
Show(E)
V=A.eigenvectors_right()
Show('V=', V)
Sum(E)==A.trace()
Product(E)==det(A)
Det(A)
D,M=A.eigenmatrix_right()
Show('D=',D, 'M=',M)
p(x)=A.characteristic_polynomial(x)
show('p(x)=', p(x))
Coff=p.coeifficients()
Show(coff)
7.CURVE FITTING
1. Syntax for finding the best fir curve for given data
data=[(points given)]
point(data)
f1=find_fit(data)
f1
model1=y.subs(f)
model1
point(data) + plot(model1)
var('given variables')
show(y)
show(z)
f1=find_fit(data,y,solution_dict=True)
f2=find_fit(data,z,solution_dict=True)
show(f1,f2)
model1=y.subs(f1)
model2=z.subs(f2)
show(model1)
show(model2)
8 INTEGRAL CALCULUS
1. Integrating a function
f(x)=given function
Show(integrate (f(x),x))
f(x)=given equation
g(x)=given equation
plot(f(x), points where the curve is to be plotted + plot(g(x), points where the curve is to be plotted)
S = solve(f(x) == g(x),x,solution_dict=True)
a,b
show(p1+p2)
show(Area)
show(Area.n())
f(x)
Plot(f(x))