Created
May 16, 2017 10:50
-
-
Save oyvinev/0674cf51d86993b0c86c50a925073c5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Al_h2(x): | |
return (1.00698 + 0.08183*x + 0.00537*x**2 + 0.0016*x**3 + -5.75818*10**(-5)*x**4 + 7.32321*10**(-7)*x**5 + -3.92223*10**(-9)*x**6 + 7.0807*10**(-12)*x**7)/100 | |
def SiO2(x): | |
return (50 - Al_h2)/100 | |
def aSi(x): | |
return (25 + Al_h2/2)/100 | |
def void(x): | |
return (25 - Al_h2/2)/100 | |
f_Al = Al_h2 | |
f_SiO2 = SiO2 | |
f_aSiH = aSi | |
f_air = void |
torunnkj
commented
May 16, 2017
•
import numpy as np
def Al_h2(x):
return (1.00698 + 0.08183*x + 0.00537*x**2 + 0.0016*x**3 + -5.75818*10**(-5)*x**4 + 7.32321*10**(-7)*x**5 + -3.92223*10**(-9)*x**6 + 7.0807*10**(-12)*x**7)/100
f_Al = Al_h2
f_SiO2 = lambda x: 0.5 - Al_h2(x)
f_aSiH = lambda x: 0.25 + Al_h2(x)/2
f_air = lambda x: 0.25 - Al_h2(x)/2
for x in np.linspace(0,110,10):
s = 0.0
for f in ["f_Al", "f_SiO2", "f_aSiH", "f_air"]:
r = "%s(%.0f)" %(f, x)
print r, eval(r)
s += eval(r)
print "Sum: ", s
print
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment