Here is an example that actually runs without messages, fixing a number of errors in @zeraoulia rafik's code and adjusting parameter values to make a nice plot:
(*Define parameters*)
Mo1 = 2/5;
Mo2 = 2/5;
Mo3 = 2/5;
Jo1 = 1/5;
Jo2 = 2/5;
Jo3 = 3/5;
(*Define the system of ODEs*)
eqns = {
y1'[x] == y4[x]*Sin[y3[x]]/Sin[y2[x]] + y5[x]*Cos[y3[x]]/Sin[y2[x]],
y2'[x] == y4[x]*Cos[y3[x]]*y5[x]*Sin[y3[x]],
y3'[x] == y4[x]*Sin[y3[x]]*Cos[y2[x]]/Sin[y2[x]] -
y5[x]*Cos[y3[x]]*Cos[y2[x]]/Sin[y2[x]],
y4'[x] == (Mo1 - (Jo3 - Jo2)*y6[x]*y5[x])/Jo1,
y5'[x] == (Mo2 - (Jo1 - Jo3)*y4[x]*y6[x])/Jo2,
y6'[x] == (Mo3 - (Jo2 - Jo1)*y5[x]*y4[x])/Jo3};
(* Initial conditions *)
initialConditions = {
y1[0] == 3, y2[0] == 1, y3[0] == 2, y4[0] == 1, y5[0] == 2, y6[0] == 1};
(*Variables*)
vars = {y1, y2, y3, y4, y5, y6};
ListLinePlot[
NDSolveValue[
{eqns, initialConditions}
, vars, {x, 0, 20}
, WorkingPrecision -> 32
, PrecisionGoal -> 8]
, PlotLegends -> vars]
Another approach to the problem as given:
psol = ParametricNDSolveValue[{
ode = {
y1'[x] ==
y4[x]*Sin[y3[x]]/Sin[y2[x]] + y5[x]*Cos[y3[x]]/Sin[y2[x]],
y2'[x] == y4[x]*Cos[y3[x]] y5[x]*Sin[y3[x]],
y3'[x] == y4[x]*Sin[y3[x]]*Cos[y2[x]]/Sin[y2[x]] -
y5[x]*Cos[y3[x]]*Cos[y2[x]]/Sin[y2[x]],
y4'[x] == (mo1 - (jo3 - jo2)*y6[x]*y5[x])/jo1,
y5'[x] == (mo2 - (jo1 - jo3)*y4[x]*y6[x])/jo2,
y6'[x] == (mo3 - (jo2 - jo1)*y5[x]*y4[x])/jo3}
, ics = {
y1[0] == y10, y2[0] == y20, y3[0] == y30,
y4[0] == y40, y5[0] == y50, y6[0] == y60}
}, vars = {y1, y2, y3, y4, y5, y6}
, {x, 0, 20}
, params = {
mo1, mo2, mo3, jo1, jo2, jo3,
y10, y20, y30, y40, y50, y60}];
ListLinePlot[
psol[2/5, 2/5, 2/5, 1/5, 2/5, 3/5, 3, 1, 2, 1, 2, 1],
PlotLegends -> vars]
(* same plot as above *)
NDSolve
and notNDsolve
. ALso I see no numerical values forJo1
andJo2
and all the Mos there? Also, since you are dividing by dependent variables in many places, and your IC's are zero, you will get1/0
errors. $\endgroup$