I am trying to integrate function f(k,t,p) and plot real part of it (heat map).But some how Mathematica always always shown "running..". Can you help me or suggest some workaround. Thanks in advance

f = Exp[I 2 t] Exp[I ( k Cos[t - p])]
g = Re[Integrate[f, {t, 0, 2 Pi}]]
DensityPlot[g, {k, 0, 1}, {p, 0, 2 Pi}]

Here I = Root(-1)


Make your definition functions and use numerical integration

f[k_, t_, p_] := Exp[I 2 t] Exp[I (k Cos[t - p])]
g[k_, p_] := Re[NIntegrate[f[k, t, p], {t, 0, 2 Pi}]]
DensityPlot[g[k, p], {k, 0, 1}, {p, 0, 2 Pi}]

enter image description here

  • $\begingroup$ Hello Hubble07, I am so thankful for your reply. You have given me new hope. But when I copy paste your code, it says $Failed, without even waiting. Please advice. $\endgroup$
    – dasfdsa
    Apr 23 '16 at 14:35
  • 1
    $\begingroup$ Close mma & open in new session it should work. $\endgroup$
    – Hubble07
    Apr 23 '16 at 14:54

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.