Dave L

527 Reputation

18 Badges

19 years, 310 days

MaplePrimes Activity


These are answers submitted by Dave L

I'm now in a position to report on progress with this.

The .zip file for the DirectSearch v2 package, available from this page on the Application Center, now includes the English and Russian .help files converted from the corresponding .hdb files.

I've been corresponding with member Earl, and he tells me that he can now view the package's Help pages in his Maple 2016.0 after downloading that new .zip file.

And I've entered a bug report that the Maple 2016.0 .hdb conversion mechanism is not working for that package's help archive files.

Over on the Maple Beta testing forum I've also been discussing issues with Maple not detecting these .help files, after they are placed in a custom location (ie. folder or directory) other than the lib folder of the Maple installation itself.

In Maple 15.01 it was possible to issue a command to augment the libname path with a custom folder (directory), in a worksheet of a running Standard GUI session, and then successfully query the Help topics of pages in .hdb Help archive located in the augmented location. For example, after launching the Standard GUI I could issue a command like

    libname := "C:/DirectSearch/lib", libname;

and then in that same running session successfuly query the Help pages in the .hdb file in that folder. But in Maple 16.02 and later versions that no longer works. Such dynamic adjustment of libname still works for accessing commands and values stored in similarly placed .mla archives, but it is not working for picking up pages from Help archives. I am submitting a new report against this regression.

Here are two alternative suggestions about how to use a custom location (not the lib folder of the Maple installation) for either .hdb or .help archives.

1) Put that same Maple command to augments libname in your Maple initialization file instead. For example if I put that command in the file C:\\Users\dlinder\maple.ini on my Windows 7 machine, and then completely close the Standard GUI and relaunch it, then I can successfully access the Help pages in the .hdb/.maple files I placed in the specified custon location.

2) Place all of the .mla/.hdb/.help files in a custom location as they comprised a Maple toolbox. For example, on my Windows 7 machine, I can place the files in C:\\Users\dlinder\maple\toolbox\DirectSearch\lib and then close and relaunch the Standard GUI and successfully access the commands and Help pages of that package. This is what Earl has told me works for him too. In this case it is not necessary to add a line to the initialization file to augment libname explicitly, since Maple does that automatically for such folders.

If anyone is not aware of what Maple considers as their home directory on their platform then it can be found by issuing the Maple command kernelopts(':-homedir') . On my Windows 7 machine the result from that command is "C:\Users\dlinder" while on my Unix/OSX/Linux account it is "/home/dlinder" .

I can also mention that the problem in Maple 2016.0 with migrating .hdb files may also affect other packages authored by users. I'll be looking at the OrthogonalFunctions package on the Application Center, and a colleague tells me that he is in contact with the authors of the Lattice and Orbitals packages.

Dave Linder
Mathematical Software, Maplesoft

It is a bug if fsolve stops only because the iterates got close and not because some iterate also satisfies the equations (ie, approximates some root). That covers your first two examples, I think.

I fixed a few of those kinds of bugs some years ago, in the univariate expression case. It looks like I need to do something similar for the multivariate operator case as well.

I would also like to make fsolve accept user-supplied tolerances, but that might depend on scheduling. I'll record the suggestion, with notes.

Thanks for mentioning it.

Dave Linder
Mathematical Software, Maplesoft

I just found out the following piece of information. The combinat:-randperm command of Maple 16 makes an external call to a function in the {lib}mstring.{so,dll} shared library.

> showstat((combinat::Permutations)::Random);

(combinat::Permutations):-Random := proc()
   1   passign(procname,subsop(5 = "generate a random permutation",defun(convert(mstring_randperm,'string'),"mstring",(':-mtsafe') = true)));
   2   procname(args)
end proc

And it turns out the the seed for this is controlled by the StringTools:-Randomize command.

The following is done in the commandline interface of 64bit Maple 16.01 on Linux. The behavior seems similar in Maple 14.01 and 15.01.

> restart:          
> with(combinat):   
> L:=[1,2,3]:       
> randperm(L), randperm(L);

                             [2, 1, 3], [1, 3, 2]

