# What's wrong with my code

**URL:** https://community.freefem.org/t/whats-wrong-with-my-code/3902
**Category:** General Discussion
**Created:** [May 6, 2025, 11:01am UTC](https://community.freefem.org/t/whats-wrong-with-my-code/3902 "2025-05-06T11:01:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![BelfaidaMedReda](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/belfaidamedreda/32/3170_2.png) [@BelfaidaMedReda](https://community.freefem.org/u/BelfaidaMedReda)
#### Post date: [May 6, 2025, 11:01am UTC](https://community.freefem.org/t/whats-wrong-with-my-code/3902/1 "2025-05-06T11:01:41Z")

</div>

Hello, I’m new to freefem, I can’t compute the eigenvalues as I’m getting this error

71 : varf a(u, v) = int2d(T)( dx(u) unknown operator ( on type

Error line number 71, in file drum\_shapestest.edp, before token )

current line = 71  
Compile error :  
line number :71, )  
error Compile error :  
line number :71, )  
code = 1 mpirank: 0

real L = 1;

// Définir les bords du triangle (3 segments)

border alpha1(t=0, L){ x=t; y=0; label=1; }  
border beta1(t=0, L){ x=L; y=t; label=2; }  
border gamma1(t=0, L){ x=(1-t)\*L; y=(1-t)\*L; label=3; }

// Maillage avec 10 points par bord  
mesh T1 = buildmesh(beta1(10) + gamma1(10) + alpha1(10));

border alpha2(t=0,L){ x=0; y=L - t; label=4; }  
border beta2(t=0,L){ x=L - t; y=L; label=5; }  
border gamma2(t=0,L){ x=t_L; y=t_L; label=6; }

mesh T2 = buildmesh(gamma2(10) + beta2(10) + alpha2(10));

// Triangle T3

border beta3(t=0,L){ x=-L; y = L + t;label=16;}  
border alpha3(t=0,L) { x= -L-t; y=2_L;label=17;}  
border gamma3(t=0,1){ x= -2_L\*(1-t)-L_t; y = 2_L\*(1-t) + t\*L;label=18;}

mesh T3 = buildmesh(beta3(10)+alpha3(10)+gamma3(10));

// Triangle T4  
border alpha4(t=0, L){ x=0; y=2\*L - t; label=13; }  
border beta4(t=0, L){ x=t; y=L; label=14; }  
border gamma4(t=0, 1){ x=(1 - t)_L; y=(1 - t)L + t2_L; label=15; }

mesh T4 = buildmesh( beta4(10) + gamma4(10) + alpha4(10) ); // ordre anti-horaire

// Translation : -L en x, +L en y  
real dx = -L;  
real dy = +L;

// Triangle T6 : translation de T1  
border alpha6(t=0, L){ x=t + dx; y=0 + dy; label=7; }  
border beta6(t=0, L){ x=L + dx; y=t + dy; label=8; }  
border gamma6(t=0, L){ x=(1-t)\*L + dx; y=(1-t)\*L + dy; label=9; }  
mesh T6 = buildmesh(beta6(10) + gamma6(10) + alpha6(10));

// Triangle T5 : translation de T2  
border alpha5(t=0,L){ x=0 + dx; y=L - t + dy; label=10; }  
border beta5(t=0,L){ x=L - t + dx; y=L + dy; label=11; }  
border gamma5(t=0,L){ x=t_L + dx; y=t_L + dy; label=12; }  
mesh T5 = buildmesh(gamma5(10) + beta5(10) + alpha5(10));

// Triangle T7

border beta7(t=0,L){x=-L;y=3_L-t;label=19;}  
border alpha7(t=0,L){x=-L+t;y=2_L;label=20;}  
border gamma7(t=0,1){x=-t_L;y=2_L\*(1-t) + 3_t_L;label=21;}

mesh T7 = buildmesh(beta7(10) + alpha7(10) +gamma7(10));

// Fusion des 7 triangles  
mesh T = T1 + T2 + T6 + T5 + T4 + T3 + T7;

// Espace de fonctions P1 avec conditions de Dirichlet automatiques  
fespace Vh(T, P1);  
Vh u, v;

// Définir les matrices de rigidité (a) et de masse (b)  
varf a(u, v) = int2d(T)( dx(u)\*dx(v) + dy(u)_dy(v) ); // matrice raideur  
varf b(u, v) = int2d(T)( u_v ); // matrice masse

// Assemblage des matrices  
matrix A = a(Vh, Vh, solver=sparsesolver);  
matrix B = b(Vh, Vh, solver=sparsesolver);

// Calcul des n premières valeurs propres  
int nev = 5; // nombre de valeurs propres  
real[int] ev(nev); // tableau pour stocker les valeurs propres  
Vh[int] eVec(nev); // tableau pour stocker les vecteurs propres

// Solveur des valeurs propres (resolvent: EVP)  
cout \<\< “Résolution du problème aux valeurs propres…” \<\< endl;  
int k = EigenValue(A, B, sym=true, sigma=0.0, value=ev, vector=eVec);

// Affichage des valeurs propres trouvées  
cout \<\< “Valeurs propres approchées (lambda):” \<\< endl;  
for (int i = 0; i \< k; ++i)  
cout \<\< “λ\_” \<\< i+1 \<\< " = " \<\< ev[i] \<\< endl;

// Visualisation du 1er vecteur propre  
plot(eVec[0], wait=true, cmm=“1er vecteur propre”);

---

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [May 6, 2025, 11:55am UTC](https://community.freefem.org/t/whats-wrong-with-my-code/3902/2 "2025-05-06T11:55:48Z")

</div>

Hello,  
the problem is that you should not define

```auto
real dx = -L;
real dy = +L;

```

because your definitions of dx and dy hide the operators dx, dy that you want to use.

---

<div class="post-metadata">

### Author: ![BelfaidaMedReda](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/belfaidamedreda/32/3170_2.png) [@BelfaidaMedReda](https://community.freefem.org/u/BelfaidaMedReda)
#### Post date: [May 6, 2025, 1:14pm UTC](https://community.freefem.org/t/whats-wrong-with-my-code/3902/3 "2025-05-06T13:14:31Z")

</div>

thank you so much, I realized now what was the issue!
