Mac Dude

1556 Reputation

17 Badges

12 years, 217 days

MaplePrimes Activity

These are answers submitted by Mac Dude

Here is a link to dohashi's page on the subject:



Did you actually buy a license? If yes, you should have received your code by email. If no, then you need to buy one. Prices and conditions are on the Maplesoft website.



I am not entirely sure I understand what you are after, but I have written large worksheets which are essentially papers (actually, more like text-book chapters).

First, I learned the hard way not to make a sheet too long. At least in older Maple versions, sheets exceeding a few MB in size cause trouble with Maple becoming intolerably slow. So I structure thing such that I don't need excessively long sheets.

In a sheet, I use sections, but not excessively so. Maybe 3 or 4 per sheet. They can nest if desired.

I do make extensive use of equation numbers (labels) when I reference prior results. I like Maple's way of structured labels (section.subsection.eqationnumber). Maple handles the renumbering well (by and large) when I need to insert stuff at an earlier location in the sheet.

I rarely, if ever, use ":" to suppress output.

I do bundle some often-used routines in a Package. For actual work (as opposed for writing something more like a paper) I have some very large Packages that are well structured and documented and make full use of Maples object-orientation-like features (i.e. modules containing modules containing records and procs) I have found this very powerful for large programs, although less so for writing papers.

I can and do work with such sheets on a 13-inch screen esp. when on travel even if I prefer the larger screens I have @ home and @ work.

I hope this helps,


Assuming that the example is just that and blonde Katie really looks for a general way how to do similar problems in Maple, here is a possible scheme (and yes, you'd do it similar by hand).

xpr:=n+N-1; # I use an expression, not a function, since it is simpler for this example

x=n/N; # This is an equation, not an assignment (note absence of ":"). It is what Katie has given.

solve((3),N); # express the equation in terms of the variable to be replaced (I could have picked n as well). (3) is the eq. number of the previous equation.

eval(xpr,N=(4)); # eval the original expression at the given replacement for N. (4) is the result of the solve for N.

As others have observed, you cannot get rid of a variable in this case, so the n remains.

There are more compact ways to do this simple example, but I wanted to outline the steps, assuming we are talking to a Maple apprentice here...



Your syntax is wrong:

1. The assuming statement is outside of the solve; in addition you may need to have the option useassumptions in the solve call.

2. assuming does not handle compound logical relations, you need to split these. I.e

solve(F(z),z,useassumptions) assuming -0.5<m, m<0.5, 0<u, u<0.5;

By specifying option explicit in the solve call you get an explicit value for z, but it is too complicated to print here.


In some cases eval maybe what you want:



Mac Dude


You mean this:



Mac Dude


Here is a structure that may do what you want. In words:

You write a procedure that takes the guess, does its calculations and returns the updated value.
You iterate that procedure within a while loop until the process has converged. You wrap that loop in an outer loop to execute once per time slot (e.g. hour).
You have your weather data (which is input to the calculations) in an Array or in an algorithm as function of time. The outer loop picks the appropriate value.
You store the result of the calculation in another Array for later processing.

In high-level pseudo-code:

   calc updated value
end proc;

for time from beginnning to end step one_hour


while abs(newguess-oldguess) > tolerance do
end do;


end do;

You may need to make sure the while loop terminates even if convergence is not obtained. You may wrap the inner loop into another proc for structure. You can put all the procs in a module for better encapsulation.

Mac Dude

You are not saying what kind of data you have, but assuming this is not just a few numbers but things like vectors and matrices I would look at ExportMatrix and ImportMatrix. See the Help on these. They are fairly general.

If these do not do the trick for you you'll have to tell us what kind of data you are trying to shuffle around.

Mac Dude.


It seems you are trying to use Maple as a text processor. That is a bit hard to do.

I suggest you use a decent text editor to fix whatever needs fixing (e.g. you decimal commas to decimal points) using search and replace, and the use ImportMatrix to read it in. ImportMatrix lets you specify the delimiter so you don't need to change that (and by the way; a tab is given as "\t" [with the quotes]). RTFM on how to read a generic delimited file.

I believe ImportMatrix will lump multiple delimiters (e.g. spaces).

Mac Dude.

You can save the package code as a text file with extension .mpl and read it in:

read("/Applications/Math_Calc/Maple 15/Packages/Lattice/Lattice4.mpl");

The first statement in the file is

Lattice:=module() option package;

To use it, follow the read sratement with


and you are good to go.



The principle is to Fourier-transform your data into the frequency domain; multiply the spectrum (which is complex) with a chosen transfer function (which could be a step function that removes unwanted frequencies] and transform the result back. to the time domain. I usually use DiscreteTransforms:-FourierTransform and its inverse  to transform the data. Trickyness comes in because FourierTransform gives both the spectrum and its reflection about the max frequency (plot the abs of the result to see what I mean) so your transfer function has to take that into account. Another potential issue can be the offsets at the beginning and end of your data series; these can lead to artefacts. You will need to experiment.


I pre-pended your sheet with the customary restart; and then I no longer get the :-. You do not need to declare Psi as local.

In general, :- refers to the instance on the global namespace in case you have multiple namespaces. I.e. if you load a package using with(package); then the "exports" of that package (which are package:-variable) mask any normal variables, but you can access the normal variables by writing :-variable.

I hope this is clear anough.


You are printing something using a number format, but that something is not a number. Either change your format or make sure that what you are attempting to print is actually a number.

Do note that for Maple a floating point number and a rational (or an integer) number are not the same thing (and Pi is also not a floating point number). If you think that what you are trying to print has a numerical value, try wrapping evalf() around it, which will make it to be a floating point number if it can.

Hope this helps,



ArrayTools:-Size[2] should give you the size of your matrix in the 2nd dimension. So do something like


while (ArrayTools:-Size(A)[2]>i or A(1,i)=0) do


(I have not actually tried this so you need to experiment and RTFM).

Hope this helps,

Mac Dude


5 6 7 8 9 10 11 Last Page 7 of 20