Mac Dude

1561 Reputation

17 Badges

12 years, 270 days

MaplePrimes Activity


These are answers submitted by Mac Dude

It would have to be at a lower level than Maple's packages unless you want to do the byte-twiddling needed to unpack the png at the level of the Maple language, likely to be horribly slow.

In fact, Maple's image processing abilities are not strong at all compared to, e.g., "that other CAS". So even though png import seems like a useful option to have (in ImageTools), a lot more is needed to make Maple competitive in this area. It is a pity as surely one could imagine many useful tools and procedures for this in Maple.

If you really want to do this thumbnail generation in a serious way, I suggest you look into ImageMagick (steep learning curve but powerful cmd-line program) or one of the thumbnail makers that float around the net.

M.D.

restart cleans out most things but you cannot selectively exclude variables form being cleaned out.

You could presumably write a procedure that explicitly cleans out all you want to clean. It does seem  clumsy to do that, also I assume you want to start each section with a clean slate so you easier detect when you use an unassigned variable; cleaning them individually is error prone and defeats that purpose.

You said don't want to write out the vars to keep (I personally would reconsider that).

You may also want to consider sectioning your code into modules. In that way you can do most of your calculations in a local namespace that goes away after an "end module". You may need to declare all or many variables explicitly as local (which can be a pain) but at least you won't have interference between modules. As an additional bonus you can work with export and global for some more fine-grained structure. It may be more work to refactor your code initially, but if your system is large-ish and will be used and maintained in the future, it will be worth it. If it is more like a one-time deal and your code not easily modularized, I would in fact write things out.

M.D.

Are you looking for a free license for the student, or Maplesoft picking up his/her salary or a fraction thereof, or ??

At any rate, this you will need to discuss with the company. Maybe one of the Maplesoft employees reading this question can point him towards the right contact within the company?

M.D.

seq(`if`(i>0,1/i,NULL),i=0..3);

Mac Dude

If you select the plot (the animation) and select Export from the Plot menu, and chose GIF as format, the animation will run once and Maple will save the animation sequence as an animated GIF.

A peculiarity: After the sequence has run and the interface becomes responsive again, one might reasonably expect that the file has been saved. Not so! At least on slower platforms the saving may take a good time longer; evidenced by nearly 100% CPU of the Maple process. Wait until that has settle down before trying to look at the file. (I am using Mac OS X, the thing may behave differently on Windows).

Another question is what Word or Acrobat do with the file. I have never had movies play in pdf (using Acrobat, Reader or Preview). They do play in PPT. I don't know about Word.

Mac Dude

The issue here is that eq2 is a substitution. And in fact, Maple has some (stupid) issues here:

eq1:=x1*a+x2*a+x3*a+x4*a+z=0;
            eq1 := x1 a + x2 a + x3 a + x4 a + z = 0
eq2:=x1+x2+x3+x4=m;
                  eq2 := x1 + x2 + x3 + x4 = m

soln:=solve([eq1],[z])[];

so far so good, but using eq2 is not so easy. We help using collect, but still:

collect~(soln,(a));
                  [z = (-x1 - x2 - x3 - x4) a]
subs(eq2,%);
                  [z = (-x1 - x2 - x3 - x4) a]

Much easier it is done like this:

eq1a:=collect(eq1,a);
             eq1a := (x1 + x2 + x3 + x4) a + z = 0
eq1b:=subs(eq2,eq1a);
                      eq1b := m a + z = 0
solve(eq1b,z);
                              -m a

And yes, this ought to be simpler! But after a while, you get the hang of it.

Mac Dude

 

 

 

 

It appears that x was assigned a value upstream of the statements you show. Replace x by a variable you are not using in the sheet (I use xx, or xxx, or...) and it should work.

M.D.

You can use any of the bitmapped formats in the Export... item of the Plot menu to save a bitmap, or even a JPEG (ick!). Personally, I like png.  Then use an external program to create an EPSF, which will just forward the image file to the device displaying the plot.

Come to think about it; can you reduce the no. of points you are plotting? If you chose your symbol size wisely you can end up with a plot that still looks very nice but will be maybe 10 MB (if that) rather than 100.

There are PDF compressors available in Acrobat (full version) and also in Ghostscript (ps2pdf will do that). Both can be customized to a certain extent. But if there are millions of short line segments, the compression likely won't work that well.

Mac Dude.

 

A question this broad begs for a flippant answer... but I shall refrain.

So, what exactly is the error message you are getting? Did you try to activate your copy of Maple again? Did you try to reinstall? Anything else you did (e.g. did you exchange the hard disk at the same time)?

This may naturally be an issue you may have to eventually take up with Maple support. But when talking to them it may be useful to have a complete story rather than just "it does not work".

