MATLAB Answers

Integration with pi - Rational Approximation?

조회 수: 6(최근 30일)
I'm having trouble understanding the difference between these two integration commands:
clear; syms y;
On my machine (2019b - Windows) and MATLAB Online, using format short I get:
ans =
ans =
I often receive odd rational approximations when integrating using pi (note that leaving pi out of the integral fixes the issue). I haven't been able to find an answer as to why this happens. I'm assuming MATLAB computes a decimal answer using pi, cuts the approximation at the 14 or 15th decimal place, then creates a fraction out of the result, but why does this happen some times and not others?

  댓글 수: 0

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Paul Dostert
Paul Dostert 2 Nov 2019
Thanks so much. Makes perfect sense!

  댓글 수: 0

댓글을 달려면 로그인하십시오.




Community Treasure Hunt

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

Start Hunting!

Translated by