acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@sand15 The idea of using DelaunayTriangulation is nice. Vote up for ingenuity.

I get the following image and timing of the computation, in my Maple 2022.2. (I corrected some missing statement terminators in the code you showed, but made no other significant changes.)

If I may make some constructive comemnts:
- The boundary is still somewhat rough. I still believe that this is cured better by superpositioning curves along the boundary than by refining the implicitplot options. [I am going to add such an attempt in another Answer thread.]
- There appears to be a chunk missing from the bottom-most tip of the transformed region.

restart: with(plots): with(ComputationalGeometry):

str:=time[real]():

Q := inequal(Or(u^2+4*v^2 <= 4, And(u^2+v^2 < 4, (u+2)^2+2*(v-1)^2 <= 2)),
             u=-2..2, v=-2..2, nolines):

POL := select(has, [op(Q)], POLYGONS):
numelems(POL):

F := plottools:-transform((u, v)  -> [u^3-v^2, u^2-v^3]):
display(F(Q)):

pol  := op(1..-4, op(1, POL)):
pts  :=  `<,>`(pol):
tris := DelaunayTriangulation(pts):

b1 := display(map(x -> plottools:-polygon(pts[x], style='polygon'), tris), axes=none):
d1 := F(b1):

pol  := op(1..-4, op(2, POL)):
pts  :=  `<,>`(pol):
tris := DelaunayTriangulation(pts):

b2 := display(map(x -> plottools:-polygon(pts[x], style='polygon'), tris), axes=none):
d2 := F(b2):

time[real]()-str;

2.273

display(d1, d2);

#display(b1,b2,overrideoption,style=polygonoutline,color=gray);

#display(d1,d2,overrideoption,style=polygonoutline,color=gray);

 

Download plot_transform_sand15.mw

@FDS Note that the changes that I made to your Maple code make it more like what you showed for Mathcad: I made operator f take both p and i as parameters, and inside f it has Hb[i] and k[i] as indexed references.

For fun, here's another approach, this time dealing with the OP's first example.

restart; with(plots):
P := densityplot((u,v)->`if`(`or`(u^2 + 4*v^2 <= 4,
                                  `and`(u^2 + v^2 < 4,
                                        (u + 2)^2 + 2*v^2 <= 4*v)),0,1),
                 -2..2, -1..2, grid=[301,301], style=surface, labels=[u,v]):
P2 := subsindets(P,rtable,r->ImageTools:-Threshold(r,0.6,low=0.0)):
display(plottools:-transform((u,v)->[u^3-v^2,u^2-v^3])(P2),
        view=[-8.2..8.2,-4.2..4.2], axes=boxed);

I suppose that implicitplot could produce a boundary curve, which when transformed would give the boundary of the above a cleaner look.

note: The higher-than-default grid resolution puts a greater burden on the GUI's plot renderer. But the approach has the advantage of being simple. It also avoids some difficulty that thin-polygon-strip-fill approach can have when the region is not convex.

note. Other approaches are possible.

@Thomas Dean It works on (ubuntu) Linux, for me, using either Maple 2021.2 or 2022.2.

ps. You tagged your Question as Maple 2021.  Your latest Reply mentions Maple 2022.2. Which is it?

@Thomas Dean You mention having explicit multiplication symbols in the output. It sounds as if that is your primary motivation here.

In the following attachments I first set the GUI menubar item:
   Tools->Option->Display->Maple Notation

Then I executed the whole worksheet. That gave me line-printed expression output (with explicit multiplication symbols) and properly rendered plots.

That worked for me in either Maple 2021.2 or Maple 2022.2, both for Linux.

plot-problem_ac_M2021.2.mw
plot-problem_ac_M2022.2.mw

I left other items as their defaults, ie:
 -- Maple 2021.2  interface(typesetting) returns standard
                            interface(prettyprint) returns 3
 -- Maple 2022.2  interface(typesetting) returns extended
                            interface(prettyprint) returns 3

@Thomas Dean It's not clear to me whether you want 1D output or 2D (typeset) output.

@sursumCorda For your first example plots:-inequal is generating many small (thin, say) POLYGONS substructures that when rendered together give the appearance of a filled region with curved boundary.

The transformation of those looks almost useful, something somewhat like what was desired. The scrappy end result is of mixed usefulness.

But in the second example plots:-inequal produces the POLYGONS substructure required only to render the triangular domain. That gets its (few) vertices transformed to something which lacks the information about how the triangle's boundary curve and interior region would (ideally) get transformed.

In contrast, the plot3d command that I used generates a surface whose interior points are represented explicitly in a MESH substructre. That gets transformed to another 2-D MESH substructure that retains information about the interior point's transformation, and which gets rendered quite nicely as a 2-D region. It's transformed edges are a little ragged, so I added spacecurves (which also contain many explicit data of points) along the boundary lines, so that after transformation the final result's boundary consists of smoother boundaries.

@Thomas Dean I did not notice that detail before. But good to know, thanks.

Do the Examples on the Help page VolumeOfRevolution show properly? I mean, when you open the Help page but without re-executing the examples?

note. Your posted code runs fine for me, showing a plot, using Maple 2021.2 on a similar ubuntu system.

@Thomas Dean Perhaps it's happening because you are using a version of an Operating System which is not officially supported for your Maple version? (See here, for a list for Maple 2021.) Or perhaps some Java adjustment is needed, for some kind of inline 3d plotting of the Java GUI on your system.

@mmcdara I converted it from a Question to a Post, because it didn't contain a question.

I suppose that means that you are using Maple 2022.2

@justauser I already know of several ways to accomplish that substitution in the plaintext file.

I suggest that it would be even easier if the OP found a way to have the files be created in the first place with the period instead of the comma.

You could tell us which version of Maple you're using.

You could upload and attach a .mw file that reproduces the problem.

@Sauberschrauber I edited my response to allow the comma to be converted to a period, for the parsing of the float data.

I suspect that either method could be made faster if you were able to have the original data text files be written out with periods instead of commas, eg. 1.26E+00 instead of 1,26E+00 etc.

@PaulNewton You wrote, "In all the languages...". And indeed the Maple language has a rich functionality for programmatic flow control.

Yet you have asked about the Java GUI (Graphical User  Interface), which is not part of the Maple language in the traditional sense.

I see few merits to using RunWorksheet over the benefits of encapsulating Maple programs using procedures and modules, and of using their programmatic control flow features. Using RunWorksheet can also cede many benefits of the usual model (eg. efficiency, debugging, revision control).

First 84 85 86 87 88 89 90 Last Page 86 of 591