> restart:                 
> with(combinat):          
> L:=[1,2,3]:              
> randperm(L), randperm(L);

                             [2, 1, 3], [1, 3, 2]

> restart:                 
> with(combinat):          
> StringTools:-Randomize():
> L:=[1,2,3]:
> randperm(L), randperm(L);

                             [1, 2, 3], [3, 2, 1]

> restart:                 
> with(combinat):          
> StringTools:-Randomize():
> L:=[1,2,3]:              
> randperm(L), randperm(L);

                             [3, 1, 2], [2, 1, 3]

Of course, this might be better handled in a centralized location (ie. the `randomize` command, and/or RandomTools package).

Dave Linder
Mathematical Software, Maplesoft

The previous releases' What's New help pages are available at the Online Help site. And each of these is a parent node, each linking to various sections on graphics/GUI/packages.etc.

What's New, Maple 15

What's New, Maple 14

What's New, Maple 13

What's New, Maple 12

Dave Linder
Mathematical Software, Maplesoft

 

Mortgage Calculator

© Maplesoft, a division of Waterloo Maple Inc., 2010

Introduction

 

This document allows you to calculate mortgage payments and payback times as well as compare different types of mortgages.

Mortgage Math

   

Mortgage Calculator

 

 

Principal:

Term:

years

Interest rate (per year):

%

Monthly payments:

 

Line of credit:

 

Interest rate (per year)

%

 

Monthly payments:

Total monthly payments:

(mortgage + line of credit)

 

Fixed Rate versus Variable Rate

 

A fixed rate mortgage has a fixed interest rate which will remain constant over the term, whereas a variable rate mortgage may change monthly, usually relative to the prime interest rate. To decide between a fixed and variable mortgage at given interest rates we compare the interest cost over a period of time. We will need to estimate the evolution of the variable interest rate over the course of this period. For practical reasons, we assume that the interest rates changes linearly from the initial rate to the rate at the end of the period.

Mathematical Background

   

Assuming that during the term, the variable interest rate moves linearly from the start rate to the end rate, we can compute the fixed rate at which variable rate and fixed rate mortgage payments will be equal. Note that this does not take into account discounting the value of money over time and thus has a slight bias towards fixed rates if interest rates are expected to rise.

Variable rate vs. fixed rate

 

 

Variable rate at start of interval:

%

 

Variable rate at end of interval:

%

Fixed rate:

%

Time interval of interest:

years

 

Mortgage term:

years

 

 

 

 

 

Notice: Maplesoft is not responsible for any errors contained within and are not liable for any damages resulting from the use of this material.

 

Download mortgage_calculator_.mw

 

Dave Linder
Mathematical Software, Maplesoft

How about the plots:-matrixplot command with its heights=histogram option?

Dave Linder
Mathematical Software, Maplesoft

Please stop posting duplicate comments that are also appearing (almost identical in nature) in the two other threads on this topic.

Thank you.

Dave Linder
Mathematical Software, Maplesoft

It's the semicolon at the end of the `end do;` that is controlling whether the output from statements within the for-loop get displayed or not. See the help page ?printlevel for some more on controlling that for nested loops.

For a string like your "--" you might want to use %s instead of %a inside printf, if you expect the double-quotes to not be displayed.

The single right-quote ' is sometimes called an uneval quote. It can wrap objects like names, function calls, etc. But the minus sign is not an object, and Maple will issue an error on being handed '-'. The single left-quote can be used to make a name out of symbols, and so is sometimes called a name quote. Hence `-` is a name (it's actually the protected name of the prefix minus operator).

Dave Linder
Mathematical Software, Maplesoft

The underlying problem is in how you've created operator `f` to use the name `k`, and then assigned to the index names k[1], k[2] with calls to `f`. I believe this has led to an infinitely recursive assignment.

Maple's kernel tries to catch and disallow recursive assignments done at the top level which would lead to infinite recusion during evaluation. But it's much harder to catch those when done inside a procedure (note how your `f` was set up to get k by lexical scoping at run time only).

