Why Does NDSolve Exceed Time Constraints with Second-Order Equations?

  • Mathematica
  • Thread starter arshia
  • Start date
  • Tags
    Mathematica
In summary, the conversation is about a user encountering an error while using NDSolve for a system with three second-order equations. The error message suggests using a different method to solve the equations, but the user is still having trouble. The conversation also includes a request for the user to post the code that is generating the error. The code is eventually posted, but it contains special characters and is difficult to read.
  • #1
arshia
17
0
hi everybody
i recently used NDSolve for a system with three second-order equations but it says:
"NDSolve::ndsdtc:
("\"The time constraint of 1.` seconds was exceeded trying to solve for derivatives, so the system will be treated as a system of differential-algebraic equations. You can use Method->{\\\"EquationSimplification\\\"->\\\"Solve\\\"} to have the system solved as ordinary differential equations."

whats the problem? can anyone help me soon?! i can't give answer even if i change the Method or using DSolve instead NDSolve... :(
 
Physics news on Phys.org
  • #2
It sounds like the equations that you have are not in the form of a derivative on the left and a function on the right. It looks like Mathematica is having trouble trying to put it in that form.

Can you post the code that is generating this error?
 
  • #3
DaleSpam said:
It sounds like the equations that you have are not in the form of a derivative on the left and a function on the right. It looks like Mathematica is having trouble trying to put it in that form.

Can you post the code that is generating this error?

the code is :
matherror.jpg
 
  • #4
Ugh, I cannot do anything with a blurry picture of code. Please post the code, not a picture of the code. I need enough code to be able to replicate the error here.
 
  • #5
DaleSpam said:
Ugh, I cannot do anything with a blurry picture of code. Please post the code, not a picture of the code. I need enough code to be able to replicate the error here.

Ok but because of containing special characters,you must copy the code into your own Mathematica to see it correctly...
Code:
lagrange\[CurlyPhi]i1=
56.8293 (Sin[\[Pi]/
      45] (0.169258 Cos[\[CurlyPhi]i1[t]] + 
       0.0118478 Sin[\[CurlyPhi]i1[t]]) + 
    Cos[\[Pi]/
      45] (-0.0653683 Cos[\[CurlyPhi]i1[t]] + 
       0.169258 Sin[\[CurlyPhi]i1[t]])) - 
 1.46445 (2 (-0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t]) (-0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[t]] Derivative[1][\[CurlyPhi]i1][
         t] + 0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    2 (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t]) (0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[t]] Derivative[1][\[CurlyPhi]i1][
         t] - 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) + 
 i1 (\[CurlyPhi]i1^\[Prime]\[Prime])[t] + 
 1.46445 (-0.339345 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
      1][\[CurlyPhi]i1][
      t] (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.339345 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
      1][\[CurlyPhi]i1][
      t] (0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] - 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.339345 Cos[
      0.0698842 - \[CurlyPhi]i1[
        t]] (-0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t]^2 + 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] Derivative[1][\[CurlyPhi]i2][t] + 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 + 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i1^\[Prime]\[Prime])[t] + 
       0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]) + 0.339345 Sin[
      0.0698842 - \[CurlyPhi]i1[
        t]] (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t]^2 + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] Derivative[1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 - 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 + 
       0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i1^\[Prime]\[Prime])[t] - 
       0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]))

