0

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 perfect solution to the system of non-linear equations, what starting point to use and also how to plot them in matplotlib finally. Thanks for your help!.

I tried to use fsolve like this. Note: The coeffs is a dataframe which stored the values for A and B and merged_sensoren is another dataframe which stores the value for C in the first column.

Here are a snippet of the dataframe coeffs:

coeffs = {'coeffX0': [0, 0, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3], 'coeffX1': [0, 0, 0, 58, 60, 58, 60, 87, 90, 87, 90, 87, 90, 87, 90]}

Some values of the coeffecient C are = [0, 0, 0, 0, 0, 4, 4, 0, 0, 1, 1, 15, 15]

from scipy.optimize import fsolve

def f(x):
    return [coeffs.iloc[10,0] * x[0] + coeffs.iloc[10,1] * x[0] * x[1] - merged_sensoren.iloc[10,0],
            coeffs.iloc[11,0] * x[0] + coeffs.iloc[11,1] * x[0] * x[1] - merged_sensoren.iloc[11,0]]

root = fsolve(f, [1, 1])
root

This gave me the answer as

array([1., 1.])

Can someone explain what does 1., 1. mean for a solution. Is this even a number?

however, root = fsolve(f, [0, 0]) gave me array([ 1.40333333e+02, -3.32541568e-02]).

asda1
  • 1
  • 2

0 Answers0