Re: plot of nmaximized result
- To: mathgroup at smc.vnet.net
- Subject: [mg118432] Re: plot of nmaximized result
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Thu, 28 Apr 2011 06:33:50 -0400 (EDT)
(1) The value of Print is always Null, so list1 and list2 are not List objects. (2) Hence, ListPlot[{list1, list2}] is just ListPlot[{Null, Null}]. Not a very interesting plot. (3) The function f is unbounded for every j, so NMaximize cannot give you a maximum. I'll ignore problem (3), except to suppress error messages (with Quiet): d = 2635/33859; r = 0.6; a1 = 0.7; a2 = 0.13; g = 33859; b = 0.6631; j = 5; points = Table[ x = (b*j*(j + 1))/g; f = (1/(a1 + a1*z + a2*z^2))*(b/g)*j*(j + 1) + (1 - Exp[-z])^2 + d*Exp[-r*z]; {max, val} = Quiet@NMaximize[f, z]; {x, max}, {j, 0, 5} ]; ListPlot@points Bobby On Wed, 27 Apr 2011 04:39:37 -0500, tarun dutta <tarunduttaz at gmail.com> wrote: > this is the following program.here I want to plot between x VS max.but > I can not get the result. > > Do[d = 2635/33859; > r = 0.6; > a1 = 0.7; > a2 = 0.13; > g = 33859; > b = 0.6631; > x = (b*j*(j + 1))/g; > f = (1/(a1 + a1*z + a2*z^2))*(b/g)*j*(j + 1) + (1 - Exp[-z])^2 + > d*Exp[-r*z]; > {max, val} = NMaximize[f, z]; > list1 = Print[(*"x= ",*)x]; > list2 = Print[(*" max= ",*)max], {j, 0, 5}] > ListPlot[{list1, list2}] > > any help will be appreciated. > regards, > tarun > -- DrMajorBob at yahoo.com