Complex roots of sin(2*x)-2*x=0
2 次查看(过去 30 天)
显示 更早的评论
How can i use fsolve to obtain the complex roots of the equation: sin(2*x)-2*x=0?
1 个评论
采纳的回答
Star Strider
2021-8-7
Providing fsolve with a complex initial estimate encourages it to find complex roots —
f = @(x) sin(2*x)-2*x;
xrts = fsolve(f, 1+1i)
.
3 个评论
Star Strider
2021-8-7
True.
However the request was to how to return a complex root. We know nothing more about the intended problem.
.
Matt J
2021-8-7
Providing fsolve with a complex initial estimate encourages it to find complex roots
Only if the objective is analytic, see
It's not clear to me whether that is true or not for sin(2*x)-2*x.
更多回答(1 个)
Matt J
2021-8-7
编辑:Matt J
2021-8-7
This seems to find a non-trivial complex root:
opts=optimoptions('fsolve','StepTol',1e-14,'FunctionTol',1e-14,'OptimalityTol',1e-14);
[p,fval]=fsolve(@eqnfun,[3,3],opts);
x=complex(p(1), p(2)),
sin(2*x)-2*x
function F=eqnfun(p)
x=complex(p(1), p(2));
y=sin(2*x)-2*x;
F=[real(y); imag(y)];
end
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!