acer

32328 Reputation

29 Badges

19 years, 317 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@C_R The functionality for handling units in some plotting commands, fsolve, int, etc, has been growing. It's relatively new, and there are still quirks.

I didn't have the time to figure out precisely why that one example (that involved units) failed in your followup attachment. (Offhand, I'd guess that something is checking for names but not being careful to sieve that though depends.)

But here is a workaround for that example: Gaussian_integration_ac_mov_pdf_ac.mw

It was certainly not deleted as "spam", since the spam-identification & removal mechanism would have deactivated your account. So that's a typo/mistake in the message generator.

I noticed that you had already asked another Question with that same query embedded in it (amongst other things), ie, "I can load an image in Sketcher and draw lines on it, but can't figure out how to access the lengths of those lines".

That second Question was posted before the first one was deleted.

Why are you posting duplicate Question threads!?

 

[(cough) Some people believe that there was only one Question asked on that fateful day, and discount the very existence of a so-called second Question.]

The .maple workbook filename extension is not handled properly by this site.

It could be put in an uploaded &attached .zip file instead.

@C_R Your slow (5 secs on my machine) plot was set up with int instead of Int. But that's not really what made it so slow, because when plot pumps in float values for r__mx then int will get a float range and in consequence attempt numeric rather than integration.

I believe that the slowness comes from the underlying evalf/Int process attempting to find discontinuities of the integrand expression when no special method is forced. There are two ways around that:
1) Make the integrand an operator, which sidesteps that check because it's now a "black box". It's a little tricky here since you also want to subs values for sigma and the running plotting variable r__mx into that operator-form integrand.
Gaussian_integration_ac2.mw

2) Force a special method. Going this route you should not call evalf on the Int expression, because that does nothing (the parameters are not yet numeric) good, and it even strips off the method!
Gaussian_integration_ac2.mw

I believe that my original answer did both 1) and 2).

ps. When you pass numpoints=10 to plot it will still compute at more points than that. If you only want exactly 10 points sampled then you'd also need to pass adaptive=false.

notes: Such hybrid symbolic-numeric quadrature approaches are well-intentioned. Applying a numeric quadrature rule across discontinuities might otherwise result in wrong or inaccurate results, hence a search for where to split the range, etc.

A (new) dedicated and documented option to forcibly disable continuity checking would be more user-friendly than operator-form for the integrand, which can be tricky to code. Eg. it can be problematic in the presence of nested integrals, or when having to shoehorn in values for additional parameters (like the value taken by a plotting variable, your case).

The NAG methods like _d01ajc are for purely real-valued integrands. Sometimes (but not always) forcing method=_Dexp can also disable potentially costly symbolic analysis, and that can handle complex-valued integrands.

@Scot Gould The OP has clarified to us that in actual Maple he did in fact make an assignment using := (ie, colon-equals). He replied that his writing of = (ie. equals) in the Question text was a mere typo, ie. not what he did in Maple itself.

That's why he was otherwise able to get it to work by a variant on the plotting command.

What I find weird is the way that the Java GUI's error message has the word "maplets" in it. I don't know offhand if that means that the maplet plot driver is being tried (as one can trigger from TTY CLI Maple, etc.) I don't understand what was going on in the OP's system, or even how he was originally using and launching Maple, etc.

@jganding He almost certainly already did that (a proper assignment), since he wrote that another variant worked. Also, he should have just got a plot of a straight line, if expr were not assigned.

So it must be something else.

It's an unusual error message. Is the plotdevice inline? Something in an initialization file? Etc...

I have deleted a duplicate Question thread by you, on this.

Please add your extra details or close followup queries and development on this here, instead of spawning wholly separate new Question threads for it.

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

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