MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University
description
Transcript of MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University
![Page 1: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/1.jpg)
MATHEMATICA – Computer Simulation
R.C. VermaPhysics DepartmentPunjabi UniversityPatiala – 147 002
PART IX- Computer Simulation
Mechanics
![Page 2: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/2.jpg)
•Traditionally physics teaching comprises of theory lectures based on analytical techniques and conventional laboratory experiments.
•Despite the importance of computational physics, it has been largely neglected in the conventional physics curricula.
•Now with the availability of personal computers, it has become possible to introduce this important branch in the physics curricula.
INTRODUCTION
![Page 3: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/3.jpg)
• PC offers new opportunities for innovative learning.
• It provides highly interactive, individual and creative learning.
• It can help to approach wide variety of problems and phenomena than is possible with only analytic tools.
• It can also be used to develop physical intuition and ability to estimate physical quantities involved in a phenomena.
• NMEICT (MHRD, Govt. of India)- Rs. 4,612 crores Mission
What PC can do?
![Page 4: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/4.jpg)
Questions
For practical purposes of PC into physics we need to answer:-
1. How to use PC to improve physics teaching?
2. What other changes will come after we introduce PC to the physics curricula?
3. Could advances of research into physics learning be incorporated into new Curricula?
4. Can the new curricula reflect contemporary physics?
![Page 5: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/5.jpg)
OBJECTIVES OF PHYSICS TEACHING
i) Number awareness
ii) Experimental skills
iii) Analytic skills
iv) Scales and estimations
v) Approximations skills
vi) Numerical skills
vii) Intuition & large problem skills
![Page 6: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/6.jpg)
Applications of Computer for Physics?
• Problem Solving
• Demonstrations and Tutorials (CAI)
• Data analysis using Spreadsheets
• Simulation of Physics Problems
• Graphics and Animation
• Magnification of Instruction
![Page 7: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/7.jpg)
Problem Solving:
• PC can be used easily and interactively through a variety of high-level languages,
• They offer numerical power sufficient for even initiating research-level problems.
• Many numerical programming languages are already with us:
BASIC, FORTRAN, and C
• Recently, Symbolic Computational languages: Mathematica, MatLab, MathCad, Macsyma
• capable of dealing with algebra, differential and integral calculus, and powerful graphics tools.
• This obviously enhances the scope of physics problems to be handled on a PC.
![Page 8: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/8.jpg)
Simulation of Physics Problems:
• The corner stone of computing is building a model of an idea through simulation.
• It can deliver real time sequence on the screen.• We can simulate real world phenomena that are
prevented from studying in the laboratory due to constraints of
time, expense, danger and feasibility. • E.g. Planetary Motion, Nuclear Reactor, Interior of Sun• We can try models that don't occur in real world to see
what the implication would be. • E.g. What would happen if we change the gravitational
force law a little?
![Page 9: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/9.jpg)
Present Status in Physics Curricula
• Computational physics has largely been neglected in the standard physics curricula.
• Main factors : 1. Lack of computing hardware 2. Lack of teaching-material besides 3. Lack of trained human resource.
• Situation is slowly improving.
![Page 10: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/10.jpg)
COMPUTER SIMULATION OF PROBLEMS
(Methodology)
Physics → Algorithm → Program → Results
• Computer Hardware and Software
• Numerical analysis
• Development of algorithms for problems
• Developments of programs for simulation
• Results and Error analysis.
![Page 11: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/11.jpg)
Steps to solving Physics Problem• Identify the input variables:-
like parameters of a physical systeminitial conditions of the`system and time interval step size of time evolution.
• Identify the output variables:- solution of the problem.
• Construct the equations to connect the input variables to the output variables.
• Re-express the equations using numerical techniques.
• Write algorithm/flowchart to solve the problem. • Develop Programs
(I/O, common arithmetic operations and logical structures: Sequential, Repetitive and
Selective). • Execute the program on a computer.
![Page 12: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/12.jpg)
Performing Computer Experiments
Run computer experiments to study effects of:• change of step size used in discretization of
continuous independent variable;• change of initial conditions of the physical
system;• change of physical parameters of the system.• changes due to errors, • stability and limitations of the numerical tools.
![Page 13: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/13.jpg)
One Dimensional Motion
• A spherical body falling in viscous medium
rvmgdt
dvm 6
![Page 14: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/14.jpg)
Clear"Global`" Find analytic solution ndsol DSolve v't g c vt , v0 u , vt, tSimplifyndsolg 9.8; acceleration due to gravity eta 1.0; Viscosity of medium rad 0.2; mass 1.0; radius & mass of ball c 6 eta rad Pi mass N Give initial condition, time interval tmin 0; tmax 2.0; u 1.0;
ndsol
Plot Evaluate vt . ndsol, t, tmin, tmax,AxesLabel "t", "v", PlotRange u, g c,PlotLabel "Drag effect"
![Page 15: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/15.jpg)
Out[18]= vt c t g c t g c u
c
Out[19]= vt c t 1 c t g c u
c
Out[21]= 3.76991
Out[23]= vt 0.265258 3.76991 t 13.5699 9.8 3.76991 t
![Page 16: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/16.jpg)
Out[24]=
0 .5 1 .0 1 .5 2 .0t
1 .0
0 .5
0 .5
1 .0
1 .5
2 .0
2 .5
v
D rag effect
![Page 17: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/17.jpg)
Damped Oscillator
• Equation of motion is
0202
2
xdt
dx
dt
xd
![Page 18: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/18.jpg)
Clear["Global`*"]
(* Find Analytic solution *)
k = 3.0; (* spring constant *)
m = 1.0; (* mass attached to the spring *)
w0 = Sqrt[k/m];
c = 0.5;
damp = c/m;
x0=1.0; v0 = 1.0; (* initial conditions *)
tmin = 0;tmax = 5;
ndsol=DSolve[ {x''[t]+damp*x'[t]+w0^2 x[t]==0,
x[0]==x0, x'[0]==v0}, x[t], t]//Chop//Flatten
1. Cos[1.71391 t] 0.729325 Sin[1.71391 t]{x[t] -> ----------------- + -----------------------} ---------------- ---------------------- 0.25 t 0.25 t E E
![Page 19: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/19.jpg)
(* Plot the solution for a given time interval *)
p1= Plot[ x[t]/.ndsol, {t,tmin, tmax}, AxesLabel->{"t->", "x"}, PlotLabel->"Harmonic Motion"]
1 2 3 4 5t->
Harmonic Motion
-0.75
-0.5
-0.25
0.25
0.5
0.75
1
x
![Page 20: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/20.jpg)
v[t_]= D[x[t]/.ndsol, t]p2 =Plot[ v[t], {t,tmin, tmax},
AxesLabel->{"t->", "v"}, PlotLabel->"velocity",PlotStyle-> Dashing[{0.02} ]]
1. Cos[1.71391 t] 1.89624 Sin[1.71391 t]----------------- - -------------------------------------- --------------------- 0.25 t 0.25 t E E
1 2 3 4 5t->
velocity
-1.5
-1
-0.5
0.5
1
v
![Page 21: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/21.jpg)
a[t_]= D[v[t], t]p3=Plot[ a[t], {t,tmin, tmax},
AxesLabel->{"t->", "a"}, PlotLabel->"acceleration",PlotStyle-> Dashing[{0.05} ]]
-3.5 Cos[1.71391 t] 1.23985 Sin[1.71391 t]------------------- - ---------------------------------------- --------------------- 0.25 t 0.25 t E E
1 2 3 4 5t->
acceleration
-3
-2
-1
1
2
a
![Page 22: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/22.jpg)
Show[p1, p2, p3]
1 2 3 4 5t->
Harmonic Motion
-3
-2
-1
1
2
x
![Page 23: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/23.jpg)
ParametricPlot[ {x[t]/.ndsol, v[t]} , {t,tmin, tmax}
, AxesLabel->{"x", "v"}, PlotLabel->"phase_space_trajectory"]
-0.75 -0.5 -0.25 0.25 0.5 0.75 1x
phase_space_trajectory
-1.5
-1
-0.5
0.5
1
v
![Page 24: MATHEMATICA – Computer Simulation R.C. Verma Physics Department Punjabi University](https://reader035.fdocuments.in/reader035/viewer/2022062304/56813815550346895d9fca24/html5/thumbnails/24.jpg)
Thank you!