0% found this document useful (0 votes)
28 views8 pages

Practical 1a.b:: Styling Options in Plotting

This document provides examples of various plotting options in Mathematica, including: 1) Styling plots with different colors, thicknesses, and dash patterns. 2) Plotting multiple curves on the same axes and adding legends. 3) Finding exceptions of functions for plotting. 4) Plotting asymptotes of functions. 5) Plotting derivatives of functions. 6) Plotting functions with discrete inputs like the floor function. 7) Plotting logarithmic and piecewise functions.

Uploaded by

Divya Hasija
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

Practical 1a.b:: Styling Options in Plotting

This document provides examples of various plotting options in Mathematica, including: 1) Styling plots with different colors, thicknesses, and dash patterns. 2) Plotting multiple curves on the same axes and adding legends. 3) Finding exceptions of functions for plotting. 4) Plotting asymptotes of functions. 5) Plotting derivatives of functions. 6) Plotting functions with discrete inputs like the floor function. 7) Plotting logarithmic and piecewise functions.

Uploaded by

Divya Hasija
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Practical 1A.

b :
Styling Options in Plotting

In[26]:= Plot [Abs [Sin [x]], {x, - 2 * Pi, 2 * Pi } , PlotStyle → {Red, Thick , Dashed }]

1.0

0.8

0.6

Out[26]=

0.4

0.2

-6 -4 -2 2 4 6

In[27]:= Plot [Sin [Abs [x]], {x, - 2 * Pi, 2 * Pi }]

1.0

0.5

Out[27]=
-6 -4 -2 2 4 6

-0.5

-1.0
2

In[29]:= Plot [{Sin [Cos [x]], Cos [Sin [x]]} , {x, - Pi, Pi }, PlotLegends → {"Curve1 ", "Curve2 "},
PlotStyle → {{Orange , Thick , Dashed }, {Green , Thick }}]

1.0

0.5

Curve1
Out[29]=

-3 -2 -1 1 2 3
Curve2

-0.5

In[32]:= ResourceFunction ["EnhancedPlot "][1 / (x - 1), {x, - 10, 10 },


"FindExceptions " → True , PlotStyle → {Red , Thick }]

1.0

0.5

Out[32]=
-10 -5 5 10

-0.5

-1.0

In[3]:= f[x_] := (x ^ 2 - 9) / (x - 3) Sin [2 x] + Tan [x] - 9


ResourceFunction ["EnhancedPlot "][f[x], {x, 0, 2 Pi }, "FindExceptions " → True ]

20

10

1 2 3 4 5 6

Out[4]= -10

-20

-30

-40
3

In[35]:= ResourceFunction ["Asymptotes "][(x ^ 2 + x + 1) / (x + 1), x, y]


Out[35]=  Vertical → {{y → ± ∞ , x → - 1}}, Oblique → {{y → x, x → ± ∞}}

In[45]:= Plot [{(x ^ 2 + x + 1) / (x + 1), x}, {x, - 4, 3}, PlotStyle → {Blue, {{Red, Dashed , Thick }}},
ExclusionsStyle → {{Red, Dashed , Thick }, {PointSize → 0.0 }}]

10

Out[45]= -4 -3 -2 -1 1 2 3

-5

-10

In[40]:= ResourceFunction ["Asymptotes "][(x ^ 3 + 1) ^ (1 / 3), x, y]


Out[40]=  Oblique → {{y → x, x → ∞}}

In[43]:= Plot [{(x ^ 3 + 1) ^ (1 / 3), x}, {x, - 5, 2} , PlotStyle → {Purple , {{Orange , Dashed , Thick }}}]

-5 -4 -3 -2 -1 1 2

-1
Out[43]=

-2

-3

-4

-5
4

In[46]:= Plot [x ^ 3, {x, - 5, 10 }, PlotStyle → {Red, Dashed , Thick }]

1000

800

600

Out[46]=
400

200

-4 -2 2 4 6 8 10

In[48]:= Plot [{x ^ 3, 3 * (x ^ 2), 6 x} , {x, - 10, 10 }, PlotStyle → {{Red, Dashed }, {Green , Thick }, Blue },
PlotLegends → {"Curve1 ", "Curve2 ", "Curve3 "}]

400

300

200

Curve1
100
Out[48]= Curve2
-10 -5 5 10 Curve3
-100

-200

-300

In[51]:= g[x_] := Sin [x / 2]


Plot [{g[x], g '[x], g '' [x]}, {x, - Pi, Pi },
PlotStyle → {Red, Blue, Green }, PlotLegends → {"g", "g'", "g''"}]

1.0

0.5

Out[52]= g'
-3 -2 -1 1 2 3
g''

-0.5

-1.0
5

In[54]:= Plot [{Sin [Floor [x]], Cos [Floor [x]]}, {x, - Pi, Pi } ,
PlotStyle → {{Red, Thick }, {Blue, Thick }}, PlotLegends → {"Function1 ", "Function2 "}]

1.0

0.5

Function1
Out[54]=
-3 -2 -1 1 2 3 Function2

-0.5

-1.0

In[57]:= Plot [{Log [Sin [x / 2]], Log [Cos [x / 2]]}, {x, - 2 * Pi, 2 * Pi } ,
PlotStyle → {{Purple , Thick }, {Orange , Thick }}]

-6 -4 -2 2 4 6

-0.5

-1.0

-1.5
Out[57]=

-2.0

-2.5

-3.0

In[60]:= f[x_] := x ^ (2 / 5) * (2 x + 5)
ResourceFunction ["EnhancedPlot "][f[x], {x, - 10, 10 },
"FindExceptions " → True , PlotLegends → "GraphA ", PlotStyle → {Blue, Thick }]

60

40

20
Out[61]= GraphA

-10 -5 5 10

-20

-40
6

In[5]:= f[x_] := (x ^ 3 + 1) / (x ^ 3 - 8)
ResourceFunction ["EnhancedPlot "][f[x], {x, - 10, 10 }, "FindExceptions " → True ]
2.5

2.0

1.5

1.0

Out[6]=
0.5

-10 -5 5 10

-0.5

-1.0

In[15]:= f[x_] := 4 + ((2 * x) / (x - 3))


ResourceFunction ["EnhancedPlot "][f[x], {x, - 10, 10 },
"FindExceptions " → True , PlotStyle → {Red, Thick }]

12

10

Out[16]= 6

-10 -5 5 10
7

In[17]:= f[x_] := x ^ 2 * Exp [- x]


ResourceFunction ["EnhancedPlot "][{f[x], f '[x], f '' [x]}, {x, - 10, 10 },
"FindExceptions " → True, PlotStyle → {{Red, Thick }, {Blue, Thick }, {Green , Thick }}]

70 000

60 000

50 000

40 000
Out[18]=

30 000

20 000

10 000

-10 -5 5 10

In[19]:= f[x_] := (Sin [x]) ^ (1 / Log [Sqrt [x]])


ResourceFunction ["EnhancedPlot "][{f[x], f '[x], f '' [x]},
{ x, - 10, 10 } , "FindExceptions " → True, PlotStyle → { Red, Blue, Green }]

2.0

1.5

Out[20]=
1.0

0.5

-10 -5 5 10
8

In[6]:= Plot [{Exp [- x], - Exp [- x]}, {x, - 5, 5},


PlotStyle → {{Red, Thick , Dashed }, {Blue, Thick , Dashed }},
PlotLegends → {"y= e^(- x)", "y=- e^(- x)"}]

15

10

5
y=e^(-x)
Out[6]=
-4 -2 2 4 y=-e^(-x)
-5

-10

-15

You might also like