<div dir="ltr">yes, you need to use a [clip~ -3 3] to restrict the input.  But the function converges to +0.999999 and -0.999999 or whatever by then anyway, so for all practical purposes it is fine.  </div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 3, 2015 at 2:26 PM, Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've never seen that approximation before but there must be some<br>
restriction on the allowable values of X since the expression diverges<br>
for large positive or negative values of x, while tanh(x) converges to<br>
+1 nad -1, respectively.<br>
<br>
cheers<br>
<span class="HOEnZb"><font color="#888888">Miller<br>
</font></span><div class="HOEnZb"><div class="h5">On Fri, Jul 03, 2015 at 01:23:29PM +0900, i go bananas wrote:<br>
> there's a good approximation for tanh that can be made using just a couple<br>
> of simple arithmetic objects:<br>
><br>
> formula is:  tanh(x) ~= x*(27+x*x) / (27+9*x*x)<br>
><br>
> it's close enough for every application i've ever come across, it's cheap<br>
> cos it only uses simple arithmetic, and it doesn't degrade the resolution<br>
> of your signal like a table lookup does.<br>
><br>
><br>
><br>
> On Fri, Jul 3, 2015 at 12:56 PM, Chris McCormick <<a href="mailto:chris@mccormick.cx">chris@mccormick.cx</a>> wrote:<br>
><br>
> > On 03/07/15 03:06, Pagano, Patrick wrote:<br>
> > > Is there a way i can replace something for tanh~<br>
> > > and inits in Vanilla 46?<br>
> ><br>
> > Using a pre-computed table for speed:<br>
> ><br>
> > <a href="https://github.com/chr15m/blockhead/blob/master/e_tanh.pd" rel="noreferrer" target="_blank">https://github.com/chr15m/blockhead/blob/master/e_tanh.pd</a><br>
> > <a href="https://github.com/chr15m/blockhead/blob/master/e_tanh-help.pd" rel="noreferrer" target="_blank">https://github.com/chr15m/blockhead/blob/master/e_tanh-help.pd</a><br>
> ><br>
> > Or install "blockhead" using deken. :)<br>
> ><br>
> > Cheers,<br>
> ><br>
> > Chris.<br>
> ><br>
> > --<br>
> > <a href="http://mccormick.cx/" rel="noreferrer" target="_blank">http://mccormick.cx/</a><br>
> ><br>
> > _______________________________________________<br>
> > <a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
> > UNSUBSCRIBE and account-management -><br>
> > <a href="http://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
> ><br>
<br>
<br>
> _______________________________________________<br>
> <a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
> UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
<br>
</div></div></blockquote></div><br></div>