acer

32480 Reputation

29 Badges

20 years, 6 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

It's not really clear what the Asker hopes to ascertain with such measurements.

Matlab was mentioned, and perhaps all that's needed is measurement of hardware float rtables' memory allocations.

If symbolic objects' memory storage sizes are the desired knowledge, then is it important to avoid duplicate counting? In the example below, the "size" of `c` is counted twice, once when measuring `c` and once again when measuring `a`. But we know that the long list is only being stored once in Maple, due to its uniquification process.

> a:=b+c:

> c:=[seq(cat(x,i),i=1..10^4)]:

> length(a);
                                     58905

> length(c);
                                     58897

> length(sprintf("%m", eval(a)));
                                     78910

> length(sprintf("%m", eval(c)));
                                     78899

Maybe the Asker was originally trying to do something else, such as optimize code with respect to memory use (in which case using procedures and Maple's profiling tools might be a better all round approach).

We may need the Asker to clarify what's really wanted.

acer

Comments which relate to the programming or mathematics of such escape fractals are welcome as followups to this post.

But comments with little or no relevant substance, such as simple links to galleries of images with some mathematical background, are not welcome, and I may delete them.

acer

Here is a higher resolution version of one of those, produced at 1600 pixels in width (34sec on my machine, compiled and multithreaded) and scaled down to 800 pixels wide for insertion here.

 

 

acer

Are you running 16.02, and do you have the ability to run (or reinstall) 16.01? See here and here.

For this particular example, the curve can be revealed with,

  subsindets(A,[undefined,undefined],z->NULL);

but that (and related simple attempts at replacements) won't be a general workaround (as it may wrongly connect points).

acer

As written, the 2-dimensional rtable entries of V are of type Array rather than of type Matrix. It's not clear from the original post which is wanted or needed, and perhaps it won't matter. But for some uses it will matter, eg. behaviour w.r.t. the `.` operator, or in a release before Maple 16 when the LinearAlgebra package got coercion, etc. If it matters, then this aspect can be efficiently toggled in-place on the V[i], ie.

for i from 1 to 5 do rtable_options(V[i],subtype=Matrix); end do:

After doing so V[i] will be a Matrix instead of a 2-dimensional Array, and V[i][..,k] will be a column Vector instead of a 1-dimensional Array.

acer

As written, the 2-dimensional rtable entries of V are of type Array rather than of type Matrix. It's not clear from the original post which is wanted or needed, and perhaps it won't matter. But for some uses it will matter, eg. behaviour w.r.t. the `.` operator, or in a release before Maple 16 when the LinearAlgebra package got coercion, etc. If it matters, then this aspect can be efficiently toggled in-place on the V[i], ie.

for i from 1 to 5 do rtable_options(V[i],subtype=Matrix); end do:

After doing so V[i] will be a Matrix instead of a 2-dimensional Array, and V[i][..,k] will be a column Vector instead of a 1-dimensional Array.

acer

I have submitted this as a bug report against `solve`.

acer

I have submitted this as a bug report against `solve`.

acer

Perhaps Axel might have some clever insight.

I was suspicious of the last 3 digits or so from _d01amc. So here is _d01ajc on a finite interval. I doubt that I understand this integral well yet...

restart;

phi:=z->(z-1)^(9/10)*(z-2)^(6/10)*(z+1)^(8/10)
        /(z*(z-(21/10))^(9/10)*(z+2)^(4/10)):
g_line:=(t,mu,c)->mu+t+c*t*I:
igrand:=(phi(g_line(t,mu0,c0))/(g_line(t,mu0,c0)-mu0)
        *exp(-l*g_line(t,mu0,c0))*diff(g_line(t,mu0,c0),t)):

igrand:=eval(igrand,[mu0=2,c0=0.1,l=1]):

# Various kinds of simplification (while integrand is exact) do not
# seem to improve significantly the accuracy of the integrand itself.
# (But maybe someone can do that better...)
# For now, reverting to floats throughout.
igrand:=subsindets(igrand,rational,evalf):
T:=Int(igrand, t=0..30, digits=15, epsilon=0.5e-14, method=_d01ajc):

CodeTools:-Usage( evalf[15](T) );
memory used=4.20MiB, alloc change=10.06MiB, cpu time=514.00ms, real time=530.00ms
            0.0999887009423848 - 0.605301458903795 I

acer

Perhaps Axel might have some clever insight.

I was suspicious of the last 3 digits or so from _d01amc. So here is _d01ajc on a finite interval. I doubt that I understand this integral well yet...

restart;

phi:=z->(z-1)^(9/10)*(z-2)^(6/10)*(z+1)^(8/10)
        /(z*(z-(21/10))^(9/10)*(z+2)^(4/10)):
g_line:=(t,mu,c)->mu+t+c*t*I:
igrand:=(phi(g_line(t,mu0,c0))/(g_line(t,mu0,c0)-mu0)
        *exp(-l*g_line(t,mu0,c0))*diff(g_line(t,mu0,c0),t)):

igrand:=eval(igrand,[mu0=2,c0=0.1,l=1]):

# Various kinds of simplification (while integrand is exact) do not
# seem to improve significantly the accuracy of the integrand itself.
# (But maybe someone can do that better...)
# For now, reverting to floats throughout.
igrand:=subsindets(igrand,rational,evalf):
T:=Int(igrand, t=0..30, digits=15, epsilon=0.5e-14, method=_d01ajc):

CodeTools:-Usage( evalf[15](T) );
memory used=4.20MiB, alloc change=10.06MiB, cpu time=514.00ms, real time=530.00ms
            0.0999887009423848 - 0.605301458903795 I

acer

@Rune - math How fast do you need it? How accurate do you need it? How are you prepared to accept trade-offs in one for the other?

@Markiyan Hirnyk 

> restart:
> with(RandomTools):
> r := Generate(list(posint(range = 77), 3000)):
> st := time():
> for j to 10^2 do
>    T := Statistics:-Tally(r):
>    map(lhs, select(c -> is(rhs(c) = max(map(rhs, T))), T));
> end do:
> %;
                                      [16]

> time()-st;
                                      0.361

could be compared with,

> restart:
> with(RandomTools):
> r := Generate(list(posint(range = 77), 3000)):
> st := time():
> for j to 10^2 do
>    T := Statistics:-Tally(r):
>    tmax := max(map(rhs, T));
>    map(lhs, select(c -> rhs(c) = tmax, T));
> end do:
> %;
                                      [16]

> time()-st;
                                      0.190

@Markiyan Hirnyk 

> restart:
> with(RandomTools):
> r := Generate(list(posint(range = 77), 3000)):
> st := time():
> for j to 10^2 do
>    T := Statistics:-Tally(r):
>    map(lhs, select(c -> is(rhs(c) = max(map(rhs, T))), T));
> end do:
> %;
                                      [16]

> time()-st;
                                      0.361

could be compared with,

> restart:
> with(RandomTools):
> r := Generate(list(posint(range = 77), 3000)):
> st := time():
> for j to 10^2 do
>    T := Statistics:-Tally(r):
>    tmax := max(map(rhs, T));
>    map(lhs, select(c -> rhs(c) = tmax, T));
> end do:
> %;
                                      [16]

> time()-st;
                                      0.190

@Markiyan Hirnyk You might get a little more speed by pulling the `max` call out of the anonymous proc body (precomputed and preassigned, say, before calling `select`). And you shouldn't need the `is` hammer.

Speedup may depend not only on number of repetitions, but on problem size.

@Markiyan Hirnyk You might get a little more speed by pulling the `max` call out of the anonymous proc body (precomputed and preassigned, say, before calling `select`). And you shouldn't need the `is` hammer.

Speedup may depend not only on number of repetitions, but on problem size.

First 382 383 384 385 386 387 388 Last Page 384 of 594