Carl Love

Carl Love

28035 Reputation

25 Badges

12 years, 321 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@vv I think that this is a substantially simpler inverse Fibonacci computation:

InvFib:= proc(x::nonnegative)
uses C= combinat;
local r, rr; 
   if x=0 then return 0 fi;
   r:= evalf(ln(sqrt(5)*x)/ln((1+sqrt(5))/2));
   if x::posint and x = C:-fibonacci((rr:= round(r))) then return rr fi;
   r
end proc
: 

It returns nonnegint if the result is exact, float otherwise. This simplification is possible because the second root of the characteristic equation (or, equivalently, the second eigenvalue of the matrix) has magnitude less than 1, and therefore it can be ignored for integer computation.

These Fibonacci methods are ad hoc to the specifc matrix from the original Question, and are difficult or impossible to generalize to some larger class (such as square matrices of nonnegint with an eigenvalue greater than 1). That is why I didn't address them in my original Answer even though I recognized the matrix as the generator for that sequence.

@izhammulya I made your follow-up question into a new Question with the title "Combining lists."

@tomleslie There are at least four reasons to not do it that way:

  • Its average-case time is several times more than that of my procedure
  • Its best-case time is several times more than that of my procedure
  • It behaves ungracefully when the upperbound is greater than the sum of all the elements
  • It's not a procedure

All of these things are obvious without needing to run tests, but feel free to do so anyway.

@tomleslie Unfortunately Dice1() + Dice1() does automatically simplify to 2*Dice1(), and this is a common pitfall for generating samples and performing other operations with multivariate r.v. expressions. You can use unevaluation quotes to get independent draws:

'Dice1()' + 'Dice1()'

@vv I would expect and hope that Maple would consider the complex case as the default. But here's a counterexample to that:

limit(exp(-1/x^2), x= 0);
                                                    
0

Compare with

limit(exp(-1/x^2), x= 0, complex);
                                           undefined

 

@Kitonum Numbers of the same general "type" are ordered the usual way within a set, but they get grouped by type. Observe:

{0, 1/2, 1};
                                         
{0, 1, 1/2}

Regardless, one should not rely on the order because it may change in different versions.

@Kitonum It seems to me to be mere happenstance that each of the last three elements (as they're listed above) is greater than each of the first three elements.

@tomleslie Your randomize should be randomize().

@Ronan Your operation can be done by

13*~(1+~ListTools:-PartialSums(GRP5));

This produces a list rather than the set that you had. It's trivial to convert it to a set, but I can't imagine why you'd want to do that.

@tomleslie The mean (or expected) number of rolls (needed to achieve the desired outcome) is not necessarily the same as the median number of rolls. The OP's problem is essentially asking for that median (rounded up to the next integer).

You, on the other hand, have correctly computed the mean, which is exactly 147/10. This can be computed exactly by Maple from Kitonum's formula, which I'll call P(n): Take its first differences with respect to n, multiply by n, and sum from to infinity:

sum(n*(P(n)-P(n-1)), n= 6..infinity);

The tell-tale sign that you have not computed the median is that nowhere (neither exactly nor via simulation) have you used the value 1/2. And you yourself said that you were computing the average number of rolls. Average is mean, not median.

@tomleslie I am sorry. You are correct that I misrepresented your Reply. I was misled by that Reply appearing after the OP's L^2 request. Indeed, upon a closer rereading of your Reply, I do see 

  • that you didn't claim to compute the L^2 norm,
  • that you had a good reason for squaring the function (to keep it differentiable), 
  • that that wasn't a misguided attempt to compute the L^2 norm.

@acer No permission is needed. Posting the procedure is clearly covered under the Fair-Use Doctrine of copyright law. However, I'm not even asking for the procedure to be posted. All I want is its page number(s) in the thesis.

@Rim Given that your linked paper is 179 pages, you should specify the page number(s) on which "he used the command simplify".

@mmcdara Yes, thanks, that is precisely the thread that I was recalling.

@vv I was wrong about this. I was thinking about something related that you, I, mmcdara, and Tom Leslie were discussing at length a few months ago, but I don't remember the exact details. It was definitely about there being two ways to save, one of which mysteriously preserved significant environment details and one of which didn't. Do you recall it?

First 282 283 284 285 286 287 288 Last Page 284 of 708