Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB Matlab Symbolic Math Toolbox

  1. Sep 12, 2011 #1
    Does anybody know much about how this works?

    I can't understand why it doesn't give me an answer for definite integrals sometimes... e.g. in Matlab R2011a:

    syms x a;

    gives the answer (a^2 + x^2)^(1/2) as expected.

    But int(x/sqrt(x^2+a^2),0,10) gives - Warning: Explicit integral could not be found.

    This doesn't really make any sense as the answer should be (a^2 + 10^2)^(1/2) - a. Is there some way to understand this strange behavior?
  2. jcsd
  3. Sep 12, 2011 #2
    In this case you have to assume that a is real. Even then the solution will be plus/minus a given that we dont know the sign of a.

    evalin(symengine,'assume(a in R_)')
    syms x a

    ans =

    (a^2 + 100)^(1/2) - abs(a)
  4. Sep 12, 2011 #3
    Ah, thank you! I understand!
  5. Sep 12, 2011 #4


    User Avatar
    Gold Member

    Another way to declare a real (the code below will actually declare both x and a real, but the example stands) is:
    Code (Text):

    syms [COLOR="Magenta"]x a real[/COLOR]
    I find it easier to remember that way.
  6. Sep 12, 2011 #5
    that's perfect, thank you!
  7. Sep 12, 2011 #6


    User Avatar
    Gold Member

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook