Post Reply 
Little explorations with HP calculators (no Prime)
04-03-2017, 06:24 PM
Post: #110
RE: Little explorations with the HP calculators
(04-02-2017 04:01 PM)DavidM Wrote:  ...

So, I modified the code a bit, after some work (you can see it in the previous post) but the direction was very nice. In short "do not access a matrix, especially in algebraic notation', it is super fast now (also due to set flags) compared to before.
2 executions needs 65 seconds only so I would estimate that 1000 needs, 30k seconds, so less than a day.

The 50g can burn that long.

The next post will be about the list suggestion.

Code:

getVarFunc
  @ see log 20170403
  \<<
    @program to extract the variance out of the built matrix
    @the original from hpmuseum.org/forum makes uses of the stack a bit more
    @so it is faster. I changed a little bit.
  
    @output, the variance of the strength points out of the matrix

    0 @curProbV
    0 @tmpV
    0 @sumProbV
    \->
    @external inputs
    @local var
    curProbV
    tmpV
    sumProbV
    \<<
      @ obtain a random curProbV
      \<-maxSumProbV RAND * 1 + IP 'curProbV' STO

      @ now, thanks to the formula of davidM, we get the underlying probability tokens
      @but not the variance modifiers. I modified it to have practically the variance
      @modifiers already, but some moving along the axis is needed.
      @ see the topic linked in the log.
      IF
        curProbV 3826 <
      THEN
        curProbV 0.53 ^ 5.4 * 
        @ 5.4 * x ^0.53
        @ this is almost good in returning the variance, 
        @ but it returns positive values, so we need to move
        @ those back by -425
        425 -
        'tmpV' STO
      ELSE
        7.62 -16 ALOG * curProbV 4.58 ^ *
        @ 7.6 * 10^-16 * x ^4.58
        @ this is good by itself.
        'tmpV' STO
      END
      
      
      @ round resulting variance modifier to nearest multiple of 25
      tmpV 25 /
        @divided by 25 first, so the result will have a decimal part
      0 RND
        @decimal part disappear, now the number is a multiple of 25
        @rounded to the nearest multiple
      25 *
        @now it is the nearest multiple of 25.
    \>>
  \>>

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with the HP calculators - pier4r - 04-03-2017 06:24 PM



User(s) browsing this thread: 4 Guest(s)