MATLAB: Is the fval value so large when I use fzero to solve a equation which has Elliptical integral?

elliptic integralsfzero

I want to solve a equation as follows, (F is Incomplete elliptic integral of the first kind, E is incomplete elliptic integrals of the second kind)
QQ截图20181114174309.png
when k= 0.5, find β* .
My code is
clear
f=@(betax,k2) 2.*ellipticE(betax,k2)-ellipticF(betax, k2)-tan(betax).*(1-k2.*sin(betax).^2).^0.5;
k=0.5;
k2=k^2;
f1=@(betax)f(betax,k2);
[betaxx,fval]=fzero(f1,1.5)
f(betaxx,k2)
The answer is
betaxx = 1.5708
fval = 8.2558e+14
ans = 8.2558e+14
I want to know why is the error so large, and how can I get the right answer?

Best Answer

[betaxx,fval]=fzero(f1,[pi/2+0.01,3*pi/2-0.01])