acer

32303 Reputation

29 Badges

19 years, 309 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Running all the built-in functions with no arguments should be done as part of basic testing and quality assurance. acer
> kernelopts(version); Maple 11.00, X86 64 LINUX, Feb 16 2007 Build ID 277223 > `^`(f); Execution stopped: Stack limit reached. That's 8 keystrokes, counting the return. acer
A post by DJKeenan contains, `^`(`$`(x,n)); Maple 10.2 gave "Error, invalid input: ^ expects 2 arguments, but received 1" for that input. But Maple 11.00 (and 11.01 it seems) crash immediately with "Execution stopped: Stack limit reached". That's 15 keystrokes, including the return. A moderately interesting variation is this, which cuts out two keystrokes, `^`($(x, n)); acer
The Matrix and Vector constructors will generally attempt to "flatten" the data, for most input forms. But someone might actually want to create a Vector of rtable objects, with no flattening occuring during construction. Someone else might want or expect flattening, and be caught unawares when it was not done, and for that user an error raised may be helpful. So, some balance is needed, to get all these effects. Personally I don't find the current behaviour of Vector() to be so bad, since the square-brackets are also used to delimit data (separating rows, say) for the Matrix constructor. Having written all that, what is the corresponding format for entering an unflattened Matrix of other rtables? When I tried a similar thing, with Matrix(), I obtained a Matrix whose entries were actual lists. Maybe there's a way, that I did not see. acer
Hi Roman, Is enabling system/ssystem calls only necessary to install it? Or is it required in order to run the package (and if so, why, may I ask)? What's the story behind the commented-out free_memory() call in the ModuleUnload of module sdmp? Does the compiled shared object do its own memory management, and if so why, and what would happen if it couldn't free on restart? Have you considered distributing the mpl sources in a .mla file, and the .mw as an embedded help-page within a .hdb file? Have you considered using InstallerBuilder from Maple to create a self-installing .mla (container, which unpacks the various files)? How about putting the materials under a subdirectory of /toolbox/ , so that .mla/.hdb and bin. get found automagically by the maple kernel? acer
Hi Robert, This is equivalent to what I was did, I believe, although I assumed that the poster would see the rationale for himself. There are 12 equations in 2*4*4 unknowns (real and imaginary parts). And only when the 12x32 matrix has rank=12 will one know that the 12 rows (or 12 4x4 complex matrices) are linearly independent. What I had as the bigM Matrix looks equivalent to the Matrix G in what you posted (though possibly with columns out of order). One can form G without having to form eqs, though of course `solve` would use the latter. acer
Can you make a 12x32 Matrix, where the entries of each row are the real and imaginary components of the entries of one of the 4x4's? with(LinearAlgebra): for i from 1 to 12 do M[i] := LinearAlgebra:-RandomMatrix(4)+I*LinearAlgebra:-RandomMatrix(4); od: for i from 1 to 12 do m[i]:=ArrayTools:-Alias(M[i],[16]); od: for i from 1 to 12 do n[i]:=Vector[row](32,[Vector(16,ii->Re(\ m[i][ii])),Vector(16,ii->Im(m[i][ii]))]); od: bigM := Matrix(12,32,(i,j)->n[i][j]): Rank(bigM); m[7]:=(2*I)*m[1]-m[3]; for i from 1 to 12 do n[i]:=Vector[row](32,[Vector(16,ii->Re\ (m[i][ii])),Vector(16,ii->Im(m[i][ii]))]); od: bigM := Matrix(12,32,(i,j)->n[i][j]): Rank(bigM); m[7]:=(2)*m[1]-m[3]; for i from 1 to 12 do n[i]:=Vector[row](32,[Vector(16,ii->Re\ (m[i][ii])),Vector(16,ii->Im(m[i][ii]))]); od: bigM := Matrix(12,32,(i,j)->n[i][j]): Rank(bigM); I wonder if there's a super slick way to do this using LinearAlgebra[Generic] from Maple 11. acer
Given that m and n are integers, then is it only the cases where m=n that the result is not zero? And when m=n<>0, then is the result Pi? If so (and check that I'm not wrong about that), then Maple 11 gives me, > _EnvAllSolutions:=true: > int( cos(m*x) * cos(n*x) , x = 0..2*Pi) assuming n=m, n::integer, m::integer: > lprint(%); piecewise(m+n = 0,2*Pi,Pi) That looks close. The subcase m+n=0 combined with m=n implies that m=n=0, so 2*Pi is good there. But I couldn't get maple to simplify to that. Interestingly, I got it slightly differently below using assume instead of assuming, > _EnvAllSolutions:=true: > assume(m::integer,n::integer); > int( cos(m*x) * cos(n*x) , x = 0..2*Pi ): > lprint(%); piecewise(m-n = 0,Pi,0)+piecewise(m+n = 0,Pi,0) Using other incantations of assume(), I got a result similar to the first one above, using assuming. acer
Can you use the new parameter-processing for this? See the ?paramprocessing help-page. > are_these_numbers_equal := proc(a, b, {tol::{identical(none),realcons}:='none'}) > if a<>b then > if type(tol,realcons) and abs(a-b) else return "False"; > fi; > else > return "True"; > fi; > end proc: > are_these_numbers_equal(2.,3.,tol=0.3); "False" > are_these_numbers_equal(2.,2.2,tol=0.3); "True enough" > are_these_numbers_equal(2.,2.2); "False" > are_these_numbers_equal(2.,2); "True" > are_these_numbers_equal(2.,2.4,tol=0.3); "False" Also, the help-page ?`:=` says, 1. The left-hand side is evaluated to a name. (For more information, see the evaln function). I believe the intended meaning there is that the lhs of the `:=` assignment statement must be something that can evaluate as a name. See the ?evaln help-page. I interpret the meaning as saying that the object has to be such that it can be used as a name. Maybe I'm wrong. If lhs(T):=rhs(T) were to do anything (and I can understand that it does not) then my guess would have been more along the lines of assigning to a remember table. But lhs doesn't have such, that I know of. And it seems difficult to give one to such built-ins, without them not losing their functionality. acer
There are several claims put forward in this post which I find to be incorrect or surprising. It is a mistake to expect that `:=` can be used as a postfix operator, eg. by doing things like `:=`(T,7) and expecting T to be assigned the value of 7. Notice too that it's help-page, ?`:=` calls it the assignment statement, not the assignment operator, and shows usage to accord with this. It was claimed that this works, in the original post, for piped in TTY maple. Is it truly so, and if so then in which version of Maple? It is a mistake to expect evalb() to return true when asked to compare a global and local which use the same symbol. I would be surprised if evalb ever identified the two as being the same. It is a mistake to expect lhs(Q) to not produce the `a` from the higher level (in this case, the global), when Q is a procedure parameter which gets passed in as a=5 say. If one used the assign() command then a side-effect will be brought about on the inbound name/value rather than on some local using the same symbol. I'm not a big fan of using side-effects when coding in Maple, but I don't find this behaviour surprising. So, what buggy behaviour has truly been shown here? acer
I realized that I had a little bit of conditional probability in the code, according to how one looks at it. It hinges on the if..then..else..end if clause in the proc body. "if nops(montys_choices) = 1 then" means that Monty had no choice in how to show inside a losing door. That's because the player picked a loser. Monty can't show the winning door, and he can't show inside the player's picked door. So he has only one choice. This can be rephrased as, "Given that the user selects a losing door, then Monty will show the remaining losing door and the final unshown door will always be the winning door." That has just the sort of phrasing that conditional probabilities do, when spoken, I think. It says, "Given that the user selects a losing door, then switching will always win." Similarly, one can analyze the code fragment that occurs in the `else` portion. Given that the player picked the winning door then Monty has a choice of two doors. Hence, given that the player picked the winning door then switching will always lose. These are both conditional probability statements. The probability of the first parts ("that the user selects a losing door" and "that the player picked the winning door") are 2/3 and 1/3 respectively. What makes it a somewhat unusual conditional probability is that the other parts (subsequent chances of winning, upon switching) have probabilities of 1 and 0 respectively. ps. I initially responded that the coding would be straightforward. There is one place where I made it not so, very much on purpose. It's where the set montys_choices is converted to a list and sorted, prior to one entry of it being selected at random. I just wanted to be sure that I'd avoided any pitfall of the consequences of how maple might order sets (now, or in future). acer
I realized that I had a little bit of conditional probability in the code, according to how one looks at it. It hinges on the if..then..else..end if clause in the proc body. "if nops(montys_choices) = 1 then" means that Monty had no choice in how to show inside a losing door. That's because the player picked a loser. Monty can't show the winning door, and he can't show inside the player's picked door. So he has only one choice. This can be rephrased as, "Given that the user selects a losing door, then Monty will show the remaining losing door and the final unshown door will always be the winning door." That has just the sort of phrasing that conditional probabilities do, when spoken, I think. It says, "Given that the user selects a losing door, then switching will always win." Similarly, one can analyze the code fragment that occurs in the `else` portion. Given that the player picked the winning door then Monty has a choice of two doors. Hence, given that the player picked the winning door then switching will always lose. These are both conditional probability statements. The probability of the first parts ("that the user selects a losing door" and "that the player picked the winning door") are 2/3 and 1/3 respectively. What makes it a somewhat unusual conditional probability is that the other parts (subsequent chances of winning, upon switching) have probabilities of 1 and 0 respectively. ps. I initially responded that the coding would be straightforward. There is one place where I made it not so, very much on purpose. It's where the set montys_choices is converted to a list and sorted, prior to one entry of it being selected at random. I just wanted to be sure that I'd avoided any pitfall of the consequences of how maple might order sets (now, or in future). acer
It should be straightforward to write a program in maple that simulates the game. That would let you confirm whether it is better to always switch, or not. acer
It should be straightforward to write a program in maple that simulates the game. That would let you confirm whether it is better to always switch, or not. acer
Robert's suggestion to simply remove the square [] list brackets from equ1 and equ2 is better than my suggestion to do equ11:=w_1=op(rhs(...)). But you might still want to use the ideas about reducing the number of equations. Multivariable Newton's method has an easier time of it and a better chance for convergence, for smaller systems of fewer variables and equations. It might then make it faster a more likely to get a result, if you decide to go with a variety of values for delta, p, and T say. acer
First 567 568 569 570 571 572 573 Last Page 569 of 591