Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@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?

@vv For a generalized eigenvalue problem (which is the case considered in this Question), symmetry doesn't guarantee real eigenvalues. For example, consider this case, where the matrices are real symmetric and the computation is exact:

LinearAlgebra:-Eigenvalues( <1,0; 0,-1>, <0,1; 1,0>);

@tomleslie It looks like the MaplePrimes worksheet rendering ignores displayprecision. Actually, it's not even clear whether its value is stored in the worksheet..

@vv Why do you use shape= symmetric? Is the original matrix symmetric?

@Carl Love If the intent is to use the above procedure iteratively, using a list of vectors as the second argument, the overall efficiency can be substantially improved for that case.

Continuing Preben's line of thought, for any matrix that's small enough that I'd enter it manually, I do this (in 1D input (aka Maple Notation)):

M:= < 
   1,   1         ;
   1,   2/3.4

>;

For me, this spacing and visual result lets me totally see it as a mathematical matrix. In addition, the prettyprinted result of the above (explicitly typed without palettes) command is identical regardless of whether you use 1D or 2D Input.

I've taken my suggestion above, and I've written a procedure Winding to more robustly compute the winding numbers. It checks for five error conditions (the details of which are clear in the following code, I hope). This is then incorporated into a slightly modified procedure ContourInt, whose callling protocol remains the same, with a new (optional) keyword argument time which specifies the maximum number of seconds to allow for each numeric integral. All computations for the winding number are done in hardware-float arithmetic to the extent possible. Of course, the final result of ContourInt is still exact symbolic.

Winding:= proc(
   C::algebraic,
   z0::complexcons, 
   trange::(name= range(realcons)), 
   {time::{positive, -1}:= 5} #see ?timelimit
)
description
   "Somewhat robust, yet speedy, exact computation of the winding number of a "
   "curve around a point in the complex plane via low-precision numeric integration"
;
option
   `Author: Carl J. Love <carl.j.love@gmail.com> 22 Feb 2019`,
   hfloat
;
local t:= lhs(trange), w, W;
   Digits:= trunc(evalhf(Digits)); #"environment" variable
   UseHardwareFloats:= 'deduced';  #"environment" variable
   try
      if evalf(abs(`-`(eval~(C, t=~ [op(rhs(trange))])[]))) > 1e-7 then
         error "Ends of contour do not meet"
      fi
   catch:
      error "Cannot numerically evaluate contour endpoints"
   end try;

   try
      w:= timelimit(
         `if`(time=infinity, -1, time), #see ?timelimit
         int(
            diff(C,t)/(C-z0), trange, 
            numeric, 'method'= '_d01akc', 'epsilon'= 1e-3, 'digits'= 4, _rest
         )
      );
      w:= evalhf(w/2/Pi/I)
   catch "time expired":
      error "Couldn't evaluate winding integral in under %1 seconds", time
   end try;

   W:= round(w);
   if W::integer implies abs(w-W) > 1e-2 then
      error "Winding number is not an integer"
   fi;
   W
end proc
:
      
ContourInt:= proc(
   f::algebraic, 
   C::(name= algebraic), 
   trange::(name= range(realcons)), 
   {time::{positive, -1}:= 10} #see ?timelimit
)
local r:= rhs(C), a;
   add(
      residue(f,a)*Winding(r, rhs(a), trange, :-time= time, _rest),
      a= remove(a-> type(rhs(a), infinity), op~({singular(f,lhs(C))}))
   )*(2*Pi*I)
end proc
:


Although you seem satisfied by Acer's Answer, it's not clear to me (and I doubt that it's clear to Acer) whether you want the result to be a new table or simply a list combining the entries of the original tables. And if you do want a new table, then how should duplicate indices be handled?

@C1Ron Yes, {z=p1} is a set, and the output of [singular(f(z), z)] is a list of sets. The command op (short for operand(s)) applied to a set or list will return its underlying sequence of elements. So, op({z=p1}) returns z = p1. Any command and almost all operators can have ~ appended to make them act elementwise, i.e., so that their action will apply to all elements of a container (the relevant containers being sets, lists, tables, and rtables (Vectors, Arrays, Matrices)). So, op~([singular(f(z), z)]) returns [z = p1, z = p2, ....]. Note that the outer container, in this case a list, remains the same.

If you change any add or mul command to seq, the sequence of operands will be returned without being added or multiplied.

 

First 283 284 285 286 287 288 289 Last Page 285 of 709