0% found this document useful (0 votes)
69 views

P-1 1st Sem-13C Plotting Funs

The document discusses plotting graphs of functions in Mathematica. It provides examples of commands to plot various functions over different ranges and customize the plot using options like AxesLabel, PlotLabel, PlotStyle, and PlotLegend. Some key functions plotted include sin(x), tan(x), exp(x), and log(x). The document also includes questions asking to plot additional functions using the plotting commands and customization options.

Uploaded by

Ashwani Tanwar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

P-1 1st Sem-13C Plotting Funs

The document discusses plotting graphs of functions in Mathematica. It provides examples of commands to plot various functions over different ranges and customize the plot using options like AxesLabel, PlotLabel, PlotStyle, and PlotLegend. Some key functions plotted include sin(x), tan(x), exp(x), and log(x). The document also includes questions asking to plot additional functions using the plotting commands and customization options.

Uploaded by

Ashwani Tanwar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Practical-1st

Plotting of graphs of functions-:


Command-:
Plot[ f[x], { x, x_min, x_max } ]

Plot@Sin@xD, 8x, -2 Pi, 2 Pi<D


1.0

0.5

Out[81]=

-6

-4

-2

-0.5

Plot@Tan@xD, 8x, -Pi, Pi<D


-1.0

In[83]:=

Out[83]=

-3

-2

-1
-2

-4

-6

P-1_1st_Sem-13C Plotting_Funs.nb

In[84]:=

Plot@Exp@xD, 8x, -5, 2<D


4

Out[84]=

-5

-4

-3

-2

-1

Command for AxesLabel, PlotLabel, PlotStyle, PlotLegend.


(1)

Command for AxesLabel:-

Plot[ f[x], { x, x_min, x_max }, AxesLabel


In[85]:=

{x,y} ]
Plot@Sin@xD, 8x, -2 Pi, 2 Pi<,
AxesLabel 8x, y<D
y

1.0

0.5

Out[85]=

-6

-4

-2

-0.5

-1.0

P-1_1st_Sem-13C Plotting_Funs.nb

In[86]:=

Plot@Sin@xD, 8x, -2 Pi, 2 Pi<,


AxesLabel 8jdm, college<D
college

1.0

0.5

Out[86]=

jdm
-6

-4

-2

-0.5

-1.0

(2)

Command for PlotLabel:-

Plot[ f[x], { x, x_min, x_max }, PlotLabelf[x]


In[87]:=

]
Plot@Sin@xD,
8x, -2 Pi, 2 Pi<, PlotLabel f@xDD
-5

1.0

0.5

Out[87]=

-6

-4

-2

-0.5

-1.0

P-1_1st_Sem-13C Plotting_Funs.nb

In[88]:=

Plot@Sin@xD, 8x, -2 Pi, 2 Pi<, PlotLabel My_NameD


My_Name
1.0

0.5

Out[88]=

-6

-4

-2

-0.5

-1.0

(3)

In[89]:=

Command for PlotStyle:-

Plot[ f[x], { x, x_min, x_max }, PlotStyle


{Red,Thick} ]
Plot@Sin@xD, 8x, -2 Pi, 2 Pi<,
PlotStyle 8Red, Thick<D
1.0

0.5

Out[89]=

-6

-4

-2

-0.5

-1.0

P-1_1st_Sem-13C Plotting_Funs.nb

In[90]:=

Plot@Cot@xD, 8x, -2 Pi, 2 Pi<,


PlotStyle 8Red, [email protected]<D
6

Out[90]=

-6

-4

-2

-2

-4

-6

In[91]:=

Plot@Tan@xD, 8x, -Pi, Pi<,


PlotStyle 8Green<D
6

Out[91]=

-3

-2

-1

-2

-4

-6

(4)

Command for PlotLegend:-

Plot[ f[x], { x, x_min, x_max }, PlotLegend{


In[92]:=

f(x) } ]
Needs@"PlotLegends`"D

P-1_1st_Sem-13C Plotting_Funs.nb

In[93]:=

Plot@Sin@xD, 8x, -2 Pi, 2 Pi<,


PlotLegend 8"fHxL"<D
1.0

0.5

-6

-4

-2

Out[93]=

-0.5

-1.0
fHxL

One Command for :- AxesLabel, PlotLabel,


PlotStyle, PlotLegend.
Plot[ f[x], { x, x_min, x_max }, PlotLegend{
f(x) } ]
(5)

P-1_1st_Sem-13C Plotting_Funs.nb

In[94]:=

Plot@Sin@xD, 8x, -2 Pi, 2 Pi<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Red, [email protected]<,
PlotLegend 8"fHxL"<D
-5
y

1.0

0.5

Out[94]=

-6

-4

-2

-0.5

-1.0
fHxL

