acer

32822 Reputation

29 Badges

20 years, 134 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

The given examples all return 22, without emitting an error, in Maple 2018.0.

There are options which make the solver try harder.

restart;
f:=sin(3*x)-cos(7*x)+sin(17*x)+cos(20*x)-sin(67*x):

Optimization:-Maximize(f, x=0..2*Pi, method = branchandbound);
           [3.17327920314180, [x = 4.10406174848180]]
Optimization:-Minimize(f, x=0..2*Pi, method = branchandbound);
          [-4.46537362759898, [x = 1.71553210252725]]

Optimization:-Maximize(f, x=0..2*Pi, method = branchandbound, evaluationlimit=100);
           [3.40373784598076, [x = 4.94786409656254]]
Optimization:-Minimize(f, x=0..2*Pi, method = branchandbound, evaluationlimit=100);
          [-4.82606452700204, [x = 3.59004152499192]]

Of course there will always be examples which make a global optimizer miss the best extreme points. And indeed there are examples for which DirectSearch fails to find the global optima with its own defaults. However I suspect that DirectSearch is stronger in general (and with default options too).

Unfortunately the extra options for method branchandbound are listed only on the help page for NLPSolve and not on that for Maximize/Minimize.

Setting infolevel[Optimization]:=3 or higher shows information on working parameters (default or otherwise).

It seems to work ok for me in Maple 2015 (or 2017), if I use plot(sin(x)/x, legend=sinc(x))  [note minor invalid syntax correction].

By that I mean I see the legend in the examples which use the list assigned to A.

Could you please upload a Worksheet or Document that exhibits the problem?

@tomleslie First thing: ArrayTools:-Append acts in-place on its rtable argument. In the given example it is applied to the value assigned to the parameter Rx1. The parameter Rx1 (of the procedure Sort4) is not being assigned a value or being otherwise used illegally when ArrayTools:-Append acts on its assigned (rtable) value.

Second thing: round-bracket indexing into rtables (Vector, Matrix, and Array), aka "programmer indexing", was introduced in Maple 12 (released 2008). See ?updates,Maple12,programming 

The old (lowercase) matrix and array are both implemented internally using a table.

Several of the old linalg commands have early code like, say,

proc(A)
   B := evalm(A);
   ...(operations on elements of B)...

or similar. Generally the linalg commands did not offer in-place semantics. The newer uppercase Matrix and Array with dense storage are based internally on the newer rtable (ie. rectangular table, because elements are stored in a continguous rectangular block of memory to allow efficient use by external compiled routines).

Unlike a table, an rtable does not have last-name-eval. But an rtable is indeed generally passed by reference (which I suspect contradicts a claim above). No copy is made on a procedure pass because eval works differently on an rtable (hence the later need for rtable_eval).

The example with elementwise sqrt~ works on a full copy because map does so (as a special case), and not because Matrices are in general passed by value.

The reason for this handling of tables is that they are mutable and the behaviour is more generally useful than not. Eg. in-place argument passing, which is not beneficial merely for memory performance.

I recall looking at this before, where some branches of the piecewise are evaluated prematurely. IIRC it's related to stuff around showstat(`eval/piecewise`,15).

@Adam Ledger You identified three steps. Making the "pre execution" action of step 3 to be automatic is the least of the difficulties.

For steps 1 and 3 you could wrap all your commands in a call to a prodecure you write. Eg. B( intended_command_here ) . Making step 3 (or 1) automatic -- without the wrapping call -- is a finesse that could well wait until last.

For step 1 you need to measure the performance of executed commands and record the details in a way that can be analyzed in step 2. You could use commands from the CodeTools package for most of the measurement, I expect.

The central difficulties will be in step 2. The computations in general will not exhibit patterns that could be predicted statistically. You will have to severely restrict the kinds of computations to a relatively few narrow domains if there is to be a hope of successful data mining and predicition as you describe it. So far you have given no indication in this thread of any tight and narrow domain of computation. I suspect that you do not properly conceive of the enormity of what you seem to be asking more generally.

The breadth of the computational domain aside, who is going to devise the data mining of step 2 and the statistical prediction methodology of step 3? That would require programming acumen and, I expect, considerably more detail as to the computational domain.

What have you accomplished so far on this project?

This is a very ambitious project for someone (ie. you) who is not well versed in how Maple's kernel and interfaces work and interoperate.

Since I am sure that you do not yet know how to properly and generally accomplish the described goal I've changed the parent from Post to Question. (I'm trying to be pragmatic here, and I truly intend no offense.)

This would be a good time to fully describe the requirements, e.g. what will the user see as input interface (the usual, or just a single reusable container)? Where will the output go? etc.

I have two prototypes of a general purpose Maple interface involving all input and output via 3 embedded components (input, output, and plotting). The purpose is to have something that works in the maplecloud or MaplePlayer. One of them also has a dynamic menu driven interface to the right click context menus.

Hence, if you tell me what user interface you're after then I may well be able to offer advice on the hurdles I know will appear. (Eg. managing the history of input and output assignments is desirable but heavy work.)

A more basic all round effect might be attainable, while keeping the usual worksheet flow, by replacing the kernel evaluator. I've had experience with that too.

But the detailed requirements are needed from you first.

@Adam Ledger This member (under one handle or another) has been posting here since long before your handle has actively posted here.

@asa12 Upload your complete code here if you expect us to work with it.

@Lali_miani See here for a list of books on Maple.

The first one listed, by Ian Thompson, is good and very reasonably priced.

An older book by Andre Heck is also good (it may not describe all modern features, but it laid out the basic concepts quite well).

Another good (but again slightly older) book is by Doug Meade et al.

 

 

Nobody wants to re-type your Matrices from images.

Upload a worsheet that contains the actual values for the Matrices or the complete code to reproduce them.

Code that contains, say,  close3(tt+Jesus[H][1,1]+i) without any code to evaluate that to a real constant value is of no use.

I had hoped to obtain the desired output display using a function call to Typesetting:-menclose with an argument something like notation="strikethrough", alongside other Typesetting calls.

But I have not been able to get a properly rendered display, with this approach.

@Christopher2222 If you upload it zipped somewhere then I would have a go with `vi`, a very strong editor.

I'm not sure that your editing methodology would be just the same as mine, wrt output removal.

First 265 266 267 268 269 270 271 Last Page 267 of 601