## 1561 Reputation

12 years, 285 days

## MaplePrimes Activity

### These are answers submitted by Mac Dude

Maple has the ability to insert spreadsheet-like frames into a (standard-) worksheet. Help Spread will tell you all about it. I don't have much experience with it but you can set its cells & look at the data.

If you have a long Vector or Matrix that displays only its placeholder: you can double click on the placeholder & a viewer window opens.

Mac Dude

## minimum info needed...

Ask yourself: what is the minimum info defining the object you want to draw:

A circle is defined by its radius.

Prallel lines are defined by their slope and the distance between them

So, given good enough "geometry software" these are the pieces of info necessary to draw these objects, no more, no less. An entirely different question would be: What are suitable "mechanics" to plot these: parametric, in polar coordinates, ...

My \$0.02

Mac Dude

## ?solve/details tells you what you need t...

?solve/details tells you what you need to do. Your hunch is correct: expressions get "=0" appended to make eqns. If you don't specify the variables to solve for, it'll solve for all indets (indeterminate variables), in your example for a[1] and a[2].

Help and the docs will tell you what you need to know.

Mac Dude

## Need more detail...

Well, let me try at least:

SomeRatFunc:=proc(p1::rational)
...
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 v...

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 ...

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 f...

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...

M.D.

PS: After nearly 10 min CPU I get this:

solve(subxpr2=0,i);
[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 ...

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...

Lattice module() option package;
export `.`;
...
local cumR:=LinearAlgebra:-IdentityMatrix(6),cuml:=0,element;
for element in [elements] do
cumR:=LinearAlgebra:-Multiply(cumR,element:-R):
cuml:=cuml+element:-l:
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 "."??

M.D.

## NonlinearFit...

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 ...

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
﻿