Activity: Approximating Functions with Power Series

Static Fields 2022 (8 years)
Students use prepared Sage code or a prepared Mathematica notebook to plot \(\sin\theta\) simultaneously with several terms of a power series expansion to judge how well the approximation fits. Students can alter the worksheet to change the number of terms in the expansion and even to change the function that is being considered. Students should have already calculated the coefficients for the power series expansion in a previous activity, Calculating Coefficients for a Power Series.
What students learn
  • Visualizing the fit of a power series approximation to a given function;
  • Visualizing how the fit of a power series improves as more terms are added;
  • What it means to expand a power series around a point other than \(z=0\).
  • Media
    • activity_media/SeriesExpansions.nb
    • activity_media/SeriesExpansionsAlt.nb
    • activity_media/SeriesExpansions_LG.nb

Use the Sage code in the activity at this link or the attached Mathematica Notebook to plot the function \(\sin\theta\) and power series approximations to the function to explore how well the approximations work.

You will first need to calculate the coefficients of the power series. For the first part of the worksheet, calculate these coefficients for the power series around \(\theta=0\) and for the second part of the worksheet, calculate the coefficients around \(\theta=\frac{\pi}{6}\).

You will need to know a few things about Mathematica Notebooks:

  • To select a line of code, click anywhere on the line.
  • To evaluate the line of code, first select it and then hit SHIFT/ENTER.
  • Some of the lines of code are missing information (the values of the coefficients. Enter them BEFORE evaluating the line of code.)

Student Conversations

  • Students have to modify the worksheet in order to plot approximations better than 3rd order. Students who are uncomfortable with Mathematica may have a little trouble.
  • Students are asked to determine how many terms are needed in the approximation in order to fit the function \(\sin{\theta}\) between \(-\pi\) to \(\pi\). Students should be encouraged to explore other ranges.

