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

Another alternative here is to use PolyhedralSets. That too produces a lightweight plot with cleanly rendered boundaires, but with less need for thinking about the inequalities and region.

We could optionally remove the sphere symbols at the vertices, adjust the view, etc.

restart;

with(PolyhedralSets):

p := PolyhedralSet([0<=x, x<=y, y<=z, z<=1], [x,y,z]):

P := Plot(p);

plots:-display(subsindets(P,specfunc(POINTS),()->NULL),
               view=[(0..1)$3], glossiness=0);

 

Download polyhedral_ex.mw

@C_R You wrote about five inequalities (now adjusted). But four inequalities are sufficient, and are given by the OP. Ie,

   0<=x, x<=y, y<=z, z<=1

Please don't start wholly separate new Question threads for this problem.

@Christopher2222 What is the size of your actual Matrix?

If it's datatype=float[8] then is ImageTools:-Threshold fast enough?

Or is it so large (and not just floats), so that you really need parallelism?

Did you read the Help page for that command?

If so, then which specific parts of did you not understand?

Could you provide your complete example?

@OliverB It's always a good idea to inform us up front if you're using an older version, thanks. I've now adjusted the Product field of this Question.

In Maple 2021 the contourplot command didn't recognize an appliable module (as returned by Interpolate, say) as something it could accept for its operator form calling sequence.

You could try either of these, instead,

plots:-contourplot((x,y)->f(x,y),
                   min(data[..,1])..max(data[..,1]),
                   min(data[..,2])..max(data[..,2]),
                   contours=[seq(100 .. 1000, 100)]);

plots:-contourplot(f(x,y),
                   x=min(data[..,1])..max(data[..,1]),
                   y=min(data[..,2])..max(data[..,2]),
                   contours=[seq(100 .. 1000, 100)]);

interp_cont_data_2021.mw

If that still doesn't work then please upload and attach either as .mw file, or a zip-file of the .maple workbook. Your .maple file attachment is not accessible (a problem of this site, I think).

@MaPal93 The idea was that you could use the instance that contains the placeholder names. You could apply coeff to that.

collect_complete_ac_coeffissue_ac.mw

