Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: LS30A-3 20F
Views: 603
Image: ubuntu2004
Kernel: SageMath 9.1

Hi everyone. Here are the help notes to clarify some points of lab-8.

#FORGET ABOUT THE subs function. We will not be using it for this lab. #Instead, we shall find the expression for the derivative (using the diff function) #However, we shall store that expression as a mathematical function of some dummy variable, say P. Let's see.
Nprime(N) = 0.2 * N * (1 - N/200) * (N/100 - 1) #Let us see what diff function does: print(diff(Nprime))
N |--> -0.0000100000000000000*(N - 100)*(N - 200) - 0.0000100000000000000*(N - 100)*N - 0.0000100000000000000*(N - 200)*N

We see that the diff function simply differentiated Nprime and gave an expression. I now want to store this expression as a mathematical function of some dummy variable,P

derNprime(P) = diff(Nprime(P))#THE MOST IMPORTANT LINE. Converts the EXPRESSION FOR THE DERIVATIVE OF NPRIME INTO A MATHEMATICAL FUNCTION named derNprime. print(derNprime)
P |--> -0.0000100000000000000*(P - 100)*(P - 200) - 0.0000100000000000000*(P - 100)*P - 0.0000100000000000000*(P - 200)*P
#derNprime is the mathematical function that represents the derivative of Nprime. #Since derNprime is a mathematical function, I can compute it for a specific input simply by: print(derNprime(100))
0.100000000000000
#13. We can therefore do exercise 13 as: Nprime(N) = 0.2 * N * (1 - N/200) * (N/100 - 1) derNprime(P) = diff(Nprime(P)) print(derNprime)
P |--> -0.0000100000000000000*(P - 100)*(P - 200) - 0.0000100000000000000*(P - 100)*P - 0.0000100000000000000*(P - 200)*P
#16. def stability (chng_eqn, eql_list): derXprime(P) = diff(chng_eqn(P)) #Converts the derivative of chng_eqn into a mathematical function named derXprime. for eq in eql_list: val = derXprime(eq) if val < 0: print("STABLE") elif val > 0: print("UNSTABLE") else: print("TEST FAILS")
my_eqn(N) = 0.2 * N * (1 - N/200) * (N/100 - 1); eq_pts = [0, 100, 200] stability(my_eqn, eq_pts)
STABLE UNSTABLE STABLE