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