Pseudomodo

255 Reputation

8 Badges

14 years, 45 days

 

Istra balagina kish kish karia.

MaplePrimes Activity


These are replies submitted by Pseudomodo

@alex_01 Yes, that form can be obtained directly by replacing L' with U (or R') and L by U' (or R) literally, throughout (as mentioned).

The worksheet is quite interesting and approachable.

I noticed a small mistake on the Application Center own page for this. In the "Toolkit" pane it has the typo, "Download attacked worksheet".

Pardon me if this is a silly question, but when would the result of

`if`(evalb(PP),1,0)

be different from that of

`if`(PP,1,0)

if used in your inlined procedure?

Pardon me if this is a silly question, but when would the result of

`if`(evalb(PP),1,0)

be different from that of

`if`(PP,1,0)

if used in your inlined procedure?

> f:=a->int(a*x,x=0..1):

> int('f'(x), x=0..1);
                                      1/4

Which leads to trying

> g:=proc(j)
>   if j=0 then
>     y->int(y*x,x=0..1)
>   else
>     y->int(y*'g'(j-1)(x),x=0..1);  
>   end if:
> end proc:

> seq( int( 'g'(i)(x), x=0..1), i=1..10);  

      1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024, 1/2048, 1/4096

Erik's suggestion, which gets a distinct local `x` as the dummy variable of integration for each call (recursion), is clever.

> gerik:=proc(j)
> local x;
>   if j=0 then
>     y->int(y*x,x=0..1)
>   else
>     y->int(y*gerik(j-1)(x),x=0..1);
>   end if:
> end proc:

> seq( int( gerik(i)(x), x=0..1), i=1..10);

      1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024, 1/2048, 1/4096
> f:=a->int(a*x,x=0..1):

> int('f'(x), x=0..1);
                                      1/4

Which leads to trying

> g:=proc(j)
>   if j=0 then
>     y->int(y*x,x=0..1)
>   else
>     y->int(y*'g'(j-1)(x),x=0..1);  
>   end if:
> end proc:

> seq( int( 'g'(i)(x), x=0..1), i=1..10);  

      1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024, 1/2048, 1/4096

Erik's suggestion, which gets a distinct local `x` as the dummy variable of integration for each call (recursion), is clever.

> gerik:=proc(j)
> local x;
>   if j=0 then
>     y->int(y*x,x=0..1)
>   else
>     y->int(y*gerik(j-1)(x),x=0..1);
>   end if:
> end proc:

> seq( int( gerik(i)(x), x=0..1), i=1..10);

      1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024, 1/2048, 1/4096

Was the 2nd condition that diff(f[1](x),x))=1 , while you have used diff(f[1](x),x))=0 ?

Was the 2nd condition that diff(f[1](x),x))=1 , while you have used diff(f[1](x),x))=0 ?

As shown yesterday, the difference is that the Vector returned by AudioTools:-Create has certain attributes on it.

So you can convert a plain datatype=float[8] Vector[column] to an "audio object" by either calling AudioTools:-Create on it, or simply by giving it the appropriate attributes.

What's interesting is that AudioTools:-Create doesn't seem to produce a new Vector object. It just applies the attributes, etc. So it isn't more efficient to apply them manually.

restart:
v1 := Vector([1, 2, 1, 2],datatype=float[8]):
a1:=AudioTools:-Create(v1):
a1[1]:=2.45:
v1[1];
                              2.45000000000000

restart:
V := LinearAlgebra:-RandomVector(10^6,outputoptions=[datatype=float[8]]):
startmem:=kernelopts(bytesalloc):
A:=AudioTools:-Create(V):
kernelopts(bytesalloc)-startmem;
                                      0

As shown yesterday, the difference is that the Vector returned by AudioTools:-Create has certain attributes on it.

So you can convert a plain datatype=float[8] Vector[column] to an "audio object" by either calling AudioTools:-Create on it, or simply by giving it the appropriate attributes.

What's interesting is that AudioTools:-Create doesn't seem to produce a new Vector object. It just applies the attributes, etc. So it isn't more efficient to apply them manually.

restart:
v1 := Vector([1, 2, 1, 2],datatype=float[8]):
a1:=AudioTools:-Create(v1):
a1[1]:=2.45:
v1[1];
                              2.45000000000000

