0
$\begingroup$

$$f(x) = \frac{1}{(\pi-\cos^{-1}(x))}$$ is very steep and hard to approximate near $1/-1$ points.

I need to have an approximation in the range -1...0.7, (not full -1..1). This smaller area allows to have potentially better/more efficient approximations than ones available from the literature.

How do I approach this task in Octave/Matlab?

Currently I've created function : (v(1)+(v(2)+(v(3)+(v(4)+(v(5)+v(6).*x).*x).*x).*x)) (as an example, there are several candidates), merit function - integral of it's difference to target function (1/(pi-acos(x))) and trying to optimize vector v using fminsearch. Sometimes it finds good solutions, but more often does not.

Is there a good/better approach to such problems to get to good solutions more reliably?

$\endgroup$
0
0
$\begingroup$

Close to $\pm1$, the derivative of the arc cosine is unbounded. This is what causes your trouble. You can improve on this by squaring the function or its supplement.

On the plot, you see that the two curves become nicely linear at an endpoint, which makes it much easier to evaluate by a polynomial.

enter image description here

The plot below shows the close matching between the curve of the arc cosine and $\sqrt{2(1-x)}$ or $\pi-\sqrt{2(1+x)}$.

Anyway, you can't spare the square root.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.