acer

32333 Reputation

29 Badges

19 years, 318 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Frankoldstudent The value assigned to `a` does also change when you move the slider. That's one of the two things that my example does.

If you re-execute the line that (previously) printed a prior value of `a` then it should reflect that last attained position of the slider -- when it subsequently prints the current value.

But the previously printed output of that same input line is static output, in the sense that it won't change unless you also re-execute that separate input line (or delete the output).

That's why I also included a textarea component, to illustrate how the running values of the slider may be used to dynamically update other embedded components.

The action-code of embedded components may also alter the appearance of other embedded components (Text Area Component, Math Expression Component, etc). But action-code of embedded components don't alter regular output that has been printed already to the worksheet.

That is also related to why I mentioned that the action-code of the slider may pass the running slider value to some other command (eg. a procedure that you have written yourself, or another stock command).

@Marvin Ray Burns Please do not repost reformulations of your results here, in a separate Post.

Could you lprint it, in Maple, and the copy that?

Hello Andreas, was this posting in another forum by you, or by someone else? Thanks.

It might be useful if you could mention your OS platform, whether this happens in a fresh session, whether it is using a 1D plaintext command or a context-menu action on 2D input or output, and whether you have any special Maple commands in personal initialization file.

@mmcdara I think the scenario you describe is esoteric and unlikely to represent this case.

If the Questioner merely wants the intersecting dashed lines using values 0.5, 1.0, 1.5 for `t` then a straightforward, usual, easy and accurate way to find the corresponding intersection points is to simply evaluate at those values (using whatever made tha smooth plot).

There is, as yet, no evidence that your esoteric scenario applies here. If a formula or function/operator for the curve is available (very common, no evidence yet to the contrary) then using a copied point-probe is relatively poor. It would fail to provide instruction in common and reusable Maple usage skills.

The dashed lines get produced and added programmatically, regardless.

Why can't you simply evaluate at the given numeric values for t?

Show us how you produced the plot, and we can show you how to do that.

That would be more accurate and far less error prone than using crude mouse-pointer position.

You can upload and attach a worksheet using the green up-arrow in the Mapleprimes editor.

What is your reason for not explicitly telling us what it is that you do need?

@vs140580 For 2D plots you can pass the option,

   legendstyle=[location=right]

etc, to the plotting command or to the plots:-display command for your case of a merged point-plot and a curve-plot.

For the 3D case there is no direct facility to place a caption (or title) on either side, and legends aren't available. I can, however, think of a few ways to mimic the effect. One way is to use a textplot, placed carefully according to a fixed orientation (without further manual rotations). Another is to use Tabulate to place a close 2D plot containing only the legend (although that cannot then be exported as a single image).

But I am not going to do either of those unless you state explicitly and believably what is your final goal. You have made ten (!) followup Replies in this thread, many of them revisions or augmentations of your goal. I don't believe that your latest Reply was your final goal.

@vs140580 The following behaves for me in Maple 2020.2. The color symbols also survive export of the plot to an image file.

The attachment shows how the caption can be stacked (multi-line), or a single space line (seen below).

regr_3d2d_4.mw

 

Note: The techniques from this old Post don't work completely properly in my Maple 2020.2, since when I right-click on the plots to export the symbols in the plot (not the caption!) vanish. The above attachment has a tweak to the approach which fixes that (for me, at least).

@vs140580 

Uncomment the legend for the fitted curve, if you want.

F2d:=Statistics:-LinearFit(a*x, pts[..,[1,2]], x):
plots:-display(
  plot(pts[..,[1,2]],
       style=point, color=red,
       legend="my data points",
       symbol=solidbox, symbolsize=15),
  plot(F2d,
       x=min(pts[..,1])..max(pts[..,1])
#      , legend="fitted curve"
       ),
  labels=[x,y], axes=box);

I believe that you could figure this out after reading the Help pages on the links I included.

@vs140580 You can specify the used symbol, and its symbolsize, and its color. (If you look at the linked Help page I gave before you would see all these options described.)

