CoCalc Public FilestestFit.ipynbOpen with one click!
Author: Harald Schilly
Views : 47
In [6]:
dataP=[(5, 66.0000000000000), (6, 117.000000000000), (7, 150.000000000000), (8, 188.000000000000), (9, 240.000000000000), (10, 400.000000000000), (11, 639.000000000000), (12, 795.000000000000), (13, 902.000000000000), (14, 1139.00000000000), (15, 1296.00000000000), (16, 1567.00000000000), (17, 2369.00000000000), (18, 3062.00000000000), (19, 3795.00000000000), (20, 4838.00000000000), (21, 6012.00000000000), (22, 7156.00000000000), (23, 8198.00000000000), (24, 10999.0000000000), (25, 13957.0000000000), (26, 16662.0000000000), (27, 18610.0000000000), (28, 22672.0000000000), (29, 27436.0000000000), (30, 31554.0000000000), (31, 36508.0000000000), (32, 42288.0000000000), (33, 48582.0000000000), (34, 52547.0000000000), (35, 57298.0000000000), (36, 61913.0000000000), (37, 67366.0000000000), (38, 73522.0000000000), (39, 79696.0000000000), (40, 85778.0000000000), (41, 91714.0000000000), (42, 95391.0000000000), (43, 99225.0000000000), (44, 103228.000000000), (45, 108202.000000000), (46, 113525.000000000), (47, 117658.000000000), (48, 120479.000000000), (49, 123016.000000000), (50, 125098.000000000), (51, 127584.000000000), (52, 130450.000000000), (53, 133830.000000000), (54, 137439.000000000), (55, 139897.000000000), (56, 141672.000000000), (57, 143457.000000000), (58, 145694.000000000), (59, 148046.000000000), (60, 150383.000000000), (61, 152438.000000000), (62, 154175.000000000), (63, 155193.000000000), (64, 156337.000000000), (65, 157641.000000000), (66, 159119.000000000), (67, 160758.000000000)]
In [7]:
var('a,S,c,x') @interact def _(a0=slider(1000,2000,default=1800,step_size=100),S0=slider(160000,200000,default=182000,step_size=10000),c0=slider(0.1,0.2,default=0.14,step_size=0.01)): f_log(a,S,c,x)=a*S/(a+(S-a)*e^(-c*x)) q=find_fit(dataP, f_log, variables=[x], parameters=[a, S, c], initial_guess=(a0,S0,c0),solution_dict = True) list_plot(dataP) show(list_plot(dataP)+plot(f_log(a=a0,S=S0,c=c0), 5, 67,color='red')+plot(f_log(a=q[a], S = q[S], c = q[c]), 5, 67,color='green'))
In [9]:
f_log(a,S,c,x)=a*S/(a+(S-a)*e^(-c*x)) a0 = 1000 S0 = 10000 c0 = .5 q=find_fit(dataP, f_log, variables=[x], parameters=[a, S, c], initial_guess=(a0,S0,c0),solution_dict = True) list_plot(dataP) show(list_plot(dataP)+plot(f_log(a=a0,S=S0,c=c0), 5, 67,color='red')+plot(f_log(a=q[a], S = q[S], c = q[c]), 5, 67,color='green'))
In [ ]: