acer

32333 Reputation

29 Badges

19 years, 323 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I have deleted seven duplicates of this Question, all posted within the last 45 minutes. Please stop spamming the forum with these.

If you have followup queries or details for this problem then please add them as Comments/Replies in this Question thread, instead of spawing new and separate Question threads.

@Tokoro Intersection points at the boundaries should also be included in the candidate points (ie. as well as what extrema returns). And the results from extrema can be filtered, according to the desired ranges.

I left out the end-points for the previous computation of the maximum because I could see by the graph that it did not occur at a boundary. But ideally you could use the a robust approach for both min and max.

restart;

m := 1: n := 2:

Zc := m*cos(1/180*x*Pi) + n*cos(1/180*y*Pi);

cos((1/180)*x*Pi)+2*cos((1/180)*y*Pi)

Zs := m*sin(1/180*x*Pi) + n*sin(1/180*y*Pi);

sin((1/180)*x*Pi)+2*sin((1/180)*y*Pi)



From the graph we can observe that the curve passes through the boundary
only along x=0 or x=180.
Programmatically we could also solve along y=0 and y=180 (and get no further
results there).

endpts := [map(yy->[x=0,y=yy],
               select(y->is(y>=0 and y<=180),
                      [solve(eval(Zc=Zs,x=0))]))[],
           map(yy->[x=180,y=yy],
               select(y->is(y>=0 and y<=180),
                      [solve(eval(Zc=Zs,x=180))]))[]]:
endpts := simplify(endpts);

[[x = 0, y = (45*arctan(3*7^(1/2))+45*Pi)/Pi], [x = 180, y = (-45*arctan(3*7^(1/2))+45*Pi)/Pi]]

extrema(Zs, {Zc=Zs}, {x,y}, 's'):


Filter from `s` the points which are in the desired ranges.
Augment that with the end-points.

news := select(sol->eval(x,sol)>=0 and eval(x,sol)<=180
               and eval(y,sol)>=0 and eval(y,sol)<=180,
               s) union {endpts[]};

{[x = 0, y = (45*arctan(3*7^(1/2))+45*Pi)/Pi], [x = 180, y = (-45*arctan(3*7^(1/2))+45*Pi)/Pi], {x = 45, y = 45}}

objs := eval~(Zs, news);

{(3/2)*2^(1/2), 2*cos((1/4)*arctan(3*7^(1/2))+(1/4)*Pi), 2*sin((1/4)*arctan(3*7^(1/2))+(1/4)*Pi)}

minobj := min(objs);

2*cos((1/4)*arctan(3*7^(1/2))+(1/4)*Pi)

minpts := select(u->eval(Zs,u)=minobj, news);

{[x = 180, y = (-45*arctan(3*7^(1/2))+45*Pi)/Pi]}

evalf(minobj), evalf(minpts);

.8228756542, {[x = 180., y = 24.29518893]}

maxobj := max(objs);

(3/2)*2^(1/2)

maxpts := select(u->eval(Zs,u)=maxobj, news);

{{x = 45, y = 45}}

evalf(maxobj), evalf(maxpts);

2.121320343, {{x = 45., y = 45.}}

 

Download plot-15-iPlot_ac.mw

@pik1432 Only with the interpretation ( eg. of p*(Delta*delta) ) as multiplication is your input equivalent to your stated desired result.

With the function call interpretation your input expression is not equivalent to your desired target expression.

@ijuptilk The contourplot command had not been updated in Maple 18 to make use of a thickness value less than 1.

And (funny as it sounds) thickness=0 produces a line actually thicker than it could be.

But the Maple GUI knows how to render even thinner lines. The trick is to forcibly shoehorn the smaller thickness value into the constructed PLOT structure.

The contourplot command doesn't make use of, say, thickess=0.2 as an option. But we can forcibly replace with what we want in the PLOT structure, using subsindets.

@ijuptilk Here is some explanation of those code snippets that you mentioned:

P:=plot3d(x*y,x=1..2,y=1..2,grid=[3,4]):


This is the z-data, ie. height, or values of x*y.

op([1,3],P);