The assignment to k[1] overwrites the earlier float assignment you'd made to `k`. It turns k into a table. And the value of k[1] is itself a (self-)reference to k. The fact that f uses its second parameter v to make a function call contributes. When f is called yet again, on k[1], havoc breaks out with evaluation.

A simple workaround is to use another name instead of k for the unindexed name (to which you assigned the float value), such as kk or your own choice.

Here is the problem example in simpler form. By the time it's finished, op([2,0,2],k[2]) is too much like k[2] itself.

> restart;
> interface(prettyprint=1):

> f := proc(v) -k*v(t); end proc:
> k[1] := f(w);
                               k[1] := -k w(t)

> k[2] := f(k[1]);
k[2] := k TABLE([1 = -k w(t), 2 = k pointto(38451308)(t) w(t)(t)])(t) w(t)(t)

> op([2,0,2],k[2]);
[1 = -k w(t), 

  2 = k TABLE([1 = -k w(t), 2 = k pointto(38451308)(t) w(t)(t)])(t) w(t)(t)]

Dave Linder
Mathematical Software, Maplesoft

Have you looked at the Help page for Student:-Calculus1:-NewtonsMethod yet? (Follow this link to see it online, or do a search for NewtonsMethod in Maple's Help.)

Perhaps the Example section of that Help page could get you started. From within Maple's Help, you can copy all the Examples of a given Help page and then paste them into your worksheet and execute them.

Or you could show us what you've tried so far (even if it fails or produces only error messages -- we could likely help with that too). You can upload your worksheet to this site (green button).

Dave Linder
Mathematical Software, Maplesoft

I see the `||` concatenation operator get used quite a bit in posts on this forum. And often it is done within a loop, forming lots of names like base||i for a loop index i. I'd suggest at least considering use of an indexed name instead. For example,

> utility:=[CARA,CRRA,DARA]:

> DARA[1]:=alpha+beta*x:

> eval(utility[3][1],[alpha=1,beta=2]);

                            1 + 2 x

This alternative of using an indexed name might not always be the best (especially if you want to use base and base[i] together in some equation). But sometimes it is effective while also being much simpler. And, in a loop, it can avoid a lot of name creation & extra function calls. And it doesn't necessitate extra care for evaluations due to `cat` vs `||` distinctions.

Dave Linder
Mathematical Software, Maplesoft

Your assumed phi has a name of which actually contains the tilde. So, technically, the conversion to a string is doing what it's "supposed" to do.

As a workaround of a sort, you could instead do sprintf(%a,phi) and get just "phi".

> restart:

> assume(phi,real);

> convert(phi,string);
                             "phi~"

> sprintf(%a,phi);
                             "phi"

Here's a pair of dubious results, found while looking at this,

> restart:

> sprintf(%a, `foo~`);
"foo"

> interface(showassumed=2):
> `foo~`; foo With assumptions on foo
> convert(`foo~`,`global`);
foo
With assumptions on foo

> about(%);
foo:
nothing known about this object

So, the sprintf trick works only because sprintf knows to strip off trailing tildes. But it's wrong that it does so for a name ending in a tilde, even when there are no assumptions on the base name.

And it's also wrong behaviour to get "With assumptions on foo" displayed when there are no assumptions.

Dave Linder
Mathematical Software, Maplesoft

Thanks for posting this. I'll look into it.

Dave Linder
Mathematical Software, Maplesoft

Maple can do garbage collection on the objects in which your data (or plots) are assigned, and reclaim allocated memory for reuse. But it can only do that if those objects are no longer referenced by anything else in your session.

If you could post or upload some representative code here then we may be able to give more specific advice.

Dave Linder
Mathematical Software, Maplesoft

(m,n) := 5,7:
A := LinearAlgebra[RandomMatrix](m,n);

convert(A,Vector[column]);

or,

Vector([seq(A[1..-1,i],i=1..LinearAlgebra[ColumnDimension](A))]); 

or,

B := Vector(m*n):
ArrayTools[Copy](m*n,A,0,1,B,0,1):
B;

Dave Linder
Team Lead, Mathematical Software, Maplesoft, Inc.

1 2 3 Page 1 of 3