# NDSolve: Unable to find initial conditions

**URL:** <https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772>\
**Category:** Questions\
**Tags:** calculus, equation-solving, numerical-computation\
**Created:** [March 17, 2023, 11:30pm UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772 "2023-03-17T23:30:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolandfranzius](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rolandfranzius](https://community.wolfram.com/u/rolandfranzius)\
**Post date:** [March 17, 2023, 11:30pm UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772/1 "2023-03-17T23:30:05Z")

</div>

[@ZSeong Hwang](https://community.wolfram.com/web/jisunghwang0603) Your posting has no reply window.

In your equations an initial condition for theta’[0] seems to be missing

[pre\_iypt\_2.nb](https://community.wolfram.com/uploads/short-url/iBc9gHs1kI8a4W2g985ZboehB2o.nb) (38.4 KB)

---

<div class="post-metadata">

**Author:** ![jisunghwang0603](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jisunghwang0603/32/34617_2.png) [@jisunghwang0603](https://community.wolfram.com/u/jisunghwang0603)\
**Post date:** [March 17, 2023, 11:57pm UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772/2 "2023-03-17T23:57:26Z")

</div>

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/e35d4894-c085-42ff-a809-a3bf8f278875)

Hello Roland. I put initial condition for theta dot. But still not working.

[pre\_iypt\_2 \_OP\_1\_CP\_.nb](https://community.wolfram.com/uploads/short-url/ijHius68R06xxoJFIBzjtfGWGo2.nb) (38.4 KB)

---

<div class="post-metadata">

**Author:** ![rolandfranzius](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rolandfranzius](https://community.wolfram.com/u/rolandfranzius)\
**Post date:** [March 18, 2023, 12:55am UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772/3 "2023-03-18T00:55:23Z")

</div>

To make your notebook readable and tractable, put a semicolon ; behind each setting line and break the commands into different input cells.

Its is too time consuming, if for checking for syntax errors the notebook has to be edited beforehand.

Roland

---

<div class="post-metadata">

**Author:** ![anon21378091](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@anon21378091](https://community.wolfram.com/u/anon21378091)\
**Post date:** [March 18, 2023, 7:24am UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772/4 "2023-03-18T07:24:49Z")

</div>

Parameter fixing

```
L = 0.001;
d = 0.001;
l = 0.001;
B = 0.1;
M = 0.001;
k = 1;
R = 0.001;
g = 10;
rx0 = L/2;
rz0 = L/2 + d + l/2;
r0 = Sqrt[rx0^2 + rz0^2];
A0 = -rz0 rx0;
Fz0 = B/r0^5 (rx0 - 2 rz0 + 5 A0/r0^2 rz0);

Spherical coordinates by time dependent angles

rx = L/2 Sin[alpha[t]] Cos[psi[t]];
ry = L/2 Sin[alpha[t]] Sin[psi[t]];
rz = L/2 Cos[alpha[t]] + d + l/2;
r = Sqrt[rx^2 + ry^2 + rz^2];

 A spherical coordinate tensor A of rank 2 and a vector F

In[18]:= A = (rx^2 + ry^2) Cos[alpha[t]] - ry rz Sin[alpha[t]] Sin[psi[t]] - 
   rz rx Sin[alpha[t]] Cos[psi[t]];
Fx = B/r^5 (-4 rx Cos[alpha[t]] + rz Sin[alpha[t]] Cos[psi[t]] + 5 A/r^2 rx);
Fy = B/r^5 (-4 ry Cos[alpha[t]] + rz Sin[alpha[t]] Sin[psi[t]] + 5 A/r^2 ry);
Fz = B/r^5 (ry Sin[alpha[t]] Sin[psi[t]] + rx Sin[alpha[t]] Cos[psi[t]] - 
     2 rz Cos[alpha[t]] + 5 A/r^2 rz);

Three equations of of second order for alpha , theta of the form    

```

D{rx, ry, rz},t,t]== Fx + fs + Nf

```
In[48]:= D[rx, t, t] /. {_?NumericQ :> 1} // FullSimplify

Out[48]= Sin[alpha[t]] (Cos[psi[t]] + Sin[psi[t]]) Derivative[1][psi][t] + 
 Derivative[1][alpha][
   t] (Cos[psi[t]] (Cos[alpha[t]] + Sin[alpha[t]]) + 
    Cos[alpha[t]] Sin[psi[t]] Derivative[1][psi][t])

In[46]:= eq1 = M L/
     2 (alpha''[t] Cos[alpha[t]] Cos[psi[t]] - 
      psi''[t] Sin[alpha[t]] Sin[psi[t]] - (alpha'[t]^2 + psi'[t]^2) Sin[
        alpha[t]] Cos[psi[t]] - 
      2 alpha'[t] psi'[t] Cos[alpha[t]] Cos[psi[t]]) == 
   Fx + (fs[t] + k Nf[t] theta'[t]) Sin[psi[t]];

eq2 = M L/
     2 (alpha''[t] Cos[alpha[t]] Sin[psi[t]] + 
      psi''[t] Sin[alpha[t]] Cos[psi[t]] - (alpha'[t]^2 + psi'[t]^2) Sin[
        alpha[t]] Sin[psi[t]] + 
      2 alpha'[t] psi'[t] Cos[alpha[t]] Cos[psi[t]]) == 
   Fy - (fs[t] + k Nf[t] theta'[t]) Cos[psi[t]];

eq3 = M R (alpha''[t] Cos[alpha[t]] - alpha'[t]^2 Sin[alpha[t]]) - 
    M L/2 (alpha''[t] Sin[alpha[t]] + alpha'[t]^2 Cos[alpha[t]]) == 
   Fz + M g + Nf[t];

One algebraic constraint for two unknown functions Nf and fs, once theta is known

eq4 = theta''[t] - 2 k Nf[t]/(M R) theta'[t] - 2 fs[t]/(M R) == 0;

One algebraic equation for alpha, once theta and psi are known

eq5 = L/2 Sin[alpha[t]] psi'[t] - R theta'[t] == 0;

Any differential equation for Nf and fs is missing , so the given values at one point are void, the system is indefinite with respect to Nf and fs. On the other hand eq5 is a constraint to the second order system {alpha, psi, theta} . So the system is over-under-determined, an error that NDSolve seems to be unable to detect.

In[37]:= soln = nDSolve[{eq1, eq2, eq3, eq4, eq5, alpha[0] == Pi/2, alpha'[0] == 1, 
   theta[0] == 0, theta'[0] == 1/2, psi[0] == 0, psi'[0] == 1, 
   Nf[0] == -Fz0 - M g, Nf'[0] == 1, fs[0] == 0, fs'[0] == 1}, {alpha[t], 
   theta[t], psi[t], Nf[t], fs[t]}, {t, 0, 10}]

```

–

Roland Franzius

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [March 18, 2023, 10:51am UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772/5 "2023-03-18T10:51:23Z")

</div>

Your initial conditions are not compatible with eq1

```
(eq1 /. t -> 0) /. {alpha[0] -> \[Pi]/2, psi[0] -> 0, 
  theta[0] -> 0, Derivative[1][alpha][0] -> 1, 
  Derivative[1][psi][0] -> 1, Derivative[1][theta][0] -> 1/2}

False

```

Your system has no solution.

---

<div class="post-metadata">

**Author:** ![wernergg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wernergg/32/6481_2.png) [@wernergg](https://community.wolfram.com/u/wernergg)\
**Post date:** [March 18, 2023, 5:50pm UTC](https://community.wolfram.com/t/ndsolve-unable-to-find-initial-conditions/21772/6 "2023-03-18T17:50:11Z")

</div>

The reason for the message _NDSolve::pdord_ is that you do not specify differential equations for Nf[t] and fs[t]. So we are only dealing with arbitrary predefined functions Nf[t] and fs[t] with given values and derivatives at t = 0.

How is this supposed to be numerically solvable?

I think your problem is not yet sufficiently specified.
