You are on page 1of 79

E-Record

Mathematics Using Maxima

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

7 Mean Value Theorems 65


7.1 Rolle’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
7.2 Lagrange’s Mean Value Theorem . . . . . . . . . . . . . . . . . . 68
7.3 Cauchy’s Mean Value Theorem . . . . . . . . . . . . . . . . . . . 70

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.

1.1 Basic Arithmetic Functions


1.1.1 Arithmetic Operator

There are various arithmetic operators like :


+ : Addition
− : Subtraction
∗ : Multiplication
/ : Division
ˆ : Exponentiation
mod(a, b): Remainder of a/b
Eg.

−→ 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)

1.2 Mathematical Function

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)

1.2.1 Basics functions

Here are few basic functions and their operations


Let f(x):=x ˆ 2+1
Let g(x):=x ˆ 3+2
Find the sum, difference and composite of the function

(% 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)

1.3 Variables and Functions


We can assing values to variables :

−→ 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

Makelist function is used to generate a list value according to a conditioner a


function.
Syntax:
makelist(function,variable,start,end)
For example:

−→ 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)

1.4.2 Basic in-built Commands

There are many in-built function in wxMaxima few are as follow:


sum(f unc, var, f rom, to) : To sum the values
lcm(equ1, equ2) : LCM of polynomials
divide(eq1, eq2) : Divide polynomials
dif f (f unc, var, var1) : Differentiation Multiple times
Eg.

−→ 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)

1.6 Basic Equation-related Commands


Some basic Equation-related commands are given below:
solve([eq], [var]) : Solving Equation
linsolve([eq1, eq2], [var]) : Solve linear equation
f actor(expression) : Factorization
Eg.

−→ 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));

%o5 + 1.732050807568877 (% o4)

(% 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)));

[0.0 , 0.7071067811865475 , 1.0 , 0.7071067811865475 , 0.0] (% o9)

10
Date: 08.09.2020

2 Programming Approach

2.1 Input and Output Functions

2.1.1 disp() function

This disp() function is used to print the content given in the function.
Syntax:
disp(”T ext”);
Eg.

(% i3) disp("Hello World");


Hello World
done

Note: Here the word "done" is default and to avoid it, add "$" in
the end.
Eg.

(% i4) disp("Hello World")$


Hello World

2.1.2 print() function

The print function is same as the disp()function but it partially formates and
display it.
Syntax:
print(”T ext”);
Eg.

(% i5) print("Hello World");


Hello World

(% o5)

Hello World

11
Note: Here the word is printed again by default printed to avoid it
add "$" in the end
Eg.

(% i6) print("Hello World")$


Hello World

2.1.3 printf() function

The printf() function is used to print the statement on the screen.


Eg.

(% i8) printf(true,"Hello World")$

HelloW orld

2.1.4 read() function

The read() function is used to get input from the user.


Syntax:
var : read(”Enteraninteger : ”);
Eg.

(% i9) k: read("Enter a number:");


Enter a number: 23;
23

2.2 Conditional Structure

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

Syntax for if-else:

−→ if condition then
expr_1else
expr_2;

12
2.2.2 Nested If-Else

Syntax for Nested if-else:

−→ if cond_1 then
expr_1else if cond_2
expr_2else if cond_3...
else expr_n

2.2.3 Examples

1. Write a program to check age of person to eligible to vote or not:

(% i2) a:read("Enter your age:")$


if(a>=18) then
print("Your eligible to vote")
else
print("Your are not eligible to vote")$
Enter your age: 18;

You are eligible to vote

2.3 Iterative Statements

Iterative/Looping statement is used to perform repeatedly same task.

2.3.1 For Loop

Eg.
Program to print 1-10:

(% i3) for i:1 thru 10 do(disp(i))$


12345678910

2.3.2 While Loop

Eg.
To print 10 numbers using while loop

(% i4) for i:1 while i<=10 do(disp(i))$


12345678910

13
2.3.3 Unless Loop

Eg.
To print 10 numbers using unless loop

(% i5) for i:1 unless i=11 do(disp(i))$


12345678910

2.3.4 Example

1. Write a program to find sum of the numbers from 1 to 50:

