Skip to content

Is there an inverse of basis.interpolate()? #816

Answered by kinnala
gatling-nrl asked this question in Q&A
Discussion options

You must be logged in to vote

Alright, to answer the original question, with the existing projection it would like this:

import numpy as np
from skfem import *
m = MeshTri()
basis = Basis(m, ElementTriP1())
x1 = m.p[0]  # the function f(x) = x
x1_interp = basis.interpolate(x1)
x2 = projection(LinearForm(lambda v, w: x1_interp * v), basis)
print(np.linalg.norm(x1 - x2))

which will print 2.6766507790745728e-16.

Replies: 2 comments 18 replies

Comment options

You must be logged in to vote
8 replies
@gatling-nrl
Comment options

@gatling-nrl
Comment options

@kinnala
Comment options

@kinnala
Comment options

@kinnala
Comment options

Comment options

You must be logged in to vote
10 replies
@gatling-nrl
Comment options

@kinnala
Comment options

@gatling-nrl
Comment options

@kinnala
Comment options

@kinnala
Comment options

Answer selected by gatling-nrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants