0

Define a matrix and a function as

h[y_] := {{101, 2 (1 + E^(-I) + E^(-I* y) + E^(-I* (1 + y)))}, {2 (1 + E^I + E^(I *y) +E^(I* (1 + y))), 1}};

htest[y_] := N[Block[{e, f}, {e, f} = Eigensystem[h[y]]; {e, f} = {e[[#]], f[[#]]} &@Ordering[N[Re[e]]];Return[{Re[e], f}]]] 

So, by htest[y], we should get an ordered eigensystems for matrix h[y]. For instance, h[1][[1]] gives you {0.621825, 101.378}, but h[x][[1]]/.x->1 gives you {101.378, 0.621825}, whose first element isn't the smaller one.

When I try to calculate some integrals, say the integral of the smaller eigenvalue:

NIntegrate[htest[x][[1]][[1]], {x, 0, 2}]

you will get 145.07. It's not th result from smaller eigenvalue but from h[y][[1]][[1]]/.y->x. Actually, you can

Plot[htest[x][[1]][[1]], {x, 0, 2}]
Plot[htest[x][[1]][[1]] /. x -> y, {y, 0, 2}]

to see the difference. So, my problem is how can I integrate the smaller eigenvalues by using NIntegrate?

ciao
  • 25,774
  • 2
  • 58
  • 139
Simon
  • 131
  • 1
  • 4
  • When editing, use the little question mark icon for help - readability can make the difference between getting answers and not... – ciao Mar 16 '15 at 07:33
  • Perhaps define your integrand as f[x_?NumericQ] := htest[x][[1]][[1]]? See http://mathematica.stackexchange.com/questions/18393/what-are-the-most-common-pitfalls-awaiting-new-users/26037#26037 – Michael E2 Mar 17 '15 at 00:53
  • Excellent. Thanks for your help. I think that's the right approach to solve this problem. – Simon Mar 17 '15 at 01:19

0 Answers0