Re: Crossing of 3D functions
- To: mathgroup at smc.vnet.net
- Subject: [mg57160] Re: Crossing of 3D functions
- From: Maxim <ab_def at prontomail.com>
- Date: Thu, 19 May 2005 03:08:43 -0400 (EDT)
- References: <d5sks6$o2t$1@smc.vnet.net> <d69uuf$94p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Mon, 16 May 2005 11:07:59 +0000 (UTC), Paawel <fonfastik at interia.pl>
wrote:
> Hello again
>
> The point of this question is to obtain the function of crossing of
> these supersurfaces. Once I have this fcrossing function I want to
> find a local minimum (1<r<2, 90<f<180). So I want to find a local
> minimum, and plot this function.
>
> Regards
>
I assume that you want to minimize another function (func below) along the
curve F1 == F2. Then you can either solve for f explicitly and use
FindMinimum or search for a constrained minimum with NMinimize:
In[1]:=
{{r1, r2}, {f1, f2}} = {{1, 2}, {90, 180}};
F1[r_, f_] = 3.92 + 3.758/E^(6.152*(-1.184 + r)) - (6.288336759430112*(1 -
0.00008280000000000001*(180 - f)^2))/E^(3.076*(-1.184 + r));
F2[r_, f_] = 0.479 + 0.479/E^(9.986*(-1.375 + r)) - (0.958*(1 -
0.00107*(133 - f)^2))/E^(4.993*(-1.375 + r));
func[r_, f_] = 50000*(r - 1.2)^2 + (f - 135)^2;
Lsol = Solve[F1[r, f] == F2[r, f], f];
FindMinimum[func[r, f] /. Lsol[[2]], {r, (r1 + r2)/2, r1, r2}]
Out[6]=
{176.96819, {r -> 1.1620375}}
In[7]:=
NMinimize[{func[r, f], F1[r, f] == F2[r, f]},
{{r, r1, r2}, {f, f1, f2}}]
Out[7]=
{176.96819, {f -> 145.24258, r -> 1.1620374}}
Also you can use FindRoot, which can handle equations that don't have
closed-form solutions and is faster than NMinimize:
In[8]:=
R[f_?NumericQ] :=
r /. FindRoot[F1[r, f] == F2[r, f], {r, (r1 + r2)/2, r1, r2}]
Plot[func[R[f], f], {f, f1, f2}]
FindMinimum[func[R[f], f], {f, (f1 + f2)/2, f1, f2}]
Out[10]=
{176.96819, {f -> 145.24259}}
This works because there is only one root for each value of f.
Maxim Rytin
m.r at inbox.ru