Re: Assigning (really dumb question)

• To: mathgroup at smc.vnet.net
• Subject: [mg60997] Re: Assigning (really dumb question)
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Fri, 7 Oct 2005 03:37:42 -0400 (EDT)
• Organization: The Open University, Milton Keynes, U.K.
• References: <di2ml8\$8h0\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```vjp2.at at at.BioStrategist.dot.dot.com wrote:
> What the heck am I doing wrong? I've been away from Mathematica for a while.
>
> I can't get it to evaluate the expressions at the solved values.
>
> I feel so stupid.
>
> r[q_] := 1800 q - .006 q^2
> c[q_] := 12100000 + 800 q + .004 q ^2
>
> qa = Solve[ D[ r[q]-c[q] , q] == 0, q]
> r[q] /. q -> qa
> c[q] /. q -> qa
> r[q]-c[q] /. q -> qa
> D[r[q],q] /. q -> qa
> D[c[q],q] /. q -> qa
>
> qm = Solve[ c[q]/q - D[c[q] , q] == 0, q] [[2]]
> r[qm] /. q -> qm
> c[qm] /. q -> qm
> r[qm]-c[qm] /. q -> qm
> D[r[q],q] /. q -> qm
> D[c[q],q] /. q -> qm

In[1]:=
r[q_] := 1800*q - 0.006*q^2
c[q_] := 12100000 + 800*q + 0.004*q^2

In[3]:=
qa = Solve[D[r[q] - c[q], q] == 0, q]

Out[3]=
{{q -> 50000.}}

In[4]:=
r[q] /. qa[[1]]
c[q] /. qa[[1]]
r[q] - c[q] /. qa[[1]]
D[r[q], q] /. qa[[1]]
D[c[q], q] /. qa[[1]]

Out[4]=
7.5*^7

Out[5]=
6.21*^7

Out[6]=
1.29*^7

Out[7]=
1200.

Out[8]=
1200.

In[9]:=
qm = Solve[c[q]/q - D[c[q], q] == 0, q][[2]]

Out[9]=
{q -> 55000.}

In[10]:=
r[q] /. qm[[1]]
c[q] /. qm[[1]]
r[q] - c[q] /. qm[[1]]
D[r[q], q] /. qm[[1]]
D[c[q], q] /. qm[[1]]

Out[10]=
8.085*^7

Out[11]=
6.82*^7

Out[12]=
1.265*^7

Out[13]=
1140.

Out[14]=
1240.

Hopt this helps,
/J.M.

```

• Prev by Date: FortranForm of Integers and Reals
• Next by Date: Re: Assigning (really dumb question)
• Previous by thread: Re: Assigning (really dumb question)
• Next by thread: Re: Assigning (really dumb question)