Matrix(3, 4, {(1, 1) = 1., (1, 2) = 1.33333333333333, (1, 3) = 1.66666666666667, (1, 4) = 2.00000000000000, (2, 1) = 1.50000000000000, (2, 2) = 2., (2, 3) = 2.50000000000000, (2, 4) = 3.00000000000000, (3, 1) = 2., (3, 2) = 2.66666666666667, (3, 3) = 3.33333333333333, (3, 4) = 4.00000000000000})


The min and max values from those z-values, then assigned to minv and maxv respectively..

(minv,maxv) := [min,max](op([1,3],P))[];

1., 3.99999999999999956

nconts:=4:


This is a variant of a standard technique, and generates a sequence of nconts evenly spaced values. But I chose to omit the lower value, so that in the contour-plot the colored/filled regions denote areas less than the next higher contour. (In that manner, there's no point in showing the lowest contour corresponding to z=x*y=minv .)


conts:=[seq(minv+(u-1)*(maxv-minv)/(nconts+2-1),u=1..nconts+2)][2..nconts+1];

[1.600000000, 2.200000000, 2.800000000, 3.400000000]

(color1,color2):="Red","Yellow":


This turns each of those two colors into the corresponding two lists of RGB values.

temp := [ColorTools:-Color(color2)[]], [ColorTools:-Color(color1)[]];

[1.00000000, 1.00000000, 0.], [1.00000000, 0., 0.]


This generates a sequence of lists that transition linearly between the first and the second of the above RGB representations of color1 and color2. This is that standard technique, once again: generate N results on the (here, 3-dimensional) line between c1 and c2 inclusive.

((c1,c2,N)->[seq(c1+(u-1)*(c2-c1)/(N-1),u=1..N)])(temp, nops(conts));

[[1.00000000, 1.00000000, 0.], [1.00000000, .6666666667, 0.], [1.00000000, .3333333333, 0.], [1.00000000, 0., 0.]]

Download some_expl.mw

I have deleted a duplicate of this.

Submitting a duplicate of this item is not justified by the fact that the OP is not satisfied by the amount of response here.

If the OP doesn't care for the title used here, then it can be edited.

Additional details can be added in Replies, or edits to the Question body.

If you uploaded a worksheet with an instance of your "unable to parse" problem then we might be able to pinpoint the cause.

You should tell us which input mode you're using, ie. 1D Maple Notation (plaintext), or 2D Input (typeset math).

But a concrete example of the syntax problem would be best.

@Ali Guzel  It appears that the OP is interested in multivariate systems, for which fsolve does not currently have support of a maxsols option.

@Carl Love I think that there is a bug in the special case of using legend alongside filledregions in contourplot, with anything but the default number of 8 contours.

But it's not that complicated to combine a sequence of implicitplots instead.

Something like this, perhaps, assuming my color bookkeeping is right,

Dynamisches_Modell_Final_filled_impls.mw

I suggest you double check that I got matching colors there. I rushed it. Adjust as needed.

Which version of Maple do you use?

@vv I don't deny a problem in the symbolic summation here. But that route is unnecessary all the same.

Even if the symbolic summation worked (and produced some valid representation in terms of the unspecified symbolic name k) then I'd still recommend the direct addition for this particular example.

Here's an alternate that looks more like your followup image. Also in Maple 17.02.

restart;

kernelopts(version);

`Maple 17.02, X86 64 LINUX, Sep 5 2013, Build ID 872941`

(1)

#x:=[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4]:

#y:=[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]:

z:=[0, 0, 0, 0, 0,
    0, .689376362, 1.378752724, 2.068129087, 2.757505449,
    0, 1.02920355, 2.0584071, 3.087610649, 4.116814199,
    0, 1.216469264, 2.432938529, 3.649407793, 4.865877057,
    0, 1.325720912, 2.651441823, 3.977162735, 5.302883646]:

interfunc:=subs(__M=Matrix(Matrix(5,5,z),datatype=float[8]),
                (x,y)->CurveFitting:-ArrayInterpolation([[0,1,2,3,4],
                                                         [0,1,2,3,4]],
                                                   __M,[[x],[y]],
                                                   method=cubic)[1,1]):

newz:=CurveFitting:-ArrayInterpolation([[0,1,2,3,4],[0,1,2,3,4]],
                                       Matrix(5,5,z),
                                       [[seq(0+(4-0)*(i-1)/(50-1),i=1..50)],
                                        [seq(0+(4-0)*(i-1)/(50-1),i=1..50)]],
                                                   method=cubic):

(nminz,nmaxz):=(min,max)(newz):

C:=0.666*(1-ImageTools:-FitIntensity(newz)):

PC:=PLOT(GRID(0..4,0..4,newz,COLOR(HUE,C)),STYLE(PATCHNOGRID)):

numcontours:=9:

(P->op(0,P)(op(P),
            ROOT(BOUNDS_X(0),BOUNDS_Y(0),
            BOUNDS_WIDTH(600),BOUNDS_HEIGHT(500))))(plots:-display(PC,
               plots:-contourplot(interfunc,0..4,0..4,thickness=0,
                                  contours=[seq(nminz
                                                +(nmaxz-nminz)*(i-1)/(numcontours+2-1),
                                                i=1..numcontours+2)]),
               seq(plot(z[1],nminz..nminz,
                        thickness=15,color=COLOR(HUE,0.666*(1-(i)/(numcontours+1))),
                        legend=sprintf(" %.3f",
                                       nminz+(nmaxz-nminz)*(i)/(numcontours+1))),
                   i=numcontours+1..0,-1),
               legendstyle=[location=right,font=[Helvetica,14]],
               font=[Helvetica,16],
               labelfont=[Helvetica,bold,16],
               labels=[eta,"X"],labeldirections=[horizontal,vertical]));

 

Download listcontdens2_M17.mw

@asaa Your Question's title has it as "xmaple 2020.2" but the body of your Question has it as "xmaple 2021.1". Which is it?

Maple comes bundled with a JRE, so why (and how) are you not using that? For Maple 2021.2 on Linux it is (IIRC) openjdk version "17" 2021-09-14 (build 17+35).

@jalal Explain how you want it animated. Provide that here.

Please don't submit a separate Question thread for this.

If this Post is supposed to serve as an example of good practice then the first example (A) would be better -- and also far more clear -- as,

restart;
with(ScientificConstants):

GetValue(Constant(g));

                       9.80665

instead of its current (and muddled) form, ie.

restart;
with(ScientificConstants):

ScientificConstants:-GetValue(Constant(g))

                       9.80665

Also, the Help page with Topic UsingPackages could be improved in several ways. It's an important usage page for new users, and ought to be a paragon of lucidity and helpfulness.

- It should utilize the colon-dash syntax, eg. P:-E, and not the square-bracketed, indexed syntax, P[E], in its early examples. The latter form is inferior because it can sometimes need the extra safety of having the index-name to be uneval-quoted like P['E'] (as mentioned later in that very page!). In fact the indexed form can sometimes need to be P[':-E'], which appears silly since P:-E is safer and simpler.

It's not helpful or sensible for that Help page to first describe examples using the inferior P[E] form, and only in a later paragraph mention that the P:-E form is more recommended.

The indexed form like P[E] should only appear in a very late paragraph on that Help page, on account of there being a relatively small number of old packages not converted to work with the recommended colon-dash P:-E form.

- That Help page is too verbose and abstract. A few sensible, concrete (actual) examples would be better and more understandable that all that abstract talk of some PackageName. New users shouldn't have to decode all that, including the abstract PackageName['command'](arguments).

- After the basic examples of short and long form have been demonstrated with nice clean, clear, and concrete examples then a couple of examples of the (underdocumented!) uses and use syntax would be relevant and completely apropos. For example,

restart;
use ScientificConstants in
  GetValue(Constant(g));
end use;
                    9.80665

restart;
G := proc()
  uses ScientificConstants;
  GetValue(Constant(g));
end proc:

G();
                    9.80665

And, to be helpful to the programmer:

restart;
use SC=ScientificConstants in
  SC:-GetValue(SC:-Constant(g));
end use;
                    9.80665

restart;
F := proc()
  uses SC=ScientificConstants;
  SC:-GetValue(SC:-Constant(g));
end proc:

F();
                    9.80665
First 104 105 106 107 108 109 110 Last Page 106 of 591