(% 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

2.4 Additional In-Built Functions


2.4.1 Concatenation of lists

We use the concact function to add a value to the list.


Syntax:
makelist(concat(val1, val2), var1, start, stop);
Eg.
−→ makelist(xˆ2,x,1,10);
[1 , 4 , 9 , 16 , 25 , 36 , 49 , 64 , 81 , 100] (% o1)

−→ makelist(concat(y,xˆ2),x,1,10);
[y1 , y4 , y9 , y16 , y25 , y36 , y49 , y64 , y81 , y100 ] (% o2)

2.4.2 cons() function

The cons() function is used to add the number in a list.


Eg.
−→ K:makelist(xˆ3,x,1,5)$cons(0,K);
[0 , 1 , 8 , 27 , 64 , 125] (% o7)

14
2.4.3 endcons() function

The endcons() function is used to add numbers at the end of the list.
Eg.

−→ endcons(55,K);

[1 , 8 , 27 , 64 , 125 , 55] (% o8)

rest() function The rest() function is used to display the values except the range
of values mentioned in the function.
Eg.

−→ rest(K,2);

[27 , 64 , 125] (% o11)

−→ rest(K,-2);

[1 , 8 , 27] (% o12)

2.4.4 delete() function

To remove a number we use the delete()function in a list.


Eg.

−→ delete(55,K);

[1 , 8 , 27 , 64 , 125] (% o13)

2.4.5 join() function

To join two lists we use the function join().


Eg.

−→ k:makelist(3*x,x,1,10);

[3 , 6 , 9 , 12 , 15 , 18 , 21 , 24 , 27 , 30] (% o14)

−→ join(K,k);

[1 , 3 , 8 , 6 , 27 , 9 , 64 , 12 , 125 , 15] (% o15)

15
2.4.6 append() function

The append() function is used to add the list in orders.


Eg.

−→ append(K,k);

[1 , 8 , 27 , 64 , 125 , 3 , 6 , 9 , 12 , 15 , 18 , 21 , 24 , 27 , 30] (% o16)

2.4.7 reverse() function

The reverse() function is used to reverse the order of the list.


Eg.

−→ reverse(K);

[125 , 64 , 27 , 8 , 1] (% o17)

2.5 Trigonometric Functions

2.5.1 trigexpand() function

The trigexpand() function is used to expand the trigonometric functions.


Eg.

−→ trigexpand(sin(x+y));

cos (x) sin (y) + sin (x) cos (y) (% o19)

2.5.2 trigsimp() function

To simplify the trigonometric function we use trigsimp() function.


Eg.

−→ trigsimp(-sin(x)ˆ2+3*cos(x)ˆ2+x);
2
4cos (x) + x − 1 (% o22)

16
Date: 01.09.2020

2.6 Assignment-2

2.6.1 To get linear equation and solve them:

(% i73) k:read("Enter a linear equation :")$


m:read("Enter a linear equation :")$
print("The solution of the equation is :",linsolve([k, m], [x,y]))$
Enter a linear equation : x ˆ 2+y=10;

Enter a linear equation : x+yˆ2=5

The solution of the equation is : [x=5, y = 10]

2.6.2 To get a polynomial equation and find the roots of it:

(% i75) n:read("Enter a polynomial Equation:")$


print("The roots of the polynomial equation is:",allroots(a))$
Enter a polynomial Equation: xˆ2=625;
The roots of the polynomial equation is: [x=25]

2.6.3 To get two inputs and do Arithmetic operations:

(% 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;

Enter a number(b): 20;

The value of the arithmetic operators:

10 + 20 = 30

10 - 20 = −10

17
10 * 20 = 200

10 / 20 = 10

2.6.4 To find the radius of a Circle:

(% r:read("Enter radius :")$


i122) print("The area of the Circle (in terms of pi)is: ",%pi*rˆ2)$
print("The area of the Circle is :",3.14*r*r)$
Enter radius : 7;

The area of the Circle (in terms of pi)is: 49π

The area of the Circle is : 153.86

2.6.5 To find the LCM and GCD:

(% l:read("Enter an equation for lcm :")$


i126) h:read("Enter an equation for lcm:")$
lcm(l,h);
gcd(l,h);
Enter an equation for lcm : 15;

Enter an equation for lcm: 20;

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.

(% i3) a:read("Enter a number :")$


b:read("Enter a number :")$
if(gcd(a,b)=1) then
print("The numbers given are co-prime")else
print("The numbers given are not co-prime")$
Enter a number :5;

Enter a number :1;

The numbers given are co-prime.

2.7.2 Write a program to find the factorial of a number.

(% i7) x:read("Enter a number to check the factorial :")$


f:1$
for i:1 step 1 thru x do f:f*i$
print("The factorial of the number is: ",f)$
Enter a number to check the factorial : 5;

The factorial of the number is: 120

2.7.3 Write a program to find the factors of a number.

(% i15) y:read("Enter a number to find factors of a number: ")$


for n:1 step 1 thru y do
if((mod(y,n))=0) then
print(n)$
Enter a number to find factors of a number: 4;

The factors of the number is: 1 2 4

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));

