Buckets:
| from decay_mod import solver | |
| import numpy as np | |
| import scitools.std as st | |
| def non_physical_behavior(I, a, T, dt, theta): | |
| """ | |
| Given lists/arrays a and dt, and numbers I, dt, and theta, | |
| make a two-dimensional contour line B=0.5, where B=1>0.5 | |
| means oscillatory (unstable) solution, and B=0<0.5 means | |
| monotone solution of u'=-au. | |
| """ | |
| a = np.asarray(a); dt = np.asarray(dt) # must be arrays | |
| B = np.zeros((len(a), len(dt))) # results | |
| for i in range(len(a)): | |
| for j in range(len(dt)): | |
| u, t = solver(I, a[i], T, dt[j], theta) | |
| # Does u have the right monotone decay properties? | |
| correct_qualitative_behavior = True | |
| for n in range(1, len(u)): | |
| if u[n] > u[n-1]: # Not decaying? | |
| correct_qualitative_behavior = False | |
| break # Jump out of loop | |
| B[i,j] = float(correct_qualitative_behavior) | |
| a_, dt_ = st.ndgrid(a, dt) # make mesh of a and dt values | |
| st.contour(a_, dt_, B, 1) | |
| st.grid('on') | |
| st.title('theta=%g' % theta) | |
| st.xlabel('a'); st.ylabel('dt') | |
| st.savefig('osc_region_theta_%s.png' % theta) | |
| st.savefig('osc_region_theta_%s.pdf' % theta) | |
| non_physical_behavior( | |
| I=1, | |
| a=np.linspace(0.01, 4, 22), | |
| dt=np.linspace(0.01, 4, 22), | |
| T=6, | |
| theta=0.5) | |
Xet Storage Details
- Size:
- 1.35 kB
- Xet hash:
- 30514c60ab94af74aa2f1c68837f4005f4323a215e06ab4307d651724cbdf03f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.