# Solving this equation with NDSolve

I'm trying to solve a differential equation numerically. I've written this code but it is leading to some errors "initial history needs to be specified for all variables for delay-differential equations" however I am not intending to solve a 'delay' equation. Could someone point out my mistake(s)? Thanks.

m = 511000;
cl = 299792458;
E0 = 100*^6;
λ = 0.001;
k = 2 Pi/λ;
A = 10*^-10;
a0 = λ/4;
f[t_] := x'[t]/Sqrt[1 - (x'[t]/cl)^2]
eqns = {f'[t] == E0 Sin[((cl*t - g[t]) - a0) k], g[t] == Integrate[x'[ta], {ta, 0, t}], x == a0, x' == 0.97*cl}
b = NDSolve[eqns, x'[t], {t, 0, A}, MaxStepSize -> 3.3*^-12, Method -> "ExplicitEuler"]
Plot[{Evaluate[x'[t] /. b]}, {t, 0, A}, PlotRange -> All]

• why don't you just sub x[t]-a0 for Integrate[x'[ta], {ta, 0, t}] ? – george2079 Dec 4 '15 at 19:15
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Apr 12 '16 at 3:40

## 1 Answer

Taking george2079's comment one step further and eliminating g altogether, I get the following:

eqns = {f'[t] == E0 Sin[((cl*t - (x[t] - a0)) - a0) k], x == a0,
x' == 0.97*cl};
b = NDSolve[eqns, x'[t], {t, 0, A}];
Plot[{Evaluate[x'[t] /. b]}, {t, 0, A}, PlotRange -> All] 