Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@testht06 What do you mean by "don't run"!? Do you mean that it doesn't stop running? Does it give an error message? Does simply stop running, but without producing any answer?

@testht06 What exactly happened when you ran it? You said that the program "don't run." For me, it doesn't stop running. I've let the Primfield command run for five hours of CPU time, and there's no result. Is this what happened to you?

I don't know if it's a bug in Primfield or if the computation really takes a long time.

For the other readers: It is computing the splitting field of an irreducible degree-three polynomial over GF(2^8). So the final field is only degree 24. Could it legitimately take more than five hours to compute it? The specific command is

alias(x= RootOf(Z^8+Z^7+Z^6+Z+1)):
alias(
     q= RootOf(
          Z^3 + (x^7+x^6+x^4+1)*Z^2 + (x^3+x+1)*Z + (x^7+x^6+x^4+x^3+x^2+x+1)
     )
):
Primfield({x,q}) mod 2;

The memory usage is low and stable: It's been at 66 Mb since the first few minutes.

@roman_pearce It's certainly more elegant than my solution. Vote up. Since the command inner is undocumented (see ?UndocumentedNames) and built-in, would you please explain what it does?

I think that your procedure would also benefit by doing a preliminary Expand.

Your code looks like Matlab.

Any subsindets of the form

subsindets(A, identical(B), C)

is equivalent to

subs([B]=~ C~([B]), A)

So, your inner subsindets could be simplified to

subs(alpha= freeze(alpha), x)

@acer Agreed: It would be better to create the final Matrix straightaway. It looks like the OP is trying to create a banded matrix, so the special input techniques for those would be helpful.

@billyp245 With powers of the variables a and b being arguments of erf and BesselK, these equations are far, far too complicated to solve symbolically. Your only hope is for a numeric solution, but for that you'll need to give numeric values to the constants.

@Art Kalb I think that they are equivalent for polynomial input. You should include the call to Expand within your procedure mod2simp. Both techniques will give incorrect results for unexpanded polynomials. For example, (1+alpha)^2 would become 1+alpha.

@Art Kalb Sorry that I didn't spot that. The whole purpose of the inner subsindets is to protect those alphas (by freezing them).

This works:

thaw(
     subsindets[2](
          subsindets[flat](z2, {identical(alpha), identical(alpha)^anything}, freeze),
          `^`, 1, op
     )
);

To be a bit more general, we can freeze any RootOf. Just replace identical(alpha) with specfunc(RootOf):

thaw(
     subsindets[2](
          subsindets[flat](z2, {specfunc(RootOf), specfunc(RootOf)^anything}, freeze),
          `^`, 1, op
     )
);

@billyp245 What do you mean by both derivatives? The expression D2(a,b) can only be one derivative. If you had two derivatives, say D2__a and D2__b, then you could solve for them being 0 with

solve({D2__a, D2__b}(a,b), {a,b});

If you have another question, please upload a worksheet.

For what it's worth, continuation doesn't help with this problem. I was able to successfully apply continuation (I multiplied the right side of the first boundary condition by the continuation parameter) only to get the much-more-difficult-to-deal-with error Newton iteration is not converging.

I need to know the modulus, i.e., the degree-8 irreducible polynomial, that you used to create GF(2^8).

Here's Kitonum's procedure with my improvements.

restart:

ContoursWithLabels:= proc(
     Expr::algebraic,
     Range1::(name= range(realcons)), Range2::(name= range(realcons)),
     {contours::{posint, {set,list}(realcons)}:= 8},
     {ImplicitplotOptions::{list,set}({name, name= anything}):= NULL},
     {GraphicOptions::{list,set}({name, name= anything}):= NULL},
     {TextOptions::{list,set}({name, name= anything}):= NULL},
     {Coloring::{list,set}({name, name= anything}):= NULL}
)
local
     r1, r2, f, L1, h, S1, P, r, M, C, T, p, p1, m, n, i,
     x:= lhs(Range1), y:= lhs(Range2)
;
     f:= unapply(Expr, (x,y));
     if contours::posint then
          r1:= rand(convert(rhs(Range1), float));
          r2:= rand(convert(rhs(Range2), float));
          L1:= select(type, (f@op)~({seq([r1,r2](), i= 1..205)}), realcons);
          h:= (L1[-6]-L1[1])/contours;
          S1:= [seq(L1[1]+h/2+h*(n-1), n= 1..contours)]
     else #contours::{set,list}(realcons)
          S1:= [contours[]]
     end if;
     userinfo(1, ContoursWithLabels, print('Contours' = evalf[2](S1)), `\n`);
     r:= k-> rand(20..k-20);
     for C in S1 do
          P:= plots:-implicitplot(
               Expr = C, Range1, Range2,
               gridrefine= 3, ImplicitplotOptions[]
          );
          for p in [plottools:-getdata(P)] do
               p1:= convert(p[3], listlist);
               n:= nops(p1);
               if n < 500 then
                    m:= `if`(40 < n, r(n)(), round(n/2));
                    M[`if`(40 < n, [p1[1..m-11], p1[m+11..n]], [p1])[]]:= NULL;
                    T[[p1[m][], evalf[2](C)]]:= NULL
               else
                    h:= trunc(n/2);
                    m:= r(h)();
                    M[p1[1..m-11], p1[m+11..m+h-11], p1[m+h+11..n]]:= NULL;
                    T[[p1[m][], evalf[2](C)], [p1[m+h][], evalf[2](C)]]:= NULL
               end if
          end do
     end do;
     plots:-display(
          [`if`(
               Coloring = NULL,
               NULL,
               plots:-densityplot(Expr, Range1, Range2, Coloring[])
          ),
          plot([indices(M, 'nolist')], color= black, GraphicOptions[]),
          plots:-textplot([indices(T, 'nolist')], TextOptions[])
         ], 'axes'= 'box', 'gridlines'= false, _rest
     )
end proc:

 

Example:

PP:=0.3800179925e-3*exp(-0.6065722618e-3*(x-29.51704536)^2+(0.6650093594e-3*(x-29.51704536))*(a-12.94061928)-0.1106850312e-2*(a-12.94061928)^2);

0.3800179925e-3*exp(-0.6065722618e-3*(x-29.51704536)^2+0.6650093594e-3*(x-29.51704536)*(a-12.94061928)-0.1106850312e-2*(a-12.94061928)^2)

infolevel[ContoursWithLabels]:= 1:

ContoursWithLabels(
     PP, x= -20..20, a= -20..20, contours= {seq(1e-4..4e-4, 5e-5)},
     Coloring= [colorstyle= HUE, colorscheme= ["Cyan", "Red"], style= surface],
     TextOptions= [font= [HELVETICA,BOLD,7], color= blue],
     ImplicitplotOptions= [gridrefine= 4],
     GraphicOptions= [thickness= 0],
     title= "         My contour plot\n",
     labelfont= [TIMES,BOLDITALIC,16], axesfont= [HELVETICA,8],
     size= [600,600]
);

ContoursWithLabels:

Contours = [0.1e-3, 0.15e-3, 0.20e-3, 0.25e-3, 0.30e-3, 0.35e-3, 0.40e-3]


 


Download ContoursWithLabels.mw

@Kitonum Okay, I made it an Answer, and I'll make it a Comment to your post.

I did just what I said: changed x to x(t) and y to y(t). Then you just press ENTER and you should get the plot.

First 419 420 421 422 423 424 425 Last Page 421 of 709