lagrange\[CurlyPhi]i2=
28.7325 (0.00908229 Cos[\[CurlyPhi]i2[t]] + 
    0.129883 Sin[\[CurlyPhi]i2[t]]) + 
 56.8293 (0.0181646 Cos[\[CurlyPhi]i2[t]] + 
    0.259766 Sin[\[CurlyPhi]i2[t]]) - 
 1.46445 (0.5208 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
      t] (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.5208 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
      t] (0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] - 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) - 
 2.8965 (0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
      t] (-0.1302 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
      t] (-0.1302 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) + 
 i2 (\[CurlyPhi]i2^\[Prime]\[Prime])[t] + 
 1.46445 (2 (0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]) (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    2 (0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]) (0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] - 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    2 (0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] - 
       0.2604 Cos[\[CurlyPhi]i2[t]]) (-0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[t]] Derivative[1][\[CurlyPhi]i1][
         t]^2 + 0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] Derivative[1][\[CurlyPhi]i2][t] + 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 + 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i1^\[Prime]\[Prime])[t] + 
       0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]) + 2 (-0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] - 
       0.2604 Sin[\[CurlyPhi]i2[t]]) (-0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[t]] Derivative[1][\[CurlyPhi]i1][
         t]^2 + 0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] Derivative[1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 - 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 + 
       0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i1^\[Prime]\[Prime])[t] - 
       0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t])) + 2.8965 (0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[
      1][\[CurlyPhi]i2][
      t] (-0.1302 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
      t] (-0.1302 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.2604 Cos[\[CurlyPhi]i2[
       t]] (0.1302 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 + 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.1302 Cos[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]) - 
    0.2604 Sin[\[CurlyPhi]i2[
       t]] (-0.1302 Cos[\[CurlyPhi]i2[t]] Derivative[
         1][\[CurlyPhi]i2][t]^2 - 
       0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.1302 Sin[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]))

lagrange\[CurlyPhi]o1=
28.7325 (-0.00761741 + 
    Cos[\[Pi]/
      45] (0.0653683 Cos[\[CurlyPhi]o1[t]] - 
       0.318726 Sin[\[CurlyPhi]o1[t]])) + 
 28.7325 (-0.00761741 + 
    Cos[\[Pi]/
      45] (0.0772161 Cos[\[CurlyPhi]o1[t]] - 
       0.487984 Sin[\[CurlyPhi]o1[t]]) + 
    Sin[\[Pi]/
      45] (-0.429658 Cos[\[CurlyPhi]o1[t]] - 
       0.0118478 Sin[\[CurlyPhi]o1[t]])) + 
 56.8293 (-0.00761741 + 
    Cos[\[Pi]/
      45] (0.0772161 Cos[\[CurlyPhi]o1[t]] - 
       0.487984 Sin[\[CurlyPhi]o1[t]]) + 
    Sin[\[Pi]/
      45] (0.429658 Cos[\[CurlyPhi]o1[t]] - 
       0.0118478 Sin[\[CurlyPhi]o1[t]])) + 
 56.8293 (-0.00761741 + 
    Cos[\[CurlyPhi]o1[t]] (0.0772161 Cos[\[CurlyPhi]o1[t]] - 
       0.357784 Sin[\[CurlyPhi]o1[t]]) + 
    Sin[\[Pi]/
      45] (-0.299458 Cos[\[CurlyPhi]o1[t]] - 
       0.0118478 Sin[\[CurlyPhi]o1[t]]) - (0.1092 (1 - 
          Cos[\[CurlyPhi]o1[t]]) + 0.466984 Cos[\[CurlyPhi]o1[t]] + 
       0.0772161 Sin[\[CurlyPhi]o1[t]]) Sin[\[CurlyPhi]o1[t]]) - 
 1.46445 (-0.0153456 Cos[0.728647 - \[CurlyPhi]o1[t]] Sin[
      0.728647 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][
      t]^2 + 
    0.175189 Cos[0.728647 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.0875946 Sin[0.728647 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) - 
 2.8965 (-0.267938 Cos[1.35828 - \[CurlyPhi]o1[t]] Sin[
      1.35828 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][t]^2 + 
    0.732036 Cos[1.35828 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.366018 Sin[1.35828 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) - 
 1.46445 (0.988106 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.988106 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] - 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) - 
 2.8965 (0.988106 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (-0.1302 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.988106 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (-0.1302 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t])) + 
 i1 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] + 
 i2 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] + 
 1.46445 (-0.0306913 Cos[0.728647 - \[CurlyPhi]o1[t]] Sin[
      0.728647 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][
      t]^2 + 0.175189 Cos[0.728647 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.0875946 Sin[0.728647 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    0.0153456 Sin[
      0.728647 - \[CurlyPhi]o1[t]]^2 (\[CurlyPhi]o1^\[Prime]\[Prime])[
      t] + 2 (0.1092 - 
       0.0875946 Sin[0.728647 - \[CurlyPhi]o1[t]]) (0.0875946 Cos[
         0.728647 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][
         t]^2 + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.0875946 Sin[
         0.728647 - \[CurlyPhi]o1[
           t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[t])) + 
 2.8965 (-0.535877 Cos[1.35828 - \[CurlyPhi]o1[t]] Sin[
      1.35828 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][t]^2 + 
    0.732036 Cos[1.35828 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.366018 Sin[1.35828 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    0.267938 Sin[
      1.35828 - \[CurlyPhi]o1[t]]^2 (\[CurlyPhi]o1^\[Prime]\[Prime])[
      t] + 2 (0.1092 - 
       0.366018 Sin[1.35828 - \[CurlyPhi]o1[t]]) (0.366018 Cos[
         1.35828 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][
         t]^2 + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.366018 Sin[
         1.35828 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t])) + 1.46445 (0.988106 Cos[
      1.41389 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][
      t] (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.988106 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] - 
       0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i2][t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][t] + 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    2 (0.1092 - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]]) (-0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[t]] Derivative[1][\[CurlyPhi]i1][
         t]^2 + 0.169672 Sin[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] Derivative[1][\[CurlyPhi]i2][t] + 
       0.2604 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 + 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i1^\[Prime]\[Prime])[t] + 
       0.169672 Cos[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]) + 0.988106 Sin[
      1.41389 - \[CurlyPhi]o1[
        t]] (-0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t]^2 + 
       0.169672 Cos[0.0698842 - \[CurlyPhi]i1[t]] Derivative[
         1][\[CurlyPhi]i1][t] Derivative[1][\[CurlyPhi]i2][t] - 
       0.2604 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t]^2 - 0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 + 
       0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i1^\[Prime]\[Prime])[t] - 
       0.169672 Sin[
         0.0698842 - \[CurlyPhi]i1[
           t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[t] - 
       0.2604 Sin[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t])) + 2.8965 (0.988106 Cos[
      1.41389 - \[CurlyPhi]o1[t]] Derivative[1][\[CurlyPhi]o1][
      t] (-0.1302 Cos[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.1092 Derivative[1][\[CurlyPhi]o1][t] - 
       0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) - 
    0.988106 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
      1][\[CurlyPhi]o1][
      t] (-0.1302 Sin[\[CurlyPhi]i2[t]] Derivative[1][\[CurlyPhi]i2][
         t] + 0.494053 Sin[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]) + 
    2 (0.1092 - 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]]) (0.1302 Sin[\[CurlyPhi]i2[
          t]] Derivative[1][\[CurlyPhi]i2][t]^2 + 
       0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.1302 Cos[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.1092 (\[CurlyPhi]o1^\[Prime]\[Prime])[t] - 
       0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]) + 0.988106 Sin[
      1.41389 - \[CurlyPhi]o1[
        t]] (-0.1302 Cos[\[CurlyPhi]i2[t]] Derivative[
         1][\[CurlyPhi]i2][t]^2 - 
       0.494053 Cos[1.41389 - \[CurlyPhi]o1[t]] Derivative[
         1][\[CurlyPhi]o1][t]^2 - 
       0.1302 Sin[\[CurlyPhi]i2[t]] (\[CurlyPhi]i2^\[Prime]\[Prime])[
         t] + 0.494053 Sin[
         1.41389 - \[CurlyPhi]o1[t]] (\[CurlyPhi]o1^\[Prime]\[Prime])[
         t]))

