## Trouble with the nth Root…

Oct 17, 2013 at 5:08pm

# Trouble with the nth Root…

I’ve recently started learning to use MaxMSP and have been tasked with working out how to patch different equations, but I’ve been a little stuck trying to work out the “nth root of X”. I have looked around quite extensively and it appears I have to use the [expr] object, but I have no knowledge of how to use it.

So my question is, is there any alternative within Max (v6, if it matters) to work out the “nth Root of X” than [expr]?
If not could would anyone know of any recommended documentation/tutorials on the object, other than the help files supplied? I know I’ll need to do a fair bit of reading on the object if it is definitely what I require, as it seems fairly complex from anything I’ve read so far. If I’m not mistaken it uses language similar to C?

Thanks in advance for any help!

#268332
Oct 17, 2013 at 8:35pm

look all through the help file of expr, there is an almost complete listing of operators it accepts in the subpatchers. and dont be afraid of expr, tame it, and it will follow you.

#268342
Oct 17, 2013 at 8:48pm

expr is great… I use it all the time and my math sucks… so you have no excuse. :)

Here..

– Pasted Max Patch, click to expand. –
#268344
Oct 18, 2013 at 4:28pm

Cheers guys, thanks a lot for the help!
I completely forgot that you can translate the nth Root of X into X^1/n.

I’m gonna look a lot into [expr] now then. My maths skills are by no means phenomenal, but the sort of stuff I’ve been doing, I can normally do on paper, it’s just working out how to do it in the environment itself, with the right objects, correct routing and setting order of execution, with the hot and cold inlets, that I’m trying to get the hang of.

I was set a task of working out log(x) and Z*log(X/Y), too. I’ve managed to do all of them now except for these two.

So, sorry to be a pain, but would you mind me asking for some guidance on how to patch these as well? I’m struggling even more finding any information at all on log within Max.

Thanks again!

#268426
Oct 18, 2013 at 4:50pm

in the help file it says:

List of functions in expr:
min, max, int (convert to integer), float (convert to float), pow (power), sqrt (square root), exp (power of e to x), log10 (log), ln (natural log), log (nat. log), sin, cos, tan, asin (arcsin), acos, atan, atan2, sinh, cosh, tanh, fact (factorial), random, size (size of a table), sum (sum of table contents), Sum (sum with boundaries), avg (of table contents), Avg (avg with boundaries), store (store into a table)

so they would be: `[expr log(\$f1)]` and `[expr \$f1*log(\$f2/\$f3)]`
or: `[expr log10(\$f1)]` and `[expr \$f1*log10(\$f2/\$f3)]`

#268428
Oct 18, 2013 at 7:05pm

You can also just use the pow object for exponential calculations. Expr is for compound formulas and is IIRC a little slower. (Pow .25 is the fourth root)

#268434

You must be logged in to reply to this topic.