[gr2d (explicit , explicit)] (% o15)

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));

[gr2d (explicit , explicit , explicit)] (% o16)

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));

[gr2d (explicit , explicit , explicit)] (% o17)

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.

(% i18) draw2d(grid=true, title="Straight line",


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));

[gr2d (explicit , explicit , explicit)] (% o18)

Note: The grid is used easily identify the point by locking at it

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.

(% i19) draw2d(grid=true, title="Straight line",


xrange=[-5,5], yrange=[-5,5],
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));

[gr2d (explicit , explicit , explicit)] (% o19)

24
3.0.5 Coordinate axes

Eg.

(% i28) draw2d(grid=true, user_preamble="set zeroaxis linetype 2;set xtics axis;set yt-


ics axis; set border;",
nticks=1000,title="Straigt line",xrange=[-5,5], yrange=[-5,5],
line_width=3,color=red,explicit(sin(m),m,-5,5),
line_width=2,color=blue,explicit(cos(m),m,-5,5));

[gr2d (explicit , explicit)] (% o28)

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.

(% i39) draw2d( grid= true, title= "Two Intersecting Straight Lines",


xaxis=true, xaxis_type= dots, xaxis_color= blue,
yaxis= true, yaxis_type=dots, yaxis_color= blue,
xrange=[-20, 20], yrange=[-20, 20], label(["(0,0)",0,-3]),
line_width= 2, color=blue,key="mˆ2", explicit(mˆ2, m, -15, 15),
line_width= 2, color=pink, key="mˆ2-2",explicit(mˆ2-2, m, -15, 15));

[gr2d (label , explicit , explicit)] (% o39)

26
Date : 15.09.2020

3.0.7 Assignment - 4

1. Write a program to define two functions. Find the sum, difference


and composite of two functions

−→ 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

Enter a function : xˆ3+2;


Enter a function : xˆ2+1;
(% i72) f(x)-g(x);

x3 − x2 + 1 (% o72)

Enter a function : xˆ3+2;


Enter a function : xˆ2+1;
(% i73) f(g(x));
2
x3 + 2 +1 (% o73)

Enter a function : xˆ3+2;


Enter a function : xˆ2+1;
(% i74) g(f(x));
2
x3 + 2 +1 (% o74)

2. Plot the following curves in the same plot:


a) (x/2)ˆ2-1
b) f(x)=5y-3
c) f(x)=sin(1- 2x)
d) f(x)=(xˆ2)cos(1/xˆ2)

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));

[gr2d (label , points , explicit , explicit , explicit , explicit)] (% o103)

Figure 1: Plotting Graph for the functions

28
Date: 22.09.2020

3.1 Different types of functions plotting

3.1.1 Piece-wise function

Eg.
f(m)=3-xˆ2
if x<-2
11-xˆ2 if x>=-2

(% i41) draw2d(grid=true, user_preamble="set zeroaxis linetype 2;


set xtics axis;set ytics axis; set border;",nticks=1000,
title="Piece Wise function",
xrange=[-15,5], yrange=[-15,15],
line_width=3,color=red,explicit(3-mˆ2,m,-4,-2),explicit(11-mˆ2,m,-2,4));

[gr2d (explicit , explicit)] (% o41)

29
3.1.2 Implicit function

Eg.
Plotting an implicit function xˆ2/3+yˆ2/3=4

(% i43) draw2d(title="ASTEROID",xaxis=true, yaxis=true,


line_width=3,color=pink,implicit(mˆ(2/3)+nˆ(2/3)=4,m,-15,15,n,-15,15));

[gr2d (implicit)] (% o43)

30
3.1.3 Polar curve

Eg.
Plotting a three-leaved rose by r=sin3(theta)

(% i45) draw2d(title="3 leaved rose",nticks=200,


polar(sin(3*%theta),%theta,-4*%pi,4*%pi));

[gr2d (polar )] (% o45)

31
3.1.4 Discrete plot

Plotting a discrete plot using f(n)=(sin(n))/n with interval -10 to 20

(% i49) a:makelist(sin(n)/n,n,-10,20,0.2)$
draw2d(color=blue,points(a));

[gr2d (points)] (% o49)

32
3.1.5 Parametric function

Plotting a parametric function using the x=2(t-sint); y=1-cost

