how to fin dalta from this equation

2 visualizzazioni (ultimi 30 giorni)
Hussein Ali
Hussein Ali il 11 Apr 2018
Risposto: David Goodmanson il 12 Apr 2018
how to solve this equation attached to file
  1 Commento
KALYAN ACHARJYA
KALYAN ACHARJYA il 11 Apr 2018
Modificato: KALYAN ACHARJYA il 11 Apr 2018
Good Question
x+c1cosx=c2 solve for x?
where c1, c2 constant.

Accedi per commentare.

Risposte (1)

David Goodmanson
David Goodmanson il 12 Apr 2018
Hello Hussein,
A plot of the equation shows that there are three real roots:
x = -2:.001:6;
figure(1)
y = x + 1.6*cos(x)-1.303;
plot(x,y)
Of the many ways to find the roots, just for fun the method below finds a new x value from the present value and iterates. One could keep track of progress and stop after a certain tolerance was reached, but this method is so fast that it's easier to run the for loop a lot of times and verify the accuracy after that. For this root, you can guess basically anything for the starting value of x.
The final result shows 0 for the imaginary part so taking x = real(x) is justified.
You can see that their value of 2.08 is not very good, although it's possible that they were carrying more significant figures than they showed on their next-to-last-line.
format long
x = 4; % starting point
for k = 1:400
x = acos((1.303-x)/1.6);
end
x
x = real(x);
accuracy_check = x+1.6*cos(x)-1.303
x = 2.072569688766171 - 0.000000000000000i
accuracy_check = 2.220446049250313e-16
If you want to obtain the other two roots then you would iterate on
x = 1.303-1.6*cos(x);
in which case the initial value for x determines which root you get.

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by