How to stop pi appearing as a text in the disp result?
3 views (last 30 days)
I want to estimate the value of cos(pi/4) using the taylor series expansion around the point x=0, here is my code,
I expect the result as a floating number however the result is printed as : pi^4/6144 - pi^2/32 + 1
How can I overcome this?
More Answers (2)
Image Analyst on 23 Apr 2023
I suggest you don't use symbolic terms at all. I suggest you just do it numerically with a for loop to sum some number of terms (like a thousand or so).
Walter Roberson on 23 Apr 2023
I do not recommend this approach: there is not much control over the number of digits output, and there are (in my opinion) too many places where you would want symbolic instead of floating point values.