I have a rather complicated differential equation, $$\ddot \theta=\frac{ml(g-l\dot\theta^2 \cos \theta)(\sin\theta - \mu_k \cos\theta)}{I+ml^2\sin\theta(\sin\theta-\mu_k \cos \theta)}$$ I have managed to solve this equation using DSolve. Now, I want to substitute the solution $\theta [t]$ into another function: $$F[t]=m[l(\ddot\theta \cos \theta-\dot\theta^2 \sin\theta)]$$. However, I cannot do it.

The code is attached:

sol=DSolve[θ''[t]==(m l (g - Ι (θ'[t])^2 Cos[θ[t]])(Sin [θ[t]]-μk Cos[θ[t]]))/(Ι + m l^2 Sin[θ[t]](Sin[θ[t]]-μk Cos[θ[t]])), θ[t], t]

Ak = sol[[1]]

j = sol[[2]]

DSolve [{F[t] ==m l (θ''[t] Cos[θ[t]]-θ[t]'^2 Sin[θ[t]])}/.k,F[t],t]

DSolve [{F[t] ==m l (θ''[t] Cos[θ[t]]-θ[t]'^2 Sin[θ[t]])}/.j,F[t],t]

DSolve[{n[t]- m g==-m l(θ''[t]Sin[θ[t]]+θ'^2 Cos[θ[t]]) }/.k, n[t], t]

DSolve[{n[t]- m g==-m l(θ''[t] Sin[θ[t]]+θ'^2 Cos[θ[t]]) }/.j, n[t], t]

DEFricitonk = NDSolve[{F[t] ==m l (θ''[t] Cos[θ[t]]-θ[t]'^2 Sin[θ[t]]), θ[0]== π/2,θ'[0]==0, F[0]==0}/.k,F,{t,0,5}]

DEFrictionj= NDSolve[{F[t] ==m l (θ''[t] Cos[θ[t]]-θ[t]'^2 Sin[θ[t]]), θ[0]== π/2,θ'[0]==0, F[0]==0}/.j,F,{t,0,5}]

DENormalk= NDSolve[{n[t]- m g==-m l(θ''[t]Sin[θ[t]]+θ'^2 Cos[θ[t]]) , θ[0]== π/2,θ'[0]==0, F[0]==0}/.k,n,{t,0,5}]

DENormalj= NDSolve[{n[t]- m g==-m l(θ''[t]Sin[θ[t]]+θ'^2 Cos[θ[t]]) , θ[0]== π/2,θ'[0]==0, F[0]==0}/.j,n,{t,0,5}] 

Please send help. Thank you so much.

  • 1
    $\begingroup$ You question concerns one ode and one substitution. And your ?minimal? working example consists out of 9 (N)DSolve commands? $\endgroup$ Nov 11 '20 at 15:44
  • $\begingroup$ Consider whether DSolveValue or NDSolveValue might give answers in a more convenient form for you. $\endgroup$
    – Michael E2
    Nov 11 '20 at 17:09


teta = DSolve[θ''[t] == (m l (g - Ι (θ'[t])^2 Cos[θ[t]]) (Sin[θ[t]] - μk Cos[θ[t]]))/(Ι +m l^2 Sin[θ[t]] (Sin[θ[ t]] - μk Cos[θ[t]]))
, θ , t][[1]] //Quiet

The subsitution into the equation F[t]==…follows using the substitution /. θ -> teta to

F[t] == m l (θ''[t] Cos[θ[t]] - θ[t]'^2 Sin[θ[t]]) /. θ -> teta 

The numerical case is solved much easier:

teta=NDSolveValue[{\[Theta]''[t] == (m l (g -i (\[Theta]'[t])^2 Cos[\[Theta][t]]) (Sin[\[Theta][t]] - \[Mu]k Cos[\[Theta][t]]))/(i +m l^2 Sin[\[Theta][t]](Sin[\[Theta][t]] - \[Mu]k Cos[\[Theta][t]]))
, \[Theta][0] == \[Pi]/2, \[Theta]'[0] == 0} /. {m -> 0.03517,l -> 0.0279,g -> 9.81,i -> 10.^-3 ,\[Mu]k -> 0.1827}, \[Theta] , {t, 0, 5}]  


F[t] == m l (\[Theta]''[t] Cos[\[Theta][t]] - \[Theta][t]'^2 Sin[\[Theta][t]]) 
/. \[Theta] -> teta // Simplify
  • $\begingroup$ For some reason I can't plot the graph $\endgroup$ Nov 12 '20 at 1:09
  • $\begingroup$ If you would specify "for some reason" one could try to help. Plot[teta[t], {t, 0, 5}] works. $\endgroup$ Nov 12 '20 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.