acer

32368 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@janhardo I am not aware of any way to lock a document block.

How about either uploading a Document in which there is a plot you don't understand, or supplying a URL that points at one? Youc could do either of those in a followup Comment in this thread on Mapleprimes. Then we could try and figure out your issue.

By the way, plots can also be copied and pasted in a Document or Worksheet. It is possible to paste in a (previously and elsewhere generated) plot and have no source present that would reproduce it in the sheet.

Did you intend assignment with

csvfile := Matrix(30,7);

rather than your

csvfile = Matrix(30,7);

acer

@oldstudent While it isn't specifically a Mapleprimes thing, the Maple Portal has material designed for new Maple users.

Note that the Portal is quite heavy on Document mode, 2D Math input, and (mouse driven) "clickable math", while some users discover a marked preference for Worksheet mode, 1D notation input, and programmatic approaches.

Assignment is performed using := and not by using = which just forms an equation. So your code is not actually assigning to the names a, b, and c.

acer

@ber9erud Each time you invoke `assume(p,real)` you affect how Maple interprets your subsequent references to `p`. And the earlier instances of `p` assigned to various expressions will be different from the latter ones. The problem would also occur if you made that invocation at the top-level (not in a procedure) multiple times within the loop. The issue is with the repetition of the call, rather than whether it is done inside a procedure call.

 

@Markiyan Hirnyk Does this mean that you're not going to answer my question about how you got that output in your first comment to my Answer, with the display as calls to `%+`?

Anyway, it's not clear what your "that" refers to. Do you mean the original question, or something to do with ``() specifically, or some typeset display-only mechanism for Maple 11, or...?

The following produces the same results, and displays them the same, in the Std GUIs of both Maple 11.02 and Maple 18.01. It produces a display with the real and imaginary parts separated as requested, but without extra bracketing in the 2D Math output. And the result is still subject to further computation.

restart:

c := a+I*b:

H:=proc(ee)
 (evalc(Re(ee)))+I*(evalc(Im(ee)));
end proc:

`print/%H`:= proc(ee)
     eval( 'Typesetting:-Typeset'(evalc(Re(ee)))
           + 'Typesetting:-Typeset'(evalc(Im(ee)))*I );
end proc:

For the given example one can evaluate at a point either before or after applying `value`,

`%H`( c^2 );

eval( value(%), [a=1,b=2] );

abs( % );

`%H`( c^2 );

eval( %, [a=1,b=2] );

abs( value(%) );

And now taking abs of the symbolic quantity,

`%H`( c^2 );

abs( value(%) ) assuming real;

`%H`( c^2 );

value( abs( % ) ) assuming real;

There are several ways to approach this topic. I see some different disadvantages to both the ``() and the InertForm approaches. I more often find that I want output with which I can continue to compute, but alongside customized prettyprinting. Somewhat similar kinds have questions have come up several times before.

Can you supply a definition of P_Chain, so that we could run the whole sheet?

Why are you using deprecated lowercase `array` instead of capitalized `Array`?

acer

@Markiyan Hirnyk I did mention that aspect in my comment, but as it may not have been crystal clear enough I will edit. Indeed I agreed that it is an important distinction.

By the way, your first comment in reply to my Answer shows output (as images) that does not conform to what I see in the Std GUI when using InertForm:-Display. Your output images show function calls to `%+`, perhaps as 2D Math. Is that an unfortunate consequence of inlining it on this site? However in your second comment your inlined image does show a displayed result from InertForm:-Display that typesets as I usually see it. Did you paste in, or do something else differently, the second time?

@Markiyan Hirnyk The two approaches certainly have different usages, and different advantages and disadvantages. No doubt about it. Neither is perfect.

Using ``() one has to live with the extra parentheses which look articificial, or else go to more effort with special `print/` mechanisms, or deal with italic vs upright fonts, etc. And while it's easy to use `expand` to remove instances of ``(), it's a pain if you want to use `expand` in more usual ways and leave the ``() untouched, etc. Whenever I use this mechanism I find it wanting: it's too fragile or finicky in the presence of multiple `expand` calls, and the bracketing is unattractive.

It should be no surprise that the InertForm package deals with displaying forms that are, umm, mostly inert. So indeed it is a disadvantage that the displayed result is just that -- display rather than output for further direct computation. Indeed this introduces an unnatural break, since one cannot simply use `%` in the usual way, following a call to Display. Having said that, I would accomplish substitutions as you attempted before wrapping with `Display`. Eg,

restart:
c:=a+b*I:
expr:=c^2:
U := `%+`(evalc(Re(expr)),evalc(I*Im(expr))):
with(InertForm):