In[95]:=

Plot@Tan@xD, 8x, -2 Pi, 2 Pi<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Magenta, [email protected]<,
PlotLegend 8"fHxL"<D
-5
y

6
4
2

Out[95]=

-6

-4

-2

-2
-4
-6
fHxL

Question-:(1) Plot the graphs of the following functions in


given range.
Use AxesLabel, PlotLabel, PlotStyle,

P-1_1st_Sem-13C Plotting_Funs.nb

Question-:(1) Plot the graphs of the following functions in


given range.
Use AxesLabel, PlotLabel, PlotStyle,
PlotLegend.
Solution-:
In[96]:=

(i)

f(x) = 1x , {x, -10, 10}.

Plot@1 x, 8x, -10, 10<, AxesLabel 8x, y<,


PlotLabel f@xD, PlotStyle 8Green<D
-5
y

1.0

0.5
Out[96]=

-10

-5

-0.5

-1.0

(ii)

f(x) = |x|, {x, -5, 5}.

10

P-1_1st_Sem-13C Plotting_Funs.nb

In[97]:=

Plot@Abs@xD, 8x, -5, 5<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Red, [email protected]<D
-5
y

Out[97]=

-4

In[98]:=

-2

(iii)
f(x) = 2*Sin[2x], {x, -, }.
Plot@2 Sin@2 xD, 8x, -Pi, Pi<,
AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Magenta, [email protected]<D
-5
y

Out[98]=

-3

-2

-1

-1

-2

(iv)

Abs@xD
f(x) =
, {x, -10, 10}.
x

10

P-1_1st_Sem-13C Plotting_Funs.nb

(iv)
In[99]:=

f(x) =

Abs@xD
, {x, -10, 10}.
x

Plot@Abs@xD x, 8x, -10, 10<,


AxesLabel 8x, y<, PlotStyle 8Pink<D
y

1.0

0.5

Out[99]=

-10

-5

10

-0.5

-1.0

(v)
In[100]:=

f(x) = SinA 1x E, {x, -10, 10}.

Plot@Sin@1 xD, 8x, -10, 10<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Magenta<D
-5
y

1.0

0.5

Out[100]=

-10

-5

-0.5

-1.0

(vi)

f(x) = SinA 1x E, {x, -/2, }.

10

P-1_1st_Sem-13C Plotting_Funs.nb

In[101]:=

Plot@Sin@1 xD, 8x, -Pi 2, Pi<D


Plot@Sin@1 xD,
8x, -Pi 2, Pi<, PlotRange AllD
1.0

0.5

Out[101]=

-1

-0.5

-1.0
1.0

0.5

Out[102]=

-1

-0.5

-1.0

(vii)

f(x) = x*SinA 1x E, {x, -10, 10}.

11

12

P-1_1st_Sem-13C Plotting_Funs.nb

In[103]:=

Plot@x Sin@1 xD, 8x, -10, 10<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Magenta, [email protected]<D
-5
y

1.00

0.98

0.96

0.94

Out[103]=

0.92

0.90

0.88

-10

10

f(x) = x * SinA 1x E, {x, -/2, /2}.

(viii)
In[104]:=

-5

Plot@x Sin@1 xD, 8x, -Pi 2, Pi 2<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Red, [email protected]<D
-5
y

0.8

0.6
Out[104]=

0.4

0.2

-1.5

-1.0

0.5

-0.5

1.0

-0.2

(ix)

f(x) = e3 x+5, {x, 0, 5}.

1.5

P-1_1st_Sem-13C Plotting_Funs.nb

In[105]:=

PlotA3 x+5, 8x, 0, 5<, AxesLabel 8x, y<,

PlotLabel f@xD, PlotStyle 8Magenta, [email protected]<E


-5

8 107

6 107
Out[105]=

4 107

2 107

(x)
In[106]:=

13

PlotB

f(x) =

x , {x, 0, 5}.

x , 8x, 0, 5<, AxesLabel 8x, y<,

PlotLabel f@xD, PlotStyle 8Yellow, [email protected]<F


-5

1.5

Out[106]= 1.0

0.5

(xi)

f(x) = e1x, {x, -100, 100}.

14

P-1_1st_Sem-13C Plotting_Funs.nb

In[107]:=

Plot@Exp@1 xD, 8x, -100, 100<, AxesLabel 8x, y<,


PlotLabel f@xD, PlotStyle 8Magenta<D
-5
y

1.10

1.05
Out[107]=

1.00

0.95

0.90
-100

(xii)
In[108]:=

50

-50

100

f(x) = e-1x, {x, -100, 100}.

Plot@Exp@-81 x<D, 8x, -100, 100<D


1.10

1.05

Out[108]=

1.00

0.95

0.90
-100

