finding roots of user defn. functions

*To*: MATHGROUP at yoda.physics.unc.edu*Subject*: finding roots of user defn. functions*From*: "James M. Rotenberry" <H5RR1001%SMUVM1 at vm.cis.smu.edu>*Date*: Mon, 09 Mar 92 09:41:34 CST*Organization*: Southern Methodist University

I am using Mathematica 1.2 on a Mac II under 6.0.7. In my work I often need to find the root of a function, and I thought that Mma would be what I required. Below I have the results of a test program. I am seeking the value of alpha where the real part of the root of the quadratic becomes zero. (A Hopf bifurcation occurs at this value, hence the name of the user defined function. I am aware that there are other ways to determine this value for this simple test case.) I have searched through the Mathematica 1.2 and 2.0 manuals, Maeder's book, Blachman's book and have tried various combinations of Release[], Hold[], and HoldAll[]. How can I get this program to treat my function like one of its built in functions such as BesselJ[]? The function Plot[] works fine, probably since a table of values is created, but FindRoot does not work. This seems like a very natural thing for a symbolic manipulation to do, so I apologize if this is a frequently asked question. Thanks. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Hopf[alpha_,B_,eps_,beta_]:=Re[ -y-3 /. FindRoot[0==y^2+ (beta+alpha B/(1+eps alpha B/(1+beta))^2 -alpha/(1-alpha))y +alpha beta B/ (1+eps alpha B/(1+beta))^2,{y,-.1+.1I}] ] eqn1=Hopf[.2,16,.1,2] -0.818569 plt1=Plot[Hopf[x,16,.1,2],{x,.2,.3}] -Graphics- eqn2=FindRoot[Hopf[x,16,.1,2], {x,{.25,.27}}] FindRoot::fnotnum: Function number 1 is not numerical at 32. x {-0.1 + 0.1 I}=0.02 I - ------------------ + 2 (1. + 0.533333 x) 1. x (0.1 - 0.1 I) (2. - --------- + 1. - 1. x 16. x ------------------). 2 (1. + 0.533333 x) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- James M. Rotenberry Dept. of Math. Southern Methodist University rotenber at alumni.caltech.edu