Physics Education
PAPER
Using SMath Studio in physics teaching
To cite this article: Keith Atkin 2019 Phys. Educ. 54 025012
View the article online for updates and enhancements.
This content was downloaded from IP address 148.212.19.20 on 04/04/2019 at 06:01
Paper
Phys. Educ. 54 (2019) 025012 (10pp) iopscience.org/ped
Using SMath Studio in physics
teaching
Keith Atkin
E-mail:
[email protected]Abstract
This paper shows how a freely downloadable and powerful software package,
SMath Studio, can be used to model physical systems in physics teaching. The
software can form the basis of lecture demonstrations by teachers or can be
used individually by students working in an educational environment or on
their own home computers.
Introduction notebook program similar to Mathcad but has the
Over the years we have seen the advent of very important educational advantage that it is totally
powerful and sophisticated software packages such free. Like Mathcad, it is used in ‘live’ worksheet
as Mathematica [1] and Mathcad [2], which have fashion to solve all manner of mathematical prob-
provided a natural way of setting up physical and lems, permitting solutions to be displayed as
mathematical problems without having to devote tables or graphs in two or three dimensions.
large amounts of time to tedious coding which Although lacking some of the more sophis-
often, in an educational context, detract from the ticated features of Mathcad, or Mathematica,
physics of the original problem to be solved. SMath Studio is nevertheless capable of produc-
Some physics educators [3–5] have demon- ing results which are more than adequate for the
strated how physical models can be set up and illustration of physics problem solving.
solved by means of a spreadsheet (e.g. Microsoft Figure 1 shows the main window which
Excel). appears when Smath Studio is first opened. At
My preferred system is Mathcad which is the top are menus and a toolbar with a number
extremely powerful and intuitively easy to use. of palettes on the right-hand side. Equations and
Parameters and equations are entered into an on- numbers can be directly typed into the page and
screen ‘live’ worksheet with results appearing text regions can be created to clarify the problem
in tabular or graphical form in a wide variety of being worked on.
styles. Unfortunately, Mathcad is an expensive Help files are available and it is easy to
product and will typically remain out of financial download material such as the SMath Suite
reach for many educational establishments. The primer [7] and Introduction to programming with
same cost limitation applies to Mathematica. SMath Studio [8]. Another very useful primer is
On the other hand, SMath Studio1 [6], created by Liengme [9].
by Andrey Ivashov in 2005, is a mathematical
1
N.B. If X–Y plot does not initially appear in the Insert menu, An example of SMath in action
select Tools → Plugins → Local storage → Online gallery,
then scroll down to locate ‘X–Y plot region’, and install. To To illustrate the power of SMath, consider the
avoid all such minor problems, one can obtain a Windows problem of calculating the distribution of light
portable version of SMath. Go to: http://smath.info/wiki/ intensity in the famous double-slit experiment.
SMath%20with%20Plugins.ashx Just download the 78 MB
zip file and expand. You can then run SMath on any computer Figure 2 shows a possible SMath worksheet to
without having to do an installation. solve this.
1361-6552/19/025012+10$33.00 1 © 2019 IOP Publishing Ltd
K Atkin
Figure 1. The SMath desktop.
Notice that quantities are entered using the All that remains is to insert a graph area.
definition operator (:=). This is obtained using This is best done using ‘Insert X–Y plot’ from the
shift plus colon on the keyboard. Text can be menu at the top of the screen. This is preferable to
entered using double quotes (“) on the keyboard. ‘Insert Plot, 2D’ as the latter does not permit axes
The wavelength of light is here represented by labelling and other formatting.
λ which is found in the symbols palette on the The functions are entered at the bottom left
right of the worksheet. The other parameters, N, of the X–Y plot by using the last entry in the
L, a, and d have also been given values. In this Functions palette on the right. Left-clicking on
example, it was convenient to express distances in the graph area brings up a window in which a
millimetres. The quantity p (reciprocal of slit-to- wide range of formatting is available, including
screen distance) made the equations a little neater. axis limits, intervals (‘Xtick’ and ‘Ytick’), axes
As can be seen, the relevant physical equa- labelling, titles, grid colour, type of trace etc.
tions which describe both diffraction and inter- It is best to experiment with these features to
ference effects have been directly typed into gain confidence and obtain a ‘feel’ for how these
the worksheet. The ‘eval’ function is peculiar to different options work.
SMath and simply serves to speed up the evalu-
ation of the various functions. A simple diagram
showing a laser, slits, and screen has also been Solving differential equations using
pasted into the worksheet. SMath
In this example, there is no programming to SMath does provide some built-in functions such
do, as the expressions for the diffraction enve- as Rkadapt which use the well-known Runge–
lope, A(x), and normalised light intensity, I(x), Kutta method for solving ordinary differential
are evaluated directly as functions of distance x equations. It is felt, however, that in introduc-
across the screen. tory physics courses, it is better to use simple
March 2019 2 Phys. Educ. 54 (2019) 025012
Using SMath Studio in physics teaching
x
θ W
N - Slit diffraction pattern
1.4
1.2
1
Normalised intensity
0.8
0.6
0.4
0.2
–0.2
−50 −40 −30 −20 −10 0 10 20 30 40 50
Distance x across screen /mm
Figure 2. Double-slit fringes.
March 2019 3 Phys. Educ. 54 (2019) 025012
K Atkin
Constant acceleration
50
40
30
s/m
20
10
0 2 4 6
t/s
Figure 3. Constant acceleration (crude method).
March 2019 4 Phys. Educ. 54 (2019) 025012
Using SMath Studio in physics teaching
step-wise methods which illustrate the basic pro-
cesses of numerical integration. S
Example 1: motion with constant
acceleration
Consider a body starting from rest with a con- S4
stant acceleration. We wish to find the distance v3
S3
travelled as a function of time. The analytical S2 v2
solution is, of course, well known. The motion is S1 v1
described by the equations: ∆t ∆t ∆t ∆t ∆t ∆t
2 2 2 2 2 2
dv ds
=a and =v t1 t2 t3 t4 t
dt dt
∆t ∆t ∆t
where v is speed, t is time, s is distance travelled
and a is the constant acceleration. These equa-
tions may be replaced by the approximations Figure 4. The Feynman half-step method.
∆v ∆s Programming palette on the right. The ‘augment’
≈a and ≈ v.
∆t ∆t function combines the computed values of t and
Consequently, s into a plotting matrix M. The X–Y plot function
does not automatically draw graph axes but these
∆v ≈ a · ∆t and ∆s ≈ v · ∆t. can easily be generated using two small matrices
It should then be clear that we can update succes- abs and ord. In our example, a line is drawn from
sive values of s, v, and t using a simple iterative (0,0) to (6,0) to generate the horizontal axis and a
process controlled by a loop variable i. line from (0,0) to (0,50) provides the vertical axis.
For comparison purposes, the analytical solution
si+1 ≈ si + vi ∆t
(s = 21 at2 ) is included but the symbols are put
vi+1 ≈ vi + a · ∆t into upper case so as not to be confused with those
used in the numerical method. All four quantities
ti+1 ≈ ti + ∆t. to be plotted are inserted at the foot of the X–Y
plotting area.
These expressions can be entered into a simple The points (crosses) generated by this crude
loop on the SMath page along with intial values algorithm depart visibly from the theoretical
of s, v, and t. curve (in green) and we would clearly like to have
It is convenient to store values of these quanti much better agreement between the two.
ties in a column vector, a process which is com-
mon to both Mathcad and SMath. In SMath, each
vector element is identified by an index i whose The Feynman half-step method
initial value is unity (see Mathcad in which the In the well known Feynman Lectures on Physics
index starts at zero). Figure 3 shows a crude SMath [10] we find a technique which improves on our
method for implementing the above process. The original crude method by using the speed half-
number of steps, n, has been deliberately kept low way between each successive point in time. The
(just 6) to illustrate the principle as clearly as pos- situation is illustrated in figure 4.
sible. The subscripts are typed in using ‘[’ (left- Here we have distance S as some function of
hand square bracket on the keyboard). Constants time t. S1 is the initial position of the body at time
and initial values appear in red (using the text-col- t1, and S2, S3… are subsequent positions at times
our menu at the top of the work sheet). The ‘for’ t2, t3 …. etc. The time interval is Δt. The speeds
loop (highlighted in yellow (using the background- v1, v2 …. are the average speeds during each time
colour menu at the page top)) is created using the interval.
March 2019 5 Phys. Educ. 54 (2019) 025012
K Atkin
Constant acceleration
50
40
30
s/m
20
10
0 2 4 6
t/s
Figure 5. Constant acceleration (half-step method).
March 2019 6 Phys. Educ. 54 (2019) 025012
Using SMath Studio in physics teaching
x Rigid support
Spring
O Block
Vane
Damped oscillations
0.5
x/m
–0.5
–1
0 2.5 5 7.5 10 12.5 15
t/s
Figure 6. The damped oscillator.
March 2019 7 Phys. Educ. 54 (2019) 025012
K Atkin
Applying this to our problem for constant
Y
acceleration, the value of v1 will be given by
∆t Fx
v1 = a · y m
2
the subsequent speeds v2, v3 …. lying half-way r Fy
F
between the times t2, t3. Figure 5 shows the effect
of this improvement with the computed points θ
M x X
now lying on the theoretical curve.
Of course we can achieve greater accuracy
by reducing the size of the time increment, and Figure 7. Orbital motion.
we shall do this in future. As Feynman [10] says: So, F = − GMm with components
r2
‘…the error varies about as the square Fx = Fcosθ and Fy = Fsinθ from which
of the interval. If we make the interval dvx GMm x
a thousand times smaller, it is a million Fx = m =− 2 ,
dt r r
times more accurate’.
where vx is the x-component of velocity. A similar
There is always a trade off however: smaller expression can be written for the y-component.
time steps imply a longer time for the calculation Thus we obtain the equations of motion:
to be completed.
dvx GMx
=− 3
dt r
Example 2: the damped oscillator
dvy GMy
For a damped oscillator with damping propor- =− 3
tional to velocity, we have dt r
with r = x2 + y2 .
dv Again, these expressions can be used to pro-
m = −kx − cv,
dt duce a step-wise solution in SMath and figure 8
where m is the mass, k is the spring constant illustrates such an implementation. It would be
and c is the damping factor. A SMath worksheet possible to assume SI units without explicitly
for this is shown in figure 6. It is interesting for including them in the calculation. However, I
students to change the values of the parameters have used a set of non-conventional units which
and observe the effect on the resulting curve. are not SI but which have a simple relation to the
Laboratory investigations can also be compared international system. These units are coherent and
with the computed results. their use here has the advantage that the numbers
generated are relatively small—no large powers
of ten needed. Distances on this solar-system
Example 3: orbit in a gravitational field scale are in gigametres (Gm), time in megasec-
So far, I have shown how SMath can be used to onds (Ms) and mass in besagrams (Bg).We can
solve well-known problems which yield positions refer to this system as SS (Solar System) units.
as a function of time, but it is also possible to The prefix besa—which is unofficial—stands
address situations where we need to calculate the for 1033; using this we can express the solar mass
path of a body through space, i.e. the computation as 2.0 Bg. The Earth’s orbital radius is 150 Gm and
of trajectories. orbital speed about 30 Gm Ms−1 (=30 km s−1).
For our final example from mechanics, I have In this system, the gravitational constant is the
chosen the problem of a body moving in a radial only sizeable value: G = 66 700 SS units.
gravitational field, in this case the Earth orbiting A proposal for other SI subsystems is to be
the Sun. found in an earlier paper [11].
In figure 7, M is the mass of the Sun, m is the Notice in figure 8 that the ordering of the
mass of the Earth, and F is the centripetal force equations in the for-loop is important. The val-
provided by gravitation at distance r. ues of x and y are first updated, the new radial
March 2019 8 Phys. Educ. 54 (2019) 025012
Using SMath Studio in physics teaching
Earth orbit about Sun
200
160
120
80
40
y / Gm
–40
–80
–120
–160
–200
–200 –160 –120 –80 –40 0 40 80 120 160 200
x / Gm
Figure 8. Earth orbit about the Sun.
March 2019 9 Phys. Educ. 54 (2019) 025012
K Atkin
distance is then found, followed by updating of References
the velocity components. [1] Mathematica (https://en.wikipedia.org/wiki/
Students and teachers can experiment with Wolfram_Mathematica)
these models and, in particular, study the effect [2] Mathcad (www.ptc.com/
engineering-math-software/mathcad)
of changing parameters such as the time step to [3] Singh I, Khun Khun K and Kaur B 2018
see what effect this has on the accuracy of the Simulating Fraunhoffer diffraction of
solution. waves using Microsoft excel spreadsheet
Phys. Educ. 53 055010
[4] Quale A On the use of a standard spreadsheet to
Conclusion model physical systems in school teaching
Phys. Educ. 47 355–65
I have tried to show how SMath can be a use- [5] Liengme B V 2014 Modelling Physics with
ful tool in the hands of both student and teacher Microsoft Excel (Williston, VT: Morgan &
and hope that interested readers will experiment Claypool)
with this free and powerful application. The [6] SMath Studio (http://en.smath.info/)
authors and co-authors of the system are con- [7] SMath Suite Primer (http://smath.info/wiki/
GetFile.aspx?File=Tutorials/SmathPrimer.
stantly producing improvements and responding pdf)
to users’ suggestions. Many features have not [8] Introdution to programming (http://smath.info/
been described in this paper as I have tried to keep wiki/(S(5vo3g345pltqcn45akvhzb45))/
things as simple as possible. For example, SMath GetFile.aspx?File=Tutorials/
provides for the inclusion of units (even non-SI IntroductionToProgrammingSMathStudio.
pdf)
ones!) but having assumed SI for the most part, I [9] Liengme B V 2016 SMath for Physics (Bristol:
have not illustrated this facility. IOP Publishing)
Comments and suggestions are welcome, and [10] Feynman R 2011 Feynman Lectures on Physics
I look forward to learning about the experiences vol 1 (sections 9-5 to 9-9) (New York: Basic
of others using this software in physics education. Books)
[11] Atkin J K 2006 SI subsystems and their uses
Phys. Educ. 41 560
Acknowledgments
I am indebted to Andrey Ivashov (the creator of Keith Atkin graduated in physics in
SMath). 1964, and in 1975 obtained an MSc
I should also like to thank Simon Gray, for research into the application of
computers in physics teaching. He
Dr Tim Searle, and Dr John Williams for their was a founder member of Star Centre
expert, critical and constructive comments. at Sheffield Hallam University, UK
and an Associate Lecturer in physics
at Hallam and afterwards at the University of Sheffield. He
Received 25 October 2018, in final form 14 November 2018 is the author of Computer Science (M&E Handbooks, 1980)
Accepted for publication 6 December 2018 and Solving Problems in Physics (blurb.com 2012). He
https://doi.org/10.1088/1361-6552/aaf6d9 retains an active interest in all aspects of physics education.
March 2019 10 Phys. Educ. 54 (2019) 025012