The question here is somewhat related to the comments in Computing eigenvectors and eigenvalues

I have a matrix M, say 400 by 400, and all elements depend explicitly on one parameter t in a quadratic form. That's to say, for one given t, I can calculate each element and write down the full matrix explicitly.

I would like to try different t, say a list of t(s), see how the lowest eigenvalues change with respect to t and plot it. I tried something like assuming and with but it did not work well. Anyone has an idea how to do it efficiently? Thanks.


1 Answer 1

ClearAll[mat, minev]
rm = RandomInteger[10, {400, 400, 3}];

mat[t_] := rm.{1, t, t^2};
minev[t_?NumericQ] := Eigenvalues[mat[t], -1];

DiscretePlot[Evaluate[minev[t]], {t, 0, 1, .01}]

Mathematica graphics

  • $\begingroup$ Thanks. You always come to my rescue.... $\endgroup$
    – James LT
    May 4, 2016 at 3:07
  • $\begingroup$ @James, i am glad i could help. Thank you for the Accept. $\endgroup$
    – kglr
    May 4, 2016 at 3:08
  • $\begingroup$ by the way, do you think it possible to get the exact coordinates of the points after I plot? Also, is it possible change the scale of y axis after I plot? I know we have lots of options in the plotting function and we can set them before running the plot command. $\endgroup$
    – James LT
    May 4, 2016 at 3:13
  • 1
    $\begingroup$ @James, to extract the point coords from dp = DicretePlot[...]; you can use Cases[dp, Point[x_] :> x, {0, Infinity}][[1]]. For the second question, you can use Show[dp, PlotRange->{a,b}] to change the y axis range to {a,b}. $\endgroup$
    – kglr
    May 4, 2016 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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