Question: Error, invalid input: diff expects 2 or more arguments, but received 1

Hi,

I get the error message "Error, invalid input: diff expects 2 or more arguments, but received 1" from the following program. Could you please help me? Thank you i,n advance for your help!

som:=0:

for b1 from 10 to 10 by 1 do
for b2 from 1 to 2 by 1 do
for alpha from 0.5 to 0.5 by 0.1 do
for beta from 0.33 to 0.5 by 0.1 do
for c from 1 to 1 by 1 do
for f from 1 to 10 by 1 do
for g from 1 to 10 by 0.1 do
for lambdaj from 0.2 to 0.4 by 0.1 do
for gammaj from 0.2 to 0.4 by 0.1 do

p:='p';

aiSQ:=(alpha*b1)/(alpha*b2+beta*b2+c);
ajSQ:=(beta*b1)/(alpha*b2+beta*b2+c);
UiSQ:=(1/2)*alpha*b1^2*(alpha^2*b2+2*alpha*beta*b2+c*alpha+beta^2*b2+2*beta*c)/(alpha*b2+beta*b2+c)^2;
UjSQ:=(1/2)*beta*b1^2*(alpha^2*b2+2*alpha*beta*b2+2*c*alpha+beta^2*b2+beta*c)/(alpha*b2+beta*b2+c)^2;
USQ:=(1/2)*b1^2*(alpha+beta)*(alpha*b2+beta*b2+2*c)/(alpha*b2+beta*b2+c)^2;
UTSQ:=UiSQ+UjSQ+USQ;

ai:=(-alpha*b2*f*p+alpha*b1*c-b2*f*p+b1*c)/(c*(alpha*b2+b2*beta+b2+c));
aj:=(alpha*b2*f*p+b1*beta*c+b2*f*p+c*f*p)/(c*(alpha*b2+b2*beta+b2+c));

aineg:=-(alpha*b2*f*lambdaj*p+b2*f*lambdaj*p+alpha*b1*c+b1*c)/(c*(alpha*b2*lambdaj-2*alpha*b2-b2*beta+b2*lambdaj-2*b2-c));
ajneg:=(alpha*b2*f*lambdaj*p+alpha*b1*c*lambdaj+b2*f*lambdaj*p+c*f*lambdaj*p-alpha*b1*c-b1*beta*c+b1*c*lambdaj-b1*c)/(c*(alpha*b2*lambdaj-2*alpha*b2-b2*beta+b2*lambdaj-2*b2-c));
uj:=beta*(b1*(aineg+ajneg)-(b2/2)*(aineg+ajneg)^2)-(c/2)*ajneg^2-p*f*(ajneg-aj);
uL:=(alpha+1)*(b1*(aineg+ajneg)-(b2/2)*(aineg+ajneg)^2)-(c/2)*aineg^2+p*f*(ajneg-aj);
eqtj:=gammaj*(uL-USQ)-((1-gammaj)/(1-lambdaj))*(uj-UjSQ)-tj;
tj:=solve(eqtj,tj);

dai:=diff(ai,p);
daj:=diff(aj,p);
daineg:=diff(aineg,p);
dajneg:=diff(ajneg,p);
dtj:=diff(tj,p);
Ujp:=beta*(b1*(ai+aj)-(b2/2)*(ai+aj)^2)-(c/2)*aj^2-p*f*(ajneg-aj)+(1-lambdaj)*tj;
ULp:=(alpha+1)*(b1*(ai+aj)-(b2/2)*(ai+aj)^2)-(c/2)*ai^2+p*f*(ajneg-aj)-tj-g*((p^2)/2);
eqp:=diff(ULp,p);
eqpp:=diff(eqp,p);
p:=solve(eqp,p);

CSQ:=b1-b2*(aiSQ+ajSQ);
Cabat:=b1-b2*(ai+aj);
Cneg:=b1-b2*(aineg+ajneg);

if (ai>aineg) then f*(aineg-ai)=0
else if (aj>ajneg) then f*(ajneg-aj)=0
else if (CSQ>0 and Cabat>0  and Cneg>0 and eqpp<0 and p>0 and p<1 and beta<alpha and aiSQ>0 and ajSQ>0 and ai>0 and aj>0 and aineg>0 and ajneg>0 and tj>0)
then
#print(b1,b2,alpha,beta,c,f,g,lambdaj,gammaj,p);
som:=som+1;
fi;fi;fi;
od;od;od;od;od;od;od;od;od;
som;
 

Please Wait...