Commit 12946367 by Han-Miru Kim

### add fucntion areEquivalent :: BQF -> BQF -> Bool

parent 510e5fda
 ... ... @@ -157,9 +157,21 @@ The transformation is done by applying the transformation ~T = S_n = [[n,1],[-1, -- how many reduction stepts does it take to reduce f stepsTillReduced :: BQF -> Int stepsTillReduced = (length . (takeWhile (not . isReduced)) . reduction) -- two forms with D > 0 are equivalent, if and only if they end up in the same reduced cycle areEquivalent :: BQF -> BQF -> Bool areEquivalent f g | (d /= d') = False | d <= 0 = error "not definite forms" | otherwise = (reduce f) `elem` (reduction g) where d = discriminant f d' = discriminant g #+END_SRC * Continued Fractions ** Evaluation #+BEGIN_SRC haskell ... ...
 ... ... @@ -85,12 +85,23 @@ reduction f = aux (iterate reduceStep f) Nothing reduce :: BQF -> BQF reduce = head . (dropWhile (not . isReduced)) . reduction reduce = head . (dropWhile (not . isReduced)) . (iterate reduceStep) -- how many reduction stepts does it take to reduce f stepsTillReduced :: BQF -> Int stepsTillReduced = (length . (takeWhile (not . isReduced)) . reduction) -- two forms with D > 0 are equivalent, if and only if they end up in the same reduced cycle areEquivalent :: BQF -> BQF -> Bool areEquivalent f g | (d /= d') = False | d <= 0 = error "not definite forms" | otherwise = (reduce f) `elem` (reduction g) where d = discriminant f d' = discriminant g eval :: [Double] -> Double eval [] = 0 eval (x:[]) = x ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!