Search code examples
matlabwolfram-mathematicasymbolic-mathmaplesymbolic-computation

Checking symbolic computations


I have to do some computations where long formulae, mainly involving derivatives of polynomials with variable coefficients come up.

Unfortunately the results I obtain from engines like Mathematica or Maple are represented in a way that is very different to those I need, and rearranging the result into the desirable form takes too long (not to mention the risk of re-introducing errors).

Hence I was wondering whether there is some way to instead do the computations myself and then let the result be checked – i.e. some sort of "equation checker":

I put in d/dx f(x) = g(x) where I provide BOTH sides and the system evaluates this to be true or false.


Solution

  • I would check out sym/isequaln. It is an overloaded version of isequaln used to compare symbolic expressions. For example:

    syms x
    f(x) = 3*x^3-2*ln(x);
    g(x) = 9*x^2 - 2/x;
    isequaln(f,g)
    
    ans =
        0
    
    isequaln(diff(f), g)
    
    ans = 
        1
    

    See the MathWorks documentation on the function. It's pretty handy.