Author Topic: Calculate ideal number of chloroplasts for a given light level  (Read 569 times)

Offline PhiNotPi

  • Bot Builder
  • **
  • Posts: 64
    • View Profile
Calculate ideal number of chloroplasts for a given light level
« on: February 19, 2014, 07:54:50 PM »
Here is the line of code, which makes use of 2.46's new advanced "root" command.

Code: [Select]
*.light 2 pow 3 root 2 pow 1386 mult 19601 div 32000 ceil
The main difficulty of writing this was to make sure that the number stays within the limits of what DB can handle, which is integers +/- 2000000000.  This involved finding the best rational approximation for the fraction \frac{\sqrt{2}}{20}.

So far, the most accurate version of the code is the following, which is probably twice as accurate:

Code: [Select]
*.light 39 3 pow mult 3 root 2 pow 39 div 2 pow 169 div 154 mult 19601 div 32000 ceil
The simplest version is the following, but it has horrible accuracy:

Code: [Select]
*.light 3 root 4 pow dup pyth 20 div 32000 ceil


Also, the following gives the maximum number of chloroplasts for a given light level.  Any more chloroplasts, and you will actually lose more energy than you make.

Code: [Select]
*.light 2 pow 3 root 2 pow 510 mult 3361 div 32000 ceil
All of these have some rounding issues, mainly due to the 3 root. I tested it and they are generally accurate to within a few percent. 
« Last Edit: February 20, 2014, 07:03:54 PM by PhiNotPi »
I am biased neither towards nor against any single mathematical constant.