Solve $y[x]$ by using the WKB approximation and how fitting {a Cos[bx] Exp[-cx]} with this plot of $y[x]$

I have an equation: $$y[x]=\dfrac{b}{\sqrt{|k(x)|}}e^{-\int^x k(x')dx'}\qquad\text{(1)}$$

Where

$$k(x)=\sqrt{\dfrac{w^2}{c^2}+\left(\dfrac{w(w_p)^2}{c^2v_t h}\right)(A1)}$$

$$A1=\dfrac{1}{\sqrt{\pi}}\int\dfrac{e^{-y^2}}{y-\dfrac{w+2iR-om}{v_t(\dfrac{w}{c}(1-\dfrac{(1-\dfrac{x}{L})}{1+\dfrac{w_c}{w}})^{\dfrac{1}{2}})}}dy$$

This expression $\int^x \sqrt{\dfrac{w^2}{c^2}+\left(\dfrac{w(w_p(x'))^2}{c^2v_t h(x')}\right)A1(x')}dx'$... (2) means that:

At first I must solve $\int^x \sqrt{\dfrac{w^2}{c^2}+\left(\dfrac{w(w_p(x'))^2}{c^2v_t h(x')}\right)A1(x')}dx'$ , then change $x$ to $x'$ .

But it has an error. Why? Because I get $A1(x')$ numerically and put its answer to (2), so it will be mistake. In fact I can't solve the indefinite integrate (2) because $A1$ is solved numerically, so the error is right.

The plot of the equation (1) muse be as below: The condition is $y[-L]=10$ or $y[-L]=0$ and $L=0.00001$. the others show in the program.

R = ((1 - x/L)*W^2*(16*10^-20)^2*Pi*Sqrt[me]*LnLumbda)/( T^(3/2)*e0);

Simplify[
1/Sqrt[π] E^-S^2/(S - (W + 2 I R - Om)/
(vt (W/CC (1 - (1 - x/L)/(1 + (Wc)/W))^(1/2))))]
-((0.5641895835477563 E^-S^2 Sqrt[x]) /
((0.016006834477809786 + 0.00008178287140291831 I) - 1. S Sqrt[x] - (0. + 8.178287140291829 I) x))
A1[x_] :=
NIntegrate[
-((0.5641895835477563 E^-S^2 Sqrt[x])/
((0.016006834477809786 + 0.00008178287140291831 I) - 1. S Sqrt[x] -          (0. + 8.178287140291829 I) x)),
{S, -∞, ∞}]

yWKB[x_] := b/Sqrt[Abs[κ[x]]] Exp[NIntegrate[κ[xp], {xp}]]

κ[x_] := Sqrt[W^2/CC^2 + (W wp^2)/(CC^2 vt k) A1[x]]

Simplify[κ[x]]
Sqrt[(3.947841760435743*^13 Sqrt[
x] + (6.319244960388013*^11 -
6.319244960388012*^16 x) NIntegrate[-((
0.5641895835477563 E^-S^2 Sqrt[
x])/((0.016006834477809786 + 0.00008178287140291831 I) -
1. S Sqrt[
x] - (0. +
8.178287140291829 I) x)), {S, -∞, ∞}])/Sqrt[x]]
κ[x_] := √(3.947841760435743*^13 +
1/Sqrt[x] (6.319244960388013*^11 -
6.319244960388012*^16 x) NIntegrate[-((0.5641895835477563 \
E^-S^2 Sqrt[
x])/((0.016006834477809786 + 0.00008178287140291831 I) -
1. S Sqrt[
x] - (0. +
8.178287140291829 I) x)), {S, -∞, ∞}])
yWKB[-L]

NIntegrate::ilim

0.0004027134076113933 b E^NIntegrate[κ[xp], {xp}]
Solve[0.0004027134076113933 b E^NIntegrate[κ[xp], {xp}] == 10, b]

NIntegrate::ilim

{{b -> 24831.554676346186 E^(-1. NIntegrate[κ[xp], {xp}])}}
Plot[Abs[yWKB[x]], {x, -L, L}]

So how do I solve y[x]

Update

My answer to the question is

(* ClearAll *)
W = (2.*Pi*3.*10^14);
CC = 3.*10^8;
me = 911.*10^-33;
T = 16.*10^-16;
vt = ((2.*T/me)^(1/2));
Wc = 16.*10^-20;
L = 1.*10^-5;
wp = W*Sqrt[(1 - x/L)];
Om = Wc;
e0 = 885.*10^-14;
LnLumbda = 10.;
k = W/CC (1 - (1 - x/L)/(1 + (Wc)/W))^(1/2);
R = ((1 - x/L)*W^2*(16*10^-20)^2*Pi*Sqrt[me]*LnLumbda)/( T^(3/2)*e0);

Simplify[1/Sqrt[\[Pi]]
E^-S^2/(S - (W + 2 I R - Om)/(
vt (W/CC (1 - (1 - x/L)/(1 + (Wc)/W))^(1/2))))]

-((0.56419 E^-S^2 Sqrt[x])/((0.0160068 + 0.0000817829 I) - 1. S Sqrt[x] - (0. + 8.17829 I) x))

A1[x_] :=
NIntegrate[-((0.5641895835477563 E^-S^2 Sqrt[
x])/((0.016006834477809786 + 0.00008178287140291831 I) -
1. S Sqrt[
x] - (0. + 8.178287140291829 I) x)), {S, -Infinity,
Infinity}]

Simplify[(W^2/ (CC^2) + ((W (wp)^2)/((CC^2) vt k )) A1[x])]

3.94784*10^13 + 1/Sqrt[x] (6.31924*10^11 - 6.31924*10^16 x) NIntegrate[-(( 0.56419 E^-S^2 Sqrt[x])/((0.0160068 + 0.0000817829 I) - 1. S Sqrt[ x] - (0. + 8.17829 I) x)), {S, -[Infinity], [Infinity]}]

Coef[x_] :=
3.947841760435743*^13 +
1/Sqrt[x] (6.319244960388013*^11 -
6.319244960388012*^16 x) NIntegrate[-((0.5641895835477563 \
E^-S^2 Sqrt[
x])/((0.016006834477809786 + 0.00008178287140291831 I) -
1. S Sqrt[
x] - (0. +
8.178287140291829 I) x)), {S, -\[Infinity], \[Infinity]}]

DE = {(y''[x] + Coef*y[x]) == 0, y'[-L] == 0, y[-L] == 10};
sol = NDSolve[{(y''[x] + Coef[x]*y[x]) == 0, y[-L] == 10,
y'[-L] == 0}, y, {x, -L, L}]

{{y -> InterpolatingFunction[{{-0.00001, 0.00001}}, <>]}}

Plot[Abs[y[x] /. sol], {x, -L, L}] please help me for fitting {a Cos[bx] Exp[-cx]} with this plot

• It looks likes you are trying to tabulate and plot the formal solution of some ordinary differential equation (ODE). It might be simpler to directly solve the original ODE using the NDSolve function. – yarchik Feb 19 '18 at 22:24
• @yarchik Can you work answer about NDSolve function – Emad kareem Feb 19 '18 at 22:42
• Tell us what the differential equation is – QuantumDot Feb 19 '18 at 23:34
• @QuantumDot From what I understood, the OP uses the WKB approximation (en.wikipedia.org/wiki/WKB_approximation) to describe some kind of tunnelling problem in quantum mechanics. What is disturbing with such kind of posts is that no complete code with all the definitions is given. – yarchik Feb 20 '18 at 7:59
• the code is not reproducible; one problem that pops up is that NIntegrate needs to be called with a range for the variable to integrate over (check the definition of yWKB); also there are duplicate definitions eg for κ; it's not clear what are the values of the various parameters used – user42582 Feb 20 '18 at 9:34

Well you give model a*Cos[b*x]*Exp[-c*x]] but I changed it to see below. Because I tried and I failed with yours model. My model is:

$$\left|a e^{-c x} \cos \left(b x^f+e\right)\right|+d$$

Extract data from sol:

data = Table[{x, (Abs[y[x] /. sol[]])}, {x, 0, 10^-5, 1/100000000}];

nlm = NonlinearModelFit[data, Abs[a*Cos[b*x^f + e]*Exp[-c*x]] +
d, {{a, 1.65*10^19}, {b, 10*10^7}, {c, 95000}, {d, 1.1*10^18}, {e,5.4}, {f, 1.3}}, x] // Normal

(* 7.367209126*10^17 + 1.428920015*10^19 E^(-80771.84037 Re[x])
Abs[Cos[5.515029542 + 1.439426425*10^9 x^1.507570798]]*)

and model is:

$7.36721 10^{17}+1.42892 10^{19} e^{-80771.8 x} \left|\cos \left(5.51503\, +1.43943 10^9 x^{1.50757}\right)\right|$

Show[{ListPlot[data, PlotStyle -> Red], Plot[nlm, {x, 0, 10^-5}]},
PlotRange -> All] 