How to get simplified, symbolic solutions for definite integrals
3 views (last 30 days)
Show older comments
Hi,
I have a function:

which I integrate over the whole real line, and then divide by pi. The below code:
syms x w
fn1 = exp(-abs(x))*cos(w*x)
int(fn1, x, [-inf inf])/pi
produces the following output:

Which is probably not incorrect, but I was hoping to see what Python (SymPy) would cleanly give as:

I tried to 'simplify' or to play with format, but, to be honest, I am not even sure what to look for in documentation. My issue is most likely due to trying to run before I can walk. That is to say, after recently having aquired Matlab (student, doing another degree late in life), I never did spend months on learning all of its basics, and am instead relying on 40 years of general programming and math experience. Clearly not enough in this case, though :)
Could I get a few pointers, please, as to how to get Matlab results to be in a fully symbolic, rational (1/3 instead of 0.333333), simplified (cos^2 + sin^2 = 1) kind of mode?
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!