(xiii)

-50

50

f(x) = x - Sin[x], {x, 0, Pi}.

100

P-1_1st_Sem-13C Plotting_Funs.nb

In[109]:=

Plot@x - Sin@2 xD, 8x, 0, Pi<,


AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Red, [email protected]<D
-5

3.5
3.0
2.5
Out[109]= 2.0

1.5
1.0
0.5

0.5

In[110]:=

1.0

1.5

2.0

2.5

3.0

(xiv) f(x) = ArcTan[x], {x, -10, 10}.


Plot@ArcTan@xD, 8x, -10, 10<,
AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Green, [email protected]<D
-5
y

1.5

1.0

0.5
Out[110]=

-10

-5

10

-0.5

-1.0

-1.5

(xv)

f(x) = ArcTan[x] - ArcTan[x/3], {x, -10Pi, 10Pi}.

15

16

P-1_1st_Sem-13C Plotting_Funs.nb

In[111]:=

Plot@ArcTan@xD - ArcTan@x 3D, 8x, -10 Pi, 10 Pi<,


PlotRange All, AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Yellow, [email protected]<D
-5
y

0.4

0.2
Out[111]=

-30

-20

10

-10

20

30

-0.2

-0.4

(xvi)

f(x) = Log[4 - x^2], {x, -5, 5}.

P-1_1st_Sem-13C Plotting_Funs.nb

In[112]:=

Plot@Log@4 - x ^ 2D, 8x, -5, 5<, AxesLabel 8x, y<,


PlotLabel f@xD, PlotStyle 8Red, [email protected]<D
Plot@Log@4 - x ^ 2D, 8x, -5, 5<, PlotRange All,
AxesLabel 8x, y<, PlotLabel f@xD,
PlotStyle 8Red, [email protected]<D
-5
y

1.0

0.5
Out[112]=

-4

-2

-0.5

-1.0

-1.5

-5
y

-2

-1

-2
Out[113]=

-4

-6

-8

-10

(xvii)

f(x) = 1

2 H ^ H-x ^ 2 2LL,

{x, -5, 5}.

17

18

P-1_1st_Sem-13C Plotting_Funs.nb

PlotB1

2 H ^ H-x ^ 2 2LL, 8x, -5, 5<,

AxesLabel 8x, y<, PlotLabel f@xD,

PlotStyle 8Green, [email protected]<F


-5
y

0.4

0.3

Out[114]=

0.2

0.1

-4

-2

Assignment-: Plot the graph of the following functions:


(i)
Sin[x]/x, x[ -300 Pi, 300 Pi]
(ii)
Sin2[x]/x2, x[ -30 Pi, 30 Pi]
(iii)
x - Sin(2 x), x[0, Pi] using AxesLabel and PlotLabel command.
(iv)
1/(x^2 + 1), x[ -10, 10], using
PlotRange, AxesLabel and PlotLabel command.
(v)
1/(x - 1) + 1/(x + 1), x[ -5, 5].
Manipulation Command-:

P-1_1st_Sem-13C Plotting_Funs.nb

In[115]:=

Manipulate@Plot@a * x, 8x, 0, 6<,


AxesLabel 8x, y<, PlotLabel -> a * x,
PlotStyle 8Red, Thick<D, 8a, 1, 4<D
a

3.39071

0.
y
20

Out[115]=

15

10

19

20

P-1_1st_Sem-13C Plotting_Funs.nb

In[116]:=

ManipulateBPlotB

ax+b,

8x, 0, 6<, AxesLabel 8x, y<,


PlotLabel -> Sin@a x + bD,

PlotStyle 8Green, [email protected]<F,

8a, 1, 4<, 8b, 0, 10<F


a

0
y
2.5

Out[116]=

2.0

1.5

1.0

0.5

P-1_1st_Sem-13C Plotting_Funs.nb

In[117]:=

Manipulate@Plot@Abs@a * x + bD, 8x, 0, 50<,


PlotStyle 8Red, [email protected]<D,
8a, -5, 5<, 8b, -15, 20<D
a

250

200
Out[117]=

150

100

50

10

20

30

40

50

21

22

P-1_1st_Sem-13C Plotting_Funs.nb

In[118]:=

Manipulate@Plot@c + Abs@a * x + bD,


8x, 1, 50<, AxesLabel 8x, y<,
PlotLabel c + Abs@a x + bD,
PlotStyle 8Red, Thick<D,
8a, -5, 5<, 8b, -15, 20<, 8c, -7, 7<D
a

b
c

8
y
250
Out[118]=

200

150

100

50

10

20

30

40

50

P-1_1st_Sem-13C Plotting_Funs.nb

In[119]:=

Manipulate@Plot@c - Abs@a * x + bD,


