Differential equations of the form y′ = y(a*y + b) come up often, particularly when studying bounded population growth. With the initial condition y(x0) = y0, the solution is the logistic equation
y = |
|
However, you often don’t know the values of a and b. You can still get a “best fit” logisitic equation with the following information: The initial value of x, the initial value of y, and several values of y′; namely, y′(x0),y′(x0+1),…,y′(x0+n−1) where x0 is the initial value of x. Xcas will then take the initial value y(x0) = y0 and the approximation y(t+1) ≈ y(t) + y′(t) to get the approximations y(x0+1) ≈ y0 + y′(x0), y(x0+2) ≈ y0 + y′(x0) + y′(x0+1), …y(x0+n) ≈ y0 + y′(x0) +… y′(x0+n−1), …Since y′/y = a + by, Xcas will take the approximate values of y′(x0+j)/y(x0+j) and use linear interpolation to get the best fit values of a and b, and then solve the differential equation.
The logistic_regression command will take as input a list and two numbers; the list will be [y10,y11,…,y1(n−1)], where y1j represents the value of y′(x0 + j), the first number is x0 and the last number is y0=y(x0). The command will return the function y(x), the derivative y′(x), the number C=−b/a, y′(xM) which is the maximum value of y′, xM which is where y′ has its maximum, and the linear correlation coefficient R of Y=y′/y as a function of y with Y=a*y + b. For example, if you enter
you will get
Pinstant=0.132478632479*Pcumul+0.0206552706553 Correlation 0.780548607383, Estimated total P=-0.155913978495 Returning estimated Pcumul, Pinstant, Ptotal, Pinstantmax, tmax, R [-0.155913978495/(1+exp(-0.0554152581707*x+0.140088513344+3.14159265359*i)), -0.00161022271237/(1+cos((-i)*(-0.0554152581707*x+0.140088513344+3.14159265359*i))), -0.155913978495,-0.000805111356186,2.52797727501+56.6918346552*i,0.780548607383]
You can plot the logistic equation with the command logistic_regression_plot; if you enter
you will get