Calculating Numbers

Jim Ault JimAultWins at yahoo.com
Tue May 22 03:39:06 EDT 2007


my first thoughts would be
---how often is this ocurring?
---is it tied to a user-feedback event (eg. mouse move, scroll change)
---do you have to keep changing it in the design process
---are you limited to integers or can there be real numbers

Your example describes a linear "arithmetic progression", but you might want
a logarithmic one instead (like easing in a bead movement :-) in a cool
stack that someone wrote... gee I wonder who.)

If your desire is linear, are you trying to determine the number of
increments of a fixed size to get to the goal, or the size of the increment
to use 20 steps?

If your desire is logarithmic, then the size of the increment keeps changing
until the goal is met (in your case, gets smaller) so you need to determine
the rate of change.

Of course a simplistic approach is to do

put 75 into totalAmt
put 18 into startVal
put 255 into endVal

repeat with val = 18 down to 1
   add val to totalAmt
   if totalAmt >= endVal then
      put endVal into totalAmt
     exit repeat
   end if
   --do something with this new totalAmt
end repeat
if totalAmt < endVal then
   answer "not enough marbles to get to the goal"
end if
-->we have reached the endVal
--nothing more to do


Jim Ault
Las Vegas


On 5/21/07 9:54 PM, "Scott Rossi" <scott at tactilemedia.com> wrote:

> Being math challenged as I am, I'm wondering if any of the math experts out
> there can explain how to increase the value of a variable by a progressively
> decreasing amount.  I believe this might be referred to as logarithmic
> change(?).
> 
> In any event, I want to start with a base number, say 75, and add
> progressively decreasing values to the base in a specified number of steps
> until I reach 255.
> For example (maybe about 20 steps):
> 
> 75
> -- 18
> 93
> -- 17
> 110
> -- 16
> 126
> -- 15
> 141
> -- 14
> 154
> -- 13
> . . .
> . . .
> . . .
> 240
> -- 5
> 245
> -- 4
> 249
> -- 3
> 252
> -- 2
> 254
> -- 1
> 255
> 
> I'm sure there's a formula for this but it's been years for me...  Thanks
> for any suggestions.
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list