Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to numerically solve this kind of differential equation:

NDSolve[{x''[t] == f[x[t]], x[0] == 0, x'[0] == 1}, x, {t, 0, 1}]

where f[x[t]] is defined as gaussian with a time dependent amplitude

Amp[t_] := Piecewise[{{-500 t + 5, t <= 0.01}, {0.001, t > 0.01}}]
f[x_[t_]] := Amp[t] E^(-((x - \[Mu])^2/(2 \[Sigma]^2))) /. {\[Mu] -> 
0, \[Sigma] -> 0.01}

but Mathematica gives me the error

NDSolve::dvnoarg: The function x appears with no arguments. >>

What is wrong?

share|improve this question
Just change f[x_] = Amp[t] E^(-((x - \[Mu])^2/(2 \[Sigma]^2))) /. {\[Mu] -> 0, \[Sigma] -> 0.01}. – b.gatessucks Jan 4 at 14:29
Thanks! Easier than I thought :-) – Tommi Jan 4 at 14:42

closed as too localized by Oleksandr R., Jens, rm -rf Jan 4 at 17:35

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.