0
$\begingroup$

When I evaluate the code shown below, it gives an error:

NDSolve::ndsz: At x == -0.00001, step size is effectively zero; singularity or stiff system suspected.

W := (2*Pi*3*10^14)
CC := 3*10^8
vt := ((2*T/me)^(1/2))
me := 9.11*10^-31
T := 1.6*10^-15
Wc := 1.6*10^-19/me
L := 0.00001
wp := W*Sqrt[(1 - x/L)]
Om := Wc
e0 := 8.85*10^-12
LnLumbda := 10
k := W/CC (1 - (1 - x/L)/(1 + (Wc)/W))^(1/2)
R := ((1 - x/L)*W^2*(1.6*10^-19)^2*Pi*Sqrt[me]*LnLumbda)/( T^(3/2)*e0)
q := (W + 2 I R - Om)/vt 
F := q/k
sol = 
  NDSolve[
    {(y''[x] + 
      (W^2/ (CC^2) + ((W (wp)^2)/((CC^2) vt k )) 
        ((E^-F^2 (-π Erfi[F] + Log[-(1/F)] + Log[F]))/Sqrt[π])) y[x]) == 0, 
     y'[-L] == 0, y[-L] == 10}, 
    y, {x, -L, L}]

I will appreciate any help.

$\endgroup$
3
  • 1
    $\begingroup$ So what's the problem? 1. Does the equation/system of equation actually have solution? 2. Can you get the solutions? $\endgroup$
    – user202729
    Dec 4, 2017 at 6:23
  • $\begingroup$ Are you sure, that your parameter definitions are right? With q you introduce the imaginary unit I. Plot the cofactor to y[x] in your diffequation to see it's highly oscillatory and complex for x<0. $\endgroup$
    – Akku14
    Dec 4, 2017 at 7:42
  • $\begingroup$ After solving the code, it's error has:NDSolve::ndsz: At x == -0.00001, step size is effectively zero; singularity or stiff system suspected $\endgroup$
    – Nagi
    Dec 5, 2017 at 9:50

1 Answer 1

1
$\begingroup$

After evaluating your constants, a compute of your ode:

y''[x] + (W^2/(CC^2) + ((W (wp)^2)/((CC^2) vt k)) ((E^-F^2 (-π Erfi[F] + Log[-(1/F)] + Log[F]))/Sqrt[π])) y[x] == 0 // N // Chop

yields

y[x] (-((∞ (1. - 100000. x))/Sqrt[Sign[1. - 0.999907 (1. - 100000. x)]]) + 3.94784*10^13) + (y^′′)[x] == 0

The infinity is the problem. Rationalizing your data and increasing the WorkingPrecision did not help.

$\endgroup$
3
  • $\begingroup$ so what does it mean? do I change the parameters or other things? $\endgroup$
    – Nagi
    Dec 5, 2017 at 10:03
  • $\begingroup$ Your data is way to jumpy for NDSolve to handle. Rationalize your values and plot the coefficient of y[x] in your ode from -L to L to see what I mean. You need a much smoother function than what you have. $\endgroup$
    – Bill Watts
    Dec 5, 2017 at 23:13
  • $\begingroup$ Thankful.Regards. $\endgroup$
    – Nagi
    Dec 7, 2017 at 5:18

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