acer

32627 Reputation

29 Badges

20 years, 45 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

With the (elementwise) ~ operator modifier, it can be shorter of course.

expand~(convert~(q,exp));

                             [  0    -omega  0]
                             [                ]
                             [omega    0     0]
                             [                ]
                             [  0      0     0]

(expand@convert)~(q,exp);

                             [  0    -omega  0]
                             [                ]
                             [omega    0     0]
                             [                ]
                             [  0      0     0]

But those are not as short as Carl's,

(simplify@expand)~(q);

                             [  0    -omega  0]
                             [                ]
                             [omega    0     0]
                             [                ]
                             [  0      0     0]

acer

I tried a drop-in replacement (with .dll file rename, copying the old aside, etc) using libgmp 5.0.1 and a binary built with mingw64.

On an Intel i7-930 using Maple 16.02 64bit I got a speedup from 105 sec down to 56 sec for the computation of,

evalf[4*10^5](ln(5)):

The digits appear to be correct. And it might be that other improvements are possible due to new functions available in 5.0.0.

And the timings listed above are for 5.0.1, but the latest release is 5.1.1 and supposedly Windows 64 performance gained ground in 5.1.0.

If the version of libgmp used in Maple 14 was already overdue for an update then it must surely be even more pressing in the Maple 16 life cycle.

acer

This is interesting.

Carl, I'm no expert but Times New Roman might be a place to start with a unicode chart, or Courier New. The former is what M16.02 uses for 2D Math output on my Windows 7, and the latter is what it uses for my 1D input. Or so it seems.

Alejandro, thanks very much. This works for me, then.

unicode:=(s::string)->cat(`&#`,sscanf(s,"%x")[],`;`):
T:=unicode("00A9"):
Typesetting:-mi(cat(T,` `),fontweight="bold",
                mathcolor="#c800c8",size="50");

As you may have guessed, I was thinking more about a size modifier for the MathML-like atomic-identifier-like names than I was about Typesetting calls. Your suggestion involving calls to Typesetting gets what I was after, thank you, but I still wonder about another form.

acer

Yes, it is a good idea. It's a better idea in general than using evalf/Int on the procs returned by dsolve/numeric. This mathoverflow thread is not addressing the same computational task.

I mean "better" in a sense of doing numerical computations accurately, in general. The fact the the given problem may well be computed adequately accurately, at default Digits and default accuracy, is irrelevant to distinctions between the two approaches in general.

acer

Yes, it is a good idea. It's a better idea in general than using evalf/Int on the procs returned by dsolve/numeric. This mathoverflow thread is not addressing the same computational task.

I mean "better" in a sense of doing numerical computations accurately, in general. The fact the the given problem may well be computed adequately accurately, at default Digits and default accuracy, is irrelevant to distinctions between the two approaches in general.

acer

A useful post, thank you Carl.

Some users of the Standard GUI might also find Unicode representation of interest, even though not all symbols may be supported by available fonts.

 

sscanf("221A","%x")[];  # hexadecimal to decimal

8730

`√`;

`√`

`#mrow(mo(√),mn(x))`;

`#mrow(mo(√),mn(x))`

seq(cat(`&#`,i,`;`),i=8710..8730);

`∆`, `∇`, `∈`, `∉`, `∊`, `∋`, `∌`, `∍`, `∎`, `∏`, `∐`, `∑`, `−`, `∓`, `∔`, `∕`, `∖`, `∗`, `∘`, `∙`, `√`

seq(cat(`&#`,i,`;`),i=1110..1130);

і, ї, ј, љ, њ, ћ, ќ, ѝ, ў, џ, Ѡ, ѡ, Ѣ, ѣ, Ѥ, ѥ, Ѧ, ѧ, Ѩ, ѩ, Ѫ


and so on.

Download unicode.mw

See also here and here.

Does anyone know what is the TypeMK modifier for (font) size?

The purple square below gets rendered as the copyright symbol in green foreground and purple background in Maple's Standard GUI. But I suppose that rendering via Mapleprimes's maplenet may not handle that.

 

unicode:=(s::string)->cat(`&#`,sscanf(s,"%x")[],`;`):

unicode("00A9");
convert(%,string)[3..-2];

`©`

"169"

T:=cat(`#mo(`,
       unicode("00A9"),
       `,mathbackground="purple",mathcolor="lime"))`);

`#mo(©,mathbackground="purple",mathcolor="lime"))`

plots:-display(
  plots:-textplot([2,2,sprintf(unicode("00A9"))]),
  plots:-textplot([3,3,T])
  , view=[1.0..4,1..4]);

 

 

Download unicode2.mw

acer

I suppose that this has been done before... and likely done better too. But I may as well make it into a procedure.

restart:

