Changeset cd23f31 in sasmodels


Ignore:
Timestamp:
Sep 14, 2018 10:44:23 AM (2 months ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
ticket-608-user-defined-weights
Children:
a5516b1
Parents:
b50e28b
Message:

update maier_saupe docs with P_2 inverse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • example/weights/maier_saupe.py

    rb50e28b rcd23f31  
    5959            return 1.5*r - 0.75/a - 0.5 
    6060 
     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 
    6169    References 
    6270    ---------- 
     
    103111    return 1.5*r - 0.75/a - 0.5 
    104112 
     113def P_2_inv(S): 
     114    from scipy.optimize import fsolve 
     115    return fsolve(lambda x: P_2(x) - S, 1.0)[0] 
     116 
    105117def P_2_numerical(a): 
    106118    from scipy.integrate import romberg 
     
    116128    a = float(sys.argv[1]) 
    117129    #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.