acer

32490 Reputation

29 Badges

20 years, 7 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Could you upload your data here as an attachment (green up-arrow)?

@Ramakrishnan One of the problems with your original was that MyApp did not export ChangeE. So when you called ChangeE() in the code of the Sliders nothing happened.

If you are interested in using different formulas and radio buttons:  doubt2_MathContainer_ac2.mw

@Ramakrishnan You mean you're posting the same question twice? Please don't do that.

The first thing to clarify is the format of your data. It looks like the three columns denote four points of [x,y,z] data, rather than a 3x4=12 collection of [x,y] data points. Is that right?

What version of Maple are you using?

Is this a toy example, and you plan on wanting to do it for larger sets of points (possibly with surface smoothing)? Or do you just need to deal with this kind of simple 3D polygon with a quadrilateral base?

 

@dorna01 Tacking that comment onto a 9 year old message thread is not helpful. Post your example as a new Question.

Don't say that you could upload the worksheet or code later, if needed. Just include the relevant materials and details when you post.

@Carl Love I'm not aware of any mechanism by which Library code could robustly compute the display-width of rendered, 2D prettyprinted output (at 100% zoom, say).

And I have tried pretty hard to find one.

Rough approximations can be constructed, using offset values for fractions, max of numer and denom, offsets for fencing, Int/Sum/Product symbols, radicals, etc.

But really the only thing that might be true to form is the result from a new GUI streamcall. The Typesetting package is not enough.

It's  not clear to me that a rough kluge would be better than nothing. But, I agree that it would be an improvement to have the weighting be set automatically, if it could be done reliably.

There would be other, related uses for the display-width information.

 

@Carl Love Very nice, vote up.

You could get a printing effect with,

Tabulate(Table(
   [Bin(n,p), DiscrUni(a,b), Poiss(lambda), NegBin(p)],
   [Unity, Mean, Variance, Skewness, Kurtosis]
)):

Tabulate(Table(
   [Bin(n,p), DiscrUni(a,b), Poiss(lambda), NegBin(p)],
   [Unity, Mean, Variance, Skewness, Kurtosis]
), weights=[3,1,2,3,3,5]):

(I was a little disappointed that the `lambda` in the row headers isn't typeset when Tabulated, but it doesn't detract too much.)

@mmcdara There are concrete benefits which support this point of view.

The representation is sparse, and so can take less space or memory.

That can hold for line-printing. It can also hold for round trip programmatic recreation, using `rtable`, `rtable_indfns`, `rtable_elems`, and `rtable_options`.

@mmcdara Right. The creating of a temporary rtable, and its processing by the garbage collector afterwards, incurs a relatively small time penalty.

The penalty in memory allocation incurred by the extra rtable is transient, and the collected memory can even be returned to the OS now.

Memory "used" just means memory processed by the garbage collector, and its significant effect is just whatever time that takes.

But, aside from that time overhead, memory "used" is not a penalty in itself.

On a related topic, I would like to see Statistics:-Sample become thread-safe. And I'd like to be able to parallelize it. I suspect it may be assigning to module locals in the usual thread-global way (although there is special syntax available now for thread-local module locals).

@Gabriel samaila So why did you upload an attachment saved with Maple 16 before?

@Gabriel samaila The worksheet you attached was saved using Maple 16, which was released in the year 2012.

That is not the same as Maple 2016, which was released in the year 2016.

The size option for 2D plotting commands was introduced in Maple 18, released in the year 2014.

Maple 16      (2012)
Maple 17      (2013)
Maple 18      (2014)
Maple 2015  (2015)
Maple 2016  (2016)
Maple 2017  (2017)
Maple 2018  (2018)

I look forward to Maple 2019, since there was no Maple 19.

 

@Carl Love Actually, It would only be slightly faster, since Statistics:-Sample is returning a Vector with datatype=float[8].

The elementwise operation cot~ applied over a float[8] Vector uses evalhf, and is already fast.

With map[evalhf,inplace] there is small benefit in avoiding creation of new Vector, with the copy semantics of the elementwise operation.

@Haqphy12015 I don't really see how your uploaded data could make a plot that looks exactly like that image. Leaving aside the integration, did you expect the blue curve of the data itself to loo like the image? The domain of w doesn't even match.

Here's what I get from your uploaded data. Note that I don't know what you expect to happen when w becomes zero (especially given how your uploaded image doesn't show blowup). So I just fudged that case to act like w=1.

I don't see how higher order interpolation could be meaningful results for you large w increments (not to mention the division by small w).

I didn't bother to multiply the integration results by 2, which might be what you were trying to state in your question.

restart;

M := ImportMatrix(cat(kernelopts(homedir),"/mapleprimes/data-w-a2F(w).txt")):

M[1,..];

"[[["w",,,"a2F(w)"]]]"

m := op([1,1],M)-1;

200

W := M[2..,1]:
F := <seq(seq(M[j,i],i=2..4)[1],j=2..m+1)>:

A:=<W|F>;

A := Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

H := proc(N::posint)
  local i, S1, S2;
  S1:=add(F[i]/`if`(W[i]=0,1,W[i])*(W[i]-W[i-1]),i=2..N):
  S2:=add(F[i]/`if`(W[i]=0,1,W[i])*(W[i+1]-W[i]),i=1..N-1):
  (S1+S2)/2;
end proc:

Hdata := [seq([W[i],H(i)],i=1..m)]:

plots:-display(
  plot(A, color=blue),
  plot(Hdata, color=black),
  size=[500,300]
);

 

Download numint_data.mw

@Preben Alsholm Just a few observations.

numint.mw

@sand15 You have it backwards in your comment. After executing with(Tolerances) the call `+`(a,b) is a shortcut for Tolerances:-`+`(a,b) .

I'll update the attachment in my Answer, to make it more clear, with comments in the relevent lines. The points I hoped to make in my attachment were that add([a,b]) is picking up the global :-`+`, and [3,2] *~ [x,y] is picking up the global :-`*`. I was trying to illustrate this by comparison of the outputs.

As Tom mentioned elsewhere, what I would do, hitting both package exports as desired, is:
    `+`(op( zip(`*`, [3,2], [x,y]) ));

As far as "loading" multiple packages by utilizing the with command, yes, that means only the latest rebinding of any commonly named export is available by short syntax. That's just a logical consequence of the fact that a name can only be bound to one thing at a time, though, and not directly related to your original Question.

First 228 229 230 231 232 233 234 Last Page 230 of 594