(% i50) draw2d(grid=true, user_preamble="set zeroaxis linetype 8;


set xtics axis; set ytics axis; set border 15;",
nticks=1000,parametric(2*(t-sin(t)), 1-cos(t),t,0,4*%pi));

[gr2d (parametric)] (% o50)

33
Date: 22.09.2020

3.1.6 Assignment

2. Plot the following curves:


a) (x/2)ˆ2+(y/3)ˆ2=1
b) x=5y-3
c) x=sin(1-2t), y=cos(1+2t)
d) y=(xˆ2)cos(1/xˆ2)

(% i49) draw2d(grid=true, title="Ellipse", nticks=1000,


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/2)ˆ2+(y/3)ˆ2-1", implicit((x/2)ˆ2+(y/3)ˆ2-1,x,-10,10,y,-10,10));

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)

1. Evaluate lim x→2 (3x-5) and plot the function

−→ 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]]));

[gr2d (explicit , points)] (% o4)

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.

(i) Evaluation of f(x) for 10 values

−→ 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
1.999999
1

10000000
1.9999999
1

100000000
1.99999999
1

1000000000
1.999999999
1

10000000000

39
1.9999999999
x f(x)

(% o6)

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
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

40
x f(x)

(% o8)

f(x)
(ii) lim x→0 f(x)

−→ limit(((xˆ2-4)/(x-2)),x,2);

4 (% o9)

(iii) Graphical representation

−→ draw2d( grid= true, title= "(xˆ2-4)/(x-2)",


xaxis= true, xaxis_type= dots, xaxis_color= blue,
yaxis= true, yaxis_type= dots, yaxis_color= blue,
xrange=[-14, 14], yrange=[-100, 100],
color="red",point_type=6, points([[0,0]]),line_width= 2,
color="blue",key="(xˆ2-4)/(x-4)",explicit((xˆ2-4)/(x-2),x,-20,20));

[gr2d (points , explicit)] (% o12)

Limit graph Eg. @.jpg

41
Date:29.09.2020

4.1 Assignment

1. If f(x)=(xˆ2-4)/(x-2). Then evaluate the values off(x) for 10 values of x


near 2(from both sides +2 and -2)and find lim x → 2 f(x). Also illustrate it
graphically.

(i) Evaluvation of f(x) for 10 values

(% 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)

(iii) Grapical representation

−→ draw2d( grid= true, title= "(xˆ2-4)/(x-2)",


xaxis= true, xaxis_type= dots, xaxis_color= blue,
yaxis= true, yaxis_type= dots, yaxis_color= blue,
xrange=[-14, 14], yrange=[-100, 100], point_type=6,
points([[0,0]]),line_width= 2, color="blue",key="(xˆ2-4)/(x-4)",
explicit((xˆ2-4)/(x-2),x,-20,20));

[gr2d (points , explicit)] (% o4)

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)

3. Write a program to check the continuity of the piecewise function


f(x)= 3-xˆ2 x < -2
11-xˆ2 x >= -2

−→ 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

The left hand limit is:

−1

The right hand limit is:

Given function is discontinuous


4. Program to check whether the functions are continuous

(i) cos(pi/( 19-(3*sec(2*t))))

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)

The left hand limit is:


1

2

The right hand limit is:


1

2

Given function is continuous


Q
(ii) sec( *(sin(2*x)-sin(x)/3*x))
−→ kill(all)$
a:0$
f(x):=sec(%pi*(sin(2*x)-sin(x)/(3*x)))$fa:f(x);
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 and LHL = fa then
disp("Given function is continuous")
else
disp("Given function is discontinuous")$;
  
sin (x)
sec π sin (2x) − (% o3)
3x

47
Given f(x) =
  
sin (x)
sec π sin (2x) −
3x

The left hand limit is: 0

The right hand limit is:

Given function is discontinuous

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

The left hand limit is:

48
7.3983511125934321015

The right hand limit is:

7.3983511125934321015

Given function is continuous

49
5.1 Types of Discontinuities

There are two types of discontinuities namely:


i) Removable discontinuity
ii)Non-Removable discontinuity
The are further classified as:
i) Removable discontinuity1.Missing point
2.Isolated Point
ii)Non-Removable discontinuity
1.Finite/Jump
2.Infinite3.Oscillatory

5.1.1 Removable Discontinuity:

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).

A removable discontinuity is a point on the graph that is undefined or does not


fit the rest of the graph. There is a gap in the graph at that location.

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));

