|
[Date Index]
[Thread Index]
[Author Index]
RE: FindRoot problem
- To: mathgroup at smc.vnet.net
- Subject: [mg40040] RE: [mg40032] FindRoot problem
- From: "Pigeon, Robert" <Robert.Pigeon at drdc-rddc.gc.ca>
- Date: Mon, 17 Mar 2003 03:33:16 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Thanks David,
It works! But, I would like to understand why Mathematica's
FindRoot is not working when the function has conditions!
BTW, my real equation had, as second condition, x<= 1.535, and when I
applied RootSearch with 1.54 as upper limit, it finds just the first root
(1.4811). So the conditions apply with the search! That is great !
Robert
-----Original Message-----
From: David Park [mailto:djmp at earthlink.net]
To: mathgroup at smc.vnet.net
Subject: [mg40040] RE: [mg40032] FindRoot problem
Robert,
Try using Ted Ersek's RootSearch package from MathSource. It even gets both
roots for you.
Needs["Enhancements`RootSearch`"]
f[x_ /; x >= 0 && x <= 1.54] :=
Module[{}, Sec[x] - 0.0018167 (Sec[x] - 1) - 0.002875 (Sec[x] - 1)^2 -
0.000808 (Sec[x] - 1)^3 ];
RootSearch[f[x] == 10, {x, 0, 1.54}]
{{x -> 1.4811}, {x -> 1.53501}}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Pigeon, Robert [mailto:Robert.Pigeon at drdc-rddc.gc.ca]
To: mathgroup at smc.vnet.net
Good day,
I have a problem with FindRoot that I do not understand, so I am
asking for help! I have a function defined as a Module. I use FindRoot to
find a root when the function is given a value. Everything works fine
except when I put a condition to my function, when I do I get an error
message. Here what I try to do:
f[x_]:= Module[{}, Sec[x] - 0.0018167 (Sec[x]-1) - 0.002875 (Sec[x]-1)^2 -
0.000808 (Sec[x]-1)^3 ];
f::usage="explanation of f";
If I do
FindRoot[f[x]==10,{x,1.4}]
I get
{x->1.53501}
All that is correct.
But now if I do
f[x_ /; x>= 0 && x<= 1.54]:= same as above
and I try to find the root the same way, I get an error message
FindRoot[f[x]==10,{x,1.4}]
I get
FindRoot::frjc: Could not symbolically find the Jacobian of {f[x]-10. Try
giving two starting values for each variable.
I tried putting my conditions inside the Module, after the Module. I tried
to use Which, If. But, as soon as I put a condition, I get the same error.
Any idea ???
Thanks,
Robert
Prev by Date:
Re: UnitStep
Next by Date:
Re: UnitStep
Previous by thread:
Re: FindRoot problem
Next by thread:
Re: FindRoot problem
|