[seqfan] Re: Rant on Maple code

Joerg Arndt arndt at jjj.de
Thu Aug 13 08:22:53 CEST 2009


* peter.luschny <peter.luschny at googlemail.com> [Aug 11. 2009 09:44]:
> [...]

(Seen the replies so far)
Search for with(finance) gives 216 hits.
And I do not like what I see.

Searching the web for "maple futurevalue"
sends me to the (javascript infested) page
http://www.maplesoft.com/support/help/view.aspx?path=finance/futurevalue

So futurevalue( a, b, c ) := a*(1+b)^c

A001020:
with(finance):seq(futurevalue(1, 10, n), n=0..17)
so 11^n == (1+10)^n, a truly phantastic discovery.
There we also see the groundbreaking news
that powers can be written as 2nd order recurrences 
with one coefficient zero:
[lucas_number1(n, 11, 0) for n in xrange(1, 19)]

A003946: (just a random seq I tried)
seq(floor(futurevalue(4 , 2, n)), n=-1..24); 
Let's try:
? f(a,b,c)=a*(1+b)^c
? vector(22,n,f(4 , 2, n-2)) \\ (n-2) = -1, 0, 1, 2, 3, ...
[4/3, 4, 12, 36, 108, ...]
Now that's wrong (first should be 1).


"cashflows":  the page
http://www.maplesoft.com/support/help/view.aspx?sid=24380
leaves me guessing how this is defined, looks like
cashflows([a,b,c],r) := a/(1+r) + b/(1+r)^2 + c/(1+r)^3
(first first arg possibly of arbitrary length).

Armed with this function we can conquer mathematics:

A008592 Multiples of 10:
seq(add(cashflows([3, 3, 4], 0 ), k=1..n), n=0..41);
is this a bloody joke?
...followed by:
sage: [i for i in range(420) if gcd(i, 10) == 10]
so dirt code is possible in every language.
Btw. seq should have no code at all.

Similarly for
A098848 n(n+14).
with(finance):seq(add(cashflows([k, k, 13], 0 ), k=1..n), n=0..45);
Seq should have no code at all and certainly not THIS code.

A138590  Fibonacci(9n).
seq(fibonacci(futurevalue( n, 2, 2)), n=0..12);
Wow, 9*n can be expressed as
? vector(22,n,f(n,2,2))
[9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126, 135, 144, 153, ...]


A050519 Increments of arithmetic progression of at least 6 terms having the same value of phi in A050518
COMMENT These are successive multiples of 30. 900 is the largest one known. 
and then:
seq(add(cashflows([10, 10, 10], 0 ), k=1..n), n=0..33);
To me this appears misleading at least.
And yes, 30 is indeed equal to 10/(0+1)+10/(0+1)+10/(0+1).
How come the press did not cover this right when it was published?


I STRONGLY suggest removing all code "with(finance)".
As it is frequently surrounded by more stinky code,
it may be a good idea to remove those smellies as well.




More information about the SeqFan mailing list