How to solve interdependent non-linear equations in a batch/scripted way?

Algebra

I'm trying to solve a set of equations to find the effects of a tax. I'm quite new to mathematics, so apologies for perhaps not using the proper jargon here.

My problem looks as follows:

https://preview.redd.it/3q38sfzxrk4d1.png?width=384&format=png&auto=webp&s=b44bbf52d1eed663283ce5dc6992e18add1e50aa

Q_i,D refers to the demand for a certain product i, and Q_i,S refers to the supply of a certain product i. The demand and supply depend on the prices of that product, as well as the prices for substitute products (e.g. tea, coffee, matcha, and chocolate milk are all substitute products). If i is tea, the different j's would be coffee, matcha, and chocolate milk. But, of course, if i is coffee, the j's would be tea, matcha, and chocolate milk. This makes the equations for all these products interdependent. I have data for four different products and how the supply and demand depend on the prices for these goods.

I know the values of all parameters and variables, except for the value of P_i and the values for P_j. (I do know these values when τ_i = 0, in case that's relevant.)

My goal is as follows: I want to find the values for P_i and P_j for which this equation holds. But the value for P_i depends on the value of P_j, too. But then the price of P_j depends on P_i, but then the price of P_i depends on P_j, and the loop continues. So at which values for P_i and P_j does this equation hold?

I don't think an analytical solution is possible, so a numerical solution seems best. Ideally one that I can use to manipulate data in batch. For example, I'd love to have an implementation in Google Sheets, Excel, or programming languages like R or Python. Generic maths info about how to approach this issue is more than welcome!

Posted Jun 4, 2024, 3:46 PM UTC

11

Comments aren't archived yet

This post had 1 comment on Reddit. Comments for this period haven't been loaded into the archive yet.