[gr2d (points , explicit , explicit)] (% o11)

Missing point 1.jpg

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.

1. Check the continuity of the function f(x)=(xˆ2-16)/(x-4) at x=not equal to


4 and f(x)=9 at x=4

(% 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)

Isolated point 1.jpg

5.1.2 Non-Removable Discontinuity

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.

f(x)= x+2 if x <= -1


= xˆ3-x+2 if x> -1

(% 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.

1. f(x)=1/x where f(0) is not defined.

(% 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));

[gr2d (explicit)] (% o12)

Oscillatory Type Limits oscillates between two values which are finite.

1. sin(1/x)

(% i13) draw2d (grid=true,


xaxis=true,yaxis=true,
xrange=[-0.1,0.1],yrange=[-2,2],key="sin(1/x)",
color=red,explicit(sin(1/x),x,-1,1));

[gr2d (explicit)] (% o13)

52
Oscillatory 1.jpg

5.2 Assignment

Date: 10.11.2020

1. Missing point: f(x)=(5x-10)/(x-5) at x=5

(% i49) draw2d(grid=true,title="Missing Point",


xrange=[-2,7],yrange=[-1,20],
point_type=circle,points([[5,10]]),
color=dark_blue,
explicit((xˆ2-25)/(x-5),x,-2,4.99),
color=red,
explicit((xˆ2-25)/(x-5),x,5.01,7));
[gr2d (points , explicit , explicit)] (% o49)

Missing point.jpg

53
2. Isolated Point:
f(x)=xˆ2-4/(x-4) where x6=4 at x=4 f(x)=6

(% i58) draw2d(grid=true,title="Isolated Point",


xrange=[-2,5],yrange=[-2,10],
point_type=circle,points([[2,4]]),
point_type=7,points([[2,6]]),
color=blue,
explicit((xˆ2-4)/(x-2),x,-2,1.99),
color=red,
explicit((xˆ2-4)/(x-2),x,2.01,5));
[gr2d (points , points , explicit , explicit)] (% o58)

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)

(% i54) draw2d (grid=true,


xaxis=true,yaxis=true,
xrange=[-0.1,0.1],yrange=[-2,2],
key="cos(1/x)",
color=blue,
explicit(cos(1/x),x,-1,1));
[gr2d (explicit)] (% o54)

Osilation.jpg

57
Date:06.10.2020

6 Differentiability

If f(x) is said to be differentiable at the point x = a if the derivative


f‘(a) exists at every point in its domain. It is given by. For a func-
tion to be differentiable at any point x=a in its domain, it must be
continuous at that particular point but vice-versa is not always true
it is said to be differentiablility.

Program to check the differentiablity at x=1 of a function

f(x) = 1-x; x<1;


x2 +3; x≥1

−→ 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)

The given function is not differentiable at x=


1
done (% o8)

Here the function is continues but not differentiable.


Examine the differentiablity at x=1 for the function
h(x)=2x+1; if x≤1
x2 +2; otherwise

−→ 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)

−→ draw2d(user_preamble="set zeroaxis linetype 8; set xtics axis; set


ytics axis; set border 15;",
nticks=1000,grid=true
,yrange=[-80,80],xrange=[-10,10],
color=blue, point_type=7,points([[1,3]]),
title="Piece-wise defined function that is continues and differen-
tiable",
line_width=2,explicit(2*x+1,x,-10,1),
explicit(xˆ2+2,x,1,10));
[gr2d (points , explicit , explicit)] (% o10)

60
6.1 Assignment

Date: 06.10.2020

1. Find the differentiation of the given functions



a) g(t)=1/t2 to find g’(-1) and g’( 3)

(% 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]

The function is not differentiable on the interval


0
f(a)6= f (b)

The function does not satisfy the condtion of Rolle’s theorem

64
Graph of 06.10.png

7 Mean Value Theorems

Mean value theorems are fundamental results in calculus.We will be


discussing three theorems as follows:
Rolle’s Theorem,Lagrange’s,
Mean value theorem,
Cauchy’s mean Value theorem.

7.1 Rolle’s Theorem

Rolle’s theorem states that if f(x) is a function defined on [a,b] such


that:

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.

1. Write a program to verify the Rolle’s Theorem for the function


x2 -6x+8 in the interval [2,4]. Also give geometrical interpretation.

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

The fucntion is continuous at


[2 , 4]

The function is differentiable on the interval


4

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

7.2 Lagrange’s Mean Value Theorem

Lagrange’sMean Value Theorem states that


