back to list

Re: [tuning] Re: Calculating Harmonic Entropy

🔗MANUEL.OP.DE.COUL@EZH.NL

9/12/2000 7:01:36 AM

Yeah, use the approximation that I used. I get nearly the same entropy
values as Paul. Here it is.

function Phi (Of_Number : Long_Float) return Long_Float is

function Norm (Zin : in Long_Float) return Long_Float is
P : Long_Float;
Z : constant Long_Float := abs Zin;
begin
P := 1.0 + Z * (0.04986735 + Z * (0.02114101 + Z * (0.00327763 +
Z * (0.0000380036 + Z * (0.0000488906 + Z * 0.000005383)))));
P := P * P; P := P * P; P := P * P;
if Zin >= 0.0 then
return 1.0 - 0.5 / (P * P);
else
return 0.5 / (P * P);
end if;
end Norm;

begin
if Of_Number >= 5.0 then
return 1.0;
elsif Of_Number <= -5.0 then
return 0.0;
else
return Norm(Of_Number);
end if;
end Phi;

Manuel Op de Coul coul@ezh.nl

🔗Paul H. Erlich <PERLICH@ACADIAN-ASSET.COM>

9/12/2000 9:28:04 AM

John deLaubenfels wrote,

>OK, Paul, help me out: the "Error Function" is
>the integral of the bell curve function, exp(-x^2/2), yes?

Basically, yes -- it's actually 2/sqrt(pi) * integral from 0 to x of
exp(-t^2) dt.

>If memory
>serves, that's one of those nasty function for which there is no nice
>expression to represent the integral, true?

Right -- it's a "special function".

>So, how do I write the
>"Error Function"? I can, of course, do it by brute force: integrate
>exp(-x^2/2) in tiny slices, save some of the values in a compile-time
>array, and interpolate. Got any better ideas?

Matlab uses an approximation algorithm, published in "Rational Chebyshev
approximations for the error function" by W. J. Cody, Math. Comp., 1969,
PP. 631-638. See if you can dig that up.

🔗MANUEL.OP.DE.COUL@EZH.NL

9/12/2000 9:23:50 AM

> Do my eyes deceive me, or is that Pascal?

Nope, its big sister Ada.

Manuel

🔗Paul H. Erlich <PERLICH@ACADIAN-ASSET.COM>

9/13/2000 10:39:15 AM

Ed Borasky wrote,

>Speaking of which, I've figured out how to do Sethares' contour plots of
>dissonance surfaces in Derive, and will post an example to the list in the
>near future. How do I post a "JPEG"??

You should add them to http://www.egroups.com/files/tuning/, where I've been
putting my graphs. I look forward to seeing them. Be sure to let us know
what register you're assuming and what the relative amplitudes of the
partials are in the tones you use.

🔗Joseph Pehrson <josephpehrson@compuserve.com>

9/13/2000 6:47:49 PM

--- In tuning@egroups.com, "Paul H. Erlich" <PERLICH@A...> wrote:

http://www.egroups.com/message/tuning/12671

> Matlab uses an approximation algorithm, published in "Rational
Chebyshev
> approximations for the error function" by W. J. Cody, Math. Comp.,
1969,
> PP. 631-638. See if you can dig that up.

Could someone please explain to me what "Matlab" is. Is it basically
a mathematics program?? And, if so, who had the brilliant idea of
having it capable of making .wav files?? Is that part of the basic
package??
__________ ___ __ _ _
Joseph Pehrson

🔗Paul H. Erlich <PERLICH@ACADIAN-ASSET.COM>

9/13/2000 6:48:59 PM

>Could someone please explain to me what "Matlab" is. Is it basically
>a mathematics program??

It's basically a _matrix_ mathematics program ("Mat" stands for matrix) and
I use it for my financial work.

>And, if so, who had the brilliant idea of
>.having it capable of making .wav files?? Is that part of the basic
>package??

Yup!

🔗Joseph Pehrson <josephpehrson@compuserve.com>

9/13/2000 7:49:05 PM

--- In tuning@egroups.com, "Paul H. Erlich" <PERLICH@A...> wrote:

http://www.egroups.com/message/tuning/12727

> >Could someone please explain to me what "Matlab" is. Is it
basically
> >a mathematics program??
>
> It's basically a _matrix_ mathematics program ("Mat" stands for
matrix) and
> I use it for my financial work.
>
> >And, if so, who had the brilliant idea of
> >.having it capable of making .wav files?? Is that part of the
basic
> >package??
>
> Yup!

This is such a "crazy" idea! I could never imagine somebody thinking
of incorporating a .wav generating routine in a mathematics package
like this...
_______ ____ __ __ __ _ _
Joseph Pehrson

🔗Paul H. Erlich <PERLICH@ACADIAN-ASSET.COM>

9/13/2000 7:48:14 PM

Joseph wrote,

>This is such a "crazy" idea! I could never imagine somebody thinking
>of incorporating a .wav generating routine in a mathematics package
>like this...

It's not that crazy. I think the idea was that you can read .wav files into
Matlab, do Fourier transforms, wavelet analysis, signal processing, and
other math-intensive operations, and then write a .wav file out if what you
did was, say, an algorithm to eliminate pops and hiss from the .wav file.
MathWorks (the company that sells Matlab) sells many auxillary toolboxes,
like a signal processing toolbox, a wavelet toolbox, etc.

🔗Paul H. Erlich <PERLICH@ACADIAN-ASSET.COM>

9/13/2000 10:36:15 PM

Ed Borasky wrote,

>The error function (erf) and the probability integral (integral under the
>bell curve) are similar but not identical; I don't have my tables handy but
>I believe they differ only by a scaling factor.

The integral from minus infinity to x of a normal probability curve with
mean 0 and standard deviation 1 is

.5+.5*erf(.5*sqrt(2)*x).