Think of it as mathematical out-sourcing if you will – a bit like copying your friend’s calculus homework. Mupad solves the problem and sends the result back to MATLAB for display. What it does is send the problem to another program called MuPad.
So how are these symbolic feats achieved you may ask? Well, it’s all a bit of a trick really because MATLAB isn’t doing any of the work itself. (Note to teachers: If you have a student who always gets the integral correct but shows no working and never includes the constant of integration – now you know why). It misses off the constant of integration but this is the standard behaviour for almost all symbolic integrators and so isn’t anything to worry about. It even has the power to evaluate integrals symbolically – something that I wish I had access to when I was in high school. It will also give the answer to our first quadratic exactly – which is nice. With the symbolic toolbox, however, calculations such as this are trivial thanks to the solve command If, on the other hand, you wanted to solve the general quadratic a*x^2+b*x+c=0 in terms of a,b and c then you are out of luck using MATLAB on its own. The syntax may look at bit minging at first sight but it does the job and does it efficiently. For example, if you want to solve the quadratic equation x^2 -2*x -5=0 numerically then basic MATLAB can help you. The base MATLAB package is strictly numerical and has no support for the symbolic manipulation of equations. If you are new to MATLAB then maybe a quick explanation is in order here. This could be due to complexity in the simplification process, or it could still be a safety concern, since I could at any point clear the assumption, and the equality would no longer hold.Just over a couple of weeks ago, The Mathworks released the latest version of their main product, MATLAB 2008b, which includes a completely new version of their Symbolic Toolbox. After the assumption is made that cos(x) ~= 0, MATLAB properly stated that tan(x) = sin(x)/cos(x) is true, yet it still didn't simplify the expression. The second result was surprising, though. % Place restriction on cos(x), and re-test MATLAB's behaviorĪs expected, it didn't simplify the function the first time because cos(x) may equal zero. % Define the function, and test MATLAB's behavior % Create the symbolic variable and remove all assumptions placed on it. Out of curiosity, I ran the following script: clc, clear Therefore, at those values, tan(x) ~= sin(x)/cos(x). When x is in the set described above, it means cos(x) = 0, and sin(x)/cos(x) causes a division by zero error, whereas tan(x) approaches a value of inf. simplify(tan(x) = sin(x) / cos(x))īut instead, it returns ~x in Dom::ImageSet(pi*(k + 1/2), k, Z_)
On that note, I'd expect the line below to also return TRUE.
Look at this simple example: simplify(x=x) % Returns symbolic "TRUE"
The issue here can be shown if you try to simplify your equality. Most of the simplifications you want MATLAB to do will happen when you call simplify, but the one you've posted has a minor problem. The symbolic toolbox can do some incredible simplifications, including those that use trigonometric functions.