Is it possible to display a symbolic integral with bounds and function?

4 views (last 30 days)
Hi everyone, I'm new to the form. I've looked through documentation to try to find this but I really couldn't see anything about it.
I love live scripts. They let me get a very clear view of what is going and I frequently use them for symbolic heavy exams where MATLAB is allowed. The only real issue is have, is that using the int() function only gives the symbolic output. I'd like to be able to look at the whole integral, with bounds and everything, before I evaluate it, just to make sure I haven't made any mistakes. Is this possible? I would find it a preferable way to look for simple mistakes in my inputs.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Apr 2018
Edited: Walter Roberson on 25 Oct 2024
Unfortunately there is no way to do this. The way you would do this in a mupad notebook would be to use the hold() operator. Unfortunately the MATLAB levels do not understand that operator and internal errors result if you force the symbolic engine to use hold()
In other symbolic computing systems such as Maple or Mathematica this is handled better https://mathematica.stackexchange.com/questions/66995/is-it-possible-to-pretty-print-my-input-integral-in-mathematica-like-wolframa
  4 Comments
Walter Roberson
Walter Roberson on 25 Oct 2024
In the time since the above answer, MATLAB added the hold option to int(). It allows the construction of int() constructs without evaluating them. You later release the int() form to trigger evaluation.
Using hold is especially useful for nested int() in which you know that the inner int() has no explicit form itself, but the overall double integral works out: you can save the time required to attempt to find the inner integral.
Steven Lord
Steven Lord on 25 Oct 2024
If you want to check that your integrand was written correctly, you could of course do that by storing it in a variable and displaying that variable prior to passing it into int. But if you ask MATLAB to integrate your function symbolically, and it can do so, it will in much the same way that if you tell MATLAB:
y = 2 + 2
y = 4
the result is going to be that y is 4, not that y is 2+2.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!