I'm brand new to Mathematica and having to use it for my PDE class. One of my homework questions involves plotting the first few terms of the Fourier series of a solution to a PDE, but the eigenvalues are positive solutions to an equation, for example $tan(p)=p$. How can I get a sequence $p_n$ where $p_n$ is the $n^{th}$ positive solution to the equation?

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Oct 6 '17 at 18:19
  • $\begingroup$ Related/duplicate: mathematica.stackexchange.com/questions/65896/… $\endgroup$
    – Michael E2
    Oct 6 '17 at 19:13

Do you mean something like this?

nmax = 10;
tlist = t /. Table[FindRoot[Tan[t] == t, {t, -0.1 + Pi n}], {n, 0, nmax}];
 Plot[{Tan[t], t}, {t, -nmax Pi, nmax Pi}, PlotRange -> All],
 ListPlot[{tlist, tlist}\[Transpose], PlotStyle -> Black]

Otherwise, you should be a bit more specific...

enter image description here

  • $\begingroup$ You can also use Epilog: nmax = 10; tlist = Select[ t /. Table[FindRoot[Tan[t] == t, {t, -0.1 + Pi n}], {n, 0, nmax}], 0 < # < nmax Pi &] Plot[{Tan[t], t}, {t, 0, nmax Pi}, PlotRange -> All, Epilog -> {Red, AbsolutePointSize[4], Point[{#, #} & /@ tlist]}, PlotLegends -> "Expressions"] $\endgroup$
    – Bob Hanlon
    Oct 6 '17 at 17:30
  • $\begingroup$ No, I need to be able to evaluate an expression involving the nth solution $\endgroup$
    – Zachary F
    Oct 6 '17 at 17:31
  • $\begingroup$ @ZacharyF. tlist is a list, in order, of the roots. That sounds like what you want. $\endgroup$
    – march
    Oct 6 '17 at 17:35

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.