3

$y''+\lambda y=0, y'(0)=0,y(1)+y'(1)=0$

x = FindInstance[{Cot[Sqrt[λ]] == Sqrt[λ], λ >= 0, λ < 100}, λ, 100]

  {{λ->Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 0.74017388439496704222}]}, 
   {λ->Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 11.7348618299419683428}]}, 
   {λ->Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 41.438807847570465811}]}, 
   {λ->Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 90.808214209215248455}]}}

I want to find the square root of these numbers and don't know how:

Table[Sqrt[λ] /. x[[i]], {i, 4}]

 {Sqrt[Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 0.74017388439496704222}]], 
  Sqrt[Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 11.7348618299419683428}]], 
  Sqrt[Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 41.438807847570465811}]], 
  Sqrt[Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 90.808214209215248455}]]}

How do I take the square root of the .7401 and not of Root?

RunnyKine
  • 33,088
  • 3
  • 109
  • 176
  • Sqrt[x[[All, -1, -1, -1, -1]]] – RunnyKine Apr 30 '16 at 03:05
  • Let me see if that works. How did you get the lines to line up like that? Every time I tried space bar on the last line, the browser wouldn't let me add spaces before the first { on the last line... –  Apr 30 '16 at 03:08
  • Or you can take the numerical value of the result. λ /. N[x] // Sqrt – RunnyKine Apr 30 '16 at 03:17
  • Since you knew the answer, could you explain what the -1's are doing? For the next 75 problems or so this could prevent arthritis. What if the solutions has many zeros, or an unknown number of zeros. How could I extract the numbers out of the Root[,] into a vector exactly like the one you returned. –  Apr 30 '16 at 03:19
  • Ok, i think you answered my question before I asked it. Let me see if that works. –  Apr 30 '16 at 03:20
  • Yup! Thanks! I would give you credit for answering, but you placed the answer in comments. –  Apr 30 '16 at 03:24
  • Note that Sqrt[Root[{-Cot[Sqrt[#1]] + Sqrt[#1] &, 0.74017388439496704222}]] is a exact numeric object. You can approximate it to any degree of precision with N[..., prec]. – Michael E2 Apr 30 '16 at 03:33
  • Possible duplicate: http://mathematica.stackexchange.com/questions/13767/how-do-i-work-with-root-objects – Michael E2 Apr 30 '16 at 03:34

1 Answers1

4
x = FindInstance[{Cot[Sqrt[λ]] == Sqrt[λ], λ >= 0, λ < 100}, λ, 100]

You can take the numerical value of the solution using N and use ReplaceAll (/.) to get the values and finally take the square root:

λ /. N[x] // Sqrt

{0.860334, 3.42562, 6.4373, 9.52933}

This should work regardless of the number of solutions.

RunnyKine
  • 33,088
  • 3
  • 109
  • 176