|
phystricks
|
Functions | |
| def | are_almost_equal (a, b, epsilon=0.0001) |
| def | numerical_min (x, y, epsilon=None) |
return the minimum of x and y More... | |
| def | numerical_max (x, y, epsilon=None) |
| def | is_almost_zero (x, epsilon=0.0001) |
| def | numerical_is_negative (x) |
Variables | |
| nx = numerical_approx(x) | |
Same as numerical_min with ad-hoc changes. More... | |
| ny = numerical_approx(y) | |
| def phystricks.src.Numerical.are_almost_equal | ( | a, | |
| b, | |||
epsilon = 0.0001 |
|||
| ) |
| def phystricks.src.Numerical.is_almost_zero | ( | x, | |
epsilon = 0.0001 |
|||
| ) |
Try to say if Abs(x)<epsilon.
It is not always possible because
- x could be an expression on which Sage cannot compute abs
- the precision on x could be lower than epsilon, so that Sage will complain. In this case we check is x is the smaller possible in its precision and `epsilon` is not used.
sage: from phystricks.SmallComputations import numerical_isZero
sage: numerical_isZero(-pi)
False
| def phystricks.src.Numerical.numerical_is_negative | ( | x | ) |
try to say if `x` is a numerical approximation strictly negative.
I got difficulties on the following :
sage:radian =arctan(1/sin(1.2000000000000002*pi))
sage: if radian< 0:
print("ok")
....:
results in an OverflowError: Python int too large to convert to C long.
| def phystricks.src.Numerical.numerical_max | ( | x, | |
| y, | |||
epsilon = None |
|||
| ) |
| def phystricks.src.Numerical.numerical_min | ( | x, | |
| y, | |||
epsilon = None |
|||
| ) |
return the minimum of x and y
Compute numerical approximations of x and y and return the min
If epsilon is given, raise an exception if the difference is smaller than epsilon.
The reason is that Sage cannot always determine the min or the max of expressions like 1000 of type int and cos(0.0823552493237255*pi) of type sage.symbolic.expression.Expression
| phystricks.src.Numerical.nx = numerical_approx(x) |
Same as numerical_min with ad-hoc changes.
| phystricks.src.Numerical.ny = numerical_approx(y) |
1.8.11