www.omatrix.com





:: O-Matrix ::
> Overview
> Examples
> Performance
> Analysis Functions
> Data Visualization
> The O-Matrix Language
> Data Manipulation/IO
> Application Development
> Using Matlab m-files




PADE.OMS

Script File:
# Description:
# Compares different order Pade approximations for exp(x).
#
# Order Pade approximation for exp(x)
# 2 (1. + x / 2) / (1. - x / 2)
# 4 (1. + x / 2 + x^2 / 12) / (1. - x / 2 + x^2 / 12)
# 6 (1. + x / 2 + x^2 / 10 + x^3 / 120 ) / (1. - x / 2 + x^2 / 10 - x^3 / 120)
#
clear
# define plotting limits
gyaxis("linear", - .02, + .02, 4, 5)
gxaxis("linear", - 4., + 2., 6, 5)
# plot title
gtitle("Approximation Error")
#
# a grid from - 4 to + 2
x = 6 * seq(50) / 51. - 4.
e2 = exp(x) - (1. + x / 2) / ...
	(1. - x / 2)
e4 = exp(x) - (1. + x / 2 + x^2 / 12) / ...
	(1. - x / 2 + x^2 / 12)
e6 = exp(x) - (1. + x / 2 + x^2 / 10 + x^3 / 120 ) / ...
	(1. - x / 2 + x^2 / 10 - x^3 / 120)
gplot(x, [e2, e4, e6])
#
gaddtext("order 2", gcoord( - 0.5, .015))
gaddtext("order 4", gcoord( - 2.5, - .01))
gaddtext("order 6", gcoord( - 2.0, .002))
	  

Output:


Company |  Products |  Showcase |  Support |  Ordering
Copyright© 1994-2009 Harmonic Software Inc. - All rights reserved.