# PDE of Schrodinger type

**URL:** https://community.freefem.org/t/pde-of-schrodinger-type/512
**Category:** General Discussion
**Created:** [July 21, 2020, 12:48pm UTC](https://community.freefem.org/t/pde-of-schrodinger-type/512 "2020-07-21T12:48:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PhyzWiz](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@PhyzWiz](https://community.freefem.org/u/PhyzWiz)
#### Post date: [July 21, 2020, 12:48pm UTC](https://community.freefem.org/t/pde-of-schrodinger-type/512/1 "2020-07-21T12:48:38Z")

</div>

Hello,

I wish to solve a linear PDE of the form:

-\Delta u + V u = f

in some 2d domain, where \Delta is the Laplacian. In addition to f(x,y), there is now another function V(x,y), which is specified analytically. The weak formulation is straightforward mathematically, but how do I include V in the stiffness matrix? In other words, I expect the syntax to be something like:

varf a(u,v) = int2d(Th) ( dx(u)_dx(v) +dy(u)dy(v) +uV_v )

But how do I actually specify V in the code, given its analytical form V(x,y)?

Best regards,

PhyzWiz

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [July 21, 2020, 2:23pm UTC](https://community.freefem.org/t/pde-of-schrodinger-type/512/2 "2020-07-21T14:23:57Z")

</div>

`func V = cos(x) * sin(y) + exp(x+y)`?

---

<div class="post-metadata">

### Author: ![PhyzWiz](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@PhyzWiz](https://community.freefem.org/u/PhyzWiz)
#### Post date: [July 21, 2020, 2:44pm UTC](https://community.freefem.org/t/pde-of-schrodinger-type/512/3 "2020-07-21T14:44:16Z")

</div>

I see, that simple! Great, thank you very much.  
PhyzWiz
