• API
• FAQ
• Tools
• Archive
daily pastebin goal
25%
SHARE
TWEET

# Untitled

a guest Mar 8th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. ###Problem 13.33 Stephen Lincoln, Amanda Card, John Dailey, Amanda Masotta###
2. import math
3. from scipy import optimize
4.
5.
6. def func(x):
7.     total = (1 - 2 * x[0])
8.     yh2 = (.75 - 2 * x[0] - x[1]) / total
9.     yco = (.15 - x[0] + x[1]) / total
10.     yco2 = (.05 - x[1]) / total
11.     ych3oh = (x[0]) / total
12.     yh2o = x[1] / total
13.
14.     k1 = 6.749 * 10 ** -4
15.     k2 = 0.01726
16.
17.     out = [(ych3oh / ((yh2) ** 2 * yco)) - (100 / 1) ** 2 * k1]   ###Equation 1, set eq to zero
18.     out.append((yco * yh2o / (yh2 * yco2) - k2))                  ###Equation 2, set eq to zero (P/Po)^0 = 1
19.     return out
20.
21. extents = optimize.fsolve(func, [.1, .1])  ###initial guess .1 for E1, E2
22. print("Extents: ", extents)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top