2
$\begingroup$

Merry Christmas to all.

We have a problem we want to breed rainbowfish to sell to pet stores. We start with a nice big aquarium and 30 fish, half of them male, half of them female. We want to predict the number of fish after a number of days, to see how many you can sell.

So our initial condition for our rainbow fish is $𝑃(0)=30$.

Assume that one female rainbowfish lays eggs every 30 days and 42 of the eggs hatch into baby fish, half of them male, half female.

The birth rate is $b=0.7$

The aquarium owner expects to sell 20 rainbowfish per day.

The differential equation that defines the above problem is $$P'(t)=0.7P(t)-20$$. I tried to solve this problem in Mathematica with the following code

eqn = p'[t] == 0.7 p[t] - 20
sol = DSolve[{eqn, p[0] == 30}, p[t], t]

Then I wanted to sketch the direction field and the phase line

VectorPlot[{1, p'[t] == 0.7 p[t] - 20}, {t, 0, 30}, {p, -50, 50}, 
 VectorStyle -> Red]

But this does not give me anything as a result.Any suggestion how to create direction field and the phase line please?

$\endgroup$
4

1 Answer 1

3
$\begingroup$

You can not write:

{1, p'[t] == 0.7 p[t] - 20}

You must replace p by the first element of the solution and the second part does not make sense because it does not give a number. You must eliminate "p'[t]==". Here is the corrected code:

VectorPlot[{1, 0.7 (p[t] /. sol[[1]]) - 20}, {t, 0, 30}, {p, -50, 50},
  VectorStyle -> Red]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.