Forums > MaxMSP

math is over my head

March 6, 2006 | 3:04 am

I’m trying to put an s-curve into a buffer~ to use as a lookup table,
but I can’t figure out the damn math. I gather the formula to use
would be: y= 1./ 1 + exp((b*x) -a)

b being a curve constant, & a shifting it. I was trying to peek into
a buffer using [expr 1. / 1. + exp(($f1*$f2) - $f3)] my curve
rockets up, but never levels out at the top.

Can someone who understands math tell me what I’m doing wrong?

Thank you o wise math people.

M


March 6, 2006 | 4:48 am

Couple of parentheses should clear things up:

try:

1./(1.+exp(($f1*$f2)-$f3)))

Right now you’re adding 1/1 to exp(($f1…etc., so it will never level
out. (because the exp. is going to keep growing in value.) Once you
add the parentheses, you should see the expected asymptotic behavior.

Peter McCulloch


March 6, 2006 | 10:31 am

On around Mar 6, 2006, at 4:04, mattyo said something like:
> Can someone who understands math tell me what I’m doing wrong?

Peter McC. answered your top-level question. But if you’re really
having a hard time with the math, you might want to take a look at
lp.scampf from Litter Power, which is there particularly for creating
S-shaped and other shaped-curves, doing all the hard math for you. Just
play with the number boxes in the help file until you get the shape you
want.

Here’s a snapshot showing what it looks like:

I’ve removed the alpha channel to see if that helps the folks who have
been having problems viewing Max-generated TIFFs and colors are trimmed
to 4-bit resolution to minimize bandwidth. Forum readers will probably
have to download the Litter Starter Pack (URI below) to see it; sorry,
that’s beyond my power to control.

Best, Peter C.

>
————– http://www.bek.no/~pcastine/Litter/ ————–
Peter Castine | ^
| Litter Power & Litter Bundle for Jitter
pcastine@gmx.net |
pcastine@bek.no | iCE: Sequencing, Recording, and Interface Building
4-15@kagi.com | for Max/MSP
| Extremely cool
| http://www.dspaudio.com
| http://www.dspaudio.com/software/software.html


March 6, 2006 | 6:52 pm

That works!
Cheers
Roger


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