Is there a solver that works like goal seek in excel, but can also be used for time series?
For example, lets say I have 3 timeseries variables df['Var1'], df['Var2'], df['Var3'] and an equation:(df['Var1'] / X ) (X * df['Var2']) = df['Var3']. I want to solve it for X and have the solution as a timeseries as well (since my inputs are timeseries).
My actual equation is more complicated, so the equation I put above is just an example.
CodePudding user response:
If you want to solve this row by row, you have a scalar root-finding problem. This can be solved with https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root_scalar.html.
An alternative is to solve the whole thing in one swoop. See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root.html.
In general, it is better solve n smaller problems than one big one.