lagrangesolve = 
 NDSolve[{lagrange\[CurlyPhi]i1 == 0, lagrange\[CurlyPhi]i2 == 0, 
   lagrange\[CurlyPhi]o1 == 0, \[CurlyPhi]o1[0] == -\[Pi]/
    36, \[CurlyPhi]i1[0] == \[Pi]/18, \[CurlyPhi]i2[0] == \[Pi]/
    18, \[CurlyPhi]o1'[0] == 0.5, \[CurlyPhi]i1'[0] == 
    0, \[CurlyPhi]i2'[
     0] == -0.75}, {\[CurlyPhi]o1, \[CurlyPhi]i1, \[CurlyPhi]i2}, {t, 
   0, 100}]
thanks for your consideration...
 
Last edited by a moderator:
  • #6
It looks like you have several occurrences of things like this
Code:
\[CurlyPhi]o1^\[Prime]\[Prime]

The problem with this is the exponent symbol ^ You do not want to raise Phi to the power of '', you want to take the second derivative of Phi. So this should either be
Code:
Derivative[2][f][t]
or
Code:
f''[t]

Btw, when you have strange evaluation errors, one very useful function is "FullForm" which will show the internal representation of your code. It is also helpful for posting here so that there isn't any copy-paste "mangling" by the clip board.
 
  • #7
