Jun-09-2020, 02:57 PM
(This post was last modified: Jun-12-2020, 10:56 PM by Gribouillis.)
Hi every one,
when i am trying solve this equation using fsolve with variables as list
![[Image: 2ZOfu.png]](https://i.stack.imgur.com/2ZOfu.png)
can any help me out.
i am getting this error
when i am trying solve this equation using fsolve with variables as list
![[Image: 2ZOfu.png]](https://i.stack.imgur.com/2ZOfu.png)
can any help me out.
1 2 3 4 5 6 7 8 9 10 11 12 |
from optimize import fsolve import numpy as np T = np.array([ 137 , 145 , 150 , 152 , 159 , 160 , 184 ]) Di = np.array([ 1 , 0 , 1 , 1 , 1 , 0 , 1 ]) r = 5.0 def lnL(P): mu, sigma = P return - r * np.log(sigma) - ( 1 / 2 ) * np. sum (Di * ((T - mu) / sigma) * * 2 ) + np. sum ( 1 - Di) sol = fsolve(lnL, ( 15.0 , 258.0 )) sol |
1 |
fsolve: there is a mismatch between the input and output shape of the 'func' argument 'lnL' .Shape should be ( 2 ,) but it is ( 1 ,). |