       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] []
> 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:=
r[q_] := 1800*q - 0.006*q^2
c[q_] := 12100000 + 800*q + 0.004*q^2

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

Out=
{{q -> 50000.}}

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

Out=
7.5*^7

Out=
6.21*^7

Out=
1.29*^7

Out=
1200.

Out=
1200.

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

Out=
{q -> 55000.}

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

Out=
8.085*^7

Out=
6.82*^7

Out=
1.265*^7

Out=
1140.

Out=
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)