acer

18245 Reputation

29 Badges

14 years, 243 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@sunit If you are going to manipulate integrals (including doing numeric integration) in Maple then I suggest that you read some relevant Help pages.

The capitalized Int represents an inert representation of the integral, so that you can manipulate it (eg, create it, then substitute values for parameters, then compute numerically, etc).

If you use the lowercase int command then when you create it, and each time you substitute parameter values or manipulate it, Maple will repeatedly try and do the symbolic integration. That's just an expensive waste of time here. Using floating-point integration ranges can make that even worse.

In contrast, the following is simple and very quick. It is otherwise close to your original in the sense that it too first creates the integrals, then substitutes for parameters, and then computes numerically. You can keep that flow and still attain the result. (Ie. You don't have to assign numeric values to the parameters up front, which someone else showed in an Answer.)

I use default Digits here, to demonstrate that you don't have to raise working precision to avoid the numeric difficulties. (But you could set Digits:=100 if you really want the longer result.)

restart

Digits := 10

10

y1 := C1[1, 1]*sin(alpha*x)+C1[1, 2]*cos(alpha*x)+C1[1, 3]*sinh(beta*x)+C1[1, 4]*cosh(beta*x)

C1[1, 1]*sin(alpha*x)+C1[1, 2]*cos(alpha*x)+C1[1, 3]*sinh(beta*x)+C1[1, 4]*cosh(beta*x)

y2 := C1[2, 1]*sin(alpha*x)+C1[2, 2]*cos(alpha*x)+C1[2, 3]*sinh(beta*x)+C1[2, 4]*cosh(beta*x)

C1[2, 1]*sin(alpha*x)+C1[2, 2]*cos(alpha*x)+C1[2, 3]*sinh(beta*x)+C1[2, 4]*cosh(beta*x)

fun1 := Int(y1^4, x = 0 .. 5*(1/100))+Int(y2^4, x = 5*(1/100) .. 1);

Int((C1[1, 1]*sin(alpha*x)+C1[1, 2]*cos(alpha*x)+C1[1, 3]*sinh(beta*x)+C1[1, 4]*cosh(beta*x))^4, x = 0 .. 1/20)+Int((C1[2, 1]*sin(alpha*x)+C1[2, 2]*cos(alpha*x)+C1[2, 3]*sinh(beta*x)+C1[2, 4]*cosh(beta*x))^4, x = 1/20 .. 1)

val_fun1 := evalf(expand(subs(alpha = 3.093676148361444, beta = 1.136458914000455*10^2, C1[1, 1] = 1.000000000000000, C1[1, 2] = 0, C1[1, 3] = -0.22069165109e-4, C1[1, 4] = 0, C1[2, 1] = .764799945371359, C1[2, 2] = 0.36674613077895e-1, C1[2, 3] = .95132568684786, C1[2, 4] = -.95132568684786, convert(fun1, exp))))

.1308832004

NULL

Download question_ac_2.mw

@emendes The option bytesused for the kernelopts command refers to how much memory has been processed by the garbage-collector. It does not refer to how much memory the Maple kernel has currently taken from the operating system, so it is unrelated to how much RAM your machine has.

The option bytesalloc for the kernelopts command refers to a snaphot value of how much memory has been allocated by the Maple kernel from the operating system. The running value of this does relate to how much memory your machine has.

The CodeTools:-Usage command displays differences, for each of bytesused and bytesalloc, from beginning to end of the computation. The difference in bytesused is an estimate of how much memory has been processed by the garbage collector over the given computation. The difference in bytesalloc is a difference in OS memory allocation, but can be tricky to interpret because (as of several Maple versions ago) the garbage collector can now free some significant amount of memory back to the operating system.

None of these values will tell you the greatest memory allocation over the course of a particular computation. That is, none will inform you of whether your operating system had to start using swap memory.

Examples: A computation that involves no garbage collection, a large memory allocation, and a long time duration could incur almost zero bytesused or difference thereof. A computation with a small memory footprint (allocation) at any particular moment, a long time duration, and which burns through creation/disposal of much structures could have a high bytesused or difference thereof. (Hence, bytesused tells you little to nothing about how much OS memory had to be allocated, or how big your computation ever gets.)

@vv I sent a message to one of the developers who manages int, and he replied that he was already looking at it.

@HuanLuong You also have several options for coloring. You could also interpolate the data (either within surfdata, or outside that using ArrayInterpolation).

Some examples,

restart;

M := ExcelTools:-Import("PlotTest.xlsx"):

(a,b,c,d) := M[1,2],M[1,-1],M[2,1],M[-1,1];

.5, 1.5, 1.25, 3.0

data := M[2..,2..]:

C := ["LightBlue","Orange","Grey","Yellow","Blue"]:
L := ((lo,hi)->seq(lo..hi,(hi-lo)/(nops(C))))(min(data),max(data)):
V := [-infinity..L[1]=C[1],
      seq(L[i]..L[i+1]=C[i], i=1..nops(C)),
      L[-1]..infinity=C[-1]]:

 

plots:-surfdata(data, a..b, c..d, source=regular,
                gridsize=[300,300],
                style=surface, glossiness=0.0,
                colorscheme=["valuesplit",V]);

plots:-surfdata(data, a..b, c..d, source=regular,
                gridsize=[300,300], interpolation=[method=cubic],
                style=surface, glossiness=0.0,
                colorscheme=["valuesplit",V]);

plots:-surfdata(data, a..b, c..d, source=regular,
                gridsize=[300,300],
                style=surface, glossiness=0.0,
                colorscheme=["zgradient",[C[1],C[],C[-1]]]);

plots:-surfdata(data, a..b, c..d, source=regular,
                gridsize=[300,300], interpolation=[method=cubic],
                style=surface, glossiness=0.0,
                colorscheme=["zgradient",[C[1],C[],C[-1]]]);

 

Download surfexample2.mw

The popup interface shown by LibraryTools:-Browse() is written in Maplets and is not that complicated. It should be possible to modify it for your goal.

For example, a filter on results (eg. modules/procedures/all etc) might be helpful. And its current Edit/View functionality could be utilized, but not all the rest. And its first argument might be accepted as a specific archive (eg. maple.mla) rather than a directory.

@Carl Love I may have not been clear, sorry. Sometimes it would be nice to control all nested if...then indenting irrespective of line-width.

ps.I'd like something for modules too, as alternative to convert(...,string), though it could get tricky.

Please stop submitting duplicates of this theme, where your numeric integrals have difficulty computing. Put you close follow examples here (or in one of your other duplicates of this theme) instead of in a separate thread.

Please stop submitting duplicates of this theme, where your numeric integrals have difficulty computing. Put you close follow examples here (or in one of your other duplicates of this theme) instead of in a separate thread.

Please stop submitting duplicates of this theme, where your numeric integrals have difficulty computing. Put you close follow examples here (or in one of your other duplicates of this theme) instead of in a separate thread.

@nm That is interesting.

If your actual goal is to include this in LaTeX then why do you go -> .ps -> .pdf ?

@nm I originally thought that you were interested in exporting the whole worksheet, and that your main question here was about the lack of alignment and good behaviour in the GUI Table -- which is why I suggested Tabulate.

I've never seen good behavior of exporting arrays of plots only (ie. stand-alone from the parent worksheet), whether displays using plots:-display or another mechanism.

I know that you do a lot of scripting work. If it were me, I'd script the export (and LaTeX buildup) using programmatically exported, individual plots. I don't think that you're going to get great success (easily, or perhaps at all) by trying to deal with exporting arrays of plots by themselves.

@user-JG The idea is just to put your polynomials into a Matrix.

You can create a Matrix(m,n) of m rows and n columns. Then assign yout polynomials to the entries of M. Then call  Lat(M) as a command. The result would be LaTeX for an m-by-n table.

@Aguiar I did not suggest wrapping the SetProperty call with a print call. My attachment did not have that.

It is the print call (whose argument will be NULL, which is what SetProperty returns) that is causing those blank lines.

Simply remove that print call, ie.
  DocumentTools:-SetProperty("Plot0", value, plot([VAR1], x = 0 .. vmax, gridlines));

That is what was in my attachment with the embedded Plot Component.

Out of interest, does your Comment's first sentence confirm that your Maple version is actually Maple 18?

@emendes Yes, that was my point. Which is why the explanation of the removal action (as described) did not make sense to me. It seemed to rely on the initial ordering of abc.
[edit] Perhaps that is intended. If that is the whole point then I simply misunderstood.

@emendes So, are you trying to remove the image of the conds mapping from abc? if so then it seems like a problem to be trying to do it inplace, entry by entry, because earlier removals will cause items in the image to be overlooked. But perhaps something(?) like the list version of this, for abc as a list:

   abc minus conds~(abc)

I may be miunderstanding. I am also confused by the parts of the given example.

2 3 4 5 6 7 8 Last Page 4 of 414