acer

32333 Reputation

29 Badges

19 years, 321 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@mthkvv There are also a few ideas for a programmatically generated a "Progress Bar" in this example worksheet:

   examples/ProgrammaticContentGeneration

@janhardo Yes, see the very first approach I took in the very first Answer I gave to one of your long sequence of queries. I really tried to get you to consider alternatives, and I even compared: using an Array and not. You seemed to ignore it, continuing on only with unnecessary Array clutter, in the many followups since then.

@janhardo In part ii) there is the possibility that for any of the given x-values the curve could intersect in more than one place. So I used a list and then seq to accomodate that possibility.

There won't always, necessarily, be multiple solutions for a given x-value. But there might be, for curves and ranges in general. Perhaps none of the 10 examples 7(a) to 7(j) require it. As I mentioned, I didn't compute them all.

If it looks awkward then I'd say that was because it is shoehorned into the books overall awkward use of Arrays to store temprary results.

In part i) you do not need to use all that code. I mentioned that before. You could, instead, examine the plots and estimate the ranges for fsolve individually. The book said to use fsolve for this. You don't have to try and write a compehensive root-finding approach using fsolve without any ad hoc example specific assistance. Take it or leave it.

I also wrote before that there are easier alternative ways, and I gave two of them. I showed this way, before,

 

For part i)

 

restart;

H := (x,y) -> x^2*y + x^3 + x*y^3 + y + 1:

PH := plots:-implicitplot(H, -4..2, -4..5, rangeasview):

sols := map(r->eval([x,y],r),
            evalf([solve({H(x,y)=0, x^2+y^2=1, x>=-4, x<=2, y>=-4, y<=5})]));

[[0., -1.], [-.602324011, -.7982517055], [.690623864, -.7232141305], [-1., 0.]]

# sols := map(r->eval([x,y],r), RootFinding:-Isolate([H(x,y), x^2+y^2-1], [x,y]));

plots:-display(PH, plottools:-circle([0,0], 1),
               plots:-pointplot(sols, color=blue, symbol=solidcircle));

 

Download ex_set_2_task_7_acc_part_i_short.mw

@janhardo It's interesting that you find the PlotBuilder a convenient way to construct some plotting commands. (I've heard someone else suggest that.)

When you toggle on the "show command" in the PlotBuilder it reveals the command to produce the same plot. But it doesn't include most option values that match defaults -- because otherwise almost all produced commands would look very long and awkward indeed.

So, if you change the grid option choice to, say, [27,27] then that is shown in the text version of the command call. But the [26,26] default is not shown.

There is no way to force the PlotBuilder to show the default being used for every option, in the shown text plotting call. I think that it's difficult to make such an environment work in all the different ways that everyone might imagine -- as well as make it simple and easy to use.

note. The described behaviour of the PlotBuilder also ignores any changes to "defaults" made with the plots:-setoptions command. (I'm just being more complete in description here. I don't want to distract you with a flood of details.)

@nm  Perhaps I misunderstood your question. If I have made a mistake here then I apologize to you for it.

I make mistakes now and then, like anyone else. Perhaps you could see your way to weighing the considerable efforts people make in helping you against their mistakes.

 

It duplicates your query in an earlier Question thread. It is very unproductive to split the thread, for both readers and responders. You didn't even bother to put in cross-reference links or use the Branch facility.

@nm You are mistaken; it duplicates your query here about how to make type-checking occur globally.

You didn't even bother to Branch it off (there's a separate Button for that, which you ignore). You didn't even bother to cite to earlier query here. It is very unproductive -- nobody reading either thread will know that the other exists.

I now regret mentioning objects and trying to describe a mechanism that would provide the kind of global type-checking after which you queried, if you cannot be at all gracious.

@nm If you used an object for your structure the you would get a typecheck "for free".

You can also use a Record within an object, for organized storage.

And the object's constructor could enforce the correctness of the initially stored values. 

You can also give the object some handy static methods (perhaps from some other commands in your package).

ps. I don't see why you had to duplicate your query about how to set up your type-checking as two additional, highly related, but unlinked Questions. Splitting the information isn't helpful. You could at least have put in cross-reference links, or used the Branch facility. I have deleted one of them  which duplicated your global typechecking queries.

