Here is the lemmygrad post I made it at (don’t wanna have to copy everything over).

Please give the post lots of heart-sickle, the post would really appreciate it

Don’t be afraid to ask questions.

    • sodium_nitride [she/her, any]@hexbear.netOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      2 years ago

      I added in the explict checks. It turns out, a huge number of the matrices being produced were non-productive. Instead of trying to keep generating matrices, I made a different fix (which makes the technical matrices more realistic, so win-win)

      I made it so that the average number of entries in each row of the technical matrix is (2*n)^0.5

      This means that as the economy grows larger, the matrices grow sparser. This makes productive matrices much more likely (at which point, I just have a check which makes it so that non-productive matrices are regenerated).

      Curiously, this change doesn’t have that big of an effect on the outcome. I’ve verified. The model simply handles negative net production and treats it like purchasing commodities from the external market (so something like imports). Still, I have removed it for now.

      • sodium_nitride [she/her, any]@hexbear.netOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 years ago
        1. uh, I haven’t really read staffa or anything, but my approach for computing ltv prices was

        Assume 1 unit of net output for a commodity

        Calculate how much gross production would required for each sector in that case

        Element wise multiply this with direct labor use to get needed labor from each sector

        Add up all of the labors from all the sectors.

        In formal terms, for sector 1

        (I-A)^-1 * [1;0] = g = Gross product for 1 unit of sector 1

        Then

        sum(g.*l)

        The “(eye(n)-A)\eye(n))” computes “g” for every sector at once (the output is [g1 g2 g3 g4 …])

        I believe this is equivalent to the equation you have also provided, except your equation involves fewer steps.

        Also, just as a context thing, matlab, for some reason sums matrices down columns by default. So the output the ltv prices equation is a row vector of the summed labors (which I transpose using the apostrophe symbol ')

        Indeed I am pretty sure that my code actually is using prices and values for each sector separately, otherwise the code should be giving me an error regarding the dimensionality of the code.

          • sodium_nitride [she/her, any]@hexbear.netOP
            link
            fedilink
            English
            arrow-up
            2
            ·
            2 years ago

            Matlab element wise multiplication indeed works in the correct way that you described.

            sum(Leon.*l)

            is equivalent to

            l*Leon

            which is why MatLab’s “sum” function by default sums down columns rather than by rows. The sum(Leon.*l) notation keeps things explicit (helps me in coding consistently), but the MatLab compiler knows how to optimize these things.

        • sodium_nitride [she/her, any]@hexbear.netOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 years ago
          1. the 1000 different prices are there to see what happens to the reproduction condition with 1000 different prices. I am not directly calculating reproduction prices for each economy. I am just letting random guesses show me what happens to the reproduction condition at various price points.

          2. The net income being normalised was there just to improve the visualisation. I have run the code with all sorts of parameters with and without the normalisation, and it is difficult to decide which is more useful for gaining insight.

          I’ve tried generating economies with upto 100 sectors (my poor laptop), but right now, I am facing a different problem I am trying to solve (with more and more sectors, my current random price generation strategy rarely ever produces prices close to LTV. Law of large numbers and all).

          unit cost = A^T p

          This is what I have done in C (except I also multiplied by gross output yo get total costs per sector)

          If you wanted an aggregate quantity across all sectors, this would be the p q - you have already calculated this as R.

          R is a vector denoting the revenue by sector. I think part of your misunderstanding might be from MatLab’s element-wise multiplication function, whose output can be difficult to understand.

          O is a n long coming vector, P is a n long column vector, when element wise multiplied, the output is also a n long column vector.

          And I do suppose that using standard notation (which I have never seen before tbh) would probably help greatly.

          And perhaps this is what you’ve done, but just in an aggregate way.

          thonk-cri my shitty code is causing people to think I aggregated everything even though everything is disagregated.

            • sodium_nitride [she/her, any]@hexbear.netOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              2 years ago

              All of those sound interesting, I will check them out.

              also love to hear about any updates!

              I would love to share them. Hopefully I have something good by the end of the week.

          • sodium_nitride [she/her, any]@hexbear.netOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 years ago

            I am very well aware that the dynamism is important for the law of value. I have tried making simulations of micro actors in the past to simulate commodity exchange, but those tended to become computationally intensive beyond what my cheap laptop could handle. (Either that, or trying model various effects to make it more accurate would start becoming like a full time job, forcing me to focus on my actual studies instead. )

            This simulation is intended only to model a single time step (for now, adding more time steps comes in once I perfect the simulation for a single time step).

    • sodium_nitride [she/her, any]@hexbear.netOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      I have some comments, questions, and possible suggestions.

      Exactly what I’m looking for :)

      I’m not exactly a mathematician, so I had intended the simulation to more so be a learning excercise. Feedback is appreciated. I’m going to take a look at your comments once I am done sleeping 😴

    • sodium_nitride [she/her, any]@hexbear.netOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      2 years ago
      1. correct

      2. correct

      3. I was under the impression that since matlab’s “rand” generates values between 0 and 1, all of the technical matrices should be automatically productive, but you are correct. I should add explicit checks

      4. yes

      5. I normalise the net product so that different economies are more comparable to one another. I am interested in the ratio of output between 2 industries, and not the scale of overall production

      I normalise the gross labor use because that variable should actually be “share of workforce employed”. The name is a relic from my previous attempt at the code where I had tried to incorporate the population into the sim. I seem to have forgotten to change the name.

      Matlab’s elementwise multiplication is not a dot product