(friendly ps. I'm reminded of this old jest.)

If you have followup queries for this problem then please add that here instead of spawning wholly separate new Question threads.

The filled implicitplot red region in the plots above is composed of many POLYGONS plotting structures, and errant gaps can appear when transforming onto the sphere. Those can appear as open chinks between the polygon edges, especially apparent upon manual rotation.

Using plot3d directly, instead of implicitplot with filledregions, a smoother surface without gaps can be obtained.

I include the transformed black outline, still made with implicitplot. Remove if desired.

restart; with(plots)

Equations := [-.1272463007-.1364614350*y+.5478028265*y^2-.4626165419*x+0.7714146226e-1*y*x+.6671835197*x^2, 0.9582956998e-1-.5439311444*y+.5969331379*y^2+.2711291996*x-.1314652750*y*x+.4978275516*x^2, 0.4404070985e-1-.1903242613*y+.5210473801*y^2+.5305119366*x-0.9202813426e-1*y*x+.6327990414*x^2]

P := implicitplot(max(op(Equations)), x = -.3 .. 0, y = .1 .. .5, color = black, gridrefine = 3)

S := (plottools:-transform(proc (x, y) options operator, arrow; [x, y, sqrt(1-x^2-y^2)] end proc))(P)

fsolve(Equations[[1,2]]):
fsolve(Equations[[1,2]], {x,y}, avoid={%}):
x1:=min(eval(x,%),eval(x,%%));

-.2252370148

fsolve(Equations[[1,3]]):
fsolve(Equations[[1,3]], {x,y}, avoid={%}):
x2:=max(eval(x,%),eval(x,%%));

-.1542481311

fsolve(Equations[[2,3]]):
fsolve(Equations[[2,3]], {x,y}, avoid={%}):
x3:=max(eval(x,%),eval(x,%%));

-0.5608341975e-1

yeq11:=solve(Equations[1],y)[1]: yeq22:=solve(Equations[2],y)[2]: yeq31:=solve(Equations[3],y)[1]:

opts:=style=surface,color=red:
S2:=display(
  plot3d(sqrt(1-x^2-y^2),
         x=x1..x2,
         y=yeq22..yeq11,opts),
  plot3d(sqrt(1-x^2-y^2),x=x2..x3,
         y=yeq22..yeq31,opts)):

display(S2, S);

display(plottools:-sphere([0, 0, 0], 1, color = gray, transparency = 0.8, style = surface),
        S2, S);

 

Download Projection_accc.mw

Lastly, I'll point out that I deliberately did not resort to using implicitplot3d, which (even with option style=surface) produces a clunky surface as a collection of 3D polygons. The result doesn't appear smooth unless the grid resolution is so high that the GUI gets very sluggish when rendering/rotating it.

@MaPal93 Your attached worksheet's last collect call works for me.

restart;

`&Omega;__1` := X__1*(nu[1]-`&mu;__1`-`&lambda;__1`*(u[1]+X__1)); `&Omega;__2` := X__2*(nu[2]-`&mu;__2`-`&lambda;__2`*(u[2]+X__2)); `&Omega;__3` := X__3*(nu[1]+nu[2]-`&mu;__3`-`&lambda;__3`*(u[3]+X__3)); Omega := `&Omega;__1`+`&Omega;__2`+`&Omega;__3`

X__1*(nu[1]-mu__1-lambda__1*(u[1]+X__1))+X__2*(nu[2]-mu__2-lambda__2*(u[2]+X__2))+X__3*(nu[1]+nu[2]-mu__3-lambda__3*(u[3]+X__3))

# 2.2.2 Simplify and re-arrange the Omega RV to obtain the easy-to-read version (a,b,c,d,e,f are the coefficients):
#Omega__* = a + b*nu[1] + c*nu[2] + d*u[1] + e*u[2] + f*u[3];

`&Omega;__col` := collect(Omega, [nu[1], nu[2], u[1], u[2], u[3]])

(X__1+X__3)*nu[1]+(X__2+X__3)*nu[2]-lambda__1*X__1*u[1]-lambda__2*X__2*u[2]-lambda__3*X__3*u[3]+X__1*(-X__1*lambda__1-mu__1)+X__2*(-X__2*lambda__2-mu__2)+X__3*(-X__3*lambda__3-mu__3)

coeff(Omega, nu[1]); coeff(Omega, nu[2])

X__1+X__3

X__2+X__3

coeff(Omega, u[1]); coeff(Omega, u[2]); coeff(Omega, u[3])

-lambda__1*X__1

-lambda__2*X__2

-lambda__3*X__3

Download collect_M_ac.mw

I notice that your attached worksheet did not begin with a restart. I wonder whether there were some earlier computations performed before it was saved.

I don't see how what you've written explains what you mean by the complicated term with which you were trying to "collect" in the line that assigned to `Omega__*`.

The link that Samir gave here is no longer working, and while the wayback machine has a cached version of it, its link to the zip file seems to be not archived by them.

@Vortex Is there a reason why you cannot show us the complete set of commands that you've used, and the version?

@lcz There are various ways to handle your followup query.

with(StringTools):
S := "124e34e243e45e56e76f34e45e23ea12e98e34e43":

parse~([seq(Select(IsDigit,S))]);

   [1, 2, 4, 3, 4, 2, 4, 3, 4, 5, 5, 6, 7, 6, 3, 4,
    4, 5, 2, 3, 1, 2, 9, 8, 3, 4, 4, 3]

parse~([seq(RegSubs("[A-z]"="",S))]);

   [1, 2, 4, 3, 4, 2, 4, 3, 4, 5, 5, 6, 7, 6, 3, 4,
    4, 5, 2, 3, 1, 2, 9, 8, 3, 4, 4, 3]


We don't know whether you'd always need your original operation as well as the first (in which case it might be more efficient to simply split an earlier result). Eg.

with(StringTools):
S := "124e34e243e45e56e76f34e45e23ea12e98e34e43":
T := Split(S,cat(seq("A".."z"))):

parse~(T);

     [124, 34, 243, 45, 56, 76, 34, 45, 23, 12, 98, 34, 43]

parse~(seq~(T));

   [1, 2, 4, 3, 4, 2, 4, 3, 4, 5, 5, 6, 7, 6, 3, 4,
    4, 5, 2, 3, 1, 2, 9, 8, 3, 4, 4, 3]

We don't know whether your actual examples might be very large, or what over efficiency you'd need.

You also haven't stated your general case (ie. what non-numeric characters might be present).

Your question is sparse in important details.

Where does Sx come from?

If Sx comes from dsolve(...,numeric) then you might be able to use that command's events facilities. (For example, you might make it halt when the derivative falls under a target value, has a discontinuous drop, etc.)

Why not provide the details?

First 75 76 77 78 79 80 81 Last Page 77 of 591