acer

32313 Reputation

29 Badges

19 years, 312 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

unapply is the same procedure as MakeFunction, so the latter logically cannot be the greatest procedure "created in decades", because that procedure has already existed in Maple for decades.

Please put your close followup queries here, instead of in a wholly separate new Question thread.

How's this example?

I believe that I could also put the results in tabular form... (let me know).

@Scot Gould The reason that there are so many examples in the ?Explore and ?examples,Explore Help pages of just a function call to a custom procedure is that it's quite often easiest to make a procedure do something arbitrary.

That way, you can test your procedure (outside of Explore), by just calling it on some input value(s).

Explore_with_Inert_Form_of_display_ac2.mw


Sorry that Explore can be tough sometimes. A variant on an old saw:
   flexible and powerful, easy-to-use: pick any one of those

@Traruh Synred You can set your defaults to Worksheet and 1D Input in Maple 2018, just as in later versions.

Also (in Maple 2018, or other) even in a Document you can also insert an Execution Group (instead of a Paragraph/Document Block), and then toggle it to 1D Input mode using the F5 key.

@Carl Love The cited error message, "Error, invalid 'if' statement" indicates that the OP was trying this in 2D Input mode.

It won't work in 2D Input, even in Maple 2023.

@digerdiga The context-menu conversion to Atomic Variable changes the input (in situ) into the kind of representation that I was building programatically in my Answer.

I had guessed (maybe wrongly) that you wanted to be able to programatically build such a thing, for multiple inputs.

Also, yes, non-executable math mode does't produce output. But you can mix it in with written text, for exposition.

@Carl Love But it appears that the OP wants the result to display in the a=b=c form (the first example in my Answer), rather than as some inert and form (the 2nd and 3rd examples in my Answer).

@digerdiga 

nprintf("#mrow(%a,mo(\"=\"),%a,mo(\"≤\"),%a)",
        Typesetting:-Typeset(P(X <= 5) = P(-5 <= -X)),
        Typesetting:-Typeset(P(E(X) - 5 <= E(X) - X)),
        Typesetting:-Typeset(P(E(X) - 5 <= abs(E(X) - X))));
 

`#mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi("P"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("X"),Typesetting:-mo("&le;"),Typesetting:-mn("5")))),Typesetting:-mo("&equals;"),Typesetting:-mrow(Typesetting:-mi("P"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mn("&uminus0;5"),Typesetting:-mo("&le;"),Typesetting:-mrow(Typesetting:-mo("&uminus0;"),Typesetting:-mi("X")))))),mo("&equals;"),Typesetting:-mrow(Typesetting:-mi("P"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi("E"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mi("X"))),Typesetting:-mo("&minus;"),Typesetting:-mn("5")),Typesetting:-mo("&le;"),Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi("E"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mi("X"))),Typesetting:-mo("&minus;"),Typesetting:-mi("X"))))),mo("&le;"),Typesetting:-mrow(Typesetting:-mi("P"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi("E"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mi("X"))),Typesetting:-mo("&minus;"),Typesetting:-mn("5")),Typesetting:-mo("&le;"),Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi("E"),Typesetting:-mo("&ApplyFunction;"),Typesetting:-mfenced(Typesetting:-mi("X"))),Typesetting:-mo("&minus;"),Typesetting:-mi("X")),open = "&verbar;",close = "&verbar;",Typesetting:-msemantics = "abs")))))`

Download ts_inert_ex2.mw

Some related entities are  &le;   &lt;   &ge;   &gt;
corresponding respectively to    <=    <    >=    >

In this nprintf call the three %a placeholders in the format string get replaced by the latter three arguments.  The first argument is the format string, and there most everything else (apart from the %a placeholders) are blobs of XML-style markup. The interior doublequotes in the format string are escaped \".

I used nprintf above to get a name-form of markup. The GUI also understands an operator-form. You can also build that up programmatically. For example,
   ts_inert_ex3.mw

@digerdiga Could you provide an example or what else you might want?

@Christian Wolinski It's not clear why you mention an "exact match".  It gives the same results as,

   A::'Matrix(4,4)' and LinearAlgebra:-Norm(A)=0;

with both methods accepting Matrices containing either exact or float zeroes.

ps. I like to do the dimension check first, so as (potentially) to fail out there before having to check all entries.

But reversing the order of the tests in just one of these approaches would make the approaches match (both throwing an error, or both not) in the case that A is not actually a Matrix. Alas, the OP did not really answer my query about whether the input would always be an actual Matrix.

@Jamie128 I'll mention that code would also produce A if used on a Matrix that contained floating-point zero, ie. 0.0 .  Reply if you'd want that not to happen.

Please put followup queries on this example (and related simplification or verification) as Replies/Comments here, instead of starting wholly separate new Question threads for such.

@mmcdara I wholeheartedly agree with the idea that it's often very beneficial to extend a solution and answer, past what a poster has written.

It was your sentence, "The key is to define the rewritting rules rel that will lead you to the desire result." that I found confusing.

The form that your rel rules reveal was not mentioned by the OP, and it's also not hands-down obviously superior, so why do you say that it's "the desire result" [emphasis mine]?

I didn't intend offence. It's the use of the definite article that surprised me. This might be just a translation thing.

@mmcdara I know how the Statistics package works, but thanks for your comment. I used rand and code in the OP's general form, only to try and keep it more consistent with his earlier style.

I already thought that it was clear (and obvious) that one could use a larger number of dice, to get the uniform distribution over the fixed (original) range. I used the same number n (20) in both spots only because the OP had.

The OP sometimes takes several messages before the true goal appears.

I often regret guessing, on this forum. I'll leave this thread now.

@mmcdara In the OP's original Question the stated target expressions appear (modulo rational coefficient rearrangements) as they do in your computed trigsol results.

The reformulation formed by your use of your rel equations is interesting, but not actually requested in the original Question. I'll note that one can also get it without having to write out those rel equations manually, ie.

   simplify(expand(trigsol),size)

First 55 56 57 58 59 60 61 Last Page 57 of 591