Forums > MaxMSP

### log to the base x

Jun 10 2009 | 12:20 pm

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

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

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

Jun 10 2009 | 1:31 pm

`newobj: log: No such object`
Jun 10 2009 | 1:48 pm

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.

Jun 10 2009 | 2:09 pm

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

Jun 10 2009 | 3:11 pm
 jimdrake wrote on Wed, 10 June 2009 16:09 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

[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

Jun 10 2009 | 3:18 pm

…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.

Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP