Edward Rozema

61 Reputation

5 Badges

19 years, 244 days

MaplePrimes Activity


These are answers submitted by Edward Rozema

The fsolve command numerically solves for the variable. Since eqn1 has two variables, executing solset2(z) returns the statement, "Error, (in fsolve) z is in the equation, and is not solved for." On this example, you could replace fsolve with solve and, in the plot statement, get rid of the quote marks.
I appreciate the response, but how does this help? There is nothing wrong with my procedure, try2. Execute my code and then execute the following. > try2(1750., 0.3, 0.09, 96.48692660) You will get the response 1750., 0.3, 0.09, 96.48692660 [1.48692660, 13.3810029, 48.4459596, 33.982839, 15.354723, 15.681500, 6.699209] These are the correct residuals. The question remains, how do I get Maple to give me the best-fit if LSSolve won't pass the values to the procedure? Or, how can I get LSSolve to pass the values to the procedure? One more comment: This DE has an exact solution. We can get the best-fit using the following code: > data := [[0, 95], [11, 425], [22, 928], [33, 1358], [44, 1589], [56, 1683], [67, 1724]]; > try1 := proc (K, alpha, r, tm) local R; print(K, alpha, r, tm); # for debugging R := K/(1+alpha*exp(-r*(t-tm)))^(1/alpha); map ((d) -> eval(R, t = d[1])-d[2], data): end; > sol := Optimization[LSSolve](try1(K, alpha, r, tm), initialpoint = {r = 0.09, K = 1750, tm = 17, alpha = 0.3}); K, alpha, r, tm sol := [80.205987860140, [r = 0.0884814753475860612, alpha = 0.345995076771192566, tm = 17.9418639765759238, K = 1746.34336442594190]] Notice that, even though K, alpha, r, and tm are undefined, LSSolve still works! Why won't it work with dsolve?
Page 1 of 1