# Troubleshooting an NDSolve::ndfdmc error message

Τhe following code

Ay[ξ_] := A0*(1 - κ^2)^.5*Exp[-(δ ξ - φ)^2/2] Sin[ξ]
Az[ξ_] := A0*κ*Exp[-(δ ξ - φ)^2/2] Cos[ξ]
Ay1[ξ_] := D[Ay[ξ], ξ]
Az1[ξ_] := D[Az[ξ], ξ]
j1 = DSolve[{y''[ξ] + r^2 y[ξ] == r/Δ (α2 - Az[ξ]) - 1/Δ Ay1[ξ],
z''[ξ] + r^2 z[ξ] == -1/Δ Az1[ξ] - r (α1 - Ay[ξ]), y[0] == yo,
y'[0] == Pyo/Δ, z[0] == zo, z'[0] == Pzo/Δ}, {y, z}, ξ]

Py[ξ_] := D[y[ξ] /. j1, ξ]
Pz[ξ_] := D[z[ξ] /. j1, ξ]
P1[ξ_] := Py[ξ]^2 + Pz[ξ]^2
A0 = 7; δ = 1/15; r = 1; φ = 5; κ = 1/Sqrt[2]; α1 = 0; α2 = 0; Δ = 1;
yo = 0; zo = 0; Pyo = 0; Pzo = 0;
j2 = NDSolve[{x'[ξ] == P1[ξ], x[0] == 0}, x[ξ], {ξ, 0, 1.6*2 π/δ}]


produces the message

NDSolve::ndfdmc: Computed derivatives do not have dimensionality consistent with the initial conditions. >>

How can I fix this so that I can plot x[ξ]?

Plot[x[ξ] /. j2, {ξ, 0, 1.6*2*π/δ},
PlotStyle -> Automatic, PlotRange -> All, AxesOrigin -> {0, 0}]

-
Please do not dump a block of code and ask us to debug it. Explain what your problem is in a little more detail and reduce it to a minimal example. Have you looked into your equations to see if it makes any sense? Because we can't help you there unless you tell us what it is that you're trying to do. Also, please see the [editing help](mathematica.stackexchange.com/editing-help) – R. M. Mar 13 '13 at 14:09
I am asking the question for the first time so added the block for completeness. My Problem is that the mathematical solution that comes out from DSolve has to be used in NDSolve. But the problem is with the NDSOLVe Which gives above error. – Vikram Sagar Mar 13 '13 at 14:22
Yes, adding code is always good. I meant, could you also add the mathematical equations (in latex) that are behind your DSolve/NDSolve? The error message points to some inconsistency, which could've very well been your transcribing error... – R. M. Mar 13 '13 at 14:24

Replace the second part for:

Py[ξ_] := D[y[ξ] /. j1[[1]], ξ]
Pz[ξ_] := D[z[ξ] /. j1[[1]], ξ]
P1[ξ_] := Py[ξ]^2 + Pz[ξ]^2
A0 = 7; δ = 1/15; r = 1; φ = 5; κ = 1/Sqrt[2]; α1 = 0; α2 = 0; Δ = 1;
yo = 0; zo = 0; Pyo = 0; Pzo = 0;
j2 = NDSolve[{x'[ξ] == P1[ξ], x[0] == 0}, x[ξ], {ξ, 0, 1.6*2 π/δ}]

Plot[Re[x[ξ] /. j2], {ξ, 0, 1.6*2 Pi/δ}]


-
Thanks for the help !!!! – Vikram Sagar Mar 15 '13 at 7:58
I appreciate your help, but could you please tell me what this symbolize, so that for future works, I should be vigilant. – Vikram Sagar Mar 15 '13 at 8:06
@VikramSagar j1is a List. You need to get the first element that's all – Dr. belisarius Mar 15 '13 at 8:10