Changeset cd23f31 in sasmodels for example/weights
- Timestamp:
- Sep 14, 2018 10:44:23 AM (6 years ago)
- Branches:
- master
- Children:
- a5516b1
- Parents:
- b50e28b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
example/weights/maier_saupe.py
rb50e28b rcd23f31 59 59 return 1.5*r - 0.75/a - 0.5 60 60 61 Given an order parameter $S = P_2(a)$, one can also solve for the 62 equivalent $a$: 63 64 from scipy.optimize import fsolve 65 66 def P_2_inv(S): 67 return fsolve(lambda x: P_2(x) - S, 1.0)[0] 68 61 69 References 62 70 ---------- … … 103 111 return 1.5*r - 0.75/a - 0.5 104 112 113 def P_2_inv(S): 114 from scipy.optimize import fsolve 115 return fsolve(lambda x: P_2(x) - S, 1.0)[0] 116 105 117 def P_2_numerical(a): 106 118 from scipy.integrate import romberg … … 116 128 a = float(sys.argv[1]) 117 129 #print("P_2", P_2(a), "difference from integral", P_2(a) - P_2_numerical(a)) 118 print("P_2 ", P_2(a))130 print("P_2, P_2_inv", P_2(a), P_2_inv(P_2(a)))
Note: See TracChangeset
for help on using the changeset viewer.