Professional Documents
Culture Documents
Sidharth. V
2040243
1 CMS
1
Contents
1 Introduction 5
1.1 Basic Arithmetic Functions . . . . . . . . . . . . . . . . . . . . . 5
1.1.1 Arithmetic Operator . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Some Mathematical Constants . . . . . . . . . . . . . . . 6
1.2 Mathematical Function . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.1 Basics functions . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Variables and Functions . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Evaluating Function . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.1 Makelist . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.2 Basic in-built Commands . . . . . . . . . . . . . . . . . . 8
1.5 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . 9
1.6 Basic Equation-related Commands . . . . . . . . . . . . . . . . . 9
1.7 Assignment-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2 Programming Approach 11
2.1 Input and Output Functions . . . . . . . . . . . . . . . . . . . . . 11
2.1.1 disp() function . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.2 print() function . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.3 printf() function . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.4 read() function . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2 Conditional Structure . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1 If-Else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.2 Nested If-Else . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3 Iterative Statements . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.1 For Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.2 While Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.3 Unless Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4 Additional In-Built Functions . . . . . . . . . . . . . . . . . . . . 14
2
2.4.1 Concatenation of lists . . . . . . . . . . . . . . . . . . . . 14
2.4.2 cons() function . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.3 endcons() function . . . . . . . . . . . . . . . . . . . . . . 15
2.4.4 delete() function . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.5 join() function . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.6 append() function . . . . . . . . . . . . . . . . . . . . . . 16
2.4.7 reverse() function . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . 16
2.5.1 trigexpand() function . . . . . . . . . . . . . . . . . . . . 16
2.5.2 trigsimp() function . . . . . . . . . . . . . . . . . . . . . . 16
2.6 Assignment-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6.1 To get linear equation and solve them: . . . . . . . . . . . 17
2.6.2 To get a polynomial equation and find the roots of it: . . 17
2.6.3 To get two inputs and do Arithmetic operations: . . . . . 17
2.6.4 To find the radius of a Circle: . . . . . . . . . . . . . . . . 18
2.6.5 To find the LCM and GCD: . . . . . . . . . . . . . . . . . 18
2.7 Assignment-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.7.1 Write a program to check if the given two numbers are
co-prime or not. . . . . . . . . . . . . . . . . . . . . . . . 19
2.7.2 Write a program to find the factorial of a number. . . . . 19
2.7.3 Write a program to find the factors of a number. . . . . . 19
3 Plotting 20
3.0.1 Color for the Graph . . . . . . . . . . . . . . . . . . . . . 21
3.0.2 Thickness of the line in the graph . . . . . . . . . . . . . . 22
3.0.3 Grid and title . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.0.4 Specification of x and y range . . . . . . . . . . . . . . . . 24
3.0.5 Coordinate axes . . . . . . . . . . . . . . . . . . . . . . . 25
3.0.6 Legend and Label . . . . . . . . . . . . . . . . . . . . . . 26
3.0.7 Assignment - 4 . . . . . . . . . . . . . . . . . . . . . . . . 27
3.1 Different types of functions plotting . . . . . . . . . . . . . . . . 29
3.1.1 Piece-wise function . . . . . . . . . . . . . . . . . . . . . . 29
3
3.1.2 Implicit function . . . . . . . . . . . . . . . . . . . . . . . 30
3.1.3 Polar curve . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.1.4 Discrete plot . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.1.5 Parametric function . . . . . . . . . . . . . . . . . . . . . 33
3.1.6 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4 Limits 38
4.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5 Continuity 48
5.1 Types of Discontinuities . . . . . . . . . . . . . . . . . . . . . . . 50
5.1.1 Removable Discontinuity: . . . . . . . . . . . . . . . . . . 50
5.1.2 Non-Removable Discontinuity . . . . . . . . . . . . . . . . 51
5.2 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6 Differentiability 58
6.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8 Application Problems: 74
8.1 Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9 Curve Tracing 77
9.1 Lemniscate Of Bernoulli : sqrt(cos(2θ)) . . . . . . . . . . . . . . 77
9.2 Asteroid : x(t)=cos(t)ˆ3, y(t)=sin(t)ˆ3 . . . . . . . . . . . . . . 77
9.3 Witch of Agnesi : x(t)=t, y(t)=1/(1+tˆ2) . . . . . . . . . . . . . 78
9.4 TRIFOLIUM: cos(θ)(4sin(θ))ˆ2-1 . . . . . . . . . . . . . . . . . . 78
9.5 Cissod Of Diocles : tan(θ)sin(θ) . . . . . . . . . . . . . . . . . . . 79
4
Differential Calculus
Using Maxima
Date : 30.08.2020
1 Introduction
Maxima is an Computer Algerbra System(CAS) which is used to do cal-
culations in mathematics.
Macsyma was developed in 1966 - 1971 at MIT Computer Science Lab.
It can do differentiation, integration, etc.,.
It is free and user friendly.
There are different types of Maxima like - wxMAxima, GMaxima and 13
E-Maxima.
−→ 45 + 234;
279 (% o1)
−→ (56.82 - 22.1)ˆ2/20.5;
58.8038243902439 (% o2)
Note : (To execute your calculation use Shift + Enter Key)
5
1.1.2 Some Mathematical Constants
%i : i (imaginary number)
%e : e (exponential)
There are various mathematical functions given in wxMaxima few are below:
! : factorial
exp() : exponential value
sqrt() : Square Root value
round(): Returns the near round value
min() : Returns the smallest value of list
max() : Returns the largest value of list
Eg.
−→ 10!;
3628800 (% o16)
−→ sqrt(99);
√
3 11 (% o17)
−→ max(10,50,80,1,6,51,8);
80 (% o18)
(% i7) f(x):=xˆ2+1$g(x):=xˆ3+2$
f(x)*g(x);
2 3
x2 + x + 1 + 1 x2 + x + 1 + 2 (% o7)
6
Just when we multiply them maxima substitute the values but we don’t get the
necessary answer so we use the ratsimp(%) function shown below
(% i8) ratsimp(%);
x10 + 5x9 + 15x8 + 30x7 + 46x6 + 54x5 + 53x4 + 41x3 + 27x2 + 12x + 6 (% o8)
(% i10) c(x):=sin(x);
c(x) : = sin (x) (% o10)
(% i11) c(2*%pi);
0 (% o11)
−→ x:10$
y:20$
x+y;
30 (% o9)
Note :
To assessing a variable we use the symbol Colon(:)
To assessing a function we use the := operator as shown below.
−→ f(x):= sin(x)$
f(%pi);
0 (% o11)
We can also assess multiple values as follows:
Syntax:
[var 1, var 2, ... , var n]:[val 1, val 2, ... , val n]
For example :
−→ [a,b,c,d]:[1,2,3,4];
[1 , 2 , 3 , 4] (% o12)
−→ a;
1 (% o13)
To access a value from the list we can just use the variable name.
7
1.4 Evaluating Function
1.4.1 Makelist
−→ x: makelist(sin(x),x,0,%pi,%pi/4);
1 1
[0 , √ , 1 , √ , 0] (% o14)
2 2
To access a value we can use the name as index :
−→ x[3];
1 (% o15)
−→ sum(xˆ3,x,1,10);
3025 (% o21)
−→ divide(xˆ3+yˆ3,xˆ2);
1 1
[0 ,[8000 , 3 + 8000 , 8001 , 3 + 8000 , 8000]] (% o26)
2 2 22
−→ diff(kˆ5,k,3);
60k 2 (% o34)
8
1.5 Trigonometric Functions
Some of the Trigonometric Functions are given below:
sin() :Returns sine angle
cos() :Returns cosine angle
tan() : Returns tangent angle
asin(): Returns arcsine function
cosh(): Returns Hyperbolic Cosine function
Eg.
−→ sin(%pi/4);
1
√ (% o45)
2
−→ acos(0);
π
(% o47)
2
−→ tanh(0);
0 (% o51)
−→ solve([mˆ3+1=10],[m]);
linsolve([m+n=6,n-3*m=2],[m,n]);
√ 1 1 √ 1 1
3 9 3 %i − 9 3 3 9 3 %i + 9 3 1
[m = ,m = − , m = 93 ] (% o43)
2 2
[m = 1 , n = 5] (% o44)
Date : 25.08.2020
9
1.7 Assignment-1
(% i1) a:8/18$
(% i2) b:7/9$
(% i3) a*b;
28
(% o3)
81
(% i4) float(%o5+sqrt(3));
(% i5) (%o7)ˆ2;
2
%o7 (% o5)
(% i6) float(cos(53*%pi/180));
0.6018150231520483 (% o6)
(% i7) float(tan(12*%pi/22));
−6.955152771773481 (% o7)
(% i8) linsolve([x+y=6,y-3*x=2],[x,y]);
[x = 1 , y = 5] (% o8)
(% i9) e:float((makelist(sin(x),x,0,%pi,%pi/4)));
10
Date: 08.09.2020
2 Programming Approach
This disp() function is used to print the content given in the function.
Syntax:
disp(”T ext”);
Eg.
Note: Here the word "done" is default and to avoid it, add "$" in
the end.
Eg.
The print function is same as the disp()function but it partially formates and
display it.
Syntax:
print(”T ext”);
Eg.
(% o5)
Hello World
11
Note: Here the word is printed again by default printed to avoid it
add "$" in the end
Eg.
HelloW orld
A conditional structure controls the flow of the program based on some condi-
tions. The condition determines the path of a program needs to run.
2.2.1 If-Else
−→ if condition then
expr_1else
expr_2;
12
2.2.2 Nested If-Else
−→ if cond_1 then
expr_1else if cond_2
expr_2else if cond_3...
else expr_n
2.2.3 Examples
Eg.
Program to print 1-10:
Eg.
To print 10 numbers using while loop
13
2.3.3 Unless Loop
Eg.
To print 10 numbers using unless loop
2.3.4 Example
(% i8) sum:0$
for i:1 step 1 thru 50 do
sum: sum+i$
print("Sum of the numbers is:",sum)$
Sum of the numbers is: 1275
Date: 01.09.2020
−→ makelist(concat(y,xˆ2),x,1,10);
[y1 , y4 , y9 , y16 , y25 , y36 , y49 , y64 , y81 , y100 ] (% o2)
14
2.4.3 endcons() function
The endcons() function is used to add numbers at the end of the list.
Eg.
−→ endcons(55,K);
rest() function The rest() function is used to display the values except the range
of values mentioned in the function.
Eg.
−→ rest(K,2);
−→ rest(K,-2);
[1 , 8 , 27] (% o12)
−→ delete(55,K);
[1 , 8 , 27 , 64 , 125] (% o13)
−→ k:makelist(3*x,x,1,10);
[3 , 6 , 9 , 12 , 15 , 18 , 21 , 24 , 27 , 30] (% o14)
−→ join(K,k);
15
2.4.6 append() function
−→ append(K,k);
−→ reverse(K);
[125 , 64 , 27 , 8 , 1] (% o17)
−→ trigexpand(sin(x+y));
−→ trigsimp(-sin(x)ˆ2+3*cos(x)ˆ2+x);
2
4cos (x) + x − 1 (% o22)
16
Date: 01.09.2020
2.6 Assignment-2
(% a:read("Enter a number(a):")$
i119) b:read("Enter a number(b):")$
print("The value of the arithmetic operators:")$
print(a,"+",b,"=",a + b)$
print(a,"-",b,"=",a -b)$
print(a,"*",b,"=",a*b)$
print(a,"*",b,"=",a*b)$
print(a,"/",b,"=",mod(a,b))$
Enter a number(a): 10;
10 + 20 = 30
10 - 20 = −10
17
10 * 20 = 200
10 / 20 = 10
LCM : 60
GCD : 5
18
Date: 08.09.2020
2.7 Assignment-3
2.7.1 Write a program to check if the given two numbers are co-
prime or not.
19
Date: 15.09.2020
3 Plotting
We can plot functions in maxima using the ’draw’ package. There are many
types of plots available in maxima five plots of different function are shown
below:
1. Explicit function
2. Implicit function
3. Parametric function
4. Polar function
5. Discrete plots
Eg.
Plot the graphs of the function f(x)=2x and g(xˆ2)
(% i15) draw2d(explicit(2*m,m,-5,5),explicit(mˆ2,m,-5,5));
20
3.0.1 Color for the Graph
The draw package also offers us to add color to the graph there are many varieties
of color that is offered
Few are mentioned below:grey10, grey20, black, red, blue, pink, light- pink,
etc.,Eg.Plot a straight line in different colors
(% i16) draw2d(color=red,explicit(n+1,n,-5,5),
color=blue,explicit(n,n,-5,5),
color=pink,explicit(n-1,n,-5,5));
21
3.0.2 Thickness of the line in the graph
We also can adjust the thickness of the line in the graph by using the line_width
function
Eg.
(% i17) draw2d(line_width=3,color=red,explicit(n+1,n,-5,5),
line_width=2,color=blue,explicit(n,n,-5,5),
line_width=4,color=pink,explicit(n-1,n,-5,5));
22
3.0.3 Grid and title
We can add grid in the plot using the grid=true function and to add the title
we use title="Title" command
Eg.
23
3.0.4 Specification of x and y range
The range function is used to add up the range of the x-axis and y-axis of the
plot using the xrange for xaxis and yrange for the yaxis.
Eg.
24
3.0.5 Coordinate axes
Eg.
25
3.0.6 Legend and Label
Legend is used to identify which graph represents which color and label is used
to label the axis.
Eg.
26
Date : 15.09.2020
3.0.7 Assignment - 4
−→ f(x):=read("Enter a function")$
g(x):=read("Enter a function")$
Enter a function : xˆ3+2;
Enter a function : xˆ2+1;
(% i72) f(x)+g(x);
x3 + x2 + 3
x3 − x2 + 1 (% o72)
27
(% draw2d( grid=true, title= "Plotting Graph",
i103) xaxis= true, xaxis_type= dots, xaxis_color=blue,
yaxis= true, yaxis_type= dots, yaxis_color=blue,
xrange=[-10,10], yrange=[-10,10], label(["(0,0)",0,-1]),
point_type=7, point_size=2, points([[0,0]]),
line_width=2, color="blue", key="x", explicit((x/2)ˆ2-1,x,-5,5),
line_width=2, color="red", key="x", explicit(5*xˆ3-3,x,-5,5),
line_width=2, color="green", key="x", explicit(sin(1-2*x),x,-5,5),
line_width=2, color="yellow", key="x", explicit((xˆ2)*cos(1/xˆ2),x,-5,5));
28
Date: 22.09.2020
Eg.
f(m)=3-xˆ2
if x<-2
11-xˆ2 if x>=-2
29
3.1.2 Implicit function
Eg.
Plotting an implicit function xˆ2/3+yˆ2/3=4
30
3.1.3 Polar curve
Eg.
Plotting a three-leaved rose by r=sin3(theta)
31
3.1.4 Discrete plot
(% i49) a:makelist(sin(n)/n,n,-10,20,0.2)$
draw2d(color=blue,points(a));
32
3.1.5 Parametric function
33
Date: 22.09.2020
3.1.6 Assignment
ellipse.jpg
34
(% i50) draw2d(grid=true, title="Straight Line",
xaxis=true, xaxis_type= dots, xaxis_color=blue,
yaxis=true, yaxis_type= dots, yaxis_color=blue,
xrange=[-10,10], yrange=[-10,10], label(["(0,0)",0,-1]),
point_type=7, point_size=2, points([[0,0]]),
line_width=2, color="blue",
key="x=5y-3", implicit(x=5*y-3,x,-10,10,y,-10,10));
straight line.jpg
35
(% i51) draw2d(grid=true, title="Ellipse",
xaxis=true, xaxis_type= dots, xaxis_color=blue,
yaxis=true, yaxis_type= dots, yaxis_color=blue,
xrange=[-1,1], yrange=[-1,1], label(["(0,0)",0,-0.1]),
point_type=7, point_size=2, points([[0,0]]),
line_width=2, color="blue",
key="x=sin(1-2t), y=cos(1+2t)", parametric(sin(1-2*t),cos(1+2*t),t,-5,5));
ellipse 1.jpg
36
(% i52) draw2d(grid=true,
xaxis=true, xaxis_type= dots, xaxis_color=blue,
yaxis=true, yaxis_type= dots, yaxis_color=blue,
xrange=[-1,1], yrange=[-2,2], label(["(0,0)",0,-0.5]),
point_type=7, point_size=2, points([[0,0]]),
line_width=2, color="blue",
key="y=(xˆ2)cos(1/xˆ2)", explicit((xˆ2)*cos(1/xˆ2),x,-1,1));
1.jpg
37
Date:29.09.2020
4 Limits
Limit is a point where a line or a curve may or may not reach it is the point
that the curve is approaching.
Left hand limit is the point at which the function approaches from left hand
side.
Right hand limit is the point at which the function approaches from right hand
side.
Limits in maxima are determined using a built in function limit.
Syntax:∼limit(unction,variable,limiting value)
Eg.
−→ limit(2*x+3,x,1);
5 (% o1)
−→ limit(3*x-5,x,2);
1 (% o2)
Plotting of curve:
−→ draw2d(explicit(3*x-5,x,-20,20),
title="The line 3x-5",grid=true, xrange=[-10,10],yrange=[-25,25],
color="red",point_type=6,points([[2,1]]));
Limit graph.jpg
38
Program to check the limit of the function:
1. If f(x)=(xˆ2-4)/(x-2).
Then evaluate the values of f(x) for 10 values of x near 2(from both sides +2and
-2) and
find lim x → 2 f(x).
Also illustrate it graphically.
39
1.9999999999
x f(x)
(% o6)
f(x)
40
x f(x)
(% o8)
f(x)
(ii) lim x→0 f(x)
−→ limit(((xˆ2-4)/(x-2)),x,2);
4 (% o9)
41
Date:29.09.2020
4.1 Assignment
(% i2) f(x):=((xˆ2-4)/(x-2))$print("x"," "," "," "," "," "," ","f(x)"),for i:1 thru 10
do(b:-1/(10ˆi), f: float(f(b)), print(b," "," "," "," ",f));
1
−
10
1.9
1
−
100
1.99
1
−
1000
1.999
1
−
10000
1.9999
1
−
100000
1.99999
1
−
1000000
42
1.999999
1
−
10000000
1.9999999
1
−
100000000
1.99999999
1
−
1000000000
1.999999999
1
−
10000000000
1.9999999999
x f(x)
(% o2)
f(x)
−→ f(x):=((xˆ2-4)/(x-2))$
print("x"," "," "," "," "," "," ","f(x)"),
for i:1 thru 10 do(a:1/(10ˆi),
f: float(f(a)),
print(a," "," "," "," ",f));
1
10
2.1
1
100
2.01
43
1
1000
2.001
1
10000
2.0001
1
100000
2.00001
1
1000000
2.000001
1
10000000
2.0000001
1
100000000
2.00000001
1
1000000000
2.000000001
1
10000000000
2.0000000001
44
x f(x)
(% o2)
f(x)
(ii) lim x→0 f(x)
−→ limit(((xˆ2-4)/(x-2)),x,2);
4 (% o3)
graph of 29.09.jpg
45
2. Compute the limiting value of function (xˆ2-1)/(xˆ2+1)as x → ∞.
−→ limit((xˆ2-1)/(xˆ2+1),x,inf);
1 (% o31)
−→ kill(all)$
f(n):=(3-nˆ2)$
g(m):=(11-mˆ2)$
LHL:limit(f(n),n,-2,minus)$
RHL:limit(g(m),m,-2,plus)$
print("Given f(n),f(m) =",f(n),",",f(m))$
print("The left hand limit is: ",LHL)$
print("The right hand limit is: ",RHL)$
if LHL = RHL and LHS = t and LHS = u then
disp("Given function is continuous")
else
disp("Given function is discontinuous")$;
Given f(n),f(m) =
3 − n2
3 − m2
−1
46
−→ a:0$f(t):=(cos(%pi/(sqrt(19-(3*sec(2*t))))))$
fa:f(a);
LHL:limit(f(t),t,a,minus)$
RHL: limit(f(t),t,a,plus)$
print("Given f(x) =",f(x))$
print("The left hand limit is: ",LHL)$
print("The right hand limit is: ",RHL)$
if LHL = RHL and LHL = fa then
disp("Given function is continuous")
else
disp("Given function is discontinuous")$;
1
√ (% o29)
2
Given f(x) =
!
π
cos p
19 − 3 sec (2x)
47
Given f(x) =
sin (x)
sec π sin (2x) −
3x
5 Continuity
The consistent existence of a curve is know as continuity.
Continuity of a function can be determined using a program as follows:
−→ kill(all)$
a:float(%pi/2)$
f(x):=(x*tan(x))/(xˆ2+1)$
fa:f(a);LHL:limit(f(x),x,a,minus)$
RHL: limit(f(x),x,a,plus)$
print("Given f(x) =",f(x))$
print("The left hand limit is: ",LHL)$
print("The right hand limit is: ",RHL)$
if LHL = RHL then
disp("Given function is continuous")
else
disp("Given function is discontinuous")$;
7.3983511125934311015 (% o3)
Given f(x) =
x tan (x)
x2 + 1
48
7.3983511125934321015
7.3983511125934321015
49
5.1 Types of Discontinuities
It is a type of discontinuity in which the limit of a function exist but having the
problem
1.Having different value of both the function f(x) and f(a).
2.It does not have a defined value of the function f(a).
Missing point The limit of the function exists at a particular point in the
function f(a) is not defined at ’a’.
1.Program to check the continuity of the function f(x)=(xˆ2-4)/(x-2)at x=2
(% i11) draw2d(grid=true,title="Continuity",
xrange=[-2,4],yrange=[-1,6],point_type=circle,
points([[2,4]]),color=dark_green,explicit((xˆ2-4)/(x-2),x,-2,1.99),
color=red,explicit((xˆ2-4)/(x-2),x,2.01,4));
50
Isolated Point Limit of the function exists at a particular point say ’a’ with
the function f(a) which is also defined at the particular point.
(% i9) draw2d(grid=true,title="Continuity",
xrange=[1,5],yrange=[4,10],
point_type=circle,points([[4,8]]),
point_type=7,points([[4,9]]),
color=dark_green,explicit((xˆ2-16)/(x-4),x,1,3.99),
color=red,explicit((xˆ2-16)/(x-4),x,4.01,5));
[gr2d (points , points , explicit , explicit)] (% o9)
In this type of discontinuities the limit of the function does not exist at the
given point i.e„ lim x→a f(x) does not exist.
Finite Type Function exist for finite values and can be equal to either of the
one sided limits. Such functions have non negative difference between two limits
which is called jump of discontinuity. This type of discontinuity is also called
jump discontinuity.
(% i10) draw2d(grid=true,title="Continuity",
xrange=[-2,2],yrange=[-1,4],
point_type=7,points([[-1,1],[-1,2]]),
color=dark_green,key="x+2,x<=-1",explicit(x+2,x,-2,-1),
color=red,key="xˆ3-x+2,x>-1",explicit(xˆ3-x+2,x,-1,2));
[gr2d (points , explicit , explicit)] (% o10)
51
Finite.jpg
Infinite 1.jpg
Infinite Type Discontinuity such that at least one of the two line is infinity.
(% i12) draw2d(grid=true,title="Continuity",
xrange=[-10,10],yrange=[-10,10],point_type=7,
color=dark_green,key="1/x",explicit(1/x,x,-10,10));
Oscillatory Type Limits oscillates between two values which are finite.
1. sin(1/x)
52
Oscillatory 1.jpg
5.2 Assignment
Date: 10.11.2020
Missing point.jpg
53
2. Isolated Point:
f(x)=xˆ2-4/(x-4) where x6=4 at x=4 f(x)=6
Isolated Point.jpg
54
3. Jump/Finite:
f(x) = xˆ2 if x<=1,6-x
if x>1.
(% i56) draw2d(grid=true,title="Finite/Jump",
xrange=[-5,7],yrange=[-5,10],
point_type=7,points([[1,1],[1,5]]),
color=blue,key="xˆ2, x<=1",
explicit(xˆ2,x,-7,1),
color=red,key="6-x, x>1",
explicit(6-x,x,1,7));
[gr2d (points , explicit , explicit)] (% o56)
Jump.jpg
55
Infinite:
f(x)=1/xˆ2
(% i55) draw2d(grid=true,title="Infinite",
xrange=[-10,10],yrange=[-10,10],
point_type=7,
color=blue,
key="1/xˆ2",
explicit(1/xˆ2,x,-10,10));
[gr2d (explicit)] (% o55)
Infinite.jpg
56
Oscillatory:
cos(1/x)
Osilation.jpg
57
Date:06.10.2020
6 Differentiability
−→ kill(all)$
a:1$f1(x):=1-x$
print("Given f(x)=",f1(x),"for x<1")$
f2(x):=xˆ2+3$
print("Given f(x)=",f2(x),"for x≥1")$
LHD:limit(ratsimp((f1(x)-f2(a))/(x-a)),x,a,minus);
RHD:limit(ratsimp((f2(x)-f2(a))/(x-a)),x,a,plus);
if LHD=RHD then
disp("The given function is differentiable at x=",a)
else
disp("The given function is not differentiable at x=",a);
Given f(x)=
1−x
for x< 1
Given f(x)=
x2 + 3
for x> =1
∞ (% o6)
58
2 (% o7)
−→ kill(all)$
a:1$
f1(x):=2*x+1$
print("Given f(x)=",f1(x),"for x<1")$
f2(x):=xˆ2+2$
print("Given f(x)=",f2(x),"for x≥1")$
LHD:limit(ratsimp((f1(x)-f2(a))/(x-a)),x,a,minus);
RHD:limit(ratsimp((f2(x)-f2(a))/(x-a)),x,a,plus);
if LHD=RHD then
disp("The given function is differentiable at x=",a)
else
disp("The given function is not differentiable at x=",a);
Given f(x)=
2x + 1
for x< 1
Given f(x)=
x2 + 2
for x> =1
2 (% o6)
2 (% o7)
59
The given function is differentiable at x=
1
done (% o8)
60
6.1 Assignment
Date: 06.10.2020
(% i10) kill(all)$
a:-1$
g(t):=1/(tˆ2)$
df:1/(tˆ2)$
LHD:limit(ratsimp((df-g(a))/(t-a)),t,-1,plus)$
RHD:limit(ratsimp((df-g(a))/(t-a)),t,-1,minus)$
if LHD=RHD then
print("The differentiation of function is ",LHD)
else
print("There is no differentiation for this function at ",a)$
b:sqrt(3)$
LHD:limit(ratsimp((df-g(b))/(t-b)),t,b,plus)$
RHD:limit(ratsimp((df-g(b))/(t-b)),t,b,minus)$
if LHD=RHD thenprint("The differentiation of the function is
",LHD)
else
print("There is no differentiation for the function at ",b)$
The differentiation of function is 2
2
The differentiation of the function is − 3
32
√
b)r(s)= (2*s+1) to find r;(0) and r’(1)
61
(% i11) kill(all)$
a:0$
r(s):=sqrt(2*s+1)$
df:sqrt(2*s+1)$
LHD:limit(ratsimp((df-r(a))/(s-a)),s,0,plus)$
RHD:limit(ratsimp((df-r(a))/(s-a)),s,0,minus)$
if LHD=RHD then
print("The differentiation of the function is ",LHD)
else
print("There is no differentiation of this function at",a)$
b:1$
LHD:limit(ratsimp((df-r(b))/(s-b)),s,1,plus)$
RHD:limit(ratsimp((df-r(b))/(s-b)),s,1,minus)$
if LHD=RHD then
print("The differentiation of the function is ",RHD)
else
print("There is no differentiation of this function at",b)$b:1$
The differentiation of the function is 1
1
The differentiation of the function is √
3
2.To verify the rolle’s theorem for xˆ3+3x+1=0 at the interval [-1,0]
62
(% i15) kill(all)$
a:-1$
b:0$
f(x):=xˆ3+3*x+1$
print("The given function is",f(x))$
df(x):=diff(f(x),x)$
t:ratsimp(f(x))$
/*Continuity*/
for i:a step 0.05 thru b do(
LHL[i]: limit(t,x,i,plus),
RHL[i]: limit(t,x,i,minus),
m[i]: ev(t,x:i),
if (LHL[i]=RHL[i] and LHL[i]=m[i])
then n:1
elsen:0)$
if n=1 then
print("The fucntion is continuous at",[a,b])
else
print("The fucntion is not contineous at",[a,b])$
/*Differentiation*/
for i: a+0.00001 step 0.005 thru b-0.00001 do(
LHD[i]: limit((f(x)-f(i))/(x-i),x,i,minus),
RHD[i]: limit((f(x)-f(i))/(x-i),x,i,plus),
if (LHD[i]=RHD[i] and abs(LHD[i])6=inf and abs(LHD[i])6=ind)
then o:1
elseo:0)$
if o=1 then
print("The function is differentiable on the interval",(a,b))
else
print("The function is not differentiable on the interval",(a,b))$
/*Checking f(a)=f(b)*/
fa:ev(t,x:a)$
fb:ev(t,x:b)$
if fa=fb then(print("f(a)=f(b)"),e:1)
else
(print("f(a)6=f(b)"),e:0)$
63
/*Rolle’s theorem*/if(n=1 and o=1 and e=1)then
(print("f(x) satisfies all the condition of Rolles theorem"))
else
(print("The function does not satisfy the condtion of Rolle’s theo-
rem"))$
plot2d([f(x)],[x,a,b]);
The given function is x3 + 3x + 1
The function is continuous at [−1 , 0]
64
Graph of 06.10.png
65
i) f(x) is continuous on [a,b]
ii) f(x) is derivable on∼(a,b) and
iii) f(a) = f(b)then there exists at least one value of x=c; a<c<b,
for which f’(c)=0.
Geometrically, Rolle’s theorem imply that there exist a point c in
(a,b) for a function satisfying the given conditions, at which the
tangent is parallel to the x-axis.
66
−→ kill(all)$
a:2$
b:4$
f(x):=xˆ2-6*x+8$
print("The given function is",f(x))$
df(x):=diff(f(x),x)$
t:ratsimp(f(x))$
/*Continuity*/
for i:a step 0.05 thru b do
(LHL[i]: limit(t,x,i,plus),
RHL[i]: limit(t,x,i,minus),m[i]:
ev(t,x:i),
if (LHL[i]=RHL[i] and LHL[i]=m[i])then
n:1else
n:0)$if n=1 then
print("The function is continuous at",[a,b])
else
print("The function is not continuous at",[a,b])$
/*Differentiation*/
for i: a+0.00001 step 0.005 thru b-0.00001 do
(LHD[i]: limit((f(x)-f(i))/(x-i),x,i,minus),
RHD[i]: limit((f(x)-f(i))/(x-i),x,i,plus),
if (LHD[i]=RHD[i] and abs(LHD[i])
6=inf and abs(LHD[i])6=ind)then
o:1elseo:0)$
if o=1 then
print("The function is differentiable on the interval",(a,b))
else
print("The function is not differentiable on the interval",(a,b))$
/*Checking f(a)=f(b)*/
fa:ev(t,x:a)$
fb:ev(t,x:b)$
if fa=fb then
(print("f(a)=f(b)"),e:1)
else
(print("f(a)6=f(b)"),e:0)$
/*Rolle’s theorem*/
if(n=1 and o=1 and e=1)then
(print("f(x) satisfies all the condition of Rolles theorem"))
else
(print("The function does 67 not satisfy the condtion of Rolle’s theo-
rem"))$
plot2d([f(x)],[x,a,b]);
The given function is
x2 − 6x + 8
f(a)=f(b)
f(x) satisfies all the condition of Rolles theorem
[ (% o15)
C:/Users/veluv/AppData/Local/Temp/maxout14280.gnuplot
]
Date:13.10.2020
68
−→ kill(all)$
a:2$
b:4$
f(x):=xˆ2-6*x+8$
print("The given function is",f(x))$
df(x):=diff(f(x),x)$
t:ratsimp(f(x))$
/*Continuity*/
for i:a step 0.05 thru b do
(LHL[i]: limit(t,x,i,plus),
RHL[i]: limit(t,x,i,minus),
m[i]: ev(t,x:i),
if (LHL[i]=RHL[i] and LHL[i]=m[i])then
n:1elsen:0)$
if n=1 then
print("The fucntion is continuous at",[a,b])else
print("The fucntion is not contineous at",[a,b])$
/*Differentiation*/for i: a+0.00001 step 0.005 thru b-0.00001 do
(LHD[i]: limit((f(x)-f(i))/(x-i),x,i,minus),
RHD[i]: limit((f(x)-f(i))/(x-i),x,i,plus),
if (LHD[i]=RHD[i] and abs(LHD[i])
6=inf and abs(LHD[i])6=ind)then
o:1elseo:0)$
if o=1 then
print("The function is differentiable on the interval",(a,b))
else
print("The function is not differentiable on the interval",(a,b))$
/*Lagrange’s Theorem*/
ratio:(f(b)-f(a))/(b-a)$
if(d=1 and e=1) then
(print("f(x) Satisfies all condition of Lagrange’s mean Value theo-
rem"),
print("Hence by this there exist one value of x=c such that a<c<b
for which f’(c)=f(b)-f(a)/b-a"),
print("The required value of c=",solve(df(c)=ratio,c)))
else
print("One condition of Lagrange’s Mean Value Theorem fails")$
69
The given function is
x2 − 6x + 8
70
(% i24) kill(all)$
f(x):=(x^3+x^2+x+1)$
g(x):=(x^2+x+1)$
a:10$
b:15$
cof:0$
cog:0$
dof:0$
dog:0$
p:ratsimp(f(x),x)$
q:ratsimp(g(x),x)$
fod(x):=diff(f(x),x)$
god(x):=diff(g(x),x)$
print("Given f(x)=",f(x) and "g(x)=",g(x))$
print( " Therefore f’(x)=",fod(x)and "g’(x)=", god(x))$
/*Verifying Continuity*/
for i:a step 0.05 thru b do
(LHL[i]:limit(p,x,i,plus),
RHL[i]:limit(p,x,i,minus),
h1[i]:ev(p,x:i),
if(LHL[i]=RHL[i] and LHL[i]=h1[i])then
(cof:1)else (cof:0))$
if cof=1 then(print("f(x) is continuous in ",[a,b]))
else
print("One of the condition of continuity fails,hence f(x) is not
continuous in",[a,b])$
for i:a step 0.05 thru b do
(LHL[i]:limit(q,x,i,plus),
RHL[i]:limit(q,x,i,minus),
h2[i]:ev(q,x:i),
if(LHL[i]=RHL[i] and LHL[i]=h2[i])then
(cog:1)else(cog:0))$
if cog=1 then(print("g(x) is continuous in ",[a,b]))
else
print("One of the condition of continuity fails,hence g(x) is not
continuous in ",[a,b])$
71
/*Verifying Differentiabilty*/
for i:a+0.00001 step 0.05 thru b-0.00001 do
(LHD[i]:limit((f(x)-f(i))/(x-i),x,i,minus),
RHD[i]:limit((f(x)-f(i))/(x-i),x,i,plus),
if LHD[i]=RHD[i] and abs(LHD[i])=inf and abs((LHD[i]))= ind
then
(dof:1)else(dof:0))$
if dof=1 then( print ("f(x) is differentiable in (",a,",",b,")"))
else
print("f(x) is not differentiable in ","(",a,",",b)$
for i:a+0.00001 step 0.05 thru b-0.00001 do
(LHD[i]:limit((g(x)-g(i))/(x-i),x,i,minus),
RHD[i]:limit((g(x)-g(i))/(x-i),x,i,plus),
if LHD[i]=RHD[i] and abs(LHD[i])=inf and abs((LHD[i]))=ind
then
(dog:1)else(dog:0))$
if dog=1 then( print("g(x) is differentiable in (",a,",",b,")"))
else
print("g(x) is not differentiable in",a,",",b)$
/*Verifying Cauchy’s Theorem*/
ratio:((f(b)-f(a))/(g(b)-g(a)))$
if(cof=1 and dof=1 and cog=1 and dog=1) then
(print("f(x) and g(x) satisfy all the conditions of Cauchy’s Theo-
rem"),
print("Hence by Cauchy’s Mean Value Theorem there exists atleast
one valueof x=c, such that a<c<b for which f’(c)/g’(c)=f(b)-
f(a)/g(b)-g(a)"),
print("The required value is",solve((fod(c)/god(c))=ratio,ratsimp(c))))
else
print("One of the conditions of Cauchy’s Mean Value Theorem
fails")$
Given f(x)=
x ˆ3 + x ˆ2 + x + 1and
g(x)=
x ˆ2 + x + 1
72
Therefore f’(x)=
1and
g’(x)=
[10 , 15]
[10 , 15]
,
15
,
15
73
8 Application Problems:
−→ velocity:diff(s(z),z);
32z (% o28)
−→ velocity(z):=32*z;
velocity(z) : = 32z (% o29)
i) If the screw driver was dropped for 400 ft, then it will reach the
ground.
−→ solution:solve([s(z)=400],z);
[z = −5 , z = 5] (% o35)
Since time is positive, t=5s is to be taken as the solution.
ii) To calculate the average velocity,
−→ average_v:(s(5)-s(0))/(5-0);
80 (% o33)
iii)The velocity of the screw driver when it reaches the ground is,
−→ velocity(5);
160 (% o34)
74
8.1 Assignment
Date: 13.10.2020
from the blast off time t=0 to the time when the solid rocket boosters
were jettisoned. i.e. t=126 s. Using this model, and the maximum
and minimum values of acceleration during the time between blast
off and jettisoning. (Hint: In this problem we are given the equation
representing the velocity of the shuttle. We need to determine the
extreme values of the acceleration function.)
(% i13) kill(all)$
v(t):=0.001302*tˆ3-0.09029*tˆ2+ 23.61*t-3.083$
print("velocity(t) = 0.001302*tˆ3 - 0.09029tˆ2 + 23.61*t - 3.083")$
df(t):=diff(v(t),t)$
print("The acceleration is",df(t))$
d:df(t)$
min:ev(d,t:0)$
max:0$
minx:0$
maxx:0$
for i:0 thru 126 do(
if(ev(d,t:i)<min)then
(min:ev(d,t:i),minx:i))$
print("Minimum is",float(min))$
for j:0 thru 126 do(
if(ev(d,t:j)>max)then
(max:ev(d,t:j),maxx:j))$
print("Maximum is",float(max))$
velocity(t) = 0.001302*t^3 - 0.09029t^2 + 23.61*t - 3.083
75
M inimumis21.522934
M aximumis62.868576
(% i8) kill(all)$
P(x):=(-1/3*xˆ2+7*x+30)$
print("P(x)=(-1/3*xˆ2+7*x+30)")$
df(x):=diff(P(x),x)$
h:ratsimp(df(x))$
h1:ev(h,x:10)$
h2:ev(h,x:20)$
print("(i) Ten thousand rupees per quarter is ",h1)$
print("(ii) Twenty thousand rupees per quarter is ",h2)$
P(x)=(-1/3*x^2+7*x+30)
1
(i) Ten thousand rupees per quarter is
3
19
(ii) Twenty thousand rupees per quarter is −
3
76
9 Curve Tracing
Lemniscate of Bernoulli.jpg
(% i2) draw2d(grid=true,title="ASTROID",
xaxis=true,yaxis=true,xrange=[-2,2],yrange=[-2,2],
xaxis_type=dots,xaxis_color=black,
yaxis_type=dots,yaxis_color=blue,
nticks=1000,color=spring-green,parametric(((cos(t))ˆ3),((sin(t))ˆ3),t,0,4*%pi));
[gr2d (parametric)] (% o2)
77
Astroid.jpg
Witch of Agnesi.jpg
(% i5) draw2d(grid=true,title="TRIFOLIUM",
nticks=1000,xaxis=true,yaxis=true,xrange=[-1,1],yrange=[-1,1],
xaxis_type=dots,xaxis_color=black,yaxis_type=dots,
yaxis_color=blue,line_type=1,color=red,line_width=2,
polar((cos(%theta)*(4*sin(%theta)ˆ2-1)),%theta,-3*%pi,3*%pi));
[gr2d (polar )] (% o5)
78
Trifolium.jpg
Cissod of Diocles.jpg
79