Sunday, November 26, 2017

Post-Thanksgiving Links

Some links to interesting scientific content:

1. How Wikipedia Tackles Fringe Nonsense (neurologica)

2. Seven Academic-World Lies (Mariana Cerdeira)

3. Numerically Approximating Ghosts (John D Cook)

4. An Archive of Projects Using Differential Equations (Zill)

Tuesday, November 14, 2017

History of PowerPoint

The history of MS Office is riveting.

This essay in IEEE Spectrum recounts the "Improbable Origins of PowerPoint". I did not know that Xerox PARC had such a direct influence of on MS Office (including MS Word).

Reading the essay, one gets a sense for how fluid the desktop computer landscape was between the advent of the Apple Lisa and Microsoft's bundling of Word, Excel, and PowerPoint.

Monday, November 13, 2017

Exporting Numpy Arrays and Matrices to LaTeX

Over the past couple of years, a lot of my "numerical experimentation" work has moved from Octave to python/numpy.

I incorporate a lot of this work into my classes and presentations (made using beamer), and having a script to translate vectors and matrices to LaTeX format is handy.

In the past, I shared a Matlab/Octave script which does this.

Here is a python/numpy script which does something similar. The script

  • autodetects integers and floats
  • allows you to control the number of decimals for floats
  • allows you optionally render floats in scientific format
  • right-justify using the bmatrix* environment (good for -ve numbers)
  • suppress small values near zero (~ 1e-16)

Monday, November 6, 2017

Python: Orthogonal Polynomials and Generalized Gauss Quadrature

A new (to me) python library for easily computing families of orthogonal polynomials.

Getting standard (generalized) Gauss quadrature schemes is extremely simple. For example to get 13 nodes and weights for Gauss-Laguerre integration, correct up to 50 decimal places:

pts,wts = orthopy.schemes.laguerre(13, decimal_places=50)

The numpy Polynomial package provides similar functionality:

pts, wts = numpy.polynomial.laguerre.laggauss(13)

A nice feature (besides arbitrary precision) is that you can derive custom orthogonal polynomials and quadrature rules. All you need to provide is a weight function and domain of the polynomials. From the project webpage:
import orthopy
moments = orthopy.compute_moments(lambda x: x**2, -1, +1, 20)
alpha, beta = orthopy.chebyshev(moments)
points, weights = orthopy.schemes.custom(alpha, beta, decimal_places=30)
This generates a 10-point scheme for integrating functions over the interval [-1, 1], with weight function \(w(x) = x^2\).