sand15

802 Reputation

11 Badges

10 years, 48 days

MaplePrimes Activity


These are replies submitted by sand15

I apologize : the true syntax I used is userData := convert(userData, Matrix): 

sorry again

@Carl Love 
 
Sorry for the response time, I was in vacations.

(the font and the presentation are not smart due to drag and drop between different mailing systems)

 
 
I already used kernelopts(memusage) but it is not easy to interpret the data it returns.
 
In my case I observe that practically all the types of variables have a growing size (here a sketch of the my usage of kernelopts)
 
DATA := Matrix(1000, 10, [...]):
MEM := kernelopts(memusage):   #  Initial sizes
 
n := 10: # for primary investigations
for k from 1 to n do
  result := Myproc(...., DATA[k, ..], ...)
  MEM := < MEM | kernelopts(memusage)[.., 2..3] >:
end do:
MEM;
 
What it is quite puzzling for me, is that he BINARY item presents the highest increase : typically its size after the first execution of the loop is very close to its initial size but increases by a factor of 5 after the second call to MyProc (which, at least explicitly doesn't contain any boolean type nor complex `if` structures not piecewise functions)
 
 
Nevertheless, I observe the memory does not inflate in the following case.
 
n := 10: 
TEST := 2: # or any other value in the range 1..1000
for k from 1 to n do
  result := Myproc(...., DATA[TEST, ..], ...)
  MEM := < MEM | kernelopts(memusage)[.., 2..3] >:
end do:
MEM;
 
 
Some orders of magnitude of the memory (obtained with CodeTools[usage])
  • in the later case above it keeps a constant value around 70 MiB whatever the value of n (but it is probably a consequence of some remembrance process)
  • In the first case it starts from 70 MiB, jumps to 650 MiB for n=2 and increases regularly to reach 1 GiB for n of the order of 100 and 4 GiB for n=1000
 
 
 
At the end, I stopped using kernelopts(memusage) because I was not capable to link the many items this function returns  to the quantities the procedure MyProc handles ...
 
 
Thank you nevertheless for the answer.
It feels as if I’m going to use you second suggestion CodeTools:-Profiling:-Profile()
 

@acer   thank you acer

@Carl Love 


Great thanks to you Carl, I think I could have been waste a lot of time on this problem !!!

I am going to look to the many commands you mentionned and try to understand all this,

thanks again

@Preben Alsholm 

This is a complete explanation, thank you Preben

@acer 

It suits me very well.

@Adri van der Meer 

Smarter than Matrix(N,N, Re~(convert(DC, list))) !!!

Nevertheless : do you observe the same behaviours I did myself ?

@Preben Alsholm

Thank you Preben, but I have this answer.

I would not offend Kitonum (who posted a  pretty solution) but the "other" was smarter.

In fact I think I rediscoverd it by myself (thanks to my anonymous inspirer) :

  1. Let A a fixed real interval
  2. let B another real interval and B(x) a translation of B of value x
  3. Question : "Do A and B(X) overlap ?"


(A) solution :

coverage := proc(A, B, x) 
    coulditbe('_u', `intersect`(SetOf(A), SetOf(map(y -> x+y, B)) ) )
end proc:

# example :

A := RealRange(0, 2);
B := RealRange(-3, -1);
coverage(A, B, 0.999):
coverage(A, B, 1.001):


No offence meant to Kitonum, and without regard of efficiency, this solution is slightly more aesthetic than the one he proposed to me  :-)


@John Fredsted I obtained the same conclusion yesterday evening by setting k=r*exp(theta*I).
It seemed a little bit simpler to analyze because r is always positive and sin(theta) is bounded

I will send you the .mw file asap. For the moment the uploading doesn't work correctly (I'm in the office and it could be related to the firewall ?)






@Kitonum Thanks.

It is a little bit clever than what I coded myself.

I just hoped that the equivalent of `intersect`(set1, set2) for countable sets existed for no countable ones

(Maple is sometimes so "elegant" ... it could have been the case).


Thanks again

@John Fredsted I am really sorry : I realized my mistake as I was pushing the "submit" button !!!

 

In addition to your previous reply  "Whether this is the complete solution for k remains to be investigated" I obtained these results (I hope there is no mistake this time) :

phi2  := (x,k) -> expand(phi(x,k)*conjugate(phi(x,k))) :
PHI2 := phi2(x, a+b*I) assuming x::real, a::real b::real :

limit(PHI2, x=+infinity) assuming b::positive ;    # returns 0
limit(PHI2, x=+infinity) assuming b::negative;    # returns infinity
limit(subs(b=0, PHI2), x=+infinity) ;                  # returns 1

It seems that the boundedness only occur for pure imaginary k ?

(sorry again)

@John Fredsted  Please enlighten me

In your last reply you study phi(x,k) for k complex of the form k=a+b*I (a and b real).
You draw phi(x,(a,b)) for the particular case a=0, b=1 and find thie last bell-shaped curve.

But if a=0 and b=1 then k = I and k^2 = -1

and then phi(x,k) is undefined ...

Did I miss something ?

 

First 23 24 25 Page 25 of 25