Skip to content
Snippets Groups Projects
Commit 3c41733a authored by Stephan Hilb's avatar Stephan Hilb
Browse files

add norm calculations

parent bdb7da64
No related branches found
No related tags found
No related merge requests found
...@@ -17,3 +17,21 @@ function l1triangle() ...@@ -17,3 +17,21 @@ function l1triangle()
return result return result
end end
function norm_grad()
function ref_int(f)
inty_f = Algebra.int(f, :y, 0, :(1 - x))
return Algebra.int(inty_f, :x, 0, 1)
end
# \|f\|
f = :(a * x + b * y + c * (1 - x - y))
n2_f = ref_int(:(($f)^2))
# \|grad f\|
dx_f = Algebra.df(f, :x)
dy_f = Algebra.df(f, :y)
n2_gradf = ref_int(:(($dx_f)^2 + ($dy_f)^2))
return :($n2_gradf / $n2_f)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment