log to the base x

Cycling '74's icon

how to i do log to the base x in max?

Roman Thilenius's icon

jimdrake wrote on Wed, 10 June 2009 14:20how to i do log to the base x in max?

have you tried typing "log" into an object box yet?

Cycling '74's icon
newobj: log: No such object

Holland Hopson's icon

Look at the [expr] object and reference. There's a log10 function and a log (natural log) function. The syntax is standard C, so any C reference will point you in the right direction if you can't figure it out by trial and error.

Cycling '74's icon

i hunted around and i can't see anything in C that lets you do log to the base x.

i did however dig out a text book from uni (!) and found this useful rule:

logA(x) = logB(x) / logB (a)

[capitals are meant to be subscript]

so, i can do it in [expr] with log to the base 10

Roman Thilenius's icon

jimdrake wrote on Wed, 10 June 2009 16:09i hunted around and i can't see anything in C that lets you do log to the base x.

i did however dig out a text book from uni (!) and found this useful rule:

logA(x) = logB(x) / logB (a)

[capitals are meant to be subscript]

so, i can do it in [expr] with log to the base 10

[expr log(($f1)*($f2-1)+1)/log($f2)]

this is for a range of 0. 1.

for other ranges just scale before and after.

frustrating, that expierience when typing "log" into an
object box, isnt it?

-110

Roman Thilenius's icon

...and if you want to include the input range into the
formula, you might end up with something like this:


[expr ((log((($f1-$f2)/($f3-$f2))*($f4-1)+1)/log($f4))*($f3-$f2))+$f2]

where $f2 $f3 are range low range high, and $f4 is the base.