gulliet

281 Reputation

7 Badges

19 years, 303 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by gulliet

Use, "method = uniform", to get a uniform distribution. From the online help: method = uniform or logarithmic This option specifies whether the floating-point number should be chosen logarithmically or uniformly from the interval. The logarithmic method is identical to listing all of the unique floating-point numbers that are found between the endpoints, and then choosing one of these randomly. The uniform method is similar to sampling from a uniform distribution that is bounded by the endpoints, and then converting this result into a floating-point number. The default value for this option is logarithmic. Therefore, the following will do what you are looking for (Note that we do need a For...Loop to get a list of values.): with(RandomTools); with(plots); with(Statistics); test_list := Generate(list(float(range = 1 .. 100, digits = 4, method = uniform), 5000)); listplot(test_list, style = point, symbol = point); FrequencyPlot(test_list, frequencyscale = absolute, style = point) Regards, -- Jean-Marc
I tried to compute the inverse matrix with another CAS and it took about 40 seconds to get the answer (the overall memory consumption was rather small). As Axel conjectured, the inverse matrix is, indeed, dense and each matrix entry is made of about 15,000 symbols. To check that the returned matrix was correct, I computed the individual dot product line by column (i.e. M.M^(-1) split in 121 individual dot products so I could timed and checked them individually). It took between one and two minutes to compute and simplify to zero or one each dot product.
In[3]:= Timing[inv = Inverse[m];]

Out[3]= {37.2488, Null}

In[4]:= ByteCount[inv]

Out[4]= 34654736

In[5]:= LeafCount[inv]

Out[5]= 1852920

In[7]:= Map[LeafCount, inv, {2}]

Out[7]= {{17896, 17875, 16585, 15651, 15022, 15019, 14404, 14314, 
  13859, 13859, 13927}, {17878, 17896, 15654, 16583, 15049, 15034, 
  14385, 14432, 13904, 13917, 13984}, {16582, 15651, 16606, 16570, 
  15615, 15134, 14587, 14610, 14076, 14056, 14153}, {15654, 16586, 
  16576, 16606, 15138, 15606, 14638, 14597, 14059, 14082, 
  14158}, {15011, 15046, 15606, 15130, 17126, 16777, 15996, 15391, 
  14601, 14588, 14734}, {15028, 15040, 15133, 15615, 16777, 17126, 
  15391, 16002, 14589, 14604, 14736}, {14386, 14376, 14593, 14623, 
  15996, 15391, 17075, 16941, 15577, 15201, 15577}, {14326, 14444, 
  14633, 14603, 15391, 16002, 16941, 17075, 15201, 15578, 
  15578}, {13859, 13868, 14076, 14059, 14601, 14589, 15577, 15201, 
  16503, 16474, 17007}, {13859, 13872, 14056, 14082, 14588, 14604, 
  15201, 15578, 16474, 16503, 17007}, {13927, 13939, 14153, 14158, 
  14734, 14736, 15577, 15578, 17007, 17007, 18432}}

In[8]:= Mean[Flatten[%]]

Out[8]= 1852908/121

In[9]:= % // Round

Out[9]= 15313

