Check numerical stabilityand correct the equation

19 Views Asked by At

I am struggling with a function that supposedly has a numerical error. I checked for consistency which seems to be fine but I couldn't find the stability error nor attempt to correct it.

enter image description here

where c = 1-r^(-d) and d =[1:100]

The function is struggling with small values of r and I should, therefore, find a way to redefine it but after two days of trial and error I couldn't come up with a solution.

1

There are 1 best solutions below

2
On BEST ANSWER

Use $$1-\cos\theta=2\sin^2\frac\theta2.$$