[seqfan] Re: Rant on Maple code
Raff, Paul
praff at math.rutgers.edu
Thu Aug 13 14:39:45 CEST 2009
I don't think we should be oppressing the finance-inclined people around, or
any other group for that matter. Most of them aren't mathematicians like we
are, and most of them would go through their life having no problem
calculating something like futurevalue( n, 2, 2) -- and doing it numerous
times -- without recognizing that this value is simply 9n. It's simply not
in their language.
This is what I view the OEIS as - it's a place where people find out things
that they wouldn't have realized. For those where mathematics is their
profession, it leads to more publications. For others, it may simply make
their day easier.
So yes, I agree that the code examples shown, for the most part, are crap.
But they're right - even the one you said was wrong, Joerg (you forgot the
floor). What I would like to see, which I presume can happen easily with the
wiki, is the better code coming first with the "trivial" code coming last.
[paul]
Paul Raff
Graduate Assistant - Monitoring Message Streams
Rutgers University
http://math.rutgers.edu/~praff
On Thu, Aug 13, 2009 at 2:22 AM, Joerg Arndt <arndt at jjj.de> wrote:
> * 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.
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>
More information about the SeqFan
mailing list