acer

32490 Reputation

29 Badges

20 years, 8 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Alexandrakristensen24 I was unable (as yet) to recover that corrupted portion, which contained a faulty image portion.

Your attachment's faulty portion does seem to start at line 274 of the XML. But there are only 286 lines in the file. It's quite possible that your attachment doesn't contain much more data, and that the (nor properly saved) original was actually much larger.

@C_R 

As I'd already mentioned in my original Answer: the custom mechanism is faulty in M2024.0.

I've already reported that functionality regression.

@C_R Regardless of which command you might extend, you'll need a conditional to test for type `=`.

Otherwise you'll have weird errors when applying rhs,lhs accidentally to type algebraic, Matrix, piecewise, etc.

What version are using? Did you see the part of my Answer that explained that the `simplify/ext` mechanism doesn't work properly in Maple 2023.2 and Maple 2024.0?

The general mechanism worked in 2022.2.

Which are you using here?

@C_R It may be due to the special characters in the file name. The OP could try renaming it.

@C_R Experiment and the quest for understanding are great motivations. I was curious, is all. Thanks.

I'd have to study those other examples later.

@mmcdara 

I gave the Compile variant because I didn't know whether you wanted to repeat this operation on many Matrices or column choices.

If anything else has been compiled then part of the overhead is lessened. Also, you might be able to get a faster compilation without inmem=false, but that may depend on version and OS.

In later Maple versions there are also some variants using andseq (possibly with evalhf), which also allows for a quick bailout.

@nmacsai You can change the font for the color-bar's textplot values.

colbar_M2023_4.mw

[edit] In Maple 2024 such adjustments are directly possible via additional options, eg.
   colorbar=[barcaption = ..., labelfont = ... ]
see  ?plots,colorbar

@Ronan You're very welcome; I'm glad if it suits your purpose.

I'm not quite sure that I understand that screenshot, though. Was this elision mechanism used in that shot?

@nmacsai I forgot to ask whether the effect you wanted could not at all be accomplished with a shortened view option choice.

Yes, there is a way to decompose and reparse the output of InlinePlot, to get back to a plot structure.

But that mentioned zoom/scale is not part of a plot structure. It's only part of the XML markup of the actual worksheet. So reparsing from an InlinePlot's XML return back to an actual plot structure would not retain an such scaling/zoom level information.

If that scale/zoom (like with right-click manipulator) were a programmatic part of a plot structure itself then I'd have shown that way in your previous Question.

However, another possibility for getting a "zoomed" effect might be to use the viewpoint option with just a single frame.

note: please put your close followups on this topic as Comment/Reply in your earlier Question, or Branch from that, instead of spawning more wholly separated and unlinked Question threads for it.

For fun, here is the first example, but using the allsolutions option to get a result in terms of conditional relations.

