Mac Dude

1531 Reputation

17 Badges

11 years, 38 days

MaplePrimes Activity

These are answers submitted by Mac Dude

Well, let me try at least:

end proc;

will only accept a rational expression (or an integer) as argument. Lookup "type" in the help facility in Maple to get a list of types known to Maple. You can also add your own types.

How's that for domain specification?

Be aware that by default Maple wiorks in the complex domain. This can affect the results one gets.

As for range: I usually let it run against an error... :-)

But, as I said, we really need to know more details about what it is you want to accomplish.

Mac Dude

I have had problems like this when the variables I used in the plot stmt were assigned some values beforehand. If your error persists even right after a restart (which it seems to) then you must check you init file. Also, in the sidebar you can see what is assigned to your variables/names so it is worth checking there.

Next to try: use a different variable than "x". Use "3.14159..." instead of "Pi".

Mac Dude

Well, I rea it depends entirely on what you want to do.

Matlab originated as a wrapper around linear-algebra routines (i.e. matrix multiplications, solving of linear equation sets and the like). You may look at it as a high-level programming language optimized for linear-algebra kind of work. If you work with large datasets that are or can be arranged as matrices or vectors & you need to process them; Matlab will likely do the job and do it reasonably efficiently. Matlab is primarily for work with numbers; although it may have acquired some symbolic capabilities in its later versions.

Maple originated as a CAS (computer algebra systen). As such it is geared towards analytic work, solving formulae, calculus & linear algebra with expressions. It has acquired a certain amount of numerical capabilities but is not necessarily optimized for numerical work.

Both systems have the ability to plot data in 2-d and 3-d. Both support building GUIs for your routines.

Roughly spoken, if you want to crunch numbers; Matlab will likely be more efficient than Maple. If you want to do analytic work; Maple is the tool of choice. I believe Maple may be a bit more universal than Matlab so if you don't yet know what your main use will be like; Maple may be a more flexible way to go.

Mac Dude

Not a solution, but when you bring the first equation into normal form you find that it is a 3rd-order polynomial in "i" divided by some simpler stuff. Trying to find the root for this numerator (the 3rd-order polynomial), my version of Maple (15) has a hard time... and by inspection it is clear that the situation wrt. "c" is no better. I have not used Maple's facility for solving such polynomials; in principle, 3rd-order polynomials do have solutions. A possible way out may be to replace all the coefficients of the powers of "i" with simple variables; solve that system & back-substitute. Do the same with "c" and see if you can get rid of the cross terms (the "i" in the solution for "c" and vice versa). BTW, there may be complex solutions.

At any rate, faced with expressions like this Maple usually needs some help and guidance, which is to say that you want to break-down the problem into manageable chunks. In doing so you will find where it has difficulties. The CAS that eliminates the need for our thinking has yet to be developed...


PS: After nearly 10 min CPU I get this:

          [Length of output exceeds limit of 1000000]

where subxpr2 is the numerator of the normal form of your first equation.

Ok, this is embarrassing... I have just loaded the worksheet again to extract the essential pieces of code for posting... when I had to realize that it now works! Go figure; I already have seen that "restart;" not always sets everything back, so I now suspect that my first attempt somehow hung around & was intercepting the function calls...

A reply to pagan's comment about export and overload: What I am doing is this:

Lattice module() option package;
export `.`;
`.`:=proc(elements::seq(Element)) option overload:
local cumR:=LinearAlgebra:-IdentityMatrix(6),cuml:=0,element;
for element in [elements] do
end do;
return Record(l=cuml,R=cumR);
end proc;
end module;

where I have omitted extraneous stuff. The "Element"-type entities are created with other assignments, they are records of the same structure as the record I am returning here (this record is also an Element). Am I doing something wrong in exporting and overloading "."??


Statistics[NonlinearFit] should do what you want. Use its documentation; being no real Maple expert I was able to get a fit going reasonably quickly. You will need a reasonable initial guess for your free parameters else the fit will not succeed. Your two exponential functions may be somewhat degenerate which makes fits like this unstable, but that depends entirely on your specific situation, the parameters, your data set etc.

Mac Dude

I found the answer myself. It is:

if (not test) then # have to get and set currentdir
F1:=Maplets:-Display(Maplets:-Elements:-Maplet(Maplets:-Elements:-FileDialog[F1]('fileselectionmode'='directoriesonly',title = "Select Folder",approvecaption = "Select",onapprove=Maplets:-Elements:-Shutdown(['F1']))));
end if;

Where did I find it? In the "Maple Programming Guide" that I must have downloaded when I installed Maple 15. In there, the principle of referencing into modules and submodules is described. I sort-of thought I understood that, but maybe not so well. From there it was a matter of identifying all the parts and finding where exactly they were located; which is where the online help system came in handy as it told me for each procedure where it was.

Maybe this is of help to some other poor soul, flailing about just as I am.

Mac Dude


In my (limited) experience, it helps to add the parameters "delimited" and "delimiter=..." to the ImportMatrix call. For ImportMatrix, space and tab are NOT necessarily the same... make sure you specify the correct one. Finally, ImportMatrix chokes when it hits a non-numeric character in the input stream.


Mac Dude

First 18 19 20 Page 20 of 20