In[10]:= Do[Print[p, " ", q, " ", 
  m[[p, All]].inv[[All, q]] // Simplify // Timing], {p, 11}, {q, 11}]

1 1 {116.241,1}

1 2 {72.5946,0}

1 3 {73.9493,0}

1 4 {65.2858,0}

1 5 {67.987,0}

1 6 {64.7355,0}

[snip]
-- Jean-Marc
I tried to compute the inverse matrix with another CAS and it took about 40 seconds to get the answer (the overall memory consumption was rather small). As Axel conjectured, the inverse matrix is, indeed, dense and each matrix entry is made of about 15,000 symbols. To check that the returned matrix was correct, I computed the individual dot product line by column (i.e. M.M^(-1) split in 121 individual dot products so I could timed and checked them individually). It took between one and two minutes to compute and simplify to zero or one each dot product.
In[3]:= Timing[inv = Inverse[m];]

Out[3]= {37.2488, Null}

In[4]:= ByteCount[inv]

Out[4]= 34654736

In[5]:= LeafCount[inv]

Out[5]= 1852920

In[7]:= Map[LeafCount, inv, {2}]

Out[7]= {{17896, 17875, 16585, 15651, 15022, 15019, 14404, 14314, 
  13859, 13859, 13927}, {17878, 17896, 15654, 16583, 15049, 15034, 
  14385, 14432, 13904, 13917, 13984}, {16582, 15651, 16606, 16570, 
  15615, 15134, 14587, 14610, 14076, 14056, 14153}, {15654, 16586, 
  16576, 16606, 15138, 15606, 14638, 14597, 14059, 14082, 
  14158}, {15011, 15046, 15606, 15130, 17126, 16777, 15996, 15391, 
  14601, 14588, 14734}, {15028, 15040, 15133, 15615, 16777, 17126, 
  15391, 16002, 14589, 14604, 14736}, {14386, 14376, 14593, 14623, 
  15996, 15391, 17075, 16941, 15577, 15201, 15577}, {14326, 14444, 
  14633, 14603, 15391, 16002, 16941, 17075, 15201, 15578, 
  15578}, {13859, 13868, 14076, 14059, 14601, 14589, 15577, 15201, 
  16503, 16474, 17007}, {13859, 13872, 14056, 14082, 14588, 14604, 
  15201, 15578, 16474, 16503, 17007}, {13927, 13939, 14153, 14158, 
  14734, 14736, 15577, 15578, 17007, 17007, 18432}}

In[8]:= Mean[Flatten[%]]

Out[8]= 1852908/121

In[9]:= % // Round

Out[9]= 15313

In[10]:= Do[Print[p, " ", q, " ", 
  m[[p, All]].inv[[All, q]] // Simplify // Timing], {p, 11}, {q, 11}]

1 1 {116.241,1}

1 2 {72.5946,0}

1 3 {73.9493,0}

1 4 {65.2858,0}

1 5 {67.987,0}

1 6 {64.7355,0}

[snip]
-- Jean-Marc
might contains some useful information on memory management. Evaluate ?alloc or search for alloc. Here is a sample: Memory Limits Maple has two types of memory limits: software limits and hardware limits. Software limits are imposed by the -T command-line argument, the datalimit argument to kernelopts and system imposed user limits (for example shell limits). The hardware limit is the amount of physical memory available on the system. -- Jean-Marc
might contains some useful information on memory management. Evaluate ?alloc or search for alloc. Here is a sample: Memory Limits Maple has two types of memory limits: software limits and hardware limits. Software limits are imposed by the -T command-line argument, the datalimit argument to kernelopts and system imposed user limits (for example shell limits). The hardware limit is the amount of physical memory available on the system. -- Jean-Marc
FWIW,
    |\^/|     Maple 11 (APPLE UNIVERSAL OSX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2007
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> with(LinearAlgebra): 
> M := Matrix([[R1+R2+R3+RL2, R3, -R2, 0\                                      
> , 0, 0, 0, 0, 0, 0, 0], [R3, R3+R4+R5+\                                      
> RL2, 0, -R4, 0, 0, 0, 0, 0, 0, 0], [-R\                                      
> 2, 0, R2+R6+R7+R8, R8, -R7, 0, 0, 0, 0\                                      
> , 0, 0], [0, -R4, R8, R4+R8+R9+R10, 0,\                                      
>  -R9, 0, 0, 0, 0, 0], [0, 0, -R7, 0, R\                                      
> 7+R11+R12+R13, R13, -R12, 0, 0, 0, 0],\                                      
>  [0, 0, 0, -R9, R13, R9+R13+R14+R15, 0\                                      
> , -R14, 0, 0, 0], [0, 0, 0, 0, -R12, 0\                                      
> , R12+R16+R17+R18, R18, -R17, 0, 0], [\                                      
> 0, 0, 0, 0, 0, -R14, R18, R14+R18+R19+\                                      
> R20, 0, -R19, 0], [0, 0, 0, 0, 0, 0, -\                                      
> R17, 0, R17+R21+R22+R23, R23, -R22], [\                                      
> 0, 0, 0, 0, 0, 0, 0, -R19, R23, R19+R2\                                      
> 3+R24+R25, -R24], [0, 0, 0, 0, 0, 0, 0, 0, -R22, -R24, R22+R24+R26]]):
> MatrixInverse(M):
bytes used=4009260, alloc=2948580, time=0.12
bytes used=8344364, alloc=5438492, time=0.23
bytes used=12654928, alloc=6224780, time=0.49
bytes used=16669052, alloc=7731832, time=0.70

[snip]

bytes used=1320241168, alloc=407493756, time=362.80
bytes used=1363205652, alloc=439666040, time=369.52
bytes used=1409908468, alloc=484418932, time=373.20
Execution stopped: Memory allocation failed.
Please see ?alloc for more detail.
Regards, -- Jean-Marc
FWIW,
    |\^/|     Maple 11 (APPLE UNIVERSAL OSX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2007
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> with(LinearAlgebra): 
> M := Matrix([[R1+R2+R3+RL2, R3, -R2, 0\                                      
> , 0, 0, 0, 0, 0, 0, 0], [R3, R3+R4+R5+\                                      
> RL2, 0, -R4, 0, 0, 0, 0, 0, 0, 0], [-R\                                      
> 2, 0, R2+R6+R7+R8, R8, -R7, 0, 0, 0, 0\                                      
> , 0, 0], [0, -R4, R8, R4+R8+R9+R10, 0,\                                      
>  -R9, 0, 0, 0, 0, 0], [0, 0, -R7, 0, R\                                      
> 7+R11+R12+R13, R13, -R12, 0, 0, 0, 0],\                                      
>  [0, 0, 0, -R9, R13, R9+R13+R14+R15, 0\                                      
> , -R14, 0, 0, 0], [0, 0, 0, 0, -R12, 0\                                      
> , R12+R16+R17+R18, R18, -R17, 0, 0], [\                                      
> 0, 0, 0, 0, 0, -R14, R18, R14+R18+R19+\                                      
> R20, 0, -R19, 0], [0, 0, 0, 0, 0, 0, -\                                      
> R17, 0, R17+R21+R22+R23, R23, -R22], [\                                      
> 0, 0, 0, 0, 0, 0, 0, -R19, R23, R19+R2\                                      
> 3+R24+R25, -R24], [0, 0, 0, 0, 0, 0, 0, 0, -R22, -R24, R22+R24+R26]]):
> MatrixInverse(M):
bytes used=4009260, alloc=2948580, time=0.12
bytes used=8344364, alloc=5438492, time=0.23
bytes used=12654928, alloc=6224780, time=0.49
bytes used=16669052, alloc=7731832, time=0.70

[snip]

bytes used=1320241168, alloc=407493756, time=362.80
bytes used=1363205652, alloc=439666040, time=369.52
bytes used=1409908468, alloc=484418932, time=373.20
Execution stopped: Memory allocation failed.
Please see ?alloc for more detail.
Regards, -- Jean-Marc
I would suggest to do the inversion with dummy symbols and then to replace these symbols by their actual symbolic expressions.
> with(LinearAlgebra):
> M := Matrix([[Z, X, X, 0, 0, 0, 0, 0, 0, 0, 0], [X, Z, X, X, 0, 0, 0, 0, 0, \
> 0, 0], [X, X, Z, X, X, 0, 0, 0, 0, 0, 0], [0, X, X, Z, X, X, 0, 0, 0, 0, 0],\
>  [0, 0, X, X, Z, X, X, 0, 0, 0, 0], [0, 0, 0, X, X, Z, X, X, 0, 0, 0], [0, 0\
> , 0, 0, X, X, Z, X, X, 0, 0], [0, 0, 0, 0, 0, X, X, Z, X, X, 0], [0, 0, 0, 0\
> , 0, 0, X, X, Z, X, X], [0, 0, 0, 0, 0\
> , 0, 0, X, X, Z, X], [0, 0, 0, 0, 0, 0, 0, 0, X, X, Z]]);
               [Z    X    X    0    0    0    0    0    0    0    0]
               [                                                   ]
               [X    Z    X    X    0    0    0    0    0    0    0]
               [                                                   ]
               [X    X    Z    X    X    0    0    0    0    0    0]
               [                                                   ]
               [0    X    X    Z    X    X    0    0    0    0    0]
               [                                                   ]
               [0    0    X    X    Z    X    X    0    0    0    0]
               [                                                   ]
          M := [0    0    0    X    X    Z    X    X    0    0    0]
               [                                                   ]
               [0    0    0    0    X    X    Z    X    X    0    0]
               [                                                   ]
               [0    0    0    0    0    X    X    Z    X    X    0]
               [                                                   ]
               [0    0    0    0    0    0    X    X    Z    X    X]
               [                                                   ]
               [0    0    0    0    0    0    0    X    X    Z    X]
               [                                                   ]
               [0    0    0    0    0    0    0    0    X    X    Z]

> MatrixInverse(M);
memory used=15.2MB, alloc=4.5MB, time=0.67
memory used=19.0MB, alloc=4.6MB, time=0.87
memory used=22.9MB, alloc=4.6MB, time=1.13
memory used=26.7MB, alloc=4.6MB, time=1.30

[... actual output of the matrix discarded ...]
-- Jean-Marc
I would suggest to do the inversion with dummy symbols and then to replace these symbols by their actual symbolic expressions.
> with(LinearAlgebra):
> M := Matrix([[Z, X, X, 0, 0, 0, 0, 0, 0, 0, 0], [X, Z, X, X, 0, 0, 0, 0, 0, \
> 0, 0], [X, X, Z, X, X, 0, 0, 0, 0, 0, 0], [0, X, X, Z, X, X, 0, 0, 0, 0, 0],\
>  [0, 0, X, X, Z, X, X, 0, 0, 0, 0], [0, 0, 0, X, X, Z, X, X, 0, 0, 0], [0, 0\
> , 0, 0, X, X, Z, X, X, 0, 0], [0, 0, 0, 0, 0, X, X, Z, X, X, 0], [0, 0, 0, 0\
> , 0, 0, X, X, Z, X, X], [0, 0, 0, 0, 0\
> , 0, 0, X, X, Z, X], [0, 0, 0, 0, 0, 0, 0, 0, X, X, Z]]);
               [Z    X    X    0    0    0    0    0    0    0    0]
               [                                                   ]
               [X    Z    X    X    0    0    0    0    0    0    0]
               [                                                   ]
               [X    X    Z    X    X    0    0    0    0    0    0]
               [                                                   ]
               [0    X    X    Z    X    X    0    0    0    0    0]
               [                                                   ]
               [0    0    X    X    Z    X    X    0    0    0    0]
               [                                                   ]
          M := [0    0    0    X    X    Z    X    X    0    0    0]
               [                                                   ]
               [0    0    0    0    X    X    Z    X    X    0    0]
               [                                                   ]
               [0    0    0    0    0    X    X    Z    X    X    0]
               [                                                   ]
               [0    0    0    0    0    0    X    X    Z    X    X]
               [                                                   ]
               [0    0    0    0    0    0    0    X    X    Z    X]
               [                                                   ]
               [0    0    0    0    0    0    0    0    X    X    Z]

> MatrixInverse(M);
memory used=15.2MB, alloc=4.5MB, time=0.67
memory used=19.0MB, alloc=4.6MB, time=0.87
memory used=22.9MB, alloc=4.6MB, time=1.13
memory used=26.7MB, alloc=4.6MB, time=1.30

[... actual output of the matrix discarded ...]
-- Jean-Marc
I am not familiar with Maple's kernel design, but I believe that Maple (similar to this respect to many other CAS) uses contiguous array of memory location to store object such as matrices. Say Maple needs 400 MB to store an intermediate result during a computation. Maple will request to the operating system a 400 MB contiguous chunk of memory. If the operating system cannot find any available contiguous peace of memory of at least this size, the allocation will failed, and Maple will report "not enough memory" (being understood "not enough contiguous memory" in this case). Depending on the operating system you are using, you may find a variety of software that optimize or defragment memory. Regards, -- Jean-Marc
I am not familiar with Maple's kernel design, but I believe that Maple (similar to this respect to many other CAS) uses contiguous array of memory location to store object such as matrices. Say Maple needs 400 MB to store an intermediate result during a computation. Maple will request to the operating system a 400 MB contiguous chunk of memory. If the operating system cannot find any available contiguous peace of memory of at least this size, the allocation will failed, and Maple will report "not enough memory" (being understood "not enough contiguous memory" in this case). Depending on the operating system you are using, you may find a variety of software that optimize or defragment memory. Regards, -- Jean-Marc
"What is the most popular LaTeX compiler/environment?" The answer is mostly platform dependent (though the core of TeX/LaTeX works identically in every environment). MikTeX is probably the most popular on Windows and many add-ons and extensions are configured to automatically use it if it is installed. See http://miktex.org/ for more info and download link. In addition, still on Windows, you may be interested by proTeXt. See http://www.tug.org/protext/.
proTeXt aims to be an easy-to-install TeX distribution for Windows, based on MiKTeX. After downloading, it guides the installation via a short pdf document (available in English, French, German, and Italian), which provides clickable links to install the various components, along with explanations.
Finally, you should check the following MaplePrimes thread, "What Is LaTeX ?", available at http://www.mapleprimes.com/forum/what-is-latex Cheers, -- Jean-Marc
"What is the most popular LaTeX compiler/environment?" The answer is mostly platform dependent (though the core of TeX/LaTeX works identically in every environment). MikTeX is probably the most popular on Windows and many add-ons and extensions are configured to automatically use it if it is installed. See http://miktex.org/ for more info and download link. In addition, still on Windows, you may be interested by proTeXt. See http://www.tug.org/protext/.
proTeXt aims to be an easy-to-install TeX distribution for Windows, based on MiKTeX. After downloading, it guides the installation via a short pdf document (available in English, French, German, and Italian), which provides clickable links to install the various components, along with explanations.
Finally, you should check the following MaplePrimes thread, "What Is LaTeX ?", available at http://www.mapleprimes.com/forum/what-is-latex Cheers, -- Jean-Marc
Thanks Toby, I was not aware of the syntax x::positive. Moreover, wrapping all the assumptions in one line is more readable.
> restart;
> assume(c::positive, h::positive, k::positive, T::positive);
> rho := proc (lambda) options operator, arrow;
           8*Pi*h*c/(lambda^5*(exp(h*c/(lambda*k*T))-1)) end proc;
> int(rho(lambda), lambda = 0 .. infinity);

                                     5  4  4
                                 8 Pi  k  T 
                                 -----------
                                      3  3  
                                  15 c  h   

Cheers, -- Jean-Marc
Thanks Toby, I was not aware of the syntax x::positive. Moreover, wrapping all the assumptions in one line is more readable.
> restart;
> assume(c::positive, h::positive, k::positive, T::positive);
> rho := proc (lambda) options operator, arrow;
           8*Pi*h*c/(lambda^5*(exp(h*c/(lambda*k*T))-1)) end proc;
> int(rho(lambda), lambda = 0 .. infinity);

                                     5  4  4
                                 8 Pi  k  T 
                                 -----------
                                      3  3  
                                  15 c  h   

Cheers, -- Jean-Marc
First 9 10 11 12 13 14 15 Page 11 of 15