Lecture Notes Week 1a
Lecture Notes Week 1a
Thinking
Visual Thinking
1. learn various ways of visually representing data, information or functions
2. apply skills of visual thinking to represent and solve a few maths and physics problems
3. apply skills of visual thinking to interpret results from graphs
2 Module-1 Visual Thinking - revamped.nb
Plotting a graph
! Lets start out by learning how to plot a simple function, such as a linear function.
-4 -2 2 4
Out[! ]= -5
-10
-15
! Plot a polynomial
-4 -2 2 4
-50
Out[! ]= -100
-150
-200
120
100
80
2 x2 + x - 4
Out[! ]= 60
5 x2 + x - 4
40
20
-4 -2 2 4
4 Module-1 Visual Thinking - revamped.nb
60
40
Out[! ]=
20
-4 -2 2 4
25
20
15
Out[! ]=
10
-4 -2 2 4
Module-1 Visual Thinking - revamped.nb 5
a x2 + b x + c = 0
In[! ]:= ManipulatePlota x2 + b x + c, {x, - 5, 5}, PlotRange → {{- 5, 5}, {- 10, 10}},
Frame → True, {{a, 1}, - 5, 5}, {{b, 0}, - 5, 5}, {{c, 0}, - 5, 5}
6 Module-1 Visual Thinking - revamped.nb
f1(x) = - cos(x)
sin(x)
f2(x) = -
x
-1 1
f3(x) = + 2 for x > 0
x x
Exercise: Plot these functions and identify if these functions have quadratic behaviour at their minima and
maxima?
Module-1 Visual Thinking - revamped.nb 7
Solution 3: We can also solve this analytically. Let’s say that exactly one solution happens for n = n0 and
(say) at x = x0 . Then, for n = n0 and x = x0 we have both the functions evaluate to the same value and their
derivatives also evaluate to the same value, thus
x01/n0 = log(x0)
ⅆ x1/n0 ⅆ log(x)
and, =
ⅆx x=x0 ⅆx x=x0
last equation simplifies to
1/n
1 x0
0
1
n0 x0
= x0
⇒ x01/n0 = n0 ⇒ log(x0) = n0 log(n0)
Substituting in the first equation we get
n0 = n0 log(n0) ⇒ log(n0) = 1 ⇒ n0 = ⅇ
Solving for x0 we get
Exercises
1. Explore numerical function N[ x ].
(a) N calculates numerical value of any expression. Lets find out Pi and E (the Euler number e) to 10 digits
by evaluating the following commands.
N[Pi]
N[Pi, 10]
N[E, 10]
(b) Find Pi to 100 digits.
(c) Find 21/2 and 21/3 up to 16 digits.
2. Can you reproduce the plot below by figuring out the suitable Mathematica code (one line only). Repro-
duce also the plot styling that is x-range, y-range, labeling, colors, line stroke, frame etc. You may need to
look up documentation of the Plot function to be able to do this. Its a good idea to start navigating into
documentation and also learn how to make your figures look nicer. See if you can figure out a few styling
techniques on your own to make the figure look even better that what is presented here.
2
exp(-x)
f (x)
0
log(x)
cos(2 x)
-1
-2
0 1 2 3 4 5
x