X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FFEM%2FR1.hs;h=9ce8387e8f5ec980fc252a17bf5698f0510073cf;hb=be30f3a5a4c10d4a3c9eb42e38e2ce3306d42c85;hp=f99b3dcace7be32ee7df3ba07a488dc012285ae2;hpb=d0056767bcf231e1d5cce78a85f6be0688770cc3;p=numerical-analysis.git diff --git a/src/FEM/R1.hs b/src/FEM/R1.hs index f99b3dc..9ce8387 100644 --- a/src/FEM/R1.hs +++ b/src/FEM/R1.hs @@ -583,33 +583,11 @@ solution pde params = combine ci ni = ci*(ni xi) --- energy_true :: (Arity m, Arity n, Arity l, --- Algebraic.C a, Eq a, RealField.C a, ToRational.C a) --- => PDE a --- -> Params m n (S l) a --- -> (a -> a) -- ^ True solution @u@ --- -> (a -> a) -- ^ Derivative of true solution @u'@ --- -> a --- energy_true pde params u u' = --- case (bdy pde) of --- Left (Dirichlet (x1,x2)) -> --- sqrt $ bilinear_form u u' u u' --- where --- two = fromInteger 2 --- q = affine_inv (x1,x2) --- bilinear_form w w' v v' = (x2 - x1)*(gaussian integrand)/two --- where --- integrand x = ((big_A pde) (q x))*(w' (q x))*(v' (q x)) --- + ((c pde) (q x))*(w (q x))*(v (q x)) - --- _ -> error "Neumann BCs not implemented." - - energy_fem :: (Arity m, Arity n, Arity l, Algebraic.C a, Eq a, RealField.C a, ToRational.C a) - => PDE a - -> Params m n (S l) a - -> a + => PDE a + -> Params m n (S l) a + -> a energy_fem pde params = (coefficients pde params) `dot` (big_F pde params) @@ -637,8 +615,7 @@ relative_error_pointwise :: forall m n l a. -> a -- ^ The point @x@ at which to compute the error. -> a relative_error_pointwise pde params u x = - cent * ( u_exact - u_fem ) / u_exact + cent * ( abs $ (u x) - u_fem ) / ( abs $ u x ) where - u_exact = abs $ u x u_fem = evaluate' (solution pde params) x cent = fromInteger 100