Display( eval(U,[a=1,b=2]) );
Display( eval(U,[a=1,b=2]), inert=false );

eval(``(Re(c^2))+I*``(Im(c^2)), [a=1,b=2]);

There's a certain ad hoc lack of grace to all these approaches, I would say. Fine-grained and powerful printing control and the continued ability to manipulate expressions in all usual ways -- that'd be something to write home about.

@Alejandro Jakubi I made no claim that Maple has it perfect, nor that there is some objective perfection. I find the notion that there is a single way to do it "properly" to be flawed. You are being disingenuous by stating that I claimed that Maple's default was the right way. I claimed no such thing.

It's not even clear whether the OP had recognized that the bottom of the original plot corresponded to y=2 rather than to y=0.

@oldstudent Your basic problem seems to be either that you feel the x-axis has to be drawn along y=0 and you are not paying attention to the tickmarks drawn by Maple, or that you feel that y=0 ought to be occur at the bottom of the graph. Or some other muddle related to an inflexible notion of how this curve should be "graphed properly".

The plot shown by,

  plot(x^2+2, x= -2..2);

has y=2 along the bottom edge of what is displayed, and that is where the x-axis is drawn for that particular view of the x-y plane. Please note the values of the tickmarks drawn along the y-axis.

If you do not like the default view (which is mostly designed to match the extent of the curve, by default) then you can easily force whatever other finite view you'd prefer. Eg,

  plot(x^2+2, x=-2..2, view=0..6);

  plot(x^2+2, x=-2..2, view=[-1..2, -1..6]);

@mehdi jafari Your Maple code will very often be more flexible and useful if you put it in a procedure or module.

Doing everything only at the top level is clumsy and can even run slower.

Switching over to working mostly with procedures is like moving from primary school to high school.

@Mathieu1234 

restart:

expr:=(a1/2+a2/2)*ln(a1/2+a2/2+sqrt((a1/2+a2/2)^2+(b1/2-b2/2)^2+d^2))
      +(a1/2-a2/2)*ln(a1/2-a2/2+sqrt((a1/2-a2/2)^2+(b1/2-b2/2)^2+d^2)):

ans1 := simplify(expr, {a1-a2=deltaa, a1+a2=sigmaa}):

U:=Student:-Precalculus:-CompleteSquare:

ans2 := subsindets(ans1,`^`,u->`^`(U(op(1,u),[a1,b1]),op(2,u)));

           /           /                             (1/2)         \\       
         1 |           |/         2      2         2\              ||       
 ans2 := - \-ln(2) + ln\\(b1 - b2)  + 4 d  + deltaa /      + deltaa// deltaa
         2                                                                  

        /           /                             (1/2)         \\       
      1 |           |/         2      2         2\              ||       
    + - \-ln(2) + ln\\(b1 - b2)  + 4 d  + sigmaa /      + sigmaa// sigmaa
      2                                                                  


simplify( ans1-ans2 );

                                      0

Terser, if maybe slower in general, might be,

ans3 := subsindets(ans1,`+`,u->U(u));

           /           /                             (1/2)         \\       
         1 |           |/         2      2         2\              ||       
 ans3 := - \-ln(2) + ln\\(b2 - b1)  + 4 d  + deltaa /      + deltaa// deltaa
         2                                                                  

        /           /                             (1/2)         \\       
      1 |           |/         2      2         2\              ||       
    + - \-ln(2) + ln\\(b2 - b1)  + 4 d  + sigmaa /      + sigmaa// sigmaa
      2                                                                  


simplify( ans1-ans3 );

                                      0

And you could still try and force how it approaches squares, eg,

subsindets(ans1,`+`,u->U(u,[b1,a1]));

And another few ways to do that might be,

evalindets(ans1, `+` , U);

evalindets(ans1, `+` , U, [b1,a1]);

What's your machine's exact cpu chipset, do you mind saying? It may just be that your machine supports AVX instructions and that MKL is not gracefully reverting to just SSEx in the case that some mkl_*avx*.so is missing in the Maple redistributables.

Have you tried in 18.00, if you still have that available?

It's not clear what you mean about loading your own MKL. Which version? How, in a way that Maple would pick it up at run time?

And what LinearAlgebra operations are losing accuracy? SVD? Arithmetic? Other? Could you upload a representative worksheet (green arrow)?

acer

@Markiyan Hirnyk What's the significance of that expression you evaluated at beta=0, with regard to the original expression posted?

First 354 355 356 357 358 359 360 Last Page 356 of 592