You are on page 1of 2

Pade 4th order scheme

March 8, 2016
In [ ]: # -*- coding: utf-8 -*"""
script for plot 2.1
Created on Tue Mar 8 00:53:52 2016
plot kh-kh plot for pade scheme
@author: somdeb
"""
import matplotlib.pyplot as plt
import numpy as np
a=2*np.pi
x = np.linspace(0,2*np.pi,1000)
y = ((3.0*np.sin(x))/(2.0+np.cos(x)))
y1= x
plt.figure()
plt.plot(x, y, b,label=4th order pade)
plt.plot(x,y1,r,linestyle=--,label=spectral(ideal))
plt.legend( loc=upper left, numpoints = 1 )
plt.xlabel(kh)
plt.ylabel("kh")
plt.xlim(0,np.pi)
plt.ylim(0,np.pi)
plt.grid(True,which=both)
plt.title("Fig 2.1: kh-kh plot for 4th order pade scheme",fontsize=10, fontweight=bold )
plt.show()
In [2]: """
script for plot 2.1.a
Created on Tue Mar 8 00:53:52 2016
(k/k)h plot for pade scheme
@author: somdeb
"""
import matplotlib.pyplot as plt
import numpy as np
at kh=0, the limiting values become 1
np.seterr(divide=ignore, invalid=ignore)
x = np.linspace(0,np.pi,1000)
y = (3.0*np.sin(x))/(x*(2.0+np.cos(x)))
y1=1.0+0*x
plt.figure()
plt.plot(x, y, b,label=4th order pade)
plt.plot(x,y1,r,linestyle=--,label=spectral(ideal))
plt.legend( loc=upper left, numpoints = 1 )
plt.xlabel("kh")
plt.ylabel("(k/k)")
1

plt.xlim(0,np.pi)
plt.ylim(0,1.5)
plt.grid(True,which=both)
plt.title("Fig 2.2: (k/k) vs kh plot for 4th order pade scheme",fontsize=10, fontweight=bold
plt.show()

You might also like