(Sorry, this site doesn't render it so nicely.)

restart;

r := a + (b - a)*z/h:

x1 := sqrt(r^2 - y^2):


The so-called "collapsed" syntax for multiple integrals
allows easy use of the allsolutions option.

There are various piecewise instances in the following result,
involving various relations between a,b, & h.
 

simplify( int(1, [x=-x1..x1,y=-r..r,z=0..h], allsolutions) )
   assuming real;

-h*Pi*(-a^3+b^3*piecewise(a*h = h*(-b+a), 0, 1)+2*piecewise(0 < h, -2*a^3*(piecewise(b-a < 0, 0, 1)-1/2)*piecewise(-a*h/(-b+a) < 0, 0, 1)-piecewise(-b*h/(-b+a) < 0, 0, 1)*piecewise(a*h = h*(-b+a), 0, 1)*b^3+piecewise(b-a < 0, 0, 1)*(-2*b^3*piecewise(b*h/(-b+a) < 0, 0, 1)*piecewise(a*h = h*(-b+a), 0, 1)+b^3*piecewise(a*h = h*(-b+a), 0, 1)+a^3), h <= 0, -2*piecewise(a*h = h*(-b+a), 0, 1)*(piecewise(b-a < 0, 0, 1)-1/2)*b^3*piecewise(-b*h/(-b+a) < 0, 0, 1)-piecewise(-a*h/(-b+a) < 0, 0, 1)*a^3-2*piecewise(b-a < 0, 0, 1)*piecewise(a*h/(-b+a) < 0, 0, 1)*a^3-piecewise(-b+a < 0, 0, 1)*piecewise(a*h = h*(-b+a), 0, 1)*b^3+a^3*(piecewise(-b+a < 0, 0, 1)+2*piecewise(b-a < 0, 0, 1))))/(-3*b+3*a)


Download trip_int_exb.mw

restart;

r := a + (b - a)*z/h:

x1 := sqrt(r^2 - y^2):


Your followup example:

Note that I use a different syntax for the multiple integral,
in which the command int is called just once. A "collapsed" syntax.

That allows knowledge to be transferred from the outer integeration
to the inner integration. E.g. relations between the inner level's integrand's
variables and and the outer levels' ranges.
 

simplify( int(x^2+y^2, [x=-x1..x1,y=-r..r,z=0..h]) )
    assuming h>0, a>0, b>0;

(1/10)*Pi*h*(a^4+a^3*b+a^2*b^2+a*b^3+b^4)


In contrast to the above, the form with three nested int calls
takes longer. (In general this nested form can even fail while
the collapsed form succeeds. Here, we are lucky.)

In this case the inner integral (w.r.t. x) gets computed without knowledge
that y is between -r and r, or that z is less than h.
 

simplify( int(int(int(x^2+y^2, x = -x1 .. x1), y = -r .. r), z = 0 .. h) )
    assuming h>0, a>0, b>0;

Warning, unable to determine if (a*h-a*z+b*z)/h is between -a-(b-a)*z/h and a+(b-a)*z/h; try to use assumptions or use the AllSolutions option

Warning, unable to determine if -(a*h-a*z+b*z)/h is between -a-(b-a)*z/h and a+(b-a)*z/h; try to use assumptions or use the AllSolutions option

(1/10)*Pi*h*(a^4+a^3*b+a^2*b^2+a*b^3+b^4)


Download trip_int_ex2.mw

You cannot link just the character length or length of the 1D code representation of a general expression with the width the takes to pretty-print it as 2D Output. It generally needs a bit more finesse, according to type of expression.

However, I've seen at least one quite decent attempt at estimating 2D rendering width for algebraic expressions. I'd have to go hunting to find it.

But the elision fade-out was done using Typesetting constructs, in the instance I'm recollecting. I'm not 100% sure that the further/repeat 2D type-setting by Tabulate would work ok. If not then the DocumentTools:-Layout constructors might be used to get the same kind of Table result.

Alas it is the end of the day for me.

@nmacsai These two ways of injecting the COLBAR substructure into the cylinder's PLOT3D structure end up with the same result.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Linux, November 24 2023 Build ID 1762575`

Psin := plots:-contourplot(sin(x*y),x=-Pi..Pi,y=-Pi..Pi,colorbar):

# the colorbar will have height 200 pixels
CB := subsindets(indets(Psin,specfunc(COLBAR))[1],specfunc(PLOT),
                 u->plots:-display(u,size=[200,200])):

op(0,CB);

COLBAR

c1 := plots:-display(plottools:-cylinder([1, 1, 1], 1, 3),
                     scaling = constrained, color = red, size=[400,400]):

# first way
subsop(-1=[op(-1,c1),CB][],c1);

# second way
PLOT3D(op(c1),CB);

 

 

Download colbar_M2023_2.mw

I used contourplot to get its accompanying color-bar. You could alternatively use densityplot and then pass that your choice of colorscheme option. Eg,

colbar_M2023_3.mw

[edit] The constructed color-bar is itself just a 2D densityplot with aligned values shown. There are doubtless more efficient ways to construct it, and I just chose one that was reasonably straightforward. The trick is to wrap it in a COLBAR call, and then make it the new last operand of the PLOT3D structure. You could likely use other kinds of 2D plots. The GUI recognize the COLBAR within the PLOT3D and renders it (only) on the right side.

First 43 44 45 46 47 48 49 Last Page 45 of 594