Signature
run: | % ![]() |
Example
import from Integer, Maple, ExpressionTree, Partial ExpressionTree; n := 5; -- create a session (maple is not launched but a unique link is created) mapl := maple(); -- send the maple code to compute the integral of the n-th legendre poly -- note that all the maple commands are terminated with ":" -- so that they do not generate any output -- here again, nothing happens, the commands are only stored input(mapl) << "with(orthopoly): p := P(" << n << ", x): int(p, x):"; -- now launch maple and recover the result of the last command ("int") tree := run mapl; failed? tree => error "Unable to parse Maple's output"; retract tree;Running the above code produces the following expression tree:
(+(- (* (/ 21 16) (^ x 6)) (* (/ 35 16) (^ x 4)))(* (/ 15 16) (^ x 2)))