|
|
|
|
|
The purpose of the rest of this worksheet is, to act as a future cheat-sheet, for how to wrap Python
functions XYZ into SageMath. 'mpmath' will be used as an example.
|
|
|
|
One type of object which exists in SageMath is, a procedural function, which is
more formally called a Numerical Function. Even though they could take any set of
arguments, their future conversion into symbolic functions places special requirements.
|
The version of lambert_w which is native to Sage, takes 2 arguments by default...
|
The following two Numerical Functions are shown, as an example of what to do, if the wrapped
package doesn't have the equivalent of the 'mpmathify()' function. It could happen, that the Symbolic Function
input, first needs to be approximated as a string.
In this case it's achieved, by not stating that a nested numerical approximation 'N()' should take place.
Because these Numerical Functions are only to be called, once a numerical value has been
requested of SageMath, the parameters of the main numerical approximation will also apply
to the String conversion within the Python Functions...
|
|
The concept here is, that the numeric-functions-converted-into-symbolic-functions,
don't auto-evaluate. These will only evaluate once numerical answers are required...
Because they don't auto-evaluate, symbolic manipulations on them won't take place...
|
|
(Above...)
If auto-evaluation was desired, the keyword parameter identifying which Numeric Function to use, would be named
'eval_func' ...
|
|
|
|
|
|