F2d:=Statistics:-LinearFit(a*x, pts[..,[1,2]], x):
plots:-display(
  plot(pts[..,[1,2]],
       style=point, color=red,
       symbol=solidbox, symbolsize=15),
  plot(F2d,
       x=min(pts[..,1])..max(pts[..,1])),
  labels=[x,y], axes=box);

I don't understand what you mean by having a legend for such points. What would it show!?

For fun, as an alternative to regression in 3D is to interpolate. (The fitted curve from the previous regression doesn't pass through the points exactly, although the plane surface is optimized to reduce the error. The following interpolated curve passes through the data points.)

Ip := Interpolation:-RadialBasisFunctionInterpolation(pts[..,1..2],pts[..,3]):
plots:-display(
  plots:-pointplot3d(pts,color=red,symbol=solidsphere,symbolsize=12),
  plot3d(Ip(x,y),
       x=min(pts[..,1])..max(pts[..,1]),
       y=min(pts[..,2])..max(pts[..,2]),
       color=gray),
  tickmarks=[4,4,3], size=[600,600],
  labels=[x,y,""], lightmodel=none, axes=box);

regr_3d2d_2.mw

@vs140580 You can adjust the overall plot size using the size option, and one way to adjust the tickmarks is to use the tickmarks option.

For example, using that data in pts,

plots:-display(
  plots:-pointplot3d(pts,color=red,symbol=solidsphere,symbolsize=12),
  plot3d(F3d,
       x=min(pts[..,1])..max(pts[..,1]),
       y=min(pts[..,2])..max(pts[..,2]),
       color=gray,style=surface,transparency=0.1),
  tickmarks=[4,4,3],
  labels=[x,y,""], lightmodel=none, axes=box, size=[600,600]);

And using your latest Reply's data, that same command produces this:

I believe that you could figure this out after reading the Help pages on the links I included.

Below I asked you whether you are trying to perform regression on this data. Are you?

Please don't post that as a separate Question thread. Duplicates get flagged as such and may be deleted.

@vs140580 Your goals are unclear. Is there a reason why you cannot state exactly what you are trying to accomplish!?

pts:= Matrix([[19.8,12, 1.62],[24.7,14, 1.2],
                   [26, 16, 1.25],[35.1,20, 0.84],
                   [37.8,20.83,0.74],[10.8,9, 3.98],
                   [16.1,12, 2.46],[38.3,18, 0.52],
                   [24.5,16, 1.42],[15.8,11, 2.35],
                   [28.2,17.8, 1.19],[56.8,27, 0.37],
                   [25.4,17, 1.34],[29.3,18.1,1.12]]):

I don't see how the formula f that you gave relates to the given data points. Are you trying to plot them together?

f := 72.7*x-24.5*y:
plots:-display(
  plot(pts[..,[1,2]],style=point),
  plot([solve(f,y)],
       x=min(pts[..,1])..max(pts[..,1])),
  labels=[x,y], axes=box);

Was your formula for f just an example? Are you trying to do (linear) regression/curvefitting of the x-y points in your data, ie. regression using the first two columns?

F:=Statistics:-LinearFit(a*x, pts[..,[1,2]], x);

plots:-display(
  plot(pts[..,[1,2]],style=point),
  plot(F,
       x=min(pts[..,1])..max(pts[..,1])),
  labels=[x,y], axes=box);

@mmcdara I suspect that the line with,

    if dnew < 5 then  return i 

is there to find the (first, if any) existing point that is within sqrt(5) distance from the clicked point.That would contrast with your approach to accept always the closest existing point, regardless.

And since a table is a mutable data structure you can add/remove from it with less garbage production. Augmenting a list (or subsop'ing with NULL) creates a new list each time, and the old list becomes collectible garbage. Just my guess, as to motive. As you suggest, with a very small number of points such considerations might have small impact. (...and a collectible/transient structure might be needed for sending to the plot command, anyway.)

First 129 130 131 132 133 134 135 Last Page 131 of 591