8x, 1, 50<, AxesLabel 8x, y<,
PlotLabel c + Abs@a x + bD,
PlotStyle 8Red, Thick<D,
8a, -5, 5<, 8b, -15, 20<, 8c, -7, 7<D
a

b
c

8
y
10
Out[119]=

-50

-100

-150

-200

-250

20

30

40

50

23

24

P-1_1st_Sem-13C Plotting_Funs.nb

In[120]:=

Manipulate@Plot@x ^ n, 8x, -6, 6<,


AxesLabel 8x, y<, PlotLabel -> x ^ n,
PlotStyle 8Green, [email protected]<,
PlotRange AllD, 8n, 1, 10<D
n

5.26825

0.
y
100 000

Out[120]=

80 000

60 000

40 000

20 000

P-1_1st_Sem-13C Plotting_Funs.nb

In[121]:=

Manipulate@Plot@x ^ H-nL, 8x, -5, 5<,


Exclusions 8x = 0<, AxesLabel 8x, y<,
PlotLabel "x^H-nL", PlotStyle
8Green, [email protected]<D, 8n, 1, 20<D
n

x^H-nL
y
2

Out[121]=

-4

-2

-1

-2

25

26

P-1_1st_Sem-13C Plotting_Funs.nb

In[122]:=

Manipulate@Plot@x ^ H1 nL, 8x, 0, 5<,


AxesLabel 8x, y<, PlotLabel "x^H-nL",
PlotStyle 8Green, Thick<D, 8n, 1, 20<D
n

x^H-nL
y
5

4
Out[122]=

P-1_1st_Sem-13C Plotting_Funs.nb

In[123]:=

Manipulate@Plot@Sin@a x + bD,
8x, 0, 6<, AxesLabel 8x, y<,
PlotLabel -> Sin@a x + bD,
PlotStyle 8Red, [email protected]<D,
8a, 1, 4<, 8b, 0, 10<D
a

0
y
1.0

Out[123]=

0.5

-0.5

-1.0

27

28

P-1_1st_Sem-13C Plotting_Funs.nb

In[124]:=

Manipulate@Plot@Sin@a x + bD, 8x, -10, 10<,


PlotStyle 8Green, [email protected]<D,
8a, 1, 10<, 8b, 0, 20<D
a

1.0

0.5
Out[124]=

-10

-5

-0.5

-1.0

10

P-1_1st_Sem-13C Plotting_Funs.nb

In[125]:=

Manipulate@Plot@Abs@Sin@a x + bDD,
8x, 0, 6<, AxesLabel 8x, y<,
PlotLabel -> Sin@a x + bD,
PlotStyle 8Red, [email protected]<D,
8a, 1, 4<, 8b, 0, 10<D
a

0
y
1.0

Out[125]=

0.8

0.6

0.4

0.2

29

30

P-1_1st_Sem-13C Plotting_Funs.nb

In[126]:=

Manipulate@Plot@Log@a * x + bD,
8x, 1, 10<, PlotStyle 8Purple, Thick<D,
8a, 1, 20<, 8b, 1, 10<D
a

2.0
Out[126]=

1.5

1.0

10

P-1_1st_Sem-13C Plotting_Funs.nb

In[127]:=

Manipulate@Plot@Log@a x + bD, 8x, -10, 10<D,


8a, 1, 10<, 8b, 0, 20<D
a

Out[127]=

-10

-5

-1

10

31

32

P-1_1st_Sem-13C Plotting_Funs.nb

In[128]:=

Manipulate@Plot@1 Ha * x + bL,
8x, -10, 10<, PlotStyle 8Red, Thick<D,
8a, 1, 10<, 8b, 2, 20<D
a

1.0

0.5

Out[128]=

-10

-5

-0.5

-1.0

10

P-1_1st_Sem-13C Plotting_Funs.nb

In[129]:=

Manipulate@Plot@Cos@a * x + bD,
8x, 2, 10<, PlotStyle 8Green, Thick<D,
8a, 3, 12<, 8b, 5, 30<D
a

1.0

0.5
Out[129]=

-0.5

-1.0

10

33

34

P-1_1st_Sem-13C Plotting_Funs.nb

In[130]:=

Manipulate@
Plot@Abs@Cos@a * x + bDD, 8x, 2, 10<D,
8a, 3, 12<, 8b, 5, 30<D
a

1.0

0.8
Out[130]=

0.6

0.4

0.2

10

P-1_1st_Sem-13C Plotting_Funs.nb

In[132]:=

35

ManipulateAPlotAa*x+b, 8x, 1, 10<E,


8a, 0, 5<, 8b, -1, 15<E
a

0.7
0.6
Out[132]=

0.5
0.4
0.3
0.2
0.1

10

********************************************Comple
ted************************************************
****

You might also like