Math question

-hh hh at
Fri Feb 26 08:18:46 EST 2016

>> Peter Bo. wrote
>> How would one modify this to return tOffset as a smaller change when tData is near zero, and the opposite when tData is near the maximum?
> Kay C. Lan wrote:
> I think what you need is use x to the power of. ie x*x, x*x*x, or x*x*x*x 

Yes K.C., that's my proposal too.
Allow me to write this a little more math-like.

One may use

[*] return defaultSetting + c*f(n, 5*tData/maxvalue)

if the slider range is from -maxvalue to maxvalue.
the constant factor c will depend on tData (you use 60 in your example)

-- n is any real > 1 (try n=3/2 or n=2 or n=5/2 or n=3 or n=4)
-- (n doesn't need to be an integer, essential is to set n>1).
-- x is any real, here between -5 and 5
-- I would try to use -3 to 3 (--> the 3 replacing 5 in [*])

function f n,x
  return x*abs(x^(n-1))
end f

Kay, I write this in order to remark that
instead of the two cases
  -x*x, if x<0
   x*x, if x>0
one could write
which has the correct sign
[because abs(x) = -x if x<=0 and abs(x) = x if x>0]

p.s. the thumbpos is since LC 7 a real, rounding is for setting
the thumpos not necessary any more.
One should know that if one needs an integer when getting the thumbpos.

More information about the Use-livecode mailing list