Wrap-up

  • This activity leads into a nice discussion of idealizations and making approximations. The question of "How many terms do I need to keep in my approximation?" is related to the question of "What domain do I care about?" and "How much accuracy do I need?"
  • Most students at the middle division level are familiar with small-angle approximations from the example of simple harmonic motion of a pendulum. This activity illustrates nicely how small your angle must be in order for the approximation \(\sin{\theta}\approx \theta\) to make sense.
  • You can also discuss some nice sense-making activities. One such example is being able to tell if you've got the sign wrong for a particular term - if it makes the approximation worse (the approximation diverges from the original function faster than it did with fewer terms), then you may have made a sign error.
  • assignment Series Convergence

    assignment Homework

    Series Convergence

    Power Series Sequence (E&M)

    Static Fields 2022 (4 years)

    Recall that, if you take an infinite number of terms, the series for \(\sin z\) and the function itself \(f(z)=\sin z\) are equivalent representations of the same thing for all real numbers \(z\), (in fact, for all complex numbers \(z\)). This is not always true. More commonly, a series is only a valid, equivalent representation of a function for some more restricted values of \(z\). The technical name for this idea is convergence--the series only "converges" to the value of the function on some restricted domain, called the “interval” or “region of convergence.”

    Find the power series for the function \(f(z)=\frac{1}{1+z^2}\). Then, using the Mathematica worksheet from class (vfpowerapprox.nb) as a model, or some other computer algebra system like Sage or Maple, explore the convergence of this series. Where does your series for this new function converge? Can you tell anything about the region of convergence from the graphs of the various approximations? Print out a plot and write a brief description (a sentence or two) of the region of convergence. You may need to include a lot of terms to see the effect of the region of convergence. Keep adding terms until you see a really strong effect!

    Note: As a matter of professional ettiquette (or in some cases, as a legal copyright requirement), if you use or modify a computer program written by someone else, you should always acknowledge that fact briefly in whatever you write up. Say something like: “This calculation was based on a (name of software package) program titled (title) originally written by (author) copyright (copyright date).”

  • group Calculating Coefficients for a Power Series

    group Small Group Activity

    30 min.

    Calculating Coefficients for a Power Series
    Static Fields 2022 (5 years)

    Taylor series power series approximation

    Power Series Sequence (E&M)

    This activity starts with a brief lecture introduction to power series and a short derivation of the formula for calculating the coefficients of a power series for a particular function:

    \[c_n={1\over n!}\, f^{(n)}(z_0)\]

    After a brief lecture deriving the formula for the coefficients of a power series, students compute the power series coefficients for a \(\sin\theta\) (around both the origin and \(\frac{\pi}{6}\)). The meaning of these coefficients and the convergence behavior for each approximation is discussed in the whole-class wrap-up.

  • group Electrostatic Potential Due to a Ring of Charge

    group Small Group Activity

    30 min.

    Electrostatic Potential Due to a Ring of Charge
    Static Fields 2022 (6 years)

    electrostatic potential charge linear charge density taylor series power series scalar field superposition symmetry distance formula

    Power Series Sequence (E&M)

    Ring Cycle Sequence

    Students work in groups of three to use the superposition principle \[V(\vec{r}) =\frac{1}{4\pi\epsilon_0}\int\frac{\rho(\vec{r}^{\,\prime})}{\vert \vec{r}-\vec{r}^{\,\prime}\vert} \, d\tau^{\prime}\] to find an integral expression for the electrostatic potential, \(V(\vec{r})\), everywhere in space, due to a ring of charge.

    In an optional extension, students find a series expansion for \(V(\vec{r})\) either on the axis or in the plane of the ring, for either small or large values of the relevant geometric variable. Add an extra half hour or more to the time estimate for the optional extension.

  • computer Effective Potentials

    computer Mathematica Activity

    30 min.

    Effective Potentials
    Central Forces 2022 (2 years) Students use a pre-written Mathematica notebook or a Geogebra applet to explore how the shape of the effective potential function changes as the various parameters (angular momentum, force constant, reduced mass) are varied.
  • keyboard Electrostatic potential of four point charges

    keyboard Computational Activity

    120 min.

    Electrostatic potential of four point charges
    Computational Physics Lab II 2022 (2 years)

    electrostatic potential python

    Students write python programs to compute and visualize the potential due to four point charges. For students with minimal programming ability and no python experience, this activity can be a good introduction to writing code in python using numpy and matplotlib.
  • group Electrostatic Potential Due to a Pair of Charges (with Series)

    group Small Group Activity

    60 min.

    Electrostatic Potential Due to a Pair of Charges (with Series)
    Static Fields 2022 (4 years)

    electrostatic potential multipole charge symmetry scalar field superposition coulomb's Law

    Power Series Sequence (E&M)

    Ring Cycle Sequence

    Students work in small groups to use the superposition principle \[V(\vec{r}) = \frac{1}{4\pi\epsilon_0}\sum_i \frac{q_i}{\vert\vec{r}-\vec{r}_i\vert}\] to find the electrostatic potential \(V\) everywhere in space due to a pair of charges (either identical charges or a dipole). Different groups are assigned different arrangements of charges and different regions of space to consider: either on the axis of the charges or in the plane equidistant from the two charges, for either small or large values of the relevant geometric variable. Each group is asked to find a power series expansion for the electrostatic potential, valid in their group's assigned region of space. The whole class wrap-up discussion then compares and contrasts the results and discuss the symmetries of the two cases.
  • group Equipotential Surfaces

    group Small Group Activity

    120 min.

    Equipotential Surfaces

    E&M Quadrupole Scalar Fields

    Students are prompted to consider the scalar superposition of the electric potential due to multiple point charges. First a single point charge is discussed, then four positive charges, then an electric quadrupole. Students draw the equipotential curves in the plane of the charges, while also considering the 3D nature of equipotentials.
  • format_list_numbered Quantum Ring Sequence

    format_list_numbered Sequence

    Quantum Ring Sequence
    Students calculate probabilities and expectation values for a quantum mechanical particle confined to a circular ring in bra/ket, matrix, and wave function representations and compare the different calculation methods. Several different graphical representations of the time dependence for both states with special symmetry and arbitrary states are explored in a Mathematica notebook. Compared to the analogous particle-in-a-box, this quantum system has a new feature---degenerate energy eigenstates.
  • assignment Ring Function

    assignment Homework

    Ring Function
    Central Forces 2022 (2 years) Consider the normalized wavefunction \(\Phi\left(\phi\right)\) for a quantum mechanical particle of mass \(\mu\) constrained to move on a circle of radius \(r_0\), given by: \begin{equation} \Phi\left(\phi\right)= \frac{N}{2+\cos(3\phi)} \end{equation} where \(N\) is the normalization constant.
    1. Find \(N\).

    2. Plot this wave function.
    3. Plot the probability density.
    4. Find the probability that if you measured \(L_z\) you would get \(3\hbar\).
    5. What is the expectation value of \(L_z\) in this state?
  • group Electric Field Due to a Ring of Charge

    group Small Group Activity

    30 min.

    Electric Field Due to a Ring of Charge
    Static Fields 2022 (6 years)

    coulomb's law electric field charge ring symmetry integral power series superposition

    Power Series Sequence (E&M)

    Ring Cycle Sequence

    Students work in groups of three to use Coulomb's Law \[\vec{E}(\vec{r}) =\frac{1}{4\pi\epsilon_0}\int\frac{\rho(\vec{r}^{\,\prime})\left(\vec{r}-\vec{r}^{\,\prime}\right)}{\vert \vec{r}-\vec{r}^{\,\prime}\vert^3} \, d\tau^{\prime}\] to find an integral expression for the electric field, \(\vec{E}(\vec{r})\), everywhere in space, due to a ring of charge.

    In an optional extension, students find a series expansion for \(\vec{E}(\vec{r})\) either on the axis or in the plane of the ring, for either small or large values of the relevant geometric variable. Add an extra half hour or more to the time estimate for the optional extension.


Author Information
Corinne Manogue
Learning Outcomes