Re: Question on looping FindRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg86702] Re: Question on looping FindRoot
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 19 Mar 2008 05:22:37 -0500 (EST)
- Organization: Uni Leipzig
- References: <fro35c$i3b$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
and you know the difference between Set[] "=" and
Equal[] "==" ?
Regards
Jens
PS: Using % and %% .. is not a good idea, because
it is used in the command line variant of the Mathematica
kernel but in a notebook interface it will cause many
mystic errors.
Alessandro Tavoni wrote:
> Hello,
>
> this is probably due to my being relatively new to Mathematica,
> but I cannot succesfully execute a loop with FindRoot.
> when I give the following input (I have converted it to input form):
>
>
> ClearSystemCache[]
> ratio = 1
> \[Lambda] = 1.4
> k = 1
> Overscript[U1, DifR] =
> Table[14 - 6*\[Beta]1, {\[Beta]1, 0, 0.5/ratio, 0.5/ratio/1000}];
> Overscript[U1, UifR] =
> Table[4 - 18*\[Alpha]1, {\[Alpha]1, 0, 0.5, 0.0005}];
> Overscript[U1, UifL] =
> Table[10 - 2*\[Alpha]1, {\[Alpha]1, 0, 0.5, 0.0005}];
> Overscript[U1, DifL] =
> Table[9*(\[Alpha]1 + 1)^0, {\[Alpha]1, 0, 0.5, 0.0005}];
> Overscript[U2, LifD] =
> Table[9*(\[Alpha]1 + 1)^0, {\[Alpha]1, 0, 0.5, 0.0005}];
> Overscript[U2, RifD] =
> Table[8 - 6*\[Alpha]2, {\[Alpha]2, 0, 0.5, 0.0005}];
> Overscript[U2, RifU] =
> Table[22 - 18*\[Beta]2, {\[Beta]2, 0, 0.5/ratio, 0.5/ratio/1000}];
> Overscript[U2, LifU] =
> Table[12 - 2*\[Beta]2, {\[Beta]2, 0, 0.5/ratio, 0.5/ratio/1000}];
> For[k = 1, k < 5, k++,
> eq1 = Pu == (Exp[\[Lambda]*(Overscript[U1, UifL][[k]]*Ql +
> Overscript[U1, UifR][[k]]*(1 - Ql))]/
> (Exp[\[Lambda]*(Overscript[U1, UifL][[k]]*Ql +
> Overscript[U1, UifR][[k]]*(1 - Ql))] +
>
> Exp[\[Lambda]*(Overscript[U1, DifL][[k]]*Ql +
> Overscript[U1, DifR][[k]]*(1 - Ql))]))*eq2 =
> Ql == (Exp[\[Lambda]*(Overscript[U2, LifU][[k]]*Pu +
> Overscript[U2, LifD][[k]]*(1 - Pu))]/
> (Exp[\[Lambda]*(Overscript[U2, LifU][[k]]*Pu +
> Overscript[U2, LifD][[k]]*(1 - Pu))] +
>
> Exp[\[Lambda]*(Overscript[U2, RifU][[k]]*Pu +
> Overscript[U2, RifD][[k]]*(1 - Pu))]))*Prob =
> FindRoot[{eq1, eq2}, {Pu, 0}, {Ql, 0}]*ProbUp[[k ;; All]] =
> %[[1]]*ProbLf[[k ;; All]] = %%[[2]]]
>
>
> I'm told Symbol::argx: Symbol called with 0 arguments; 1 argument is
> expected.
> and: Set::write: Tag Times in
>
> Thank you so much in advance,
>
> Alessandro
> --
> Alessandro Tavoni
> Ph.D. candidate
> Advanced Scool of Economics, University of Venice "C=E0 Foscari"
> http://venus.unive.it/alessandro.tavoni