Find max of a Find root function
- To: mathgroup at smc.vnet.net
- Subject: [mg113747] Find max of a Find root function
- From: "Van Peursem, Dan" <Dan.VanPeursem at usd.edu>
- Date: Wed, 10 Nov 2010 06:28:59 -0500 (EST)
Can someone please assist me with the following sample problem. Bottom line is that I'd like to use the FindRoot function to numerically solve an equation, that involves a parameter. I'd then like to use the Findmax function that would yield the largest root for a specified range of the parameter. Any help would be appreciated. Thanks
Dan
I first define the function
f[a_?NumberQ]:=x/.Last[FindRoot[xSCos[a x],{x,.4}]]
and it evaluates nicely.
f[3]
0.39004
It even graphs nicely.
Plot[f[x],{x,2,3}]
[cid:image002.png at 01CB8019.CA736910]
But it doesn't like me asking for a max...
FindMaximum[{f[a],2=A3a=A33},{a,3}]
The errors I get are the following
FindRoot::nlnum : The function value {1. -1. Cos[1. a]} is not a list of numbers with dimensions {1} at {x} = {1.}. ?
ReplaceAll::reps : {FindRoot[xSCos[a x],{x,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. ?
FindRoot::nlnum : The function value {1. -1. Cos[1. a]} is not a list of numbers with dimensions {1} at {x} = {1.}. ?
ReplaceAll::reps : {FindRoot[xSCos[a x],{x,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. ?
FindRoot::nlnum : The function value {1. -1. Cos[1. a]} is not a list of numbers with dimensions {1} at {x} = {1.}. ?
General::stop : Further output of FindRoot::nlnum will be suppressed during this calculation. ?
ReplaceAll::reps : {FindRoot[xSCos[a x],{x,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. ?
General::stop : Further output of ReplaceAll::reps will be suppressed during this calculation. ?
{-0.887727,{a=AE3.}}