to find root of transcendental equation

18 次查看(过去 30 天)
As from below program i need to confirm The roots are α = {2.7859,5.5215,7.9573} . how to find
a=0:0.01:9;
y1=sqrt(64-a.^2);
y2=-1.*a.*cot(a);
plot(a,y1)
grid on
hold on
plot(a, y2)
ylim([0, 12])
  1 个评论
Dyuman Joshi
Dyuman Joshi 2023-5-9
Numerically you won't be able to find the exact values, more so as the data has 2 digit precision and the values you want to obtain have 4 digit precision.
As you can see below, for tolerance of 0.1 for step-size 0.01, you get 2 out of 3 intersection points -
a=0:0.01:9;
y1=sqrt(64-a.^2);
y2=-1.*a.*cot(a);
a(abs(y1-y2)<0.1)
ans = 1×2
5.5200 7.9600
For step-size 1e-4 and tolerance 1e-3, you get 4 different roots
a=0:0.0001:9;
y1=sqrt(64-a.^2);
y2=-1.*a.*cot(a);
a(abs(y1-y2)<0.001)
ans = 1×4
2.7859 5.5214 5.5215 7.9573
Even solve() is unable to find a solution symbolically, and returns a numeric solution via vpasolve. Note that vpasolve only returns a single solution for non-polynomial equations
syms x
assume(x>=0 & x<=9)
f1(x)=sqrt(64-x.^2);
f2(x)=-1.*x.*cot(x);
sol = solve(f1-f2==0, x)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
sol = 
5.521446429976302205509075939559
You can call vpasolve() multiple times by setting 'Random' as true to obtain the solutions -
for k=1:5
s = double(vpasolve(f1-f2==0, x, [0 9], 'Random', true))
end
s = 5.5214
s = 2.7859
s = 5.5214
s = 7.9573
s = 7.9573
plot(a,y1)
Warning: Imaginary parts of complex X and/or Y arguments ignored.
grid on
hold on
plot(a, y2)
ylim([0, 12])

请先登录,再进行评论。

回答(1 个)

Matt J
Matt J 2023-5-9
As from below program i need to confirm The roots are α = {2.7859,5.5215,7.9573}
If you only need to confirm the roots, just plug them in and check:
dy=@(a) sqrt(64-a.^2) + a.*cot(a);
dy([2.7859,5.5215,7.9573])
ans = 1×3
1.0e-03 * 0.0550 -0.7282 0.3823

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by