5505 Reputation

17 Badges

9 years, 345 days

MaplePrimes Activity

These are answers submitted by tomleslie

To quote the manual entry for dsolve (with my emphasis)

Integrals appearing in answers returned by dsolve are expressed using the inert Int and Intat (not int or intat). These integrals appear when int is not able to calculate them or when it appears to be convenient not to evaluate them during the solving process. You can request the evaluation of these integrals using the value command.

And for some values of m,k in your loops, unevaluated integral were being returned - which broke the subsequent solve() command.

Somehat surprisingly, it seems that the relevant integrals can always be evaluated, and making the change below

soln[m, k] := rhs(dsolve(ode[m, k], f[m, k](r)));


soln[m, k] := value(rhs(dsolve(ode[m, k], f[m, k](r))));

means that your loop now completes, and the result[] table is populated.

See the attached

If your matrix only ever contains (real) numeric values (ie no symbols, complex nos, etc), the you can specifyt the datatype as an option to the Matrix() constructor

M:=Matrix(3,3, datatype=realcons);


M[1,1]:=1, or M[1,1]:=1.0 will work, but M[1,1]:=x, or M[1,1]=1+2*I will throw an error.

On the other hand, if you wnat to place assumptions on pre-existing symbolic matrix entries, then

MM:=Matrix(3,3, symbol=a);
map(assume, MM, real):

works for me

From the Maple toolbar

Help-> Manuals, Resources and more-> Manuals-> Programming Guide

Entering your vector as

v1:=Vector( [ (4/7)*exp(-t)*exp(-4*t)-(4/7)*exp(-t)*exp(3*t),

Then I find either

(combine@expand)~(map(integrate, v1, t));


map(integrate, (combine@expand)~(v1), t);

provides the answer you desire - so I'm not sure what the problem is??

Personally I would probably integrate first and then do the simplification, so use

(combine@expand)~(map(integrate, v1, t));

Your posted code runs in 1070 seconds on my machine

If I reorganise your code so that stuff executes in what I consider to be a logical order, and nothing is executed repeatedly, unless it actually has to be, I can get this down to ~21secs, producing the same answer. The absolute numbers on your machine will differ, but you ought to obtain the 50x improvement

Note that I have done nothing to improve the performance of the fsolve() command based on your specific problem, I have simply eliminated "redundant" operations.

See the attached

Would further improvements be possible??
Probably, but the law of diminishing returns would set in fairly quickly. I did the above improvement in about 15mins. I suspect that there might be another factor of 2 (or so) to be gained, but only if I spent a couple of hours on the problem - not sure I have the time/inclination :-)

Just because I'd never used the geom3d package before, and it seemed like an obvious choice!

# Define the triangle
   triangle(ABC, [ point(A,3,0,0),
# Compute all three altitudes
   altitude(hA, A, ABC):
   altitude(hB, B, ABC):
   altitude(hC, C, ABC):
# Generate the intersections of the
# altitudes taken in pairs - just to
# show one always gets the same result
   coordinates(intersection(H1, hA, hB));
   coordinates(intersection(H2, hA, hC));
   coordinates(intersection(H3, hB, hC));


Maple will only search the current working directory for the file.

Your current working directory can be ascertained by executing


If this isn't where the file is stored,  then you can reset the current working directory by supplying an argument to currentdir() followed by read(), as in (on Windows)

read "02ExactSoln.m";

Or you could simply supply the path in the read command, as in (for example)

read "C:/dir1/subdir2/subdir3/02ExactSoln.m";

The most important thing to realise is that there is a big overlap between the capabilities of the two commands

Generally speaking I find that cat() is the more "general" command, if only because it can concatenate names as well as strings. Consider the output of the following

for k from 1 by 1 to 5 do
    cat( sq, k )=k*k;

where the variables with names sq1, sq2,...sq5 are created. You can do this with StringTools[Join], as in

for k from 1 by 1 to 5 do
    convert( StringTools[Join]( ["sq", convert(k,string)], "" ), name)=k*k;

but as you can see it is a bit more awkward. In particular the strings have to be presented as a list, and the default separator is a space, unless you supply an alternative as the second argument (as in the above).

Join() works strictly on strings but cat() can concatenate a mixture of strings and names with the output being coerced to the type of the first argument: so

cat(a, "1");

will produce the name a1 and

cat("a", 1);

will produce the string "a1" - whic is sometimes useful, and sometimes not

In general, I would say that unless you want/need to specify the separator then cat() is more useful. However you should also consider the followiing

myLis:=[ "This", "is", "an", "example"];

So how do you get the spaces between the words when using cat()???? Adding separators when using cat() is possible but awkward.

So when do I actually use which command??? Well basically, if I happen to be doing lots of string manipulation, then I would probably use Join(). If I just happen to need a quick/dirty concatenation, in the middle of something else, then I probably use cat(). (Actually I probably use ||, but since this is now deprecated I probably shouldn't even mention that!)


Try the attached


Looks like yu have been using 2-D math input and somewhere/somehow got a syntax error in your boundary conditions. If I convert everything to 1-D match input and rewrite the boundary conditions in what I know to be the corrct format, then the code runs and I can plot answers. See attached

Short fast answer is no, not really. If you enter


in Maple then this will automatically be "simplified" to 2x. Now this can be circumvented in various ways, but why would you want to???

If you try

cl:=[coeffs(p, [x,y,z])];

then c1 contains the coefficients of each of the terms in t1 - which is the information you require

cl:=[coeffs(p, [x,y,z])]:


This is your 4th or 5th question in the last 15 minutes or so - have you tried then help documentation????

As in

map(abs, L);
map( signum, L);

As in


Save the file in either or foo.mpl to achieve what you desire - foo.m is Maple internal format which as the manual says is not intended for end users.

First 113 114 115 116 117 118 119 Page 115 of 121