1Math::Symbolic::MiscCalUcsuelrusC(o3n)tributed Perl DocuMmaetnht:a:tSiyomnbolic::MiscCalculus(3)
2
3
4
6 Math::Symbolic::MiscCalculus - Miscellaneous calculus routines (eg
7 Taylor poly)
8
10 use Math::Symbolic qw/:all/;
11 use Math::Symbolic::MiscCalculus qw/:all/; # not loaded by Math::Symbolic
12
13 $taylor_poly = TaylorPolynomial $function, $degree, $variable;
14 # or:
15 $taylor_poly = TaylorPolynomial $function, $degree, $variable, $pos;
16
17 $lagrange_error = TaylorErrorLagrange $function, $degree, $variable;
18 # or:
19 $lagrange_error = TaylorErrorLagrange $function, $degree, $variable, $pos;
20 # or:
21 $lagrange_error = TaylorErrorLagrange $function, $degree, $variable, $pos,
22 $name_for_range_variable;
23
24 # This has the same syntax variations as the Lagrange error:
25 $cauchy_error = TaylorErrorLagrange $function, $degree, $variable;
26
28 This module provides several subroutines related to calculus such as
29 computing Taylor polynomials and errors the associated errors from
30 Math::Symbolic trees.
31
32 Please note that the code herein may or may not be refactored into the
33 OO-interface of the Math::Symbolic module in the future.
34
35 EXPORT
36 None by default.
37
38 You may choose to have any of the following routines exported to the
39 calling namespace. ':all' tag exports all of the following:
40
41 TaylorPolynomial
42 TaylorErrorLagrange
43 TaylorErrorCauchy
44
46 TaylorPolynomial
47 This function (symbolically) computes the nth-degree Taylor Polynomial
48 of a given function. Generally speaking, the Taylor Polynomial is an
49 n-th degree polynomial that approximates the original function. It does
50 so particularly well in the proximity of a certain point x0. (Since my
51 mathematical English jargon is lacking, I strongly suggest you read up
52 on what this is in a book.)
53
54 Mathematically speaking, the Taylor Polynomial of the function f(x)
55 looks like this:
56
57 Tn(f, x, x0) =
58 sum_from_k=0_to_n(
59 n-th_total_derivative(f)(x0) / k! * (x-x0)^k
60 )
61
62 First argument to the subroutine must be the function to approximate.
63 It may be given either as a string to be parsed or as a valid
64 Math::Symbolic tree. Second argument must be an integer indicating to
65 which degree to approximate. The third argument is the last required
66 argument and denotes the variable to use for approximation either as a
67 string (name) or as a Math::Symbolic::Variable object. That's the 'x'
68 above. The fourth argument is optional and specifies the name of the
69 variable to introduce as the point of approximation. May also be a
70 variable object. It's the 'x0' above. If not specified, the name of
71 this variable will be assumed to be the name of the function variable
72 (the 'x') with '_0' appended.
73
74 This routine is for functions of one variable only. There is an
75 equivalent for functions of two variables in the
76 Math::Symbolic::VectorCalculus package.
77
78 TaylorErrorLagrange
79 TaylorErrorLagrange computes and returns the formula for the Taylor
80 Polynomial's approximation error after Lagrange. (Again, my English
81 terminology is lacking.) It looks similar to this:
82
83 Rn(f, x, x0) =
84 n+1-th_total_derivative(f)( x0 + theta * (x-x0) ) / (n+1)! * (x-x0)^(n+1)
85
86 Please refer to your favourite book on the topic. 'theta' may be any
87 number between 0 and 1.
88
89 The calling conventions for TaylorErrorLagrange are similar to those of
90 TaylorPolynomial, but TaylorErrorLagrange takes an extra optional
91 argument specifying the name of 'theta'. If it isn't specified
92 explicitly, the variable will be named 'theta' as in the formula above.
93
94 TaylorErrorCauchy
95 TaylorErrorCauchy computes and returns the formula for the Taylor
96 Polynomial's approximation error after (guess who!) Cauchy. (Again, my
97 English terminology is lacking.) It looks similar to this:
98
99 Rn(f, x, x0) = TaylorErrorLagrange(...) * (1 - theta)^n
100
101 Please refer to your favourite book on the topic and the documentation
102 for TaylorErrorLagrange. 'theta' may be any number between 0 and 1.
103
104 The calling conventions for TaylorErrorCauchy are identical to those of
105 TaylorErrorLagrange.
106
108 Please send feedback, bug reports, and support requests to the
109 Math::Symbolic support mailing list: math-symbolic-support at lists dot
110 sourceforge dot net. Please consider letting us know how you use
111 Math::Symbolic. Thank you.
112
113 If you're interested in helping with the development or extending the
114 module's functionality, please contact the developers' mailing list:
115 math-symbolic-develop at lists dot sourceforge dot net.
116
117 List of contributors:
118
119 Steffen Mueller, symbolic-module at steffen-mueller dot net
120 Stray Toaster, mwk at users dot sourceforge dot net
121 Oliver Ebenhoeh
122
124 New versions of this module can be found on http://steffen-mueller.net
125 or CPAN. The module development takes place on Sourceforge at
126 http://sourceforge.net/projects/math-symbolic/
127
128 Math::Symbolic
129
130
131
132perl v5.34.0 2021-07-22 Math::Symbolic::MiscCalculus(3)