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

Lecture Notes Week 1a

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lecture Notes Week 1a

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Physics through Computational

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

What is Visual Thinking


! Visual thinking is ability to represent and interpret data or any other information through a visual
medium such as a data chart, a graph, a picture, mind maps or relationship maps, flow charts etc.
! Visual thinking is a way to organize your thoughts and your ability to think and communicate. An image
or a graphic is thousand words.
! In this course we will learn a lot of visual thinking through computer and also some off the computer as
we go along.
Module-1 Visual Thinking - revamped.nb 3

Plotting a graph
! Lets start out by learning how to plot a simple function, such as a linear function.

In[! ]:= Plot[2 x - 5, {x, - 5, 5}, PlotStyle → Thick]


5

-4 -2 2 4

Out[! ]= -5

-10

-15

! Plot a polynomial

In[! ]:= Plot[x^(3) - 4 x^2 + 1, {x, -5, 5}]

-4 -2 2 4

-50

Out[! ]= -100

-150

-200

! Plot a quadratic function

In[! ]:= Plot2 x2 + x - 4, 5 x2 + x - 4, {x, - 5, 5}, PlotLegends → "Expressions"

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

In[! ]:= Plot2 x2 - 4 x + 1, 2 x2 - x + 1, 2 x2 + 4 x - 5, {x, - 5, 5}

60

40

Out[! ]=

20

-4 -2 2 4

! Plot the most simple quadratic function

In[! ]:= Plotx2 , {x, - 5, 5}

25

20

15

Out[! ]=

10

-4 -2 2 4
Module-1 Visual Thinking - revamped.nb 5

Understanding Quadratic Function


! Lets vary the parameters of a general quadratic function using Manipulate construct and see what is
the effect of each parameter on the function.

a x2 + b x + c = 0
In[! ]:= ManipulatePlota 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

Quadratic function & Quadratic-like behaviour


! Quadratic functions are of great importance in physics as quadratic potentials are associated with
simple harmonic oscillator which has a simple sinusoidal oscillatory motion.
! Thus it is often of great importance to identify regions or domains where other functions behave like a
harmonic oscillator potential or quadratic potential.
! Lets consider the following functions

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

Function behaviour near x = 0


Exercise: Can you plot x , x, x 2 , x 3 , x 4 etc. for x > 0 on the same plot/graph on paper. Keep in mind how
they differ near x = 0.
8 Module-1 Visual Thinking - revamped.nb

Radicals and Logarithms


Exercise 1: Plot x, x and log( x ). Do they intersect at any point? Plot them and find out how they behave
at small x and large x?
Exercise 2: Plot x 1/3 and log( x ). Do they intersect at any point?
Exercise 3: Visually find the solution of the transcendental equation x 1/n = log( x ). For what values of n
there are solutions to this equation. When do you have exactly one solution?
3
Plot x , Log[x], {x, 0, 10}, Frame → True, PlotLegends → "Expressions"

ManipulatePlotx1/n , Log[x], {x, 0, 100},


Frame → True, PlotLegends → x1/"n" , Log[x], {{n, 2}, 1, 5}

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

log (x0) = n0 log (n0) ⇒ log(x0) = ⅇ ⇒ x0 = ⅇⅇ


Numerically

In[! ]:= N[E]


Out[! ]= 2.71828

In[! ]:= N[E ^ E]


Out[! ]= 15.1543
Module-1 Visual Thinking - revamped.nb 9

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

You might also like