DaleSpam said:
It looks like you have several occurrences of things like this
Code:
\[CurlyPhi]o1^\[Prime]\[Prime]

The problem with this is the exponent symbol ^ You do not want to raise Phi to the power of '', you want to take the second derivative of Phi. So this should either be
Code:
Derivative[2][f][t]
or
Code:
f''[t]

Btw, when you have strange evaluation errors, one very useful function is "FullForm" which will show the internal representation of your code. It is also helpful for posting here so that there isn't any copy-paste "mangling" by the clip board.
Thank you very much DaleSpam. now it works correctly but i want to know if there is a problem when it gives me the answer but also say :

NDSolve::ntdvdae: Cannot solve to find an explicit formula for the derivatives. NDSolve will try solving the system as differential-algebraic equations. >>

can it make a problem for me?!
 
  • #8
You may have some loss of precision due to using different techniques that are less precise but more flexible. I would simply check the precision at the end to make sure it is enough.
 
  • #9
DaleSpam said:
You may have some loss of precision due to using different techniques that are less precise but more flexible. I would simply check the precision at the end to make sure it is enough.

Thank you DaleSpam... :)
 
  • #10
Hello dear Dale
recently i had written a code in mathematica and used NDSolve to solve equations as below :

\[Gamma] = 0.01;
equ1 = \[Theta]''[t] - Sin[\[Theta][t] - \[Gamma]];
equ2 = -\[CurlyPhi]''[t] + \[Theta]''[
t] + (\[Theta]'[t])^2 Sin[\[CurlyPhi][t]] -
Cos[\[Gamma] - \[Theta][t]] Sin[\[CurlyPhi][t]];
equ = NDSolve[{equ1 == 0,
equ2 == 0, \[Theta][0] == 0.207347739624690, \[CurlyPhi][0] ==
0.414695479249380, \[Theta]'[
0] == -0.206130845238664, \[CurlyPhi]'[
0] == -0.017471844666685}, {\[Theta], \[CurlyPhi]}, {t, 0, 5},
MaxSteps -> 100000]

and it gives me two interpolating function :

{{\[Theta] -> \!\(\*
TagBox[
RowBox[{"InterpolatingFunction", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{",
RowBox[{"0.`", ",", "5.`"}], "}"}], "}"}], ",", "\<\"<>\"\>"}], "]"}],
False,
Editable->False]\), \[CurlyPhi] -> \!\(\*
TagBox[
RowBox[{"InterpolatingFunction", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{",
RowBox[{"0.`", ",", "5.`"}], "}"}], "}"}], ",", "\<\"<>\"\>"}], "]"}],
False,
Editable->False]\)}}

now i want to check the situation that "Phi" will be equal to "2*Theta" in an "if". but i don't know how i can find the "t" that satisfies this condition when i just have two interpolating function?
can you help me pls Dale?
 
  • #11
Hello dear Dale
recently i had written a code in mathematica and used NDSolve to solve equations as below :

\[Gamma] = 0.01;
equ1 = \[Theta]''[t] - Sin[\[Theta][t] - \[Gamma]];
equ2 = -\[CurlyPhi]''[t] + \[Theta]''[
t] + (\[Theta]'[t])^2 Sin[\[CurlyPhi][t]] -
Cos[\[Gamma] - \[Theta][t]] Sin[\[CurlyPhi][t]];
equ = NDSolve[{equ1 == 0,
equ2 == 0, \[Theta][0] == 0.207347739624690, \[CurlyPhi][0] ==
0.414695479249380, \[Theta]'[
0] == -0.206130845238664, \[CurlyPhi]'[
0] == -0.017471844666685}, {\[Theta], \[CurlyPhi]}, {t, 0, 5},
MaxSteps -> 100000]

