tomleslie

5348 Reputation

15 Badges

9 years, 276 days

MaplePrimes Activity


These are answers submitted by tomleslie

SFloat() seesm to work for me in Maple18 and 2015. - as in

h:= HFloat(5.67,14);# define hfloat
type(h, hfloat); #check type
s:=SFloat(h);# convert
type(s, sfloat);#check type

Sounds like you are in Document Mode, rather than Worksheet Mode.

Check out the help entry

Document Mode vs Worksheet Mode

One simple way to do this is shown in the attached worksheet. Obviously, one could add an awful lot of options to each of the constituent sub-plots

aplot.mw

Many ways to do this, one of which is

with(LinearAlgebra):
with(ArrayTools):
[ add( `if`(IsZero(Row(A,j)),0,1), j=1..RowDimension(A)),
  add( `if`(IsZero(Column(A,j)),0,1), j=1..ColumnDimension(A))
];

If I undersrtand the problem correctly

cheese.mw

I assume that you mean that you have installed the DirectSearch package of which GlobalSearch is one of the commands

You don't specify which version of Maple you are running, which is unfortunate because it affects what you need to do. I am going to assume that you are running Maple 18 or later (ie 2015.0 or 2015.1).

You should have unzipped the DirectSearchh package into the lib directory under your Maple Installation: on a Widows system this will be C:\ProgramFiles\Maple 2015\bin (or might be C:\ProgramFiles\Maple 18\bin. Make sure the DirectSearxh package has been unzipped to this specific location. I can't be 100% certain but I assume that if you are running Linux or MacOs, then there will be an equivalent bin directory under your baisc Maple location

The help database for the DirectSearch package comes with help files in the (now deprecated .hdb) format. If you are running Maple 18 or later then these have to be converted to the .help format. If you type hdb in the search box on the Maple help page or ?hdb in a Maple worksheet (for Maple 18 or later), then this will pull up a help page on the steps required to convert eh .hdb files to .help files. Just follow the instructions. You will know if you have succeeded if the lib subdirectory where you have unzipped DirectSearch contains both .hdb files (the originals) and  .help files.

Once you have .help files, the only other thing you may need to do is on the Maple help page itself. Below the normal search box there is a field which says products: by default this is set to Maple: use the dropdown to ensure that the Userhelp box is checked. Technically the DirectSearch package is not an "official" maple product, and is regarded in the same way as any "user" package for which an author may have written a helpfile - so you need to ensure that the help system is looking for help on "user" packages as well as on official Maple products.

Somewhat tongue-in-cheek!

Utilise the debugger

restart;
Test:=proc()
plot(x^j,x=-2..2):
end proc:
stopat(Test); #set watchpoint
for j from 1 to 3 do
    Test()
end do;

The first time "Test" is called the debugger window will appear - push it out of the way somewhere then just keep hitting "continue" to generate plots one at a time

Having slept on this problem (cos it bothered me) I came back to it

With a carefully sequenced set of substituions I can transform your system of two equations (one second-order) and three boundary conditions, into a system of two first-order equations and two boundary conditions, where the first-order equation can be written in the form suitable for application of the basic rkf45 method. The process is shown in the attached

rkf45.mw

I have produced this worksheet in a very pedantic manner, with lots of comments which explain exactly what is being done at each stage - the whole transformation process could be written much more succinctly, but I thought this was a case where clarity trumps brevity.

The only assumption I had to make was that x0>0.

The final few execution blocks in the worksheet show the production of the rkf45-based dsolve() procedure, and a couple of sample plots which can be produced from it. For comparison I have included the production of the rkf45_dae-based dsolve() procedure for your original equations/bcs, along with the plots which can be obtained from it

Somwhat interestingly the"untransformed", rkf45_dae-based procedure hits numerical problems at x~=2, whereas that based on rkf45 using the transformed equations does not

 

Type or (copy paste from maple) the above into ypur faourite text editor. If using copy/paste, amke sure ther are no extraneous characters (such as the maple prompt >). You are aiming for plain text.

Save it to somewhere meaningful (depending on where you park you maple work, you might want to set up a mapleUtilities subdirectory) with a meaningful fileName and the extension .mpl. So aver.mpl would be a reasonable choice

Any time you want to use it in any Maple worksheet, just issue the command read("aver.mpl")

The commonest way for this to fail is that Maple cannot find the file on the basis of its current path variable, so you may have to modify the read command to include either an absolute or relative path to the file, so the read command might end up something like

read( "C:/myMapleProJects/someUtilities/aver.mpl") with an absolute path.

Or if you always run your Maple projects in the directory "C:/myMapleProJects", then the relative path

read("./someUtilities/aver.mpl") would work.

 

Well, after fixing a few typos, such as deleting the line

for ode3 and ode4:

and inserting bcs2 into

eval({ode3,ode4,bcs1},w=G[k]

And greatly simplifying some of the rest of your code in the same way that I did in my answer to your previous question, the answer which you do not want seems to be the correct answer. See the attached worksheet

tp2.mw

If you really, really know that the answer is

[-0.2], [0.51553], [0.4000]

[-0.1], [0.57000], [0.4371]

[0.], [0.62756], [0.4764]

[0.1], [0.68811], [0.5176]

[0.2], [0.75153], [0.5609]

then there is an error in the problem set up somewhere - incorrect parameter values?? bcs???

 

whilst this approach might work for the trivial problem which you gave, it is doomed to failure whenever you have more than one abs() term in your expression(s).

Why do you think that

because maple may has difficulties when dealing with absolute values

What evidence do you have for this statement?

What you want to plot is a little unconveentional. The attached worksheet produces a couple of plots.

The first is the conventional f(eta) vs eta, and theta(eta) vs eta

The second is theta(eta) vs L, for eta = 0,1,2,3, cos I wasn't sure which value of eta you were interested in

trickPlot.mw

Not sure how the first part of your question relates to the second: converting your integrand to polar coordinates is trivial, but not so for the limits.

Given the quoted limits, your question only makes sense if the integration wrt x is performed first, so the solution to your integral would be given by

int( int(9*x*y^2, x=-sqrt(a^2-y^2)..0), y=0..1);

So why do you want polar coordinates???

Since your polynomials are univariate, I suggest you examine the PolynomialTools[CoefficientList] command. Use of this command ensures that polynomial coefficients appear in defined order (with an option to reverse).

My solution for your problem is shown in the attached

coeffs.mw

@Kitonum 

No real problem with the above but


for k to 9999 do
     q:=k;
     if add
        ( irem(q, 10, 'q')^3,
           k = 1..length(q)
        )
        >= k
     then n:=k
     fi;
od:
n;

runs about 15x faster

First 111 112 113 114 115 116 117 Page 113 of 118