Message Boards Message Boards

5 Replies
12 Total Likes
View groups...
Share this post:

Application of Squeeze Theorem

Posted 11 years ago
Hi - i'm having trouble understanding Mathematica point blank. I have the second edition manual but cannot find what page to reference completing this problem. What are the beginning steps I take to plug this into Mathematica? Am I writing the input wrong? I'm trying to understand how to put things in but I can't seem to figure it out. Any help or suggestions would be great - thank you.

Define the function f(x)=x sin (1/x) in mathematica

a) Plot the graphs of y=f(x) together with the graphs of y= |x| and y=-|x| on the same set of axes. This will visually show that f(x) is squeezed between the latter two functions near x=0. 

b) Analyzing the graph obtained in part (a) near x = 0 and realizing that f(x) is squeezed between the other two functions, your intuiton should tell you that lim f(x), x, 0 must be 0 since both lim |x|, x, 0 and lim -|x|, x, 0 are clearly zero. Verify your intuition by using Mathematica to compute lim f(x), x, 0

I think this is what the graph is supposed to look like - but how do I put this all in Mathematica? 

POSTED BY: Jessica Blanton
5 Replies
First try making a plot for reach of the three functions:
Plot[Abs[x], {x, -0.5, 0.5}, PlotStyle -> Red]
Plot[-Abs[x], {x, -0.5, 0.5}, PlotStyle -> Blue]
Plot[x Sin[1/x], {x, -0.5, 0.5}, PlotStyle -> Green]
You can put these all together in different ways. For example you can use Show. Additionally you can use Plot with multiple functions:
Plot[{Abs[x], -Abs[x], x Sin[1/x]}, {x, -0.5, 0.5}, PlotStyle -> {Red, Blue, Green}]
POSTED BY: Sean Clarke
Posted 11 years ago
I'm sorry - can you explain to me what the Abs function is used for in Mathematica? I was not putting it in the original input I had - perhaps that was the problem? Thank you so much.
POSTED BY: Jessica Blanton
There is also a very nice related Demonstration with very short code: Squeeze Theorem
  Plot[{x^n Sin[1/x], Abs[x^n], -Abs[x^n]}, {x, -10^-i, 10^-i},
   PlotStyle -> {Black, {Thick, Red}, {Thick, Blue}},
   MaxRecursion -> 8, ImagePadding -> {{10, 10}, {10, 50}},
   PlotLabel ->
     Row[{Style[-Abs[x^n], Blue], " \[LessEqual] ", x^n Sin[1/x],
       " \[LessEqual] ", Style[Abs[x^n], Red]}]],
   ImageSize -> {550, 400}],
{{n, 1}, {0, 1, 2, 3}},
{{i, 0, "zoom"}, 0, 3}]

POSTED BY: Vitaliy Kaurov
Posted 11 years ago
Abs is the absolute value function, that is |x|.
POSTED BY: Jari Kirma
Jessica --

You can get information about any function in Mathematica from the Documentation center, under the Help menu (at least on my Mac). Once there, you can type in Abs, and get a lot of information. (The same functionality is present on the wolfram website in the Suport menu on the main Wolfram page.

Basically, Abs gives the absolute value of real or complex z. It is left unevaluated if z is not numeric.

You should make the documentation center your friend. Since version 6, it has replaced the printed Mathematica book. You will find information about functions, tutorials and guides.

Also under the Help menu is an item for the virtual book. This is a direct, electronic replacement for the printed book. You should probably read through topics that interest you. The neat thing about this (and the documentation center in general) is that there are 'live' computations. You can alter the examples given in the text and see what happens. You can also cut and paste code into your own notebooks.

As an example, you could read about Manipulate[] in the documentation, and then use the code that Sean provided to zoom in on points close to {0,0} by making the plot limits into a dynamic variable manipulated with a slider.
Plot[{Abs[x], -Abs[x], x Sin[1/x]}, {x, -lim, lim},
  PlotStyle -> {Red, Blue, Green}], {{lim, .3}, 0.000000000001, .5}]

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract