Maple Input and string conversion

188 Views Asked by At

In Maple how does one prompt a user to input an equation with variable x? Then convert that equation into a data type that will enable me to perform functions on said equation?

1

There are 1 best solutions below

0
On

One way to do this is to use the readstat command, which prompts the user to enter a Maple statement whose value is returned. For example:

Test := proc()
  local p, x;
  x := readstat( "Enter Variable: " );
  p := readstat( "Enter Polynomial: " );
  diff( p, x )
end proc:

Then you can do:

> Test();
Enter Variable: x;
Enter Polynomial: x^2 - a*x + 2;
                   -a + 2 x
>