> #OK to post > #Timothy Nasralla, HW5, 9/20/21 > #Question 0: Put the given 6*a(n-1) + a(n+3) + 5*a(n+1) = 0 into canonical > form, then use RecToSeq to find a(1000) > #Canonical form: Let n = n-3, a(n) = 0*a(n-1) - 5*a(n-2) + 0*a(n-3) - 6*a(n-4) > read "/Users/tan88/OneDrive - Rutgers University/mw51.txt" > Help5() RecToSeq(INI,REC,N), GrowthC(INI,REC,K) , GrowthCe(REC) LeslieMod(SUR,FER): e.g. LeslieMod([9/10,9/10],[0,1,1]); LeslieMat(SUR,FER); e.g. LeslieMat([9/10,9/10],[0,1,1]); > INI := [1, 2, 4, 11] > REC := [0, -5, 0, -6] > RecToSeq(INI, REC, 1000)[1000]; 181801458979349684211926335397716595590116925130008115201730179162903000957919\ 4774209925134910767767993350034005595962441714858161276739646642515466061813\ 1176283941650552170945484194399749328351304786759734718454695940190410974568\ 4403540309 > #Question 1: Find the growth constant of the given summation in two different > ways #GrowthC and GrowthCe > INI := [a, a, a, a, a, a, a, a, a, a] > REC := [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] > GrowthC(INI, REC, 1000) 1.999018633 > GrowthCe(REC) 1.999018633 > #Approximately the same. > #Question 2: Find the growth rate of the given situation with two different > techniques. > #Technique 1 FER := [1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, > 1/2, 1/2, 1/2, 1/2, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4, > 1/4, 1/4, 1/4, 1/4] > SUR := [.99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, > .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99, .99] > LeslieMod(SUR, FER) [1 [-, 0.4950000000, 0.4900500000, 0.4851495000, 0.4802980050, 0.4754950250, [2 0.4707400747, 0.4660326740, 0.4613723472, 0.4567586238, 0.4521910375, 0.4476691271, 0.4431924358, 0.4387605115, 0.4343729064, 0.2150145887, 0.2128644428, 0.2107357984, 0.2086284404, 0.2065421560, 0.2044767344, 0.2024319671, 0.2004076474, 0.1984035710, 0.1964195352, 0.1944553399, ] 0.1925107865, 0.1905856786, 0.1886798218, 0.1867930236] ] > GrowthCe(%) 1.489452967 > #Technique 2 LeslieMat(SUR, FER) > Eigenvalues(%) > #After comparing each eigenvalue, it is clear that the first, 1.4894... + 0i > is the greatest one after applying absolute value, which means that it is the > growth constant (and it is equal to what was found using the first method) > #Question 3, find the growth rate of the given equation. > REC := [0, 0, 0, .16, .41] > GrowthCe(REC) 0.8879729192 > #Question 4: Using the given information, write a procedure that inputs the > relevant botanical parameters and outputs the first K terms > PlantGseq := proc(alpha, beta, gamma, sigma, INI, K) local a,b,i,L,k,newguy, > REC: a := alpha*sigma*gamma: b := beta*sigma*sigma*gamma*(1 - alpha): REC := > [a, b]; if not (type(INI,list) and type(REC,list) and nops(INI)=nops(REC) and > type(K,integer) and K>=nops(INI)) then print("Yikers!"): RETURN(FAIL): fi: k:= > nops(INI): L:= INI: while nops(L) L:=[op(L),newguy]: od: L: end: > INI := [100, 80] > PlantGseq(.5, .25, 2.0, 0.8, INI, 21) [100, 80, 80.000000, 76.80000000, 74.24000000, 71.68000000, 69.22240000, 66.84672000, 64.55296000, 62.33784320, 60.19874816, 58.13305344, 56.13824246, 54.21188252, 52.35162481, 50.55520105, 48.82042081, 47.14516882, 45.52740239, 43.96514892, 42.45650352] > INI := [100, 96] > PlantGseq(.6, .3, 2, 0.8, INI, 21) [100, 96, 107.5200, 117.964800, 129.7612800, 142.6902221, 156.9139458, 172.5546061, 189.7544040, 208.6686153, 229.4681472, 252.3409206, 277.4935912, 305.1534130, 335.5702921, 369.0190446, 405.8018797, 446.2511298, 490.7322533, 539.6471367, 593.4377253] > #These values are the same as the ones found in the table. > > #Question 5: Write a function that calculates the growth constant of the same > table. PlantGseq := proc(alpha,beta,gamma,sigma) local a,b,i,ii: a := > alpha*sigma*gamma; b := beta*sigma*sigma*gamma*(1 - alpha); i := 1/2*(a - > (a*a+4*b)^(1/2)); ii := 1/2*(a + (a*a+4*b)^(1/2)); if (abs(ii)>abs(i)) then > RETURN(abs(ii)): else RETURN(abs(i)): fi: end: > PlantGseq(2,2,4,.8) 5.462741700 > #Raising the gamma value allowed for the entire function to increase > exponentially, so long as you have a positive alpha & beta > PlantGseq(2,2,.4,.01) 0.008944271910 > #As sigma approaches 0, the growth constant shows extinction. > PlantGseq(.6, .3, 2, .8) 1.099677336 > #Around this level, as well as the given parameters in the original question, > offered a relatively stable population growth.