1Math::Symbolic::Custom:U:sDeerfaCuolnttTreisbtust(e3d)PMeartlh:D:oScyummbeonltiact:i:oCnustom::DefaultTests(3)
2
3
4
6 Math::Symbolic::Custom::DefaultTests - Default Math::Symbolic tree
7 tests
8
10 use Math::Symbolic;
11
13 This is a class of default tests for Math::Symbolic trees. Likewise,
14 Math::Symbolic::Custom::DefaultMods defines default tree transformation
15 routines. For details on how the custom method delegation model works,
16 please have a look at the Math::Symbolic::Custom and Math::Sym‐
17 bolic::Custom::Base classes.
18
19 EXPORT
20
21 Please see the docs for Math::Symbolic::Custom::Base for details, but
22 you should not try to use the standard Exporter semantics with this
23 class.
24
26 is_zero()
27
28 Returns true (1) of the tree is a constant and '0'. Returns false (0)
29 otherwise.
30
31 is_one()
32
33 Returns true (1) of the tree is a constant and '1'. Returns false (0)
34 otherwise.
35
36 is_zero_or_one()
37
38 Returns true ('1' for 1, '0E0' for 0) of the tree is a constant and '1'
39 or '0'. Returns false (0) otherwise.
40
41 is_integer()
42
43 is_integer() returns a boolean.
44
45 It returns true (1) if the tree is a constant object representing an
46 integer value. It does not compute the value of the tree. (eg. '5*10'
47 is not considered an integer, but '50' is.)
48
49 It returns false (0) otherwise.
50
51 is_simple_constant()
52
53 is_simple_constant() returns a boolean.
54
55 It returns true if the tree consists of only constants and operators.
56 As opposed to is_constant(), is_simple_constant() does not apply deriv‐
57 atives if necessary.
58
59 It returns false (0) otherwise.
60
61 is_constant()
62
63 is_constant() returns a boolean.
64
65 It returns true (1) if the tree consists of only constants and opera‐
66 tors or if it becomes a tree of only constants and operators after
67 application of derivatives.
68
69 It returns false (0) otherwise.
70
71 If you need not pay the price of applying derivatives, you should use
72 the is_simple_constant() method instead.
73
74 is_identical()
75
76 is_identical() returns a boolean.
77
78 It compares the tree it is called on to its first argument. If the
79 first argument is not a Math::Symbolic tree, it is sent through the
80 parser.
81
82 is_identical() returns true (1) if the trees are completely identical.
83 That includes operands of commutating operators having the same order,
84 etc. This does not test of mathematical equivalence! (Which is much,
85 much harder to test for. If you know how to, please let me know!)
86
87 It returns false (0) otherwise.
88
89 is_identical_base
90
91 is_identical_base() returns a boolean.
92
93 It compares the tree it is called on to its first argument. If the
94 first argument is not a Math::Symbolic tree, it is sent through the
95 parser.
96
97 is_identical_base() returns true (1) if the trees are identical or if
98 they are exponentiations with the same base. The same gotchas that
99 apply to is_identical apply here, too.
100
101 For example, 'x*y' and '(x*y)^e' result in a true return value because
102 'x*y' is equal to '(x*y)^1' and this has the same base as '(x*y)^e'.
103
104 It returns false (0) otherwise.
105
106 is_sum()
107
108 (beta)
109
110 is_constant() returns a boolean.
111
112 It returns true (1) if the tree contains no variables (because it can
113 then be evaluated to a single constant which is a sum). It also returns
114 true if it is a sum or difference of constants and variables. Further‐
115 more, it is true for products of integers and constants because those
116 products are really sums of variables. If none of the above cases
117 match, it applies all derivatives and tries again.
118
119 It returns false (0) otherwise.
120
121 Please contact the author in case you encounter bugs in the specs or
122 implementation. The heuristics aren't all that great.
123
124 test_num_equiv()
125
126 Takes another Math::Symbolic tree or a code ref as first argument.
127 Tests the tree it is called on and the one passed in as first argument
128 for equivalence by sampling random numbers for their parameters and
129 evaluating them.
130
131 This is no guarantee that the functions are actually similar. The com‐
132 putation required for this test may be very high for large numbers of
133 tests.
134
135 In case of a subroutine reference passed in, the values of the parame‐
136 ters of the Math::Symbolic tree are passed to the sub ref sorted by the
137 parameter names.
138
139 Following the test-tree, there may be various options as key/value
140 pairs:
141
142 limits: A hash reference with parameter names as keys and code refs
143 as arguments. A code ref for parameter 'x', will be executed
144 for every number of 'x' that is generated. If the code
145 returns false, the number is discarded and regenerated.
146 tests: The number of tests to carry out. Default: 20
147 epsilon: The accuracy of the numeric comparison. Default: 1e-7
148 retries: The number of attempts to make if a function evaluation
149 throws an error.
150 upper: Upper limit of the random numbers. Default: 10
151 lower: Lower limit of the random numbers. Default: -10
152
154 Please send feedback, bug reports, and support requests to the
155 Math::Symbolic support mailing list: math-symbolic-support at lists dot
156 sourceforge dot net. Please consider letting us know how you use
157 Math::Symbolic. Thank you.
158
159 If you're interested in helping with the development or extending the
160 module's functionality, please contact the developers' mailing list:
161 math-symbolic-develop at lists dot sourceforge dot net.
162
163 List of contributors:
164
165 Steffen Müller, symbolic-module at steffen-mueller dot net
166 Stray Toaster, mwk at users dot sourceforge dot net
167 Oliver Ebenhöh
168
170 New versions of this module can be found on http://steffen-mueller.net
171 or CPAN. The module development takes place on Sourceforge at
172 http://sourceforge.net/projects/math-symbolic/
173
174 Math::Symbolic::Custom Math::Symbolic::Custom::DefaultDumpers
175 Math::Symbolic::Custom::DefaultMods Math::Symbolic
176
177
178
179perl v5.8.8 2008-0M2a-t2h2::Symbolic::Custom::DefaultTests(3)