# MATLAB Making a short test for self-adjointness

Tags:
1. Feb 23, 2018

### SemM

Hi, I made the following command in MATLAB to test for the following:

\langle T\psi,\phi\rangle=\langle \psi, T\phi\rangle

syms x
a = (diff(exp(-x^2)))*exp(-2*x^2)
b = (diff(exp(-2*x^2)))*exp(-x^2)
W = int(a, x)
P = int(b, x)
O=W-P

and it is tested on two square integrable functions. Can someone validate that this is OK?

2. Feb 23, 2018

### Staff: Mentor

No. Just because it is valid for a specific pair of functions doesn't mean that it will be true for all functions.

3. Feb 23, 2018

### SemM

So one needs to add that if $O \ne 0$ then the operator is not self-adjoint.

4. Feb 23, 2018

### Staff: Mentor

Yes, you can use it for counterproofs.

I am not very familiar with symbolic manipulations in Matlab, but the way you use int appears to be for indefinite integrals, not a definite integral as it should be for the inner product.

5. Feb 23, 2018

### SemM

Sure. trying the following function on the differential operator (d/dx) on the two given functions in the space 0-2pi:

syms x
a = (diff(exp(-x^2)))*exp(-2*x^2)
b = (diff(exp(-2*x^2)))*exp(-x^2)
W = int(a, 0, 2*pi)
P = int(b, 0, 2*pi)
O = W-P

Gives:

1/3 - exp(-12*pi^2)/3

So these two functions are either inadmissible, or the operator is not self adjoint. Of course the latter is ridiculous, but in order to try, can you give me a pair of functions that should work?