Search code examples
phpmaxima

maxima- How can I execute some maxima script from php?


I'm new to CAS and maxima. I'd like to know whether it's feasible to do the following:

1) I have a list of parameters e.g. a, b, c

2) In PHP, I have some maxima script stored as a string, involving a, b, c, e.g.:

do {
  a=random(20);
  b=random(20);
  c=random(20);
}while (!(a > b) || !(b > c))

Such that a, b, c are randomized to desired values and satisfy requirements.

3) Retrieve the values of a, b, c in PHP.

The purpose is to create randomized questions with reasonable parameters for students. So how can I execute the maxima script and retrieve the values of parameters? Is it suitable for my purpose?


Solution

  • I dont really know how your code works but if you save the maxima as a php extension it could work. Place this line of code at the start of the php file

          <?php
           require_once("extension/Maxima.php");
    
           ?>
    

    For the echo example

                  echo $A ;