MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Can Mathematica Do This?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8255] Re: Can Mathematica Do This?
  • From: "Seth J. Chandler" <SChandler at uh.edu>
  • Date: Sat, 23 Aug 1997 01:58:52 -0400
  • Organization: University of Houston Law Center
  • Sender: owner-wri-mathgroup at wolfram.com

A member wrote in . . .

Thanks to those who e-mailed me with some suggestions.  Although, I am
now a little more familiar with Mathematica, the problem I need to solve

seems to be too tough for Mathematica, even though it "looks" like a
simple
problem.  I tried FindMinimum, NDsolve, among other attempts, and I
either
get an error of the form ".... something is not a real number", or
Mathematica takes the command but never returns an answer!  Here is the
problem in case some kind soul wants to give it a try:

  Find the minimum of f in c and h
          f = (c d1+d2) r (2/((c+1) (h-c+1))) + d3 h/2 +
              (c d4+d5) r (2/((c+2)*(h-c+1)))

  Note that c <= h, and c,h >=0.  If it helps, h < 10,000.  The d's are
real numbers in the range 0 to 1.0, and r is real in the range 0 to
100,000.

Dear Novice,

I'm not sure I qualify as a kind soul, but I did get Mathematica 3.0.1
to produce a result in terms of Root objects. Root objects are discussed
in the 3.0 book and in the help file that comes with the program. I then
did a numeric example and found that the answer met your criteria. Hope
this helps.

 In[5]:=
  f = (c d1+d2) r (2/((c+1) (h-c+1))) + d3 h/2 +
              (c d4+d5) r (2/((c+2)*(h-c+1)))


Out[5]=
\!\(\(d3\ h\)\/2 +
    \(2\ \((c\ d1 + d2)\)\ r\)\/\(\((1 + c)\)\ \((1 - c + h)\)\) +
    \(2\ \((c\ d4 + d5)\)\ r\)\/\(\((2 + c)\)\ \((1 - c + h)\)\)\)
In[22]:=
Shallow[answer=Solve[{D[f,h]==0,D[f,c]==0},{c,h}],6]
Out[22]//Shallow=
{{h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,1]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,2]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,3]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,4]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,5]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,6]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,7]},{
    h\[Rule]Power[\[LeftSkeleton]2\[RightSkeleton]] +
          \[LeftSkeleton]6\[RightSkeleton],
    c\[Rule]Root[\[LeftSkeleton]1\[RightSkeleton]&,8]}}
In[12]:=
numericexample=answer/.{d1->0.3,d2->0.4,d3->0.4,d4->0.5,d5->0.9,r->50000}

Out[12]=
{{h\[Rule]-641.738,c\[Rule]-6.93429},{h\[Rule]-449.714,c\[Rule]-1.50028},{


h\[Rule]444.714,c\[Rule]-1.49972},{h\[Rule]636.738,c\[Rule]3.93429},{
    h\[Rule]626.564\[InvisibleSpace]-5.83327 I,c\[Rule]-4.21729-4.65961
I},{
    h\[Rule]626.564\[InvisibleSpace]+5.83327 I,c\[Rule]-4.21729+4.65961
I},{
    h\[Rule]-631.564-5.83327 I,c\[Rule]1.21729\[InvisibleSpace]-4.65961
I},{
    h\[Rule]-631.564+5.83327 I,c\[Rule]1.21729\[InvisibleSpace]+4.65961
I}}
In[17]:=
Select[numericexample,
  Re[#[[1,2]]]>0 && Re[#[[2,2]]]>0 && Im[#[[1,2]]]==0 &&
Im[#[[2,2]]]==0&]
Out[17]=
{{h\[Rule]636.738,c\[Rule]3.93429}}



  • Prev by Date: Re: Re: Threading objects of unequal length
  • Next by Date: Re: More questions on expanding function names
  • Previous by thread: Re: Re: Can Mathematica Do This?
  • Next by thread: Incorrect FullSimplify result involving BesselK functions