-- >>> phi 1
-- 7.0
--
-affine_inv :: Field.C a => (a,a) -> (a -> a)
+affine_inv :: forall a. Field.C a => (a,a) -> (a -> a)
affine_inv (x1,x2) x =
x*(x2 - x1)/two + (x1 + x2)/two
where
- two = fromInteger 2
+ two = fromInteger 2 :: a
-- * Load vector
| otherwise =
coeff * ( legendre k x - legendre (k-2) x )
where
- two = fromInteger 2
- four = fromInteger 4
- coeff = one / (sqrt (four*(fromInteger k) - two)) :: a
+ two = fromInteger 2 :: a
+ four = fromInteger 4 :: a
+ coeff = one / (sqrt (four*(fromInteger k) - two))
-- | A matrix containing 'big_N' functions indexed by their
accum i j prev_F this_N =
prev_F + this_F
where
- two = fromInteger 2
+ two = fromInteger 2 :: a
(x1,x2) = (mesh params) !!! (i,0)
q = affine_inv (x1,x2)
integrand x = ((f pde) (q x)) * (this_N x)
| k == 1 = one / (fromInteger 2)
| otherwise = coeff * ( legendre k x )
where
- two = fromInteger 2
- coeff = sqrt ((two*(fromInteger k) + one) / two) :: a
+ two = fromInteger 2 :: a
+ coeff = sqrt ((two*(fromInteger k) + one) / two)
-- | The matrix of (N_i' * N_j') functions used in the integrand of
accum i j prev_K these_N's =
prev_K + this_K
where
- two = fromInteger 2
+ two = fromInteger 2 :: a
(x1,x2) = (mesh params) !!! (k,0)
q = affine_inv (x1,x2)
integrand x = ((big_A pde) (q x)) * (these_N's x)
accum i j prev_M these_Ns =
prev_M + this_M
where
- two = fromInteger 2
+ two = fromInteger 2 :: a
(x1,x2) = (mesh params) !!! (k,0)
q = affine_inv (x1,x2)
integrand x = ((c pde) (q x)) * (these_Ns x)
relative_error pde params energy_true =
cent * sqrt(energy_true - (energy_fem pde params)/energy_true)
where
- cent = fromInteger 100
+ cent = fromInteger 100 :: a
cent * ( abs $ (u x) - u_fem ) / ( abs $ u x )
where
u_fem = evaluate' (solution pde params) x
- cent = fromInteger 100
+ cent = fromInteger 100 :: a