acer

33400 Reputation

29 Badges

20 years, 332 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@erdisayar 

The code for the module J is in the Startup Code of this attachment.  (Use the menubar's Edit->Startup Code to see it, or modify it.)  The whole point is that the input is 1D and the pretty-printed names appear in the 2D output.

You can make the commands as long as you wish, or as short as a single character. You could add additional commands like J:-dash which puts a bar over a name, so that you don't have to remember HTML entity names. Or you could add  additional commands like J:-o which puts anything over anything. Or you could could add additional commands like, say. br for bottom-right or tl for top-left.

You can assign the marked up names to any other variable of your choice.

If you really wanted to you could add additional options to allow you to specify the color, boldness, or upright vs italic.

Of course it involves more typing, but you can create your own procedure names for custom mnemonics. If you also utilize use and uses (see examples) then it's not that much more typing than LaTeX.

restart;

 

J:-dash(X);

`#mover(mi("X"),mrow(mi("\`—\`")))`

 

use J in

  o(A,`·`)*I*Pi + arctan(3*o(X,`−`)/sb(Y,3,5));

  Adot := o(A,`→`);
  Xbar := dash(X);

end use;

I*`#mover(mi("A"),mrow(mi("\`·\`")))`*Pi+arctan(3*`#mover(mi("X"),mrow(mi("\`−\`")))`/`#msub(mi("Y"),mrow(mrow(mn("3"),Typesetting:-mo(","),mn("5"))))`)

`#mover(mi("A"),mrow(mi("\`→\`")))`

`#mover(mi("X"),mrow(mi("\`—\`")))`

Adot + Xbar;

`#mover(mi("A"),mrow(mi("\`→\`")))`+`#mover(mi("X"),mrow(mi("\`—\`")))`

 

P := proc(t)
  local q,r;
  uses J;

  r := dash(Q);
  return sin(r*t) + int(sb(t,i,j)(y), y=0..Pi);
end proc:

P(x);

Parse:-ConvertTo1D, "invalid input %1", Typesetting:-mprintslash([sin(`#mover(mi("Q"),mrow(mi("\`—\`")))`*x)+int(`#msub(mi("x"),mrow(mrow(mi("i"),Typesetting:-mo(","),mi("j"))))`(y), y = 0 .. Pi)], [sin(`#mover(mi("Q"),mrow(mi("\`—\`")))`*x)+int(`#msub(mi("x"),mrow(mrow(mi("i"),Typesetting:-mo(","),mi("j"))))`(y), y = 0 .. Pi)])

 

J:-sb(A,6);

`#msub(mi("A"),mrow(mn("6")))`

J:-sb(A,4,3,2);

`#msub(mi("A"),mrow(mrow(mn("4"),Typesetting:-mo(","),mn("3"),Typesetting:-mo(","),mn("2"))))`

J:-sp(A,6);
J:-sp(x,`′`);

`#msup(mi("A"),mrow(mn("6")))`

`#msup(mi("x"),mrow(mi("\`′\`")))`

J:-sp(A,4,3,2);

`#msup(mi("A"),mrow(mrow(mn("4"),Typesetting:-mo(","),mn("3"),Typesetting:-mo(","),mn("2"))))`

J:-o(A,m);

`#mover(mi("A"),mrow(mi("m")))`

J:-o(A,x,y,z);

`#mover(mi("A"),mrow(mrow(mi("x"),Typesetting:-mo(","),mi("y"),Typesetting:-mo(","),mi("z"))))`

J:-o(x,`−`);
J:-o(Z,`&^;`);

`#mover(mi("x"),mrow(mi("\`−\`")))`

`#mover(mi("Z"),mrow(mi("\`&^;\`")))`

J:-u(A,x,y,z);
J:-u(A,`→`);

`#munder(mi("A"),mrow(mrow(mi("x"),Typesetting:-mo(","),mi("y"),Typesetting:-mo(","),mi("z"))))`

`#munder(mi("A"),mrow(mi("\`→\`")))`

J:-uo(W,`→`,`∗`);
J:-uo(W,[a,b],[[x,y]]);

`#munderover(mi("W"),mrow(mi("\`→\`")),mrow(mi("\`∗\`")))`

`#munderover(mi("W"),mrow(mrow(mi("a"),Typesetting:-mo(","),mi("b"))),mrow(mfenced(mi("x"),mi("y"),open = "[",close = "]")))`

J:-sc(A,1,2,3,4,5,6);

`#mscripts(mi("A"),mrow(mn("1")),mrow(mn("2")),mrow(mn("3")),mrow(mn("4")),mrow(mn("5")),mrow(mn("6")))`

J:-sc(A,1);
J:-sc(A,1,`+`);
J:-sc(A,1,`*`,3);

`#mscripts(mi("A"),mrow(mn("1")),mrow(none()),mrow(none()),mrow(none()),mrow(none()),mrow(none()))`

`#mscripts(mi("A"),mrow(mn("1")),mrow(mi("\`+\`")),mrow(none()),mrow(none()),mrow(none()),mrow(none()))`

`#mscripts(mi("A"),mrow(mn("1")),mrow(mi("\`*\`")),mrow(mn("3")),mrow(none()),mrow(none()),mrow(none()))`

J:-sc(X,[],[],2);
J:-sc(Y,x,[],[],[],y);
J:-sc(Z,[],a,[],[],[],b);

`#mscripts(mi("X"),mrow(none()),mrow(none()),mrow(mn("2")),mrow(none()),mrow(none()),mrow(none()))`

`#mscripts(mi("Y"),mrow(mi("x")),mrow(none()),mrow(none()),mrow(none()),mrow(mi("y")),mrow(none()))`

`#mscripts(mi("Z"),mrow(none()),mrow(mi("a")),mrow(none()),mrow(none()),mrow(none()),mrow(mi("b")))`

# evaluation sanity check
u,s,t,v,w,A := 'u','s','t','v','w','A':
u:=s: s:=t: t:=v: v:=w: w:=A:
J:-sb('u',6), J:-sb(u,6), J:-sb(eval(u,3),6);

`#msub(mi("u"),mrow(mn("6")))`, `#msub(mi("A"),mrow(mn("6")))`, `#msub(mi("v"),mrow(mn("6")))`

# evaluation sanity check
p,q := [3,4], 5:
J:-sc(A, [1,2], p, q,
           6, 7, 8);
J:-sc(AAAAA, [[1,2]], 'p', 'q',
           6, 7777, 8);

`#mscripts(mi("A"),mrow(mrow(mn("1"),Typesetting:-mo(","),mn("2"))),mrow(mrow(mn("3"),Typesetting:-mo(","),mn("4"))),mrow(mn("5")),mrow(mn("6")),mrow(mn("7")),mrow(mn("8")))`

`#mscripts(mi("AAAAA"),mrow(mfenced(mn("1"),mn("2"),open = "[",close = "]")),mrow(mi("p")),mrow(mi("q")),mrow(mn("6")),mrow(mn("7777")),mrow(mn("8")))`

map(J:-sp@op,
    [[A,`♣`],[K,`♦`],
     [Q,`#mi("♥",mathcolor=red)`],
     [J,`#mi("♠",mathcolor=black)`],
     [10,`#mi("♦",mathcolor=red)`]]);

[`#msup(mi("A"),mrow(mi("\`♣\`")))`, `#msup(mi("K"),mrow(mi("\`♦\`")))`, `#msup(mi("Q"),mrow(mi("♥",mathcolor = red,Typesetting:-msemantics = "atomic")))`, `#msup(mi("J"),mrow(mi("♠",mathcolor = black,Typesetting:-msemantics = "atomic")))`, `#msup(mn("10"),mrow(mi("♦",mathcolor = red,Typesetting:-msemantics = "atomic")))`]

 

Download Mark.mw

@C1Ron 

restart;

f := (a,z) -> z*exp(a*z) / (z^2 + 1)^2:

R:=[singular(f(a,z),z)];

[{z = -I}, {z = I}]

R[1];

{z = -I}

op(R[1]);

z = -I

R[1][];

z = -I

residue(f(a,z), op(R[1]));

((1/4)*I)*a/exp(I*a)

residue(f(a,z), R[1][]);

((1/4)*I)*a/exp(I*a)

seq(residue(f(a,z), op(eq)), eq=R);

((1/4)*I)*a/exp(I*a), -((1/4)*I)*a*exp(I*a)

seq(residue(f(a,z), eq[]), eq=R);

((1/4)*I)*a/exp(I*a), -((1/4)*I)*a*exp(I*a)

 

Download op_examp.mw

Every one of your queries submitted to this site has been a Post. And someone has had to convert each to a Question. I don't think that is very considerate of you.

Could you please use the Question form in future? It's right there at the top right of this site, right beside the Post form.

@erdisayar You mentioned LaTeX, for comparison, which entails a more verbose 1D plaintext form.

That makes it sound as if you are willing to use a 1D plaintext syntax for marking up your symbols/names with immutable subscripts and overscripts. If that's true then I can show you how. But, as input, it will require more typing/keystrokes.

I have always found 2D Input mode to be awkwardly impractical at best, and buggy at worst. I don't know how people manage to use it, even with keyboard shortcuts. It's curious to me that you're still trying to find a way to work with it easily.

I resisted changing everything to my own taste, since I believe that the OP is learning by doing.

Otherwise, a somewhat similar effect could be had with, say,

restart;

F:=proc(u,a,b,c,d)
  local expr, x;
  if u="   y = a sin(b x + c) + d " then
    expr := evalf[3](a*sin(b*x + c) + d);
    plot(expr, x=-2*Pi..2*Pi,
         ':-title'=expr,
         ':-view'=-3 .. 6);
  elif u="   y = sin(a x) + cos(b x) " then
    expr :=  evalf[3](sin(a*x) + cos(b*x));
    plot(expr, x=-2*Pi..2*Pi,
         ':-title'=expr,
         ':-view'=-2..2);
  else error u;
  end if;
end proc:

Explore( F(`function :`,a,b,c,d),
         parameters=[ [`function :`=["   y = a sin(b x + c) + d ",
                                     "   y = sin(a x) + cos(b x) "],
                       #controller="listbox",
                       placement=top]
                    ],
         a = 1.0 .. 3.0, b = 1.0 .. 3.0,
         c = 0.0 .. 2*Pi, d = 0.0 .. 3.0,
         placement = right
         #, newsheet, showbanner=false, startupdefinitions=[F]
       );

Could you upload your data here as an attachment (green up-arrow)?

@Ramakrishnan One of the problems with your original was that MyApp did not export ChangeE. So when you called ChangeE() in the code of the Sliders nothing happened.

If you are interested in using different formulas and radio buttons:  doubt2_MathContainer_ac2.mw

@Ramakrishnan You mean you're posting the same question twice? Please don't do that.

The first thing to clarify is the format of your data. It looks like the three columns denote four points of [x,y,z] data, rather than a 3x4=12 collection of [x,y] data points. Is that right?

What version of Maple are you using?

Is this a toy example, and you plan on wanting to do it for larger sets of points (possibly with surface smoothing)? Or do you just need to deal with this kind of simple 3D polygon with a quadrilateral base?

 

@dorna01 Tacking that comment onto a 9 year old message thread is not helpful. Post your example as a new Question.

Don't say that you could upload the worksheet or code later, if needed. Just include the relevant materials and details when you post.

@Carl Love I'm not aware of any mechanism by which Library code could robustly compute the display-width of rendered, 2D prettyprinted output (at 100% zoom, say).

And I have tried pretty hard to find one.

Rough approximations can be constructed, using offset values for fractions, max of numer and denom, offsets for fencing, Int/Sum/Product symbols, radicals, etc.

But really the only thing that might be true to form is the result from a new GUI streamcall. The Typesetting package is not enough.

It's  not clear to me that a rough kluge would be better than nothing. But, I agree that it would be an improvement to have the weighting be set automatically, if it could be done reliably.

There would be other, related uses for the display-width information.

 

@Carl Love Very nice, vote up.

You could get a printing effect with,

Tabulate(Table(
   [Bin(n,p), DiscrUni(a,b), Poiss(lambda), NegBin(p)],
   [Unity, Mean, Variance, Skewness, Kurtosis]
)):

Tabulate(Table(
   [Bin(n,p), DiscrUni(a,b), Poiss(lambda), NegBin(p)],
   [Unity, Mean, Variance, Skewness, Kurtosis]
), weights=[3,1,2,3,3,5]):

(I was a little disappointed that the `lambda` in the row headers isn't typeset when Tabulated, but it doesn't detract too much.)

@mmcdara There are concrete benefits which support this point of view.

The representation is sparse, and so can take less space or memory.

That can hold for line-printing. It can also hold for round trip programmatic recreation, using `rtable`, `rtable_indfns`, `rtable_elems`, and `rtable_options`.

@mmcdara Right. The creating of a temporary rtable, and its processing by the garbage collector afterwards, incurs a relatively small time penalty.

The penalty in memory allocation incurred by the extra rtable is transient, and the collected memory can even be returned to the OS now.

Memory "used" just means memory processed by the garbage collector, and its significant effect is just whatever time that takes.

But, aside from that time overhead, memory "used" is not a penalty in itself.

On a related topic, I would like to see Statistics:-Sample become thread-safe. And I'd like to be able to parallelize it. I suspect it may be assigning to module locals in the usual thread-global way (although there is special syntax available now for thread-local module locals).

@Gabriel samaila So why did you upload an attachment saved with Maple 16 before?

First 245 246 247 248 249 250 251 Last Page 247 of 612