Skip to main content
2 of 4
added 32 characters in body
Karsten7
  • 27.6k
  • 5
  • 74
  • 135

How to speed this process up?

Clear[Hmp$, "*Hmp*", m, n, p, Nmax, "\[Psi]*"]
Nmax = 10.; (*want 80*)
Hmp = Table[0, {p, Nmax}, {m, Nmax}];

Chop[ReplacePart[
  Hmp, {m_, p_} :> (p^2 \[Pi]^2)/2 KroneckerDelta[m, p] + 
    2 Integrate[
      Sin[m \[Pi] \[Chi]] Sin[p \[Pi] \[Chi]] V[\[Chi]], {\[Chi], 0, 
       1}]]]
Jacob
  • 11
  • 1