Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 107 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

Another option is v + m[..,1], which produces Vector output.

@Kitonum Yes, your solutions are the same two solutions as produced by my program. My program does not directly prove that these are the only solutions, although it can be easily used to generate such a proof.

Your techniques for the direct solution of such problems are very impressive. Your technique is to step through the entire solution space finding the points that satisfy all the constraints. My technique is to make logical deductions from the constraints and narrow the solution space. As a trivial example, from A = B and B = C, I deduce A = C (where `=` means membership in the same equivalence class rather than simple identity).

My program does this problem in about 0.1 seconds. Your technique takes about 2.9 seconds.

@sunil-maple What format do you want the table? There are 27 matrices in the ring. A 27x27 array with each entry a 2x2 matrix seems to large to put onscreen. So, what format did you have in mind?

Do you mean 2x2 matrices?

@Markiyan Hirnyk Stephen Forrest is saying to select "Factor" from the context menu. This is equivalent to using factor (lowercase f).

@Markiyan Hirnyk The information about continuity is not displayed if you include the phrase assuming n::posint.

@Christopher2222 wrote:

One could instead create a proc that would circumvent the issue when StandardDeviation command is called, yes?

Yes, Statistics:-StandardDeviation could be overloaded so that when weights are passed in, it is diverted to separate user-supplied code; and when weights are not passed in, it uses the current code. Like this:

restart:
sav_std_dev:= eval(Statistics:-StandardDeviation):
unprotect(Statistics:-StandardDeviation):
Statistics:-StandardDeviation:= overload([
     proc(A::{rtable,list})
          option overload;
          local p, weights, sd;
          if not membertype(identical(':-weights')={Vector,list}, [args], p) then
               error "invalid input:"  # Kicks to next proc in overload
          end if;
          weights:= rhs([args][p]);
          print('weights' = weights);
          sd:= Statistics:-StandardDeviation(A);
          # Do whatever you want here to compute with the weights.
     end proc,

     sav_std_dev
]):
    
protect(Statistics:-StandardDeviation):

Please explicitly show in a worksheet the code that works and the code that doesn't work. Please state explicitly why you say that it hasn't worked.

@Carl Love To analyze where f(a,c,n) < 0, the 3d animation should be viewed in conjunction with an animation of the level curves f(a,c,n) = 0. This can be done with implicitplot.

plots:-animate(plots:-implicitplot, [f(a,c,n) = 0, c= 0..2, n= 0..4, gridrefine= 3], a= 0..2);

@Christopher2222 Yet it seems that the weights are used somehow in the computation. Changing the weights often changes the last digit or two of the standard deviation.

@Markiyan Hirnyk You're right; I missed that the OP's primary interest was the sign. The animation can be improved with the view option.

plots:-animate(plot3d, [f(a,c,n), c= 0..2, n= 0..4, view= [0..2, 0..4, -300..0]], a= 0..2);

 

@Carl Love Incorporating Joe Riel's %m hack into a convert procedure, we get

`convert/decimalfraction`:=
     (x::float)-> sscanf(sprintf("#%m%m", op(1,x), 10^(-op(2,x))), "%m")[]:

@Preben Alsholm Just to be absolutely clear, Preben's comment was merely meant to point out a flaw in the OP's final argument. It was not meant to deny the fact that there is a bug in product at play here.

@Joe Riel Obviously the "#" is the key to this hack. Can you describe other hacks using the %m technique?

@love maths Here's an example. I couldn't upload an executed example (some bug in MaplePrimes), so you'll have to execute this yourself.

Eigen:= proc(A::'Matrix'(2,2))
local
     a:= A[1,1], b:= A[2,1], c:= A[1,2], d:= A[2,2],
     s:= sqrt((a-d)^2+4*b*c)/2,
     e1:= (a+d)/2 + s, e2:= (a+d)/2 - s,
     ev1:= < c, (d-a)/2+s >, ev2:= < c, (d-a)/2-s >
;
     if s=0 then [] else [e1, e2, ev1, ev2] end if
end proc:

A:= LinearAlgebra:-RandomMatrix(2,2) + I*LinearAlgebra:-RandomMatrix(2,2);
Sol:= Eigen(A);
A.Sol[3] - Sol[1].Sol[3];
simplify(%);

 

 

First 565 566 567 568 569 570 571 Last Page 567 of 709