Root Finding in Python

preview_player
Показать описание
Learn how to numerically find roots of complex equations in python.

Here we are using "Spyder" IDE with the numpy, scipy, and matplotlib libraries

Script:

import numpy as np

# Arbitrary Example
def fxn1(x):

root = fsolve(fxn1,0.5)

def fxn2(Ts, Tinf, Ti, A, Rtot, h, eps, sigma=5.67e-8): # SI units
return (Tinf - Ti)/(A*Rtot) - (h+eps*sigma*(Ts+Tinf)*(Ts**2+Tinf**2))*(Tinf-Ts)

Ts = fsolve(fxn2,290,args=(283.15,308.15,1.8,.25,2,0.95)) # [K]
Ts_C = Tsf-273.15 # [C]
Рекомендации по теме
Комментарии
Автор

what if the equation doesnt equal to zero? where should we define this specific value? for the heat transfer example...

charles
Автор

first thanks a lot for the excellent video and good description then I have a question how can you find the roots of this equation: R = 〖 (12)〗^k )/k! k/(2π(w^2+1/4)) √(1-〖(w/(LkR^2 ))〗^2 ) ∆w ∆k, ∆k=1, ∆w=LkR^2/100

asifahmadi
Автор

You should zoom the content, not clearly visible.

bishalkarki
Автор

should we include sigma variable in our function even though it is a constant but you didn't add it .

mohamedyusufmohamud
Автор

What if I'm getting the error "Result from function call is not a proper array of floats."

javierruiz