if a function f(x) is such that
i) f(x) is continuous in [a,b]
ii) f(x) is differentiable in (a,b)
Then there exists at least one value c (a,b) such that(f(b)-f(a))/(b-
a)=f’(c)

1. Lagrange’sMean Value Theorem for f(x)=(x-1)(x-2)(x-3) in [0,4].

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

The fucntion is continuous at


[2 , 4]

The function is differentiable on the interval

One condition of Lagrange’s Mean Value Theorem fails

7.3 Cauchy’s Mean Value Theorem

Cauchy’s∼Mean Value theorem states that


if two functions f(x) and g(x) are such that
i) both f(x) and g(x) are continues in (a,b)
ii) both f(x) and g(x) are differntiable in (a,b)
iii) g’(x)6=0 anywhere in (a,b), then there exists at least one point c
(a,b) such that(f(b)-f(a))/(g(b)-g(a))=f’(c)/g’(c)

1. f(x)=xˆ3+xˆ2+x+1 and g(x)=xˆ2+x+1 in [10,15]

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)=

One of the condition of continuity fails,hence f(x) is not continuous


in

[10 , 15]

One of the condition of continuity fails,hence g(x) is not continuous


in

[10 , 15]

f(x) is not differentiable in (


10

,
15

g(x) is not differentiable in


10

,
15

One of the conditions of Cauchy’s Mean Value Theorem fails

73
8 Application Problems:

1. During the construction of a high-rise building, a worker acciden-


tally dropped a screwdriver from a height of 400 ft.
After t seconds, the screwdriver had fallen a distance of s =26ˆ2 ft.
i) How long did it take the screwdriver to reach the ground?
ii) What was the average velocity of the screwdriver between the
time it was dropped the time it hit the ground?
iii) What was the average velocity of the screwdriver at the time it
hit the ground?
−→ s(z):=16*(zˆ2);
s(z) : = 16z 2 (% o27)

−→ 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

1. NASA’s Hubble Space Telescope was launched April 24, 1990, on


the space shuttle Discovery from Kennedy Space Centre in Florida.
The velocity of the shuttle can be modelled by the following equation

velocity(t) = 0.001302*tˆ3 - 0.09029tˆ2 + 23.61*t - 3.083

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

The acceleration is 0.003906t2 − 0.18058t + 23.61

75
M inimumis21.522934

M aximumis62.868576

2. The quarterly profit (in thousands of rupees) of a start-up com-


pany is given by

P(x) = (- 1/3) *x2̂ + 7x + 30(0 ≤ x ≤ 50)

where x (in thousands of rupees) is the amount of money the com-


pany spends on advertising per quarter.
Find the first derivative of P(x).
What is the company’s quarterly profit if the amount it spends on
advertising is
(i) ten thousand rupees per quarter and
(ii) twenty thousand rupees per quarter?
(Hint: Find P’(x), P’ (10), P’ (20))

(% 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

9.1 Lemniscate Of Bernoulli : sqrt(cos(2θ))

(% i1) draw2d(grid=true,title="Lemniscate of Bernoulli",


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(sqrt(cos(2*%theta)),%theta,-
1*%pi,1*%pi));
[gr2d (polar )] (% o1)

Lemniscate of Bernoulli.jpg

9.2 Asteroid : x(t)=cos(t)ˆ3, y(t)=sin(t)ˆ3

(% 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

9.3 Witch of Agnesi : x(t)=t, y(t)=1/(1+tˆ2)

(% i7) draw2d(grid=true,title="Witch of Agnesi",


xaxis=true,yaxis=true,xrange=[-4,4],yrange=[0,2],
xaxis_type=dots,xaxis_color=black,
yaxis_type=dots,yaxis_color=blue,
nticks=1000,color=spring-green,parametric(t,(1/(1+tˆ2)),t,-4,4));
[gr2d (parametric)] (% o7)

Witch of Agnesi.jpg

9.4 TRIFOLIUM: cos(θ)(4sin(θ))ˆ2-1

(% 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

9.5 Cissod Of Diocles : tan(θ)sin(θ)

(% i4) draw2d(grid=true,title="Cissod of Diocles",


nticks=1000,xaxis=true,yaxis=true,xrange=[-2,2],yrange=[-15,15],
xaxis_type=dots,xaxis_color=black,yaxis_type=dots,
yaxis_color=blue,line_type=1,color=red,line_width=2,
polar(tan(%theta)*sin(%theta),%theta,-10,10));
[gr2d (polar )] (% o4)

Cissod of Diocles.jpg

79

You might also like