1math::rationalfunctions(n) Math math::rationalfunctions(n)
2
3
4
5______________________________________________________________________________
6
8 math::rationalfunctions - Polynomial functions
9
11 package require Tcl ?8.4?
12
13 package require math::rationalfunctions ?1.0.1?
14
15 ::math::rationalfunctions::rationalFunction num den
16
17 ::math::rationalfunctions::ratioCmd num den
18
19 ::math::rationalfunctions::evalRatio rational x
20
21 ::math::rationalfunctions::addRatio ratio1 ratio2
22
23 ::math::rationalfunctions::subRatio ratio1 ratio2
24
25 ::math::rationalfunctions::multRatio ratio1 ratio2
26
27 ::math::rationalfunctions::divRatio ratio1 ratio2
28
29 ::math::rationalfunctions::derivPolyn ratio
30
31 ::math::rationalfunctions::coeffsNumerator ratio
32
33 ::math::rationalfunctions::coeffsDenominator ratio
34
35______________________________________________________________________________
36
38 This package deals with rational functions of one variable:
39
40 · the basic arithmetic operations are extended to rational func‐
41 tions
42
43 · computing the derivatives of these functions
44
45 · evaluation through a general procedure or via specific proce‐
46 dures)
47
49 The package defines the following public procedures:
50
51 ::math::rationalfunctions::rationalFunction num den
52 Return an (encoded) list that defines the rational function. A
53 rational function
54
55
56 1 + x^3
57 f(x) = ------------
58 1 + 2x + x^2
59
60
61 can be defined via:
62
63
64 set f [::math::rationalfunctions::rationalFunction [list 1 0 0 1] [list 1 2 1]]
65
66
67 list num
68 Coefficients of the numerator of the rational function
69 (in ascending order)
70
71
72 list den
73 Coefficients of the denominator of the rational function
74 (in ascending order)
75
76
77 ::math::rationalfunctions::ratioCmd num den
78 Create a new procedure that evaluates the rational function. The
79 name of the function is automatically generated. Useful if you
80 need to evaluate the function many times, as the procedure con‐
81 sists of a single [expr] command.
82
83 list num
84 Coefficients of the numerator of the rational function
85 (in ascending order)
86
87
88 list den
89 Coefficients of the denominator of the rational function
90 (in ascending order)
91
92
93 ::math::rationalfunctions::evalRatio rational x
94 Evaluate the rational function at x.
95
96 list rational
97 The rational function's definition (as returned by the
98 rationalFunction command). order)
99
100 float x
101 The coordinate at which to evaluate the function
102
103
104 ::math::rationalfunctions::addRatio ratio1 ratio2
105 Return a new rational function which is the sum of the two oth‐
106 ers.
107
108 list ratio1
109 The first rational function operand
110
111 list ratio2
112 The second rational function operand
113
114
115 ::math::rationalfunctions::subRatio ratio1 ratio2
116 Return a new rational function which is the difference of the
117 two others.
118
119 list ratio1
120 The first rational function operand
121
122 list ratio2
123 The second rational function operand
124
125
126 ::math::rationalfunctions::multRatio ratio1 ratio2
127 Return a new rational function which is the product of the two
128 others. If one of the arguments is a scalar value, the other
129 rational function is simply scaled.
130
131 list ratio1
132 The first rational function operand or a scalar
133
134 list ratio2
135 The second rational function operand or a scalar
136
137
138 ::math::rationalfunctions::divRatio ratio1 ratio2
139 Divide the first rational function by the second rational func‐
140 tion and return the result. The remainder is dropped
141
142 list ratio1
143 The first rational function operand
144
145 list ratio2
146 The second rational function operand
147
148
149 ::math::rationalfunctions::derivPolyn ratio
150 Differentiate the rational function and return the result.
151
152 list ratio
153 The rational function to be differentiated
154
155
156 ::math::rationalfunctions::coeffsNumerator ratio
157 Return the coefficients of the numerator of the rational func‐
158 tion.
159
160 list ratio
161 The rational function to be examined
162
163
164 ::math::rationalfunctions::coeffsDenominator ratio
165 Return the coefficients of the denominator of the rational func‐
166 tion.
167
168 list ratio
169 The rational function to be examined
170
171
173 The implementation of the rational functions relies on the math::poly‐
174 nomials package. For further remarks see the documentation on that
175 package.
176
178 This document, and the package it describes, will undoubtedly contain
179 bugs and other problems. Please report such in the category math ::
180 rationalfunctions of the Tcllib Trackers
181 [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas
182 for enhancements you may have for either package and/or documentation.
183
184 When proposing code changes, please provide unified diffs, i.e the out‐
185 put of diff -u.
186
187 Note further that attachments are strongly preferred over inlined
188 patches. Attachments can be made by going to the Edit form of the
189 ticket immediately after its creation, and then using the left-most
190 button in the secondary navigation bar.
191
193 math, rational functions
194
196 Mathematics
197
199 Copyright (c) 2005 Arjen Markus <arjenmarkus@users.sourceforge.net>
200
201
202
203
204tcllib 1.0.1 math::rationalfunctions(n)