Example Script for Newton's Interpolating Polynomial (kerr.newtonpoly)


In [1]:
# Import useful things
%matplotlib inline
from numpy import array,linspace,sin
from kerr import newtonpoly

from bokeh.io import push_notebook, show, output_notebook
from bokeh.plotting import figure
output_notebook()

# from matplotlib.pyplot import *


kerr## Found formula module "ksm2_cw"
kerr## Found formula module "ksm2_sc"
kerr## Found formula module "mmrdns_amplitudes"
kerr## Found formula module "mmrdns_Mfjf"
Loading BokehJS ...

In [2]:
# Generate some data over which to interpolate
x = linspace(0,10,20)
y = 10*sin(2*x)

In [3]:
# Use teh raw data points to create a function object for the polynomial
P = newtonpoly(x,y)

In [4]:
# Define a domain over which to interpolate
xx = linspace(0,max(x),200)

In [5]:
# Plot the raw data and the interpolant 

p = figure()
p.line( xx, P(xx) )
p.line( x,y,'or' )

show(p)


Out[5]:

<Bokeh Notebook handle for In[5]>


In [6]:
?show

In [ ]: