Re: solution of equation [CORRECTION]
- To: mathgroup at smc.vnet.net
- Subject: [mg116391] Re: solution of equation [CORRECTION]
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 13 Feb 2011 03:05:51 -0500 (EST)
- Reply-to: hanlonr at cox.net
I should have minimized the square of the difference.
NMinimize[{(n Tan[n L] - h)^2, 0.99 # < n < 1.01 #},
n][[2]] & /@
(Range[1, 11, 2] Pi/(2 L))
{{n -> 0.0155525}, {n -> 0.0466577}, {n -> 0.0777637}, {n ->
0.108871}, {n -> 0.139981}, {n -> 0.171093}}
Bob Hanlon
---- Bob Hanlon <hanlonr at cox.net> wrote:
=============
FindRoot will only find one root for each starting value. To find multiple roots you would map FindRoot onto a list of starting values. However, FindRoot may locate a root that is away from the starting value. To constrain the root to be near a value, it is easier to use NMinimize since it accepts explicit constraints. So Map NMinimize with varying constraints.
L = 100;
h = 1;
NMinimize[{n Tan[n L] - h, 0.99 # < n < 1.01 #}, n][[2]] & /@
(Range[1, 11, 2] Pi/(2 L)) // Quiet
{{n -> 0.015708}, {n -> 0.0471239}, {n -> 0.0785398}, {n -> 0.109956}, {n ->
0.141372}, {n -> 0.172788}}
Plot[{n Tan[n L], h}, {n, 0, 0.2},
PlotRange -> {0.95, 1.05},
Exclusions -> (Range[1, 11, 2] Pi/(2 L))]
Bob Hanlon
---- Piotr Munik <pi.munik at gmail.com> wrote:
=============
Dear Math Group,
I want to solve equation like this:
L := 100; h := 1;
n Tan[n L] == h
I need roots of this equation in a list form
but I have a problem.
I try findfoot
FindRoot[n Tan[n L] == h, {n, 0.01}]
but it's not good
I need your help...
Piotr