acer

32368 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Alejandro Jakubi OK, though that often is not the case. Do such examples (if you have some) also affect the method of export-to-.mpl or copy & paste as plaintext?

BTW, one might also be able to copy and paste to Code Edit region or TextArea Component.

@Vesnog I don't know that the black arrow displayed by doing a context-menu action within a Document Block can be converted afterwards to an explicit command (as if it had instead been done in just an Execution Group).

@Jazen1 Why are you asking me, as if I hid your palettes? Note that I did not suggest using palettes at all.

contourplot3d has similar problems, though not always to apparent at default `view`. If the view is forcibly restricted to something similar to what contourplot produces automatically then countourplot3d can produce similar aberrations as contourplot does for the same contour values.

plots:-contourplot3d(1/(x^2+y^2), x=-1..1, y=-1..1,
                     view=[-0.25..0.25,-0.25..0.25,0..100],
                     grid=[50,50], orientation=[90,0,0]);

plots:-contourplot3d(1/(x^2+y^2), x=-1..1, y=-1..1
                     , view=[-0.25..0.25,-0.25..0.25,0..500]
                     , contours=[seq(1..301,5)]
                     #, grid=[100,100]
                     , orientation=[90,0,0]
                     );

plots:-contourplot3d(1/(x^2+y^2), x=-1..1, y=-1..1
                     , view=[-0.15..0.15,-0.15..0.15,0..700]
                     , contours=[seq(1..701,25)]
                     , orientation=[90,0,0]);

The central problem is that these methods are not adaptive, as Alejandro pointed out, and for problematic examples one may have to refine the whole mesh.

One advantage of `contourplot` over repeated calls to `implicitplot` is that the latter involves recomputing values on the initial grid for each requested contour value. Another is the filled regions. It would be nice to get an improved 2D contour plotting routine that was adaptive, re-used grid values where possible/relevant, and offered filled regions.

@Axel Vogt I was being obsessive about ensuring that the evaluations of the integrand were not done under evalhf. And under evalhf a proc that creates a list will error out.

The `forget` may not be necessary, I didn't test without it. Again, I was being obsessive. I was guarding against remember tables under evalf/Int being keyed on the name of the integrand procedure rather than its content. (I recall hitting that some other day, for some other example, possibly fundamentally different...)

I too would like such 2D contour plot labeling. 

3D color keyed levels are nice, but I'd still like better 2D. And while coloured contours may sometimes be helpful, there are still times when labeled B&W contours fit the bill (eg. some publication..).

And the example image the OP has shown illustrates an important feature, namely separate labeling of the same contour value on disconnected curves. More than one separate  curve section can share the same contour value.

It's pretty easy to postprocess the output of plots:-contour plot and add a label for each contour value. Slightly more work to remove a bit of curve section so that the label can be right on the contour but not overlaid. Harder but not impossible, to obtain "usually" decent placement. 

I'm trying out some ideas for this, and will post when done. (I have a bad cold...)

But first I'm tackling a preliminary task. Currently, each contour value produces a CURVES structure which contains a sequence of line segments that together make up the one or many curve segments the attain that value. But when there are multiple separate curve segments then all of their component line segments are jumbled up together -- out of order. I'm trying to write a decent routine to split them up, so that its easy to apply the same label to each of the distinct same-valued curve segments that merit it.

I think that more flexible colouring should also be possible.

acer

@Bendesarts If `solve` returned a sequence of solutions then put those into a list before calling `remove`. Ie,

remove(has, [sol], I);

@dgem Ok, so how about trying the routine `findroots` I posted in reply on math.stackexhange.com? It returns numeric results, and it accepts arguments which specify a real range over which to find roots. Is there some reason you have not to try that routine?!

The other alternatives Student:-Calculus1:-Roots, RootFinding:-Analytic, and the add-on DirectSearch approach also meet your two criteria a) and b).

If you are bent on using fsolve, then you could try using it repeatedly with its `avoid`. But that's just what Student:-Calculus1:-Roots does internally. (It's not a great approach, in the presence of many roots.)

See my answer to the same question, posted last week on another forum. It contains code with two working approaches: one using Student:-Calculus1:-Roots, and the other a (faster) custom procedure.

Another approach sometimes cited for similar questions is to use the RootFinding:-Analytic command. I am a little more uncomfortable about the reliability of that approach, since using it to determine purely real roots involves either (potentially) too much work being done in a wide strip of the complex plane or (potentially) missing rootts due to using too narrow a strip. Nothing will be foolproof, however.

Have you asked the question because you do not yet see that an approximate floating-point numeric (nonexact) solution may be necessary here? Or that you do not see why supplying finite bounds on x may be necessary here?

acer

@Carl Love It might be worth noting that piecewise structure is such that the case shown by the conditional m<2+sqrt(5) is also implicitly dependent upon the negation of the two conditions above it, ie, m<>2-sqrt(5) and m>2-sqrt(5).

Hence the "middle" case is a solution under restrictions m<2+sqrt(5) and m>=2-sqrt(5). How could one best obtain some representation in which the branches are fully qualified (independently, each in full and simplified)? This could be useful in some situations, I imagine. For this example, one might go further, towards RealRange representation. Something like PiecewiseTools:-Support?!?

 

@Kitonum If that is so, then does this return something useful?

solve(x^2 - 2*(m+1)*x+m^2 - 2*m + m^2=0,{x},real,parametric=full);

Please provide some clear example of the commands that are failing for you.

acer

@bifurcationman A significant portion of fsolve is implemented as interpreted (Maple language Library) code, and as such can be viewed. In this case, (taking line numbers from Maple 18),

showstat(`fsolve/polynom`,33..34);

@Markiyan Hirnyk Yes, that's why I mentioned using the `complex` option for this example in my Answer made previously.

@Markiyan Hirnyk That's not the same polynomial as in the Question. You left off the minus sign in front of the constant term.

First 349 350 351 352 353 354 355 Last Page 351 of 592