Computational tools beyond handled calculators are now a necessary part of any physicists repertoire. A wide variety of tools are available including computer codes that are written to solve specific problems, mainstream software tools (such as spreadsheets and databases) which can be applied to physics problems and finally mathematical tools (such as Mathematica, Matlab, Maple, Mathcad, Sage et cetera). We will make use of tools of all of these types in this course. The purpose of this exercise is to introduce you to one of these mathematical tools, Mathematica. Mathematica distinguishes itself from many of its competitors with its abilities to do exact symbolic, as well as numerical, calculations. These abilities allow Mathematica to, for example, give the solution of
In this exercise, you will first work through a Mathematica tutorial to get an idea of Mathematica’s abilities. Then you will use Mathematica to work a more complicated physics problem.
Start up Mathematica (this tutorial can be run on any OS that Mathematica works on).
For this tutorial you will have two choice. You can you the old-fashioned text-based tutorial or a video screencast. It is up to you which one to try — you should get similar information from each.
If you want to use the text based tutorial, find and open up the “Ten Minute Tutorial” – there should be a link to it off of this lab (or the lab web site). Do not let the name fool you — it should take you much more than 10 minutes. Note that when you download Mathematica files you will often have to right click on them and “Save as ...”, then open them up with Mathematica.
If you want to use the screencast, go to the “Hands on Start to Mathematica”
http://www.wolfram.com/broadcast/screencasts/handsonstart/. If you do the screencast when other people are around, please make sure that you use headphones. I will not be responsible for any violence inflicted on you by other people if you blast this screencast in a public lab.
As you are working through the tutorial feel free to change things in the examples. Try out different numbers, functions, et cetera so that you have a better idea of how Mathematica works. Save a copy of the the tutorial in your home directory so that you can keep track of the changes you make while working through the tutorial.
Complete the following exercises based on the tutorial. For this exercise, you can either do things on paper and hand-in a paper copy, or upload your results to the course Canvas site. Where appropriate print out (or save to a separate Mathematica sheet) plots and segments of Mathematica code showing your answers. If you decide to upload the assignment, please upload the notebook (.nb) file and also a pdf copy of file. (Print the file to a pdf.)
The easiest way to answer the following questions is probably to have two Mathematica windows open. Keep the tutorial open in one window, and do your calculations in separate window. In your calculations window you can copy and paste all of the questions below. Then you complete each calculation under the corresponding question. When you are done you can just print the results from your window (or upload them to Canvas). Also, do not forget to include a written answer where one is requested.
The page numbers below refer to where you will find similar calculations in the text tutorial.
In order to get this equation in the form of the simple harmonic oscillator equation, we typically assume that the angle θ is small so that sinθ ≈ θ, which results in:
In this exercise you will explore how justified this approximation is. In some parts of this exercise you may have to force Mathematica to make more precise calculations. You may have to use the Accuracy, WorkingPrecision, AccuracyGoal, and PrecisionGoal statements to get useful results. For the purposes of this exercise we will set g/l = 1 to simplify the math. We will also assume that the pendulum always starts out at rest ((t = 0) = 0).
Next, solve this equation for initial amplitudes from 0 to π∕2 radians and then plot the pendulum frequency versus pendulum (angle) amplitude for your results. Also, on the same figure include a plot of what the angular frequency versus amplitude is assuming the pendulum is a simple harmonic oscillator. Take enough points so that you get a fairly smooth curve. You don’t have to use Mathematica to plot your results — any plotting program is fine.