Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from scipy.optimize import root
- import numpy as np
- def equations(vars):
- x, y, z = vars
- eq1 = np.sin(x) + 5 * np.exp(y) - 3 * z
- eq2 = 2 * x - np.log(y) + np.cos(z)
- eq3 = 4 * np.sin(x) + 5 * y - z
- return [eq1, eq2, eq3]
- initial_guess = [1, 1, 1]
- result = root(equations, initial_guess)
- print(f'x = {result.x[0]}\ny = {result.x[1]}\nz = {result.x[2]}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement