The answer this trigonometric integration example is wrong despite attempts to remedy it. Anyone knows why?
1 view (last 30 days)
Show older comments
Accepted Answer
Ameer Hamza
on 29 Sep 2020
Edited: Ameer Hamza
on 29 Sep 2020
It is the correct result, it is just a different way of writing it.
>> syms x
>> f = 2*cos(x) + sin(x)
f =
2*cos(x) + sin(x)
>> int_f = int(f)
int_f =
-2*cos(x/2)*(cos(x/2) - 2*sin(x/2))
>> simplify(diff(int_f)) % same expression back
ans =
2*cos(x) + sin(x)
3 Comments
Steven Lord
on 29 Sep 2020
If you want to test if Symbolic Math Toolbox can prove that two symbolic expressions that look different actually represent the same quantity you can use isAlways.
>> syms x
>> f1 = sin(x)
f1 =
sin(x)
>> f2 = (exp(1i*x)-exp(-1i*x))/2i
f2 =
(exp(-x*1i)*1i)/2 - (exp(x*1i)*1i)/2
>> isAlways(f1 == f2)
ans =
logical
1
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!