# How to create direction field and phase line

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?

• Do you mean StreamPlot[{1, .7 p - 20}, {t, 0, 30}, {p, 0, 50}]
– Moo
Dec 25, 2022 at 21:44
• Dec 25, 2022 at 21:46
• @Moo Yes! Is there another way to create separately those two? Dec 25, 2022 at 21:46
• @Nasser I got it! Thank you! Dec 25, 2022 at 21:49

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

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