Question

6. Solve the following non-linear equations using fsolve. 1.5 Al B1 Al 1.5 o= 42 G.-20 ,nol / liter, k-0.12 min. τ-5 minusing python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

from numpy import *
from scipy.optimize import * #importing all packages from scipy and numpy

def fun(z):
Ca1 = z[0]
Ca2 = z[1]
Cb1 = z[2]
Cb2 = z[3]
  
tau = 5 # in min
Ca0 = 20 # in mol / liter
k = 0.12 # in min^-1
  
F = empty((4)) # intialize F to store 4 equations
  
F[0] = (Ca0 - Ca1)/tau - k*pow(Ca1 , 1.5)
F[1] = -Cb1/tau + k*pow(Ca1 , 1.5)
F[2] = (Ca1 - Ca2)/tau - k*pow(Ca2 , 1.5)
F[3] = (Cb1 - Cb2)/tau - k*pow(Ca2 , 1.5)
return F
  
  
zguess = array([1, 1, 1, 1])
z = fsolve(fun, zguess)
print(z)

Output:

Ca1 = 7.55 , Ca2 = 3.55 , Cb1 = 12.45 , Cb2 = 8..45

Add a comment
Know the answer?
Add Answer to:
using python 6. Solve the following non-linear equations using fsolve. 1.5 Al B1 Al 1.5 o=...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT