|
From: Shigeharu T. <sh...@ie...> - 2009-02-23 00:44:32
|
shige 02/23 2009
----------------
The demo script demo/approximate.dem is the sample for the
'filledcurve' and the pseudofile '+'. This treats the Taylor
approximation of sin(x) and it defines them explicitly as
approx_1(x) = x - x**3/6
approx_2(x) = x - x**3/6 + x**5/120
approx_3(x) = x - x**3/6 + x**5/120 - x**7/5040
For the "Approximation demo", there is another way to define it
by the recursive definition:
set title "Taylor polynomial approximation of sin(x)"
set zeroaxis
# f(x,n) = (-1)^{n-1}*x^{2*n-1}/(2*n-1)!
f(x,n) = (n>1)? (-f(x,n-1)*x*x/((2.0*n-1.0)*(2.0*n-2.0))) : x
# sum_of_f(x,n) = f(x,1) + f(x,2) + ... + f(x,n)
sum_of_f(x,n) = (n>0)? sum_of_f(x,n-1) + f(x,n) : 0
plot [-8:8][-2:2] for [n=1:5] sum_of_f(x,n) \
title sprintf("degree %d",2*n-1), sin(x)
+========================================================+
Shigeharu TAKENO NIigata Institute of Technology
kashiwazaki,Niigata 945-1195 JAPAN
sh...@ie... TEL(&FAX): +81-257-22-8161
+========================================================+
|