# Why does the shape of my function change when plotted alongside another function?

I wanted to investigate the periodicity of functions so I tried to Plot them on Mathematica using the Plot function.

The particular function was $\cos(\cos(x))+\cos(\sin(x))$.

What I did was first plot them individually, then together. Individual results were as follows:

Plot[Cos[Cos[x]], {x, -4, 4}, Ticks -> {Table[x*Pi, {x, -2, 2, 1/2}],
{1.530, 1.535, 1.540}}, AspectRatio -> .1] Plot[Cos[Sin[x]], {x, -4, 4}, Ticks -> {Table[x*Pi, {x, -2, 2, 1/2}],
{1.530, 1.535, 1.540}}, AspectRatio -> .1] Plot[Cos[Cos[x]] + Cos[Sin[x]], {x, -4, 4}, Ticks -> {Table[x*Pi, {x, -2, 2, 1/2}],
{1.530, 1.535, 1.540}}, AspectRatio -> .1] Now all together:

Plot[{Cos[Cos[x]], Cos[Sin[x]], Cos[Cos[x]] + Cos[Sin[x]]}, {x, -Pi, Pi}, Ticks ->
{Table[x*Pi, {x, -1, 1, 1/2}]}, AspectRatio -> 1/2] See the yellow plot? That's supposed to be my original function but the individual function plot seems to be very different. Why is that so? Is it some system error or is it my fault?

• Please use the site's built-in image uploader. If you use external image hosting, the images will likely disappear with time (most services don't keep them indefinitely). May 12, 2012 at 13:36

All the plots are correct, but what may be catching you out is the windowing of the Y-axis and your tick specification. Adding PlotRange -> {{-4, 4}, {0, 2}} should help you see what is happening.

Plot[Cos[Cos[x]], {x, -4, 4}, Ticks -> {Table[x*Pi, {x, -2, 2, 1/2}]},
AspectRatio -> .1, PlotRange -> {{-4, 4}, {0, 2}}] Plot[Cos[Sin[x]], {x, -4, 4}, Ticks -> {Table[x*Pi, {x, -2, 2, 1/2}]},
AspectRatio -> .1, PlotRange -> {{-4, 4}, {0, 2}}] So for the combined plot you would get:

Plot[{Cos[Cos[x]], Cos[Sin[x]], Cos[Cos[x]] + Cos[Sin[x]]}, {x, -Pi,
Pi}, Ticks -> {Table[x*Pi, {x, -1, 1, 1/2}]}, AspectRatio -> 1/2,
PlotRange -> {{-4, 4}, {0, 2}}] • thanks for the answer but how come the ticks were affecting the range of the function ? May 12, 2012 at 8:48
• BTW how did you get such perfect screen shots? May 12, 2012 at 8:51
• @The-Ever-Kid In your first two plots the specifications for the Y ticks are such that they are not visible since they are at {1.530, 1.535, 1.540}, which are not in the displayed range of the plot. May 12, 2012 at 9:00
• and about the screenshots? May 12, 2012 at 9:03
• Is there a reason that you didn't upload the images to StackExchange instead of a third-party service? May 12, 2012 at 12:27