MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with implementing the following functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23938] Re: Problem with implementing the following functions
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 16 Jun 2000 00:57:23 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8i9o9j$29q@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

because MatchQ[(9 + Sqrt[18])/9, (Sqrt[x_] + (z_))/(y_)]
gives false.

thats why 
FullForm[(9 + Sqrt[18])/9]

is

Times[Rational[1, 9], Plus[9, Times[3, Power[2, Rational[1, 2]]]]]

and

FullForm[(Sqrt[x] + (z))/(y)]

is

Times[Power[y, -1], Plus[Power[x, Rational[1, 2]], z]]

the 1/9 factor is stored as Rational[1/9] and *not* as
Times[1,Power[9,-1]]

Regards
  Jens


Matt Herman wrote:
> 
> Hello,
> 
> here are the functions
> 
> q[(Sqrt[x_] + (z_))/(y_), 1] := (x - (Floor[(z + Sqrt[x])/y]*y -
> z)^2)/y
> 
> q[(Sqrt[x_] + (z_))/(y_), n_] :=
>   q[(z + Sqrt[x])/y, n - 2] +
>     a[(z + Sqrt[x])/y, n - 1]*(
>         m[(z + Sqrt[x])/y, n - 1] - m[(z + Sqrt[x])/y, n])
> 
> a[(Sqrt[x_] + (z_))/(y_), 0] := Floor[(z + Sqrt[x])/y]
> 
> a[(Sqrt[x_] + (z_))/(y_), n_] :=
>   Floor[(m[(z + Sqrt[x])/y, n] + Sqrt[x])/q[(z + Sqrt[x])/y, n]]
> 
> m[(Sqrt[x_] + (z_))/(y_), 1] := Floor[(z + Sqrt[x])/y]*y - z
> 
> m[(Sqrt[x_] + (z_))/(y_), n_] :=
>   a[(z + Sqrt[x])/y, n - 1]*q[(z + Sqrt[x])/y, n - 1] -
>     m[(z + Sqrt[x])/y, n - 1]
> 
> For some reason mathematica gives me blank inputs when I do
> a[(9+Sqrt[18])/9,5] (or any n for that matter.
> 
> Any ideas?
> 
> Thanks,
> 
> Matt


  • Prev by Date: Syntax error using (*comments*)
  • Next by Date: Re: Monte Carlo in Mathematica ?
  • Previous by thread: Problem with implementing the following functions
  • Next by thread: RE: Problem with implementing the following functions