Difference between revisions of "User:Malcolm/wip/Sage WW Notes"
< User:Malcolm | wip
Jump to navigation
Jump to search
(Created page with "Notes on embedding Sage into WW problems using the Sage cell server - May/June 2012 When passing functions to Sage, if the function is defined as a math object problems can o...") |
|||
Line 9: | Line 9: | ||
</pre>return the orginal string used to define the function. |
</pre>return the orginal string used to define the function. |
||
+ | For example with the set up: |
||
+ | <pre> |
||
+ | Context("Numeric"); |
||
+ | $f = Compute("(x-(-2))*(x-2)*(x-4)"); |
||
+ | </pre> |
||
+ | then |
||
+ | <pre>$f->string()</pre> produces[x-(-2)]*(x-2)*(x-4) |
||
+ | $f->TeX() produces\left(x-\left(-2\right)\right)\!\left(x-2\right)\!\left(x-4\right) |
||
+ | $f->stringify() produces: |
||
+ | [x-(-2)]*(x-2)*(x-4) in normalStrings |
||
+ | \left(x-\left(-2\right)\right)\!\left(x-2\right)\!\left(x-4\right) in texStrings |
||
Possible solution: |
Possible solution: |
||
Use a construction like |
Use a construction like |
Revision as of 13:47, 12 June 2012
Notes on embedding Sage into WW problems using the Sage cell server - May/June 2012
When passing functions to Sage, if the function is defined as a math object problems can occur since it can happen that none of
$f $f->string() $f->stringify() $f->TeX()
return the orginal string used to define the function.
For example with the set up:
Context("Numeric"); $f = Compute("(x-(-2))*(x-2)*(x-4)");
then
$f->string()
produces[x-(-2)]*(x-2)*(x-4)
$f->TeX() produces\left(x-\left(-2\right)\right)\!\left(x-2\right)\!\left(x-4\right) $f->stringify() produces: [x-(-2)]*(x-2)*(x-4) in normalStrings \left(x-\left(-2\right)\right)\!\left(x-2\right)\!\left(x-4\right) in texStrings Possible solution: Use a construction like
$f_raw = "(x-(-2))*(x-2)*(x-4)"; $f = Compute($f_raw);