and it gives me two interpolating function :

{{\[Theta] -> \!\(\*
TagBox[
RowBox[{"InterpolatingFunction", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{",
RowBox[{"0.`", ",", "5.`"}], "}"}], "}"}], ",", "\<\"<>\"\>"}], "]"}],
False,
Editable->False]\), \[CurlyPhi] -> \!\(\*
TagBox[
RowBox[{"InterpolatingFunction", "[",
RowBox[{
RowBox[{"{",
RowBox[{"{",
RowBox[{"0.`", ",", "5.`"}], "}"}], "}"}], ",", "\<\"<>\"\>"}], "]"}],
False,
Editable->False]\)}}

now i want to check the situation that "Phi" will be equal to "2*Theta" in an "if". but i don't know how i can find the "t" that satisfies this condition when i just have two interpolating function?
can you help me pls Dale?
 
  • #12
arshia said:
now i want to check the situation that "Phi" will be equal to "2*Theta" in an "if". but i don't know how i can find the "t" that satisfies this condition when i just have two interpolating function?
can you help me pls Dale?
Hi arshia,

My general philosophy when dealing with numerical functions is that graphical visualization of what is going on is the most important thing. So I would start with a plot of the equations over the full range:

Plot[{2 \[Theta][t], \[CurlyPhi][t]} /. equ, {t, 0, 5}]

From that plot you can see that there are two or three roots. The best way to find them is to use FindRoot. Looking at the plot there appears to be a root near t=0.1, t=2., and t=4. So I would use:

FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /. equ, {t, .1}]

FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /. equ, {t, 2.}]

FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /. equ, {t, 4.}]
 
  • #13
DaleSpam said:
Hi arshia,

My general philosophy when dealing with numerical functions is that graphical visualization of what is going on is the most important thing. So I would start with a plot of the equations over the full range:

Plot[{2 \[Theta][t], \[CurlyPhi][t]} /. equ, {t, 0, 5}]

From that plot you can see that there are two or three roots. The best way to find them is to use FindRoot. Looking at the plot there appears to be a root near t=0.1, t=2., and t=4. So I would use:

FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /. equ, {t, .1}]

FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /. equ, {t, 2.}]

FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /. equ, {t, 4.}]
This is a good idea but in fact in my general code i have a "for" loop that must finds this roots automatically in each loop and we know that the figure changes. then i can't define the starting point for FindRoot. have you any idea for it?
regards
 
  • #14
All I can think of would be to put FindRoot inside a function which would loop over possible starting points for FindRoot and then return all unique roots.
 
  • #15
ok, thank you very much DaleSpam
 
  • #16
By the way. What are you doing with multiple roots? Are you keeping all of them, or are you selecting one? If you are selecting one, what criteria are you using?
 
  • #17
i wrote a new code that have a limiting condition for finding roots and it works correctly in general. but i recently faced with some points that FindRoot could not find a solution for them even though in fact we know it has a solution ! my code is as below for i,j,k,l as defined :

