Questions tagged [fsolve]

30 questions
0
votes
1 answer

Possible to run multiple iterations of fsolve(in serial) on multiple cores?

I am trying to solve a complex optimization problem using Matlab's Particle Swarm Optimization. The objective function called in PSO solves an interior optimization problem using matlab's fsolve() function, where the solution from fsolve is used to…
0
votes
0 answers

Solve system of equations with data loaded, loop through group IDs and different observations

I have data for a large amount of Group IDs, and each group ID has anywhere from 4 to 30 observations. I would like to solve a (linear or nonlinear, depending on approach) system of equations using data in Matlab. I want to solve a system of three…
0
votes
0 answers

Solving a non-linear equation using fsolve

I have this non-linear equation: Ax + Bxy - C = 0 where A, B and C are all constants. I have a bunch of different values for A, B and C, like about 10000. My questions is how can i use the different set of A, B and C values I have to generate the…
asda1
  • 1
  • 2
0
votes
1 answer

How do I use fsolve to find theta2?

I need to solve the attached equation for "theta2" given the attached values. There should be 56 results because there are 7 different insulation thicknesses(Linsluation/d2/hc), 4 different temperatures (theta1), and 2 e values (em, ec) which must…
eeek82
  • 1
  • 1
0
votes
1 answer

How to find the root of a function within a range in python

I need to find the alpha value in [0,1] of a linear combination alpha*Id+(1-alpha)*M, where Id is the identity matrix, M is a given matrix, such that this linear combination has given mean. At the moment I am using scipyt.optimize.fsolve but it does…
userLx
  • 81
  • 8
0
votes
0 answers

scipy.optimize.fsolve ValueError: operands could not be broadcast together with shapes (2,) (105,105)

I get the following error with the function scipy.optimize.fsolve: ValueError: operands could not be broadcast together with shapes (2,) (100,100) the command is the following: q = lambda alpha :…
userLx
  • 81
  • 8
0
votes
1 answer

Solving a single variable equation in R using unitroot

I have a complicated equation for which I have written the code as follows: sigma = 1.336449027; f_t = 0.500185113; alpha = 0.364; #elasticity of capital beta = 0.115; #elasticity of labor R = 3.131696599; chi = 0.5; M = log(1056); sigma =…
riskiem
  • 187
  • 2
  • 7
0
votes
1 answer

fsolve with multiple lineare equations

Please can someone explain me what is wrong with my code. I try to solve a system of multiple equation with fsolve. `clear clc close all Modellpar.Sp11 = 0.025; Modellpar.Sp12 = 0.8; Modellpar.Sp21 = 0.04; Modellpar.Sp22 = 0.96; …
pat des pat
  • 117
  • 3
0
votes
0 answers

python function definition to solve equations

def fun(z): g = np.zeros(4 * N) for i in range(4 * N): f = np.zeros(4 * N) for j in range(4 * N): if z[j] != 0: f[i] = f[i] + M_kk[i][j] * z[j] * np.arcsinh(w_c / z[j]) else: …
0
votes
0 answers

Solving two non linear equations for two variables using values from previous iterations by python

enter image description hereI want to solve for s[ i ] ,L[ i ] using the two equations f1 and f2, i know the values of s, L at time t=0, and i want s,L values at different time steps. My second equation involves s, L value from current time step [i]…
0
votes
1 answer

How to solve a set of nonlinear equations multiple times when one of the coefficient of the variable changes

I want to solve for the variables s,L for different values of t. t is a part of my second equation and its values changes, I tried to solve for s,L for different t values then append the values to an empty list so that i could have different values…
Mahesh
  • 13
  • 5
0
votes
0 answers

Python error: Cannot cast array data from dtype('complex128') to dtype('float64') according to the rule 'safe'

def fun(z): g = np.zeros(4 * N) for i in range(4 * N): f = np.zeros(4 * N) for j in range(4 * N): f[i] = f[i] + M_kk[i][j] * z[j] * np.arcsinh(w_c / z[j]) g[i] = f[i] - z[i] return(g) z =…
0
votes
1 answer

scipy fsolve() method throws different first value when the second value changes

I am trying to get the roots of f(x) = x**3-100*x**2-x+100 I know two of the roots are 1, 100. So set guesses close to this should work. This is the code (with two different guesses): from scipy.optimize import fsolve def f(x): return…
D.L
  • 4,339
  • 5
  • 22
  • 45
-1
votes
1 answer

I need to solve an equation numerically, but fsolve gives me a seemingly incorrect answer

I need to solve a single variable in an equation numerically. I tried using fsolve on two different functions that are, according to my understanding, equivalent. Call these functions func1 and func2. If I specify the variable I am solving for, both…
Hugo
  • 3
  • 3
-2
votes
1 answer

TypeError: 'Add' object is not callable, How can I fix it?

I want to find the the root of Nonlinear Function. So, I use fsolve method in scipy.optimize library. But, it doesn't work. The name of the variable with the root of Nonlinear Function is "s". With the variable 's', I want to find the other variable…
Jun
  • 1
  • 1
1
2