cellplot:=proc(M::Matrix)
   local colorlist,m,n,i,j,Plines,Ppoints,v,vals;
   uses LinearAlgebra,plots,plottools;
   m,n:=Dimensions(M);
   Plines:=display(
      seq(seq(`if`(M[m+1-j,i-1]<>M[m+1-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5,j+0.5]),NULL),
              j=1..m),i=2..n),
      seq(seq(`if`(M[m+1-j,i]<>M[m+2-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5+1,j-1+0.5]),NULL),
              j=2..m),i=1..n),
      ':-view'=[1-0.48..m+0.48,1-0.48..n+0.48]);
   vals:=[{seq(v, v in M)}[]];
   colorlist:=setcolors();
   Ppoints:=display(
      seq(sparsematrixplot(Matrix(m, n,
                                  (i,j)->`if`(M[m+1-i,j]=vals[k],1,0))
                           ,`if`(nops(colorlist)>=nops(vals),
                                 ':-color'=colorlist[k],NULL)
                           ,':-symbol'=':-solidcircle', tickmarks=[0,0]
                           ,':-symbolsize'=20, ':-legend'=vals[k]
                           , _rest),
          k=1..nops(vals)));
   display( Plines, Ppoints, ':-labels'=[``,``], ':-axes'=':-boxed' );
end proc:

A:=LinearAlgebra:-RandomMatrix(10,generator=-7..-5):

cellplot(A);

cellplot(A, legend=NULL, symbolsize=1);

cellplot(A, legend=NULL, symbol=solidbox, symbolsize=68); # not a great idea

acer

I suppose that this has been done before... and likely done better too. But I may as well make it into a procedure.

restart:

cellplot:=proc(M::Matrix)
   local colorlist,m,n,i,j,Plines,Ppoints,v,vals;
   uses LinearAlgebra,plots,plottools;
   m,n:=Dimensions(M);
   Plines:=display(
      seq(seq(`if`(M[m+1-j,i-1]<>M[m+1-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5,j+0.5]),NULL),
              j=1..m),i=2..n),
      seq(seq(`if`(M[m+1-j,i]<>M[m+2-j,i],
                   line([i-0.5,j-1+0.5],[i-0.5+1,j-1+0.5]),NULL),
              j=2..m),i=1..n),
      ':-view'=[1-0.48..m+0.48,1-0.48..n+0.48]);
   vals:=[{seq(v, v in M)}[]];
   colorlist:=setcolors();
   Ppoints:=display(
      seq(sparsematrixplot(Matrix(m, n,
                                  (i,j)->`if`(M[m+1-i,j]=vals[k],1,0))
                           ,`if`(nops(colorlist)>=nops(vals),
                                 ':-color'=colorlist[k],NULL)
                           ,':-symbol'=':-solidcircle', tickmarks=[0,0]
                           ,':-symbolsize'=20, ':-legend'=vals[k]
                           , _rest),
          k=1..nops(vals)));
   display( Plines, Ppoints, ':-labels'=[``,``], ':-axes'=':-boxed' );
end proc:

A:=LinearAlgebra:-RandomMatrix(10,generator=-7..-5):

cellplot(A);

cellplot(A, legend=NULL, symbolsize=1);

cellplot(A, legend=NULL, symbol=solidbox, symbolsize=68); # not a great idea

acer

M:=LinearAlgebra:-RandomMatrix(13,13,generator=1..2);

Of course, for larger dimensions it should be built differently, more efficiently. (If your example was meant only as an illustrative toy example then you might consider using `implicitplot`. Or not..)

I didn't state it before, but of course you could view Plines without Ppoints.

acer

M:=LinearAlgebra:-RandomMatrix(13,13,generator=1..2);

Of course, for larger dimensions it should be built differently, more efficiently. (If your example was meant only as an illustrative toy example then you might consider using `implicitplot`. Or not..)

I didn't state it before, but of course you could view Plines without Ppoints.

acer

No, it would be very unwise.

acer

No, it would be very unwise.

acer

@dipamilo One alternative is to keep `x` local to procedure `posi4` and return unapply(objf1,x) as the last line of `posi4`.

posi1_C_modif2.mw

@dipamilo One alternative is to keep `x` local to procedure `posi4` and return unapply(objf1,x) as the last line of `posi4`.

posi1_C_modif2.mw

@kolmogorov You might have a look at this page. The error message may not match yours, but it likely covers the same general problem, namely, "when a procedure that requires numeric arguments is called with symbolic arguments."

When you call plot(p(a,b), a=.., b=..) then Maple will try and evaluate p(a,b) for nonnumeric names `a` and `b`. Your procedure `p` may not have been written to deal with symbolic names for those arguments.

First 382 383 384 385 386 387 388 Last Page 384 of 597