-------------------------------------------------------------------------------
\[Gamma] = 0.01;
equ1 = \[Theta]''[t] - Sin[\[Theta][t] - \[Gamma]];
equ2 = -\[CurlyPhi]''[t] + \[Theta]''[
t] + (\[Theta]'[t])^2 Sin[\[CurlyPhi][t]] -
Cos[\[Gamma] - \[Theta][t]] Sin[\[CurlyPhi][t]];
array = {{"i", "j", "k", "l", "time", "\[Theta]t[[1]]",
"\[CurlyPhi]t[[1]]", "\[Theta]dott[[1]]", "\[CurlyPhi]dott[[1]]"}};
o = 0;

i = 1;
j = 1;
k = 3;
l = 6;

equ = NDSolve[{equ1 == 0,
equ2 == 0, \[Theta][0] == 0.15 + i/100, \[CurlyPhi][0] ==
0.375 + j/100, \[Theta]'[0] == -0.15 - k/100, \[CurlyPhi]'[0] ==
0.00 - l/100}, {\[Theta], \[CurlyPhi]}, {t, 0, 5},
MaxSteps -> 100000];
For[\[Tau] = 1, \[Tau] <
251, \[Tau]++, \[Theta]t = \[Theta][\[Tau]/50] /.
equ; \[CurlyPhi]t = \[CurlyPhi][\[Tau]/50] /. equ;
If[2.00 \[Theta]t[[1]] < \[CurlyPhi]t[[1]] <
1.90 \[Theta]t[[1]] && \[Theta]t[[1]] < 0,
time = (FindRoot[(2 \[Theta][t] == \[CurlyPhi][t]) /.
equ, {t, (\[Tau]/50)}]); time = t /. time;
If[0 < time <
5, \[Theta]t = \[Theta][time] /.
equ; \[CurlyPhi]t = \[CurlyPhi][time] /. equ; Break[],
time = 0.25; \[Theta]t = \[Theta][time] /.
equ; \[CurlyPhi]t = \[CurlyPhi][time] /. equ;],
time = 0.25; \[Theta]t = \[Theta][time] /.
equ; \[CurlyPhi]t = \[CurlyPhi][time] /. equ;]];

time

If[2 \[Theta]t == \[CurlyPhi]t, \[Theta]t = \[Theta][time] /.
equ; \[CurlyPhi]t = \[CurlyPhi][time] /.
equ; \[Theta]dott = \[Theta]'[time] /.
equ; \[CurlyPhi]dott = \[CurlyPhi]'[time] /. equ;
array = Append[
array, {i, j, k, l,
time, \[Theta]t[[1]], \[CurlyPhi]t[[1]], \[Theta]dott[[
1]], \[CurlyPhi]dott[[1]]}]; o = o + 1;]

\[Theta]t

\[CurlyPhi]t

\[Theta]dott

\[CurlyPhi]dott

o
--------------------------------------------------------

as you see , FindRoot can not find any answer even though it has...!

the error is :

InterpolatingFunction::dmval: Input value {7.33381} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
InterpolatingFunction::dmval: Input value {7.33381} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
InterpolatingFunction::dmval: Input value {-3.67762} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
The line search decreased the step size to within tolerance specified \
by AccuracyGoal and PrecisionGoal but was unable to find a sufficient \
decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these \
tolerances. >>

note that it gives me an answer " {t -> 2.32069} " but this answer does not satisfy my conditions(equality) and for this, o does not change as we expect.
i completely confused !
 
  • #18
i don't know what this error means(i know its definition but also know no number lies out of the range in my code) and why occurs. have you any idea for this problem?
 
Last edited:
  • #19
arshia said:
FindRoot can not find any answer even though it has...!
It looks to me like Mathematica is correct. It does not have a root. After the call to NDSolve run this:

Plot[(2 \[Theta][t] - \[CurlyPhi][t]) /. equ, {t, 0, 5}]

and then

FindMaximum[(2 \[Theta][t] - \[CurlyPhi][t]) /. equ, {t, 2.5}]

You see that it gets close to 0, but does not actually reach 0. The equation does not have a root in the range 0 to 5.
 
  • #20
yes but my problem is not about having solution or not, the problem is the error:

InterpolatingFunction::dmval: Input value {7.33381} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

nowhere in my code "t" lies out of the range. my t range is 0 to 5. why FindRoot goes and checks 7.33381 that is out of range...?
thank for your concentration
 
  • #21
You didn't tell FindRoot not to. You used the call:

FindRoot[lhs==rhs,{x,x0}]

That tells FindRoot to start at x0 but doesn't tell it to stop anywhere.

FindRoot does not know that your equation uses InterpolatingFunctions, and so it has no reason to suspect that it is not valid outside of some range. So it will ask the interpolating functions for values at t=7.33 etc. The InterpolatingFunction object will return a value, which FindRoot has no reason to suspect. The InterpolatingFunction object warns you directly that it has done so, but since it provides a value the processing for FindRoot continues.

If you want FindRoot to stop outside of a range then you must use:

FindRoot[lhs==rhs,{x,x0,xMin,xMax}]
 
  • #22
i didnt know it...
Thanks for your good informations
 
  • #23
Hi DaleSpam
how are you today?
can u tell me about the error :

Set::write: Tag Times in Null {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,<<1089>>} is Protected. >>

i read about it but yet don't know why it occurs?
when i run my code part by part it doesn't occur but when i run it as a loop it appears...
 
  • #24
Do you have a "=" when you mean "=="

Usually this happens when you have an expression like "a b = c d" when you really mean "a b == c d". The first expression is assigning the value "c d" to the symbol "a b", but the symbol "a b" cannot be assigned a value because in FullForm it is Times[a,b] and Times is protected. The second expression is a logical test to see if "a b" is equal to "c d".
 
  • #25
Thank you Dale, i don't know what the problem was but it was solved in my new run.maybe i made a mistake like the one you said...
but after that, recently i wrote the code below but don't know what the problem is :

NDSolve[{0.461543 Derivative[1][\[CurlyPhi]i1p][t] -
0.15287 Cos[\[CurlyPhi]i1p[t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.109551 Cos[
0.0698842 - \[CurlyPhi]i1p[t]] Cos[\[CurlyPhi]i1p[
t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.266334 Cos[\[CurlyPhi]i1p[t]]^2 Derivative[1][\[CurlyPhi]i1p][
t] - 0.237526 Cos[\[CurlyPhi]i1p[t]] Cos[
0.0698842 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]i1p][
t] - 0.810724 Cos[\[CurlyPhi]i1p[t]] Cos[\[CurlyPhi]o1p[
t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.109551 Sin[
0.0698842 - \[CurlyPhi]i1p[t]] Sin[\[CurlyPhi]i1p[
t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.266334 Sin[\[CurlyPhi]i1p[t]]^2 Derivative[1][\[CurlyPhi]i1p][
t] - 0.108096 Cos[\[CurlyPhi]i1p[t]] Sin[\[CurlyPhi]o1p[
t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.791229 Sin[\[CurlyPhi]i1p[t]] Sin[\[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]i1p][t] -
0.15287 Sin[\[CurlyPhi]i1p[t]] Sin[\[Pi]/
4 + \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.658836 Derivative[1][\[CurlyPhi]o1p][t] -
0.0459407 Cos[0.0698842 - \[CurlyPhi]i1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] -
0.15287 Cos[\[CurlyPhi]i1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.260609 Cos[0.0698842 - \[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] +
0.893445 Cos[\[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][
t] - 0.0237172 Sin[0.728647 - \[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] -
0.0692243 Cos[\[CurlyPhi]o1p[t]] Sin[
0.728647 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][
t] - 0.231541 Sin[1.35828 - \[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] -
0.359763 Cos[0.0698842 - \[CurlyPhi]o1p[t]] Sin[
1.35828 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.951876 Cos[\[CurlyPhi]o1p[t]] Sin[
1.35828 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.446306 Sin[1.41389 - \[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] +
0.207849 Cos[0.0698842 - \[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.69163 Cos[\[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.693459 Cos[0.0698842 - \[CurlyPhi]o1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
2.36692 Cos[\[CurlyPhi]o1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.207849 Sin[0.0698842 - \[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.69163 Sin[\[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.139507 Sin[\[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][
t] - 0.0462091 Sin[
0.728647 - \[CurlyPhi]o1p[t]] Sin[\[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] -
1.08607 Sin[
1.35828 - \[CurlyPhi]o1p[t]] Sin[\[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] -
2.62559 Sin[
1.41389 - \[CurlyPhi]o1p[t]] Sin[\[CurlyPhi]o1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] +
0.0237172 Sin[
0.728647 - \[CurlyPhi]o1p[t]] Sin[\[Pi]/
4 + \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.231541 Sin[
1.35828 - \[CurlyPhi]o1p[t]] Sin[\[Pi]/
4 + \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.446306 Sin[
1.41389 - \[CurlyPhi]o1p[t]] Sin[\[Pi]/
4 + \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][
t] == -0.79287,
0.461543 Derivative[1][\[CurlyPhi]i1p][t] +
0.109551 Cos[
0.0698842 - \[CurlyPhi]i1p[t]] Cos[\[CurlyPhi]i1p[
t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.266334 Cos[\[CurlyPhi]i1p[t]]^2 Derivative[1][\[CurlyPhi]i1p][
t] + 0.109551 Sin[
0.0698842 - \[CurlyPhi]i1p[t]] Sin[\[CurlyPhi]i1p[
t]] Derivative[1][\[CurlyPhi]i1p][t] +
0.266334 Sin[\[CurlyPhi]i1p[t]]^2 Derivative[1][\[CurlyPhi]i1p][
t] - 0.0459407 Cos[0.0698842 - \[CurlyPhi]i1p[t]] Derivative[
1][\[CurlyPhi]o1p][t] -
0.15287 Cos[\[CurlyPhi]i1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.207849 Cos[0.0698842 - \[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] +
0.69163 Cos[\[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.207849 Sin[0.0698842 - \[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][t] -
0.69163 Sin[\[CurlyPhi]i1p[t]] Sin[
1.41389 - \[CurlyPhi]o1p[t]] Derivative[1][\[CurlyPhi]o1p][
t] == -0.804102, \[CurlyPhi]i1p[0] == \[CurlyPhi]i2p[0] ==
0., \[CurlyPhi]o1p[0] ==
0.}, {\[CurlyPhi]o1p, \[CurlyPhi]i1p, \[CurlyPhi]i2p}, {t, 0, 2},
MaxSteps -> 1000000]

the error is :
NDSolve::ndode: Input is not an ordinary differential equation. >>


whats your suggestion DaleSpam?
 
  • #26
It looks like your equation does not involve any derivatives of \[CurlyPhi]i2p so it isn't an ordinary differential equation. It is a differential-algebraic equation, and it cannot solve all of those.
 
  • #27
Hi DaleSpam

Can you help me about the error findroot::istol please?
i recently used the code below but the error apeared :
------------------------------------------------------------------------------------------
lagrangesolveg2 =
NDSolve[{lagrangeq12 == 0, lagrangeq22 == 0, q1[0] == hh4,
q2[0] == hh5, q1'[0] == v1, q2'[0] == v2}, {q1, q2}, {t, 0, 1},
MaxSteps -> 1000000]
time2 = FindRoot[(q1[t] == -q2[t]) /. lagrangesolveg2, {t, 0.5, 0, 1}]

FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>

{t -> 0.113944}
------------------------------------------------------------------------------------------
i really don't know what is the difference between AccuracyGoal and PrecisionGoal and their relativity to WorkingPrecision and MachinPrecision (even i read all of the helps in software guide). how can i get rid off the error?
 
  • #28
Sorry i should send you the complete code .forgot that you can't run without "lagrangeq"s &...
here is the full code as an attachment...
please help me as you done it well in the past, if possible...
 

Attachments

  • ToDaleSpam.zip
    4.9 KB · Views: 246

1. Why is my NDSolve function not working?

There could be several reasons why your NDSolve function is not working. Some common issues include incorrect syntax, incompatible boundary or initial conditions, or an insufficient number of equations to solve the problem. Make sure to carefully check your code and consult the documentation for NDSolve to troubleshoot the issue.

2. How do I specify boundary conditions in NDSolve?

Boundary conditions can be specified by using the "DirichletCondition" or "NeumannValue" options in NDSolve. The "DirichletCondition" option sets the value of the function at the boundary, while "NeumannValue" sets the derivative of the function at the boundary. Make sure to specify the conditions for all boundaries in the problem.

3. My NDSolve function is taking a long time to run. How can I speed it up?

There are several ways to improve the performance of your NDSolve function. You can try using the "Method" option to specify a faster solver, or adjust the "PrecisionGoal" and "AccuracyGoal" options to trade off accuracy for speed. Additionally, you can consider simplifying your equations or breaking them into smaller pieces to reduce the computational load.

4. I am getting an error message while using NDSolve. What does it mean?

Error messages in NDSolve typically indicate an issue with the syntax or structure of your equations, or a problem with the boundary or initial conditions. Make sure to carefully check the error message and consult the documentation for NDSolve to understand the issue and troubleshoot it.

5. Can NDSolve be used for solving partial differential equations (PDEs)?

Yes, NDSolve can be used for solving PDEs. However, the syntax and options may be slightly different compared to solving ordinary differential equations (ODEs). Consult the documentation for NDSolve for more information on how to specify and solve PDEs using this function.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
Back
Top