Newton's Method Involving Elliptic Integrals

4 ビュー (過去 30 日間)
Nicholas Davis
Nicholas Davis 2021 年 3 月 10 日
コメント済み: David Hill 2021 年 3 月 12 日
Hi,
I'm trying to find the root of a function involving elliptic integrals using Newton's Method to be used in another code. I based my code off of Be Matlabi's answer here: https://www.mathworks.com/matlabcentral/answers/441561-newton-s-method-in-matlab . I'm not too familiar with symbolic toolbox. I keep running into a "Conversion to logical from sym is not possible" error and I'm not sure how to combat this. I already have an idea of what the answer (x) is like, but I need the proper experimental value to replicate a set of plots. The x value will be incredibly close to 1 and the plots I have developed that look similiar have x values like x = 0.999999 (J=1), and x = 997999 (J=2). I really just need help developing this code to give me the proper experimental value for x. The derivative of that function should be correct, but I did do it by hand, so feel free to double-check me if you want to go the extra mile. I also got the derivatives of each elliptic integral from Wolfram's website. Thanks!
clear all
syms f(x) g(x) x
% Constants
B = 1/(2*(1-x)*x);
gN = 625;
J = 2;
tol = 1e-9;
% Functions
[K,E] = ellipke(x);
f(x) = K^2 - K*E - (gN/(8*J^2));
g(x) = B * (3*K*E - E^2 - 3*K^2 - (K^2)*x);
x(1)=0.99; % Initial Point
% Workshop
for i=1:1000 %it should be stopped when tolerance is reached
x(i+1) = x(i) - f(x(i))/g(x(i));
if( abs(f(x(i+1)))<tol) % tolerance
disp(double(x(i+1)));
break;
end
end

採用された回答

David Hill
David Hill 2021 年 3 月 11 日
編集済み: David Hill 2021 年 3 月 11 日
y=fzero(@nonLinear,[.999,.99999999999999]);
function f=nonLinear(x)
[k(1),k(2)]=ellipke(x);
gN = 625;
J = 2;
f = k(1).^2 - k(1).*k(2) - (gN/(8*J^2));
end
  3 件のコメント
David Hill
David Hill 2021 年 3 月 11 日
fzero() finds the root of the function nonLinear between the two values (.999 and .99999999999999). You can look at matlab's help file.
help fzero
David Hill
David Hill 2021 年 3 月 12 日
If you a satisfied with the answer, you should accept it to close out the question.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by