M.D.

It is a bit too open a question to answer in brief. Since this is a Maple forum, one might speculate you want to know how to use Laplace transforms in Maple. Googling for "Laplace transform in Maple" returns many applicable hits incl. some pdfs (like course materials). This ought to get you started. There is Maple help, it sort-of presumes you know what Laplace transforms are and what to use them for and shows you how to do it in Maple.

If in fact you are asking for general help re. Laplace transforms irrespective of using Maple; then you omit the reference to Maple in your Google search. Again, a good number of applicable hits appears.

In a nutshell, Laplace transforms are the generalization of Fourier transforms in to the complex domain (as far as the "ferquency" is concerned). It has different convergence behaviour and can deal with non-periodic functions. Like Fourier transforms, it can transform a differential equation into an algebraic one which can be solved and transformed back.

Now, if in fact you have access to a quaint thing called a library (found at many universities) you might be tempted to look for monographs on Laplace transforms in the library catalog.

If you have a specific problem in mind and want to solve it in Maple, state what it is you want to do and likely someone here can help you.

M.D.

Jon,

Yes, you want to use an Array, which can have any number of dimensions (up to some limit I don't know; I have only ever gone up to 3).

Technically, your "function" as stated is an "equation" to Maple and won't assign to M[n+1]. A proper Maple function definition looks different. If/when you want to assign to an element of M you need to use ":=" instead of "=".

Before you use an Array, allocate it by a statement like

M:=Array(1..m,1..n,1..o);

where m,n and o need to be numbers. If the elements of M are all numbers, add a "datatype=float" option to the declaration; this will improve efficiency of your code and also flag errors like non-evaluable expressions.

From your example, it is not clear why M needs to be an array, though, as you have only one index, i.e. a 1-dimensional Array. A Vector may be a more efficient implementation for M in that case.

You do have to worry about things like the exact time of evaluation so the index values are numbers and not unevaluated expressions. Maple's error messages for these cases are often not all that clear. In a straight for...do loop this is usually not an issue; if you use the more efficient and elegant seq() constructs things can get more complicated.

Note that, if you use lists for the parameters (like beta etc.) all of these need to have the same length else Maple will barf.

Mac Dude

A number of things are off-kilter here.

First, you actually appear to have two independent 2nd-order DE's (at least in my Maple that is what eq1 and eq2 become). You can solve these individually.

Your boundary condition x(tf)=30 is one too many and also not meaningful as tf is not given and x(t) not known before a solution has been found.

Your second initial condition ic2 uses a function MM(tf). MM is not defined. Same for NN.

You need to review what it is you want to do here. If eq1 and eq2 are indeed the ones you want, solve them individually. Define MM and NN.

Mac Dude

 

fsolve takes an option starting_values=list (or starting_values=set) that allows you to specify starting values for the iterative root finding. If your conditions vary not too much between calls, using the previous solution as starting_values may speed up fsolve qute a bit. Worth experimenting with, even though the seq() construct you are using does not make this easy and you may want to unroll the seq into a "for" loop until you have verified this actually helps .

M.D.

First, put the jvmheaplimit to 1GB. should be enough unless your graphics gets too complicated.

Then, put the stacklimit back, or maybe twice its original value. Unlikely you'll need such a huge stack (which may steal memory from the heap).

You already increased the datalimit.Verify it sticks.

Check whether your operating system allows larger processes. Maple can't exceed an op sys limit.

M.D.

Allright, get rid of the header line and save your data as plain text file (not .doc, but .txt). The file is a tab-delimited file.

Then, in Maple, you do:

data:=ImportMatrix("data.txt",source=delimited,delimiter="\t");
                        [ 79 x 2 Matrix        ]
                        [ Data Type: anything  ]
                data := [ Storage: rectangular ]
                        [ Order: Fortran_order ]
V:=data[..,1];
                     [ 1 .. 79 Vector[column] ]
                     [ Data Type: anything    ]
                V := [ Storage: rectangular   ]
                     [ Order: Fortran_order   ]
x:=data[..,2];
                     [ 1 .. 79 Vector[column] ]
                     [ Data Type: anything    ]
                x := [ Storage: rectangular   ]
                     [ Order: Fortran_order   ]

This gives you the vectors V and x.

Since your equation was done in 2-d math I cannot work with it (meaning I don't want to spend the time figuring out what commands are actually used). As is, it gives me an indexing error. Most likely you want to use add rather than sum for this as you are evaluating a finite sum. That may also fix the indexing into the vectors.

Rewrite the formula in 1-d Maple input & I am willing to look at it. I a going on a trip soon, however, which limits my connectivity and time.

M.D.

First 11 12 13 14 15 16 17 Page 13 of 20