There are some sequential functions:

e[t_] :=(E^(-t^2)) Cos[0.1 t];
a[t_] := Integrate[e[x], {x, 0, t}];
p[t_, tau_]:=Integrate[a[x],{x,t-tau,t}];
s[t_, tau_] := Integrate[(a[x])^2,{x,t-tau,t}]+ (1-(p[t,tau])^2)tau;

Although there are numeric values for s[t,tau] for example s[2, 1] // Chop is equal to 1.0008 but its integration (as will be shown below) does not have an answer.

test[t_]:=I*Integrate[E^(-I s[t,x]),{x,0,1}];

I mean the test[2]//N does have an error which could not be removed


You are almost certainly going to need to evaluate test numerically, so let's just use NIntegrate from the start.

Clear[e, a, p, s, t]
e[t_] := (E^(-t^2)) Cos[0.1 t];
a[t_?NumericQ] := NIntegrate[e[x], {x, 0, t}];
p[t_?NumericQ, tau_?NumericQ] := NIntegrate[a[x], {x, t - tau, t}];
s[t_?NumericQ, tau_?NumericQ] := 
  NIntegrate[(a[x])^2, {x, t - tau, t}] + (1 - (p[t, tau])^2) tau;
test[t_?NumericQ] := I*NIntegrate[E^(-I s[t, x]), {x, 0, 1}];

(* Out: 0.605924 + 0.731384 I *)

The use of _?NumericQ in this context is common enough to have an entry in our `common pitfalls question.

  • 1
    $\begingroup$ To maintain as much accuracy/precision as possible, I recommend that the OP use Cos[t/10] in definition of e and only use NIntegrate when necessary, i.e., for s and test. For efficiency, use Set (=) rather than SetDelayed (:=) for definitions of e, a, and p (after a and p are returned to Integrate). $\endgroup$ – Bob Hanlon Dec 23 '14 at 15:02
  • $\begingroup$ With thanks to Mark, his suggestions have been so useful. Thanks a bunch for that. the problem of the integration has been solved. However, at this time, I do not have a clear interpretation of the outcome on which I must check its correctness with the main subject. Moreover, Bob's recommendation has substantially and incredibly increased speed of calculation. So much thank to Bob. $\endgroup$ – Unbelievable Dec 23 '14 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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