@janhardo Thank you, I already know all about the PlotBuilder.

The documented default grid option value for implicitplot is [26,26] in Maple 2020. So if you supply it as [25,25] then you are already forcing a coarser starting resolution than is the documented default. In addition, what Carl wrote above about implicitplot and grid is not the whole story. The implicitplot command uses the grid option's value as a starting grid, but by default it does several kinds of further refinement -- which affects the effective resolution. See the Help page.

I reiterate some of my previous Comment's remarks: there is no need to adjust the options unless the curve looks coarse or incomplete, and no set of options will make every curve look best.

ps. It might be just a language and understanding issue, but it seems to me that you are resistant to believing quite of bit of what I offer as advice and commentary. I think that perhaps it's best that I sign off here.

@janhardo There is little point in supplying additional options (gridrefine, etc)  to the implicitplot command in the case that the default option values make the curve appear smooth and complete.

There are no setting for the options which will make all possible curves look best.

I did not try all the nine or so examples in your question 7.

If things don't look ok then I usually start by throwing in gridrefine=2, and fiddle from there. It varies.

I'll note that the default behavior of implicitplot has improved, over the years. In Maple 16.02 (2013) the following example renders quite raggedly, though it can be improved with option gridrefine=2, say. But in Maple 2020.0 it looks quite smooth with defaults.
   plots:-implicitplot(x^2*y+x^3+x*y^3+y+1,x=-4..2,y=-4..5);
And your book was written for what, Maple 7 or Maple 8? I expect that quite a bit more fiddling with options might have been required in those old versions, for some of the nine examples.
 

@janhardo You wrote, "But this grid area is wherein the implicit curve must be plotted."

And that's what the attachment in my Answer does, for part i).  I had already adjusted it, to match [ -4,2]x[-4,5].

@Carl Love You've written that [-4, 2] X [-4, 5] means x= -4..4, y= -4..5. But I suspect you meant x= -4..2, y= -4..5.

@janhardo I've changed the range in the attachment in my Answer, to use the range x=-4..2 and y=-4..5 for part i).

I also showed that it's easier to get the intersections of the example's bivariate polynomials with the equation of the unit circle using the solve or RootFinding:-Isolate commands. See the updated attachment in the Answer.

@janhardo The attachment looks at 7 ii) and i).

If you want to use x=-4..2 and y=-4..5 instead in part 7 i)  then you can just edit the ranges.

You can edit any of it, as you choose or to investigate.

@mmcdara If I were to put the row labels on the right then I'd prefer to shade the right-most column differently instead of the left-most column. (I suspect that was just an oversight or a typo on your part.)

Also fun is making use of the color names, eg.,

restart;

S := Matrix([[0,9,8,0,7],[3,5,6,5,1],[1,0,0,3,2]]):
RowNames := Vector(3, ["small","medium","large"]):
ColNames := Vector[row](6, ["Rose","Teal","Plum","Sand","Peach",""]):

DocumentTools:-Tabulate(<ColNames,<S|RowNames>>,
      color=((T,i,j)->`if`(i=1 or j=6, "0000FF", "#000000")),
      fillcolor=((T,i,j)->`if`(i=1 or j=6, "HTML NavajoWhite", white)),
      widthmode=pixels, width=400):

 

 

Ctab := table(["Rose"="Spring Rose","Teal"="Teal","Plum"="Plum",
               "Sand"="Wheat","Peach"="Orange"]):
DocumentTools:-Tabulate(<ColNames,<S|RowNames>>,
  color=((T,i,j)->`if`(j=6, "0000FF",
                  `if`(i=1,
                       `if`(Luma(ColorTools:-Color(Ctab[ColNames[j]]))>0.5,
                            "000000","FFFFFF"), "000000"))),
      fillcolor=((T,i,j)->`if`(i=1 and j<6, Ctab[ColNames[j]], white)),
      widthmode=pixels, width=400):

 

 

 

Tab_fill.mw

First 173 174 175 176 177 178 179 Last Page 175 of 591