# Help with code and FindRoot Error

**URL:** <https://community.wolfram.com/t/help-with-code-and-findroot-error/3577>\
**Category:** Questions\
**Tags:** mathematica, numerical-computation\
**Created:** [October 8, 2014, 1:14pm UTC](https://community.wolfram.com/t/help-with-code-and-findroot-error/3577 "2014-10-08T13:14:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jqs5458](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jqs5458](https://community.wolfram.com/u/jqs5458)\
**Post date:** [October 8, 2014, 1:14pm UTC](https://community.wolfram.com/t/help-with-code-and-findroot-error/3577/1 "2014-10-08T13:14:35Z")

</div>

Hello I’m very new to using mathematica. Basically I was given a code and just have to see if I can get it to run. If someone could look over my code and tell me whats wrong with it and why I’m getting these errors that would be greatly apprecitated.

```
    gamma[kappa] := Sqrt[(1.5^2 - 1.48^2) (k i)^2 - kappa^2];
    beta = Table[
       Re [N [Sqrt [
          1.5^2 (k i)^2 - (FindRoot[
               Tan[h kappa /2] == gamma[kappa]/kappa, {kappa, 100}][[1, 
               2]])^2]]], {i, 1, 60, 1}];
    ListPlot[beta]
    deltabeta = 
      Table[(beta[[i]] - beta[[i - 1]])/(500 Pi), {i, 2, 60, 1}];
    ListPlot[deltabeta, PlotRange -> {1.48, 1.505}]
    doubledeltabeta = Table[-((k i)^2 / (6 Pi))
        (deltabeta[[i]] - deltabeta[[i - 1]])/(500 Pi), {i, 2, 59, 1}];
    ListPlot[doubledeltabeta]

FindRoot::nlnum: The function value {-0.01 Sqrt[-10000.+0.0596 k^2]+Tan[50. h]} is not a list of numbers with dimensions {1} at {kappa} = {100.}. >>
FindRoot::nlnum: The function value {-0.01 Sqrt[-10000.+0.2384 k^2]+Tan[50. h]} is not a list of numbers with dimensions {1} at {kappa} = {100.}. >>
FindRoot::nlnum: The function value {-0.01 Sqrt[-10000.+0.5364 k^2]+Tan[50. h]} is not a list of numbers with dimensions {1} at {kappa} = {100.}. >>
General::stop: Further output of FindRoot::nlnum will be suppressed during this calculation. >>

```

---

<div class="post-metadata">

**Author:** ![iliang](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/iliang/32/11263_2.png) [@iliang](https://community.wolfram.com/u/iliang)\
**Post date:** [October 8, 2014, 4:28pm UTC](https://community.wolfram.com/t/help-with-code-and-findroot-error/3577/2 "2014-10-08T16:28:48Z")

</div>

The message is due to h and k not being numbers; FindRoot requires a numerically valued function.
