maple

By Hal Canary, 2004-03-09 22:41:59 (link)
#computers-code

I'm starting to think in maple these days. Cool

#begin Maple Code
interface(prettyprint=false):
f := (x) -> a*x^2 + b*x + c:
df := D(f):
x := proc(n)
  if n=0 then x0
  else simplify( x(n-1) - f(x(n-1)) / df(x(n-1)) )
  fi
end:
with(combinat, fibonacci):
Fib := (n) -> fibonacci(n+1):
P1 := (n,x) -> add( binomial(2^n,k)
  * (Fib(2^n-k-2)) * x^k,k=0..2^n):
Q1 := (n,x) -> add( binomial(2^n,k)
  * (Fib(2^n-k-1)) * x^k,k=0..2^n):
a:=1: b:=1: c:=(-1):
for n from 0 to 4 do
  printf("x(%a) - P1(%a)/Q1(%a) = %q\n",n,n,n,
  simplify(x(n) - (P1(n,x0)/Q1(n,x0)))):
end do:
#end Maple Code

(back)