Bonjour,

j'aimerais comme dit le titre convertir un programme matlab en python. Ma question est simple: à quoi sert la ligne " Dfun = @(a) 1 ", je ne la comprend pas et c'est embettant pour coder ça en python.
Merci d'avance pour vos réponses

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clear; clf; ISYM=2; nu=0.25; k2 = 2*(1-nu)/(1-2*nu) ;
numroots=8; sp = 5; sv = 0.01:0.01:sp; a0=(.2)^2;
for N=1:numroots
a0=N^2-.99;
for J=1:length(sv)
s2=sv(J)^2;
if N==1
Dfun= @(a) 1;
else
Dfun= @(a) prod( (a-xv(J,1:N-1) ) );
end
 
if ISYM==1
xv(J,N)=fzero(@(a) RL_sym1(a,s2,k2)/Dfun(a), a0);
else
xv(J,N)=fzero(@(a) RL_antisym1(a,s2,k2)/Dfun(a), a0);
end
a0=xv(J,N);
end
end
OMEGA=sqrt(xv); plot(sv,OMEGA, 'LineWidth',1.5); grid on
xlabel('\xi '); ylabel('\Omega'); title('plot of \Omega vs. wave number')