restart:
V := LinearAlgebra:-RandomVector(10^6,outputoptions=[datatype=float[8]]):
startmem:=kernelopts(bytesalloc):
A:=AudioTools:-Create(V):
kernelopts(bytesalloc)-startmem;
                                      0

@longrob It looks like it it is recognized also on account of some attributes (sampling rate, bits, channels, etc).

v1 := Vector([1, 2, 1, 2],datatype=float[8]):
v2 := Vector([1, 3, 1, 2],datatype=float[8]):

AudioTools:-Convolution(v1,v2);

Error, invalid input: AudioTools:-Convolution expects its 1st argument, audio,
 to be of type AudioTools:-Audio, but received Vector(4, {(1) = 1.0, (2) = 2.0, (3) = 1.0, (4) = 2.0}, datatype = float[8])

setattribute(v1,44100,16,1):
setattribute(v2,44100,16,1):

AudioTools:-Convolution(v1,v2);

                                    [ 1.]
                                    [   ]
                                    [ 5.]
                                    [   ]
                                    [ 8.]
                                    [   ]
                                    [ 9.]
                                    [   ]
                                    [11.]
                                    [   ]
                                    [ 4.]
                                    [   ]
                                    [ 4.]

note: doing this with Vector[row] made my Maple engine stop responding (Windows 7, 64bit, Maple 15.01) when the AudioTools:-Convolution command was called. (I've submitted an SCR against this.) The same for this more usual usage:

a1:=AudioTools:-Create(Vector[row]([1, 2, 1, 2],datatype=float[8])):

a2:=AudioTools:-Create(Vector[row]([1, 2, 1, 2],datatype=float[8]));

AudioTools:-Convolution(a1,a2);

@longrob It looks like it it is recognized also on account of some attributes (sampling rate, bits, channels, etc).

v1 := Vector([1, 2, 1, 2],datatype=float[8]):
v2 := Vector([1, 3, 1, 2],datatype=float[8]):

AudioTools:-Convolution(v1,v2);

Error, invalid input: AudioTools:-Convolution expects its 1st argument, audio,
 to be of type AudioTools:-Audio, but received Vector(4, {(1) = 1.0, (2) = 2.0, (3) = 1.0, (4) = 2.0}, datatype = float[8])

setattribute(v1,44100,16,1):
setattribute(v2,44100,16,1):

AudioTools:-Convolution(v1,v2);

                                    [ 1.]
                                    [   ]
                                    [ 5.]
                                    [   ]
                                    [ 8.]
                                    [   ]
                                    [ 9.]
                                    [   ]
                                    [11.]
                                    [   ]
                                    [ 4.]
                                    [   ]
                                    [ 4.]

note: doing this with Vector[row] made my Maple engine stop responding (Windows 7, 64bit, Maple 15.01) when the AudioTools:-Convolution command was called. (I've submitted an SCR against this.) The same for this more usual usage:

a1:=AudioTools:-Create(Vector[row]([1, 2, 1, 2],datatype=float[8])):

a2:=AudioTools:-Create(Vector[row]([1, 2, 1, 2],datatype=float[8]));

AudioTools:-Convolution(a1,a2);

@longrob AudioTools:-Convolution acts on on Vectors, Arrays, and Matrices with datatype float[8]. You don't necessarily have to start with an audio format file.

@longrob AudioTools:-Convolution acts on on Vectors, Arrays, and Matrices with datatype float[8]. You don't necessarily have to start with an audio format file.

I could also have entered manually.

    evalf(Int(x->BesselJ(170.5,x)*cos(x/(.997))/x,1..180, method=_d01akc))
+ I*evalf(Int(x->BesselJ(170.5,x)*sin(x/(.997))/x,1..180, method=_d01akc));

              -0.0001850451795 + 0.0002210831181 I

I used an operator for the procedure to avoid this problen:

evalf(Int(BesselJ(170.5,x)*cos(x/(.997))/x,x=1..180, method=_d01akc));

Error, (in evalf/int) powering may produce overflow

And I took Re and Im so that the faster oscillitory method _d01akc could work (it's for the reals only, compiled for doubles).

The result seems to be correct and accurate. Maybe someone else can confirm or refute.

1 2 3 4 5 6 Page 5 of 6