class_preso.weno_computations module

Helper functions for weno_computations notebook.

Slides can be seen on nbviewer.


Make plots similar to introductory, but with a discontinuity.


Plot a piecewise constant function w/discontinuity towards the left.

Parameters:stopping_point (int) – (Optional) The transition point to stop at when creating the plot. By passing in 0, 1, 2, … this allows us to create a short slide-show.

Return interpolated values for \(u_{j+1/2}\) using simple stencils.

First uses three sets of interpolating values,

\[\left\{\overline{u}_{j-2}, \overline{u}_{j-1}, \overline{u}_j\right\}, \left\{\overline{u}_{j-1}, \overline{u}_j, \overline{u}_{j+1}\right\}, \left\{\overline{u}_j, \overline{u}_{j+1}, \overline{u}_{j+2}\right\},\]

to give local order three approximations.

Then uses all five points \(\left\{x_{j-2}, x_{j-1}, x_j, x_{j+1}, x_{j+2}\right\}\) to give an order five approximation on the whole stencil.

Return type:tuple
Returns:Quadraple of LaTeX strings, one for each set of interpolating points, in the order described above.

Make introductory plots.


\[\overline{u}_{-2} = 0, \overline{u}_{-1} = 3, \overline{u}_{0} = 2, \overline{u}_{1} = -1, \overline{u}_{2} = 2\]

And plots the interpolations by quadratics (on the three contiguous subregions) and by a quartic that preserve the interval.


Make plots similar to introductory, but with a discontinuity.


Plot the reconstructed polynomials that occur near a shock.

class_preso.weno_computations.to_latex(value, replace_dict)[source]

Convert an expression to LaTeX.

This method is required so we can get a specified ordering for terms that may not have the desired lexicographic ordering.

  • value (sympy.core.expr.Expr) – A
  • replace_dict (dict) – Dictionary where keys are old variable names (as strings) and values are the new variable names to replace them with.
Return type:



The value as LaTeX, with all variables replaced.