Revision history [back]

Here is a possible solution:

sage: var('d')  # declare d as a symbolic variable
d
sage: N(d) = (12250*d^2 - 2419*d + 433768) / (5*d^2 -37*d+99)
sage: plot(N(d), (d,0,10), axes_labels=['d', 'N'])  # the graph of N as a function of d
Launched png viewer for Graphics object consisting of 1 graphics primitive
sage: der = diff(N(d), d).simplify_full() ; der  # the derivative N'(d)
-5*(88231*d^2 + 382436*d - 3161987)/(25*d^4 - 370*d^3 + 2359*d^2 - 7326*d + 9801)
sage: sol = solve(der==0, d, solution_dict=True)  # searching for the zeros of the derivative
sage: sol
[{d: -1/88231*sqrt(315549598521) - 191218/88231},
{d: 1/88231*sqrt(315549598521) - 191218/88231}]
sage: d_max = sol[1][d] ; d_max  # among the above two roots, we select the positive one
1/88231*sqrt(315549598521) - 191218/88231
sage: n(d_max)  # a numerical approximation of the number of days at which max(N) is achieved
4.19943121932453
sage: N_max = N(d_max).simplify_full() ; N_max  # the maximum number of bacteria
3*(1632757263*sqrt(315549598521) - 2576988387921500)/(5176727*sqrt(315549598521) - 3155495985210)
sage: n(N_max)  # a numerical approximation of this number
20116.2964961084