hojat

20 Reputation

3 Badges

1 years, 105 days

MaplePrimes Activity


These are replies submitted by hojat

@dharr You right. thank you for your answer

@dharr Yes function I2 has 12 variables that must be minimized. 

You right. I edited my code but after running the code same error occured again. my edited code replace with old code in my post.

@Carl Love You right. the error has been solved. thanks for your all guidances.

@Carl Love Thanks for your answer and i appreciate you for your time and help.the error(Could not store...) has been resolved, but the problem itself is still not solved yet!. is there any command in Maple to estimate numerical derivative or gardient? i used central difference method in above code i sent , but i get the error: Error, (in Optimization:-NLPSolve) no improved point could be found

 

restart;
with(Optimization);
with(Student[Calculus1]);
z1 := 0.15;
                           z1 := 0.15

z2 := 0.85;
                           z2 := 0.85

NULL;
Q := Matrix(3, 3, [1, 0, 0, 1, 1, 0, 1, 3, 3]);
P_S := Matrix(1, 3, [ps0, ps1, ps2]);
Phi_S := Matrix(3, 1, [1, t^(1 + gs1), t^(2 + gs2)]);
dz1Phi_S := t^z1*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gs1 + 2)/GAMMA(gs1 + 2 - z1), 0, 0, 0, GAMMA(gs2 + 3)/GAMMA(gs2 + 3 - z1)]);
dz2Phi_S := t^z2*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gs1 + 2)/GAMMA(gs1 + 2 - z2), 0, 0, 0, GAMMA(gs2 + 3)/GAMMA(gs2 + 3 - z2)]);
NULL;
P_I := Matrix(1, 3, [p_i0, p_i1, p_i2]);
Phi_I := Matrix(3, 1, [1, t^(1 + gi1), t^(2 + gi2)]);
NULL;
dz1Phi_I := t^z1*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gi1 + 2)/GAMMA(gi1 + 2 - z1), 0, 0, 0, GAMMA(gi2 + 3)/GAMMA(gi2 + 3 - z1)]);
dz2Phi_I := t^z2*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gi1 + 2)/GAMMA(gi1 + 2 - z2), 0, 0, 0, GAMMA(gi2 + 3)/GAMMA(gi2 + 3 - z2)]);
P_H := Matrix(1, 3, [ph0, ph1, ph2]);
Phi_H := Matrix(3, 1, [1, t^(1 + gh1), t^(2 + gh2)]);
dz1Phi_H := t^z1*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gh1 + 2)/GAMMA(gh1 + 2 - z1), 0, 0, 0, GAMMA(gh2 + 3)/GAMMA(gh2 + 3 - z1)]);
dz2Phi_H := t^z1*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gh1 + 2)/GAMMA(gh1 + 2 - z2), 0, 0, 0, GAMMA(gh2 + 3)/GAMMA(gh2 + 3 - z2)]);
P_L := Matrix(1, 3, [pl0, pl1, pl2]);
Phi_L := Matrix(3, 1, [1, t^(1 + gl1), t^(2 + gl2)]);
dz1Phi_L := t^z1*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gl1 + 2)/GAMMA(gl1 + 2 - z1), 0, 0, 0, GAMMA(gl2 + 3)/GAMMA(gl2 + 3 - z1)]);
dz2Phi_L := t^z1*Matrix(3, 3, [0, 0, 0, 0, GAMMA(gl1 + 2)/GAMMA(gl1 + 2 - z2), 0, 0, 0, GAMMA(gl2 + 3)/GAMMA(gl2 + 3 - z2)]);
S := (P_S . Q) . Phi_S;
NULL;
ds1 := simplify(((P_S . Q) . dz1Phi_S) . Phi_S, GAMMA);
ds2 := simplify(((P_S . Q) . dz2Phi_S) . Phi_S);
H := (P_H . Q) . Phi_H;
NULL;
NULL;
dh1 := simplify(((P_H . Q) . dz1Phi_H) . Phi_H, GAMMA);
dh2 := simplify(((P_H . Q) . dz2Phi_H) . Phi_H);
NULL;
L := (P_L . Q) . Phi_L;
NULL;
dl1 := simplify(((P_L . Q) . dz1Phi_L) . Phi_L, GAMMA);
dl2 := simplify(((P_L . Q) . dz2Phi_L) . Phi_L);
NULL;
I3 := (P_I . Q) . Phi_I;
di1 := simplify(((P_I . Q) . dz1Phi_I) . Phi_I, GAMMA);
di2 := simplify(((P_I . Q) . dz2Phi_I) . Phi_I);
RS1 := ds1 + (-0.0043217^z1 + ((0.125^z1*S) . I3) + (0.002^z1 + 0.0008^z1)*S);
RS2 := ds2 + (-0.0043217^z2 + ((0.125^z2*S) . I3) + (0.002^z2 + 0.0008^z2)*S);
RH1 := dh1 + (-0.535^z1 + ((0.0056^z1*H) . I3) - 0.35^z1 + (0.002^z1 + 0.0008^z1)*H);
RH2 := dh2 + (-0.535^z2 + ((0.0056^z2*H) . I3) - 0.35^z2 + (0.002^z2 + 0.0008^z2)*H);
RI1 := di1 + (-((0.125^z1*S) . I3) - ((0.0056^z1*H) . I3) - 0.029^z1*L + (0.002^z1 + 0.0008^z1 + 0.025^z1 + 0.35^z1)*I3);
RI2 := di2 + (-((0.125^z2*S) . I3) - ((0.0056^z2*H) . I3) - 0.029^z2*L + (0.002^z2 + 0.0008^z2 + 0.025^z2 + 0.35^z2)*I3);
RL1 := dl1 + (-0.025^z1*I3 + (0.002^z1 + 0.0008^z1 + 0.029^z1)*L);
RL2 := dl2 + (-0.025^z2*I3 + (0.002^z2 + 0.0008^z2 + 0.029^z2)*L);
R15 := evalf(RH1^2 + RI1^2 + RL1^2 + RS1^2, 4);

I1 := evalf(ApproximateInt(R15[1, 1], t = 0 .. 1), 4);
NULL;
h := 0.01;
B := zeros([1, 20]);
A := Matrix(1, 20, [ps0, ps1, ps2, p_i0, p_i1, p_i2, ph0, ph1, ph2, pl0, pl1, pl2, gs1, gs2, gi1, gi2, gh1, gh2, gl1, gl2]);
NULL;
for i to 20 do
    B[1, i] := evalf(diff(I1, A[1, i]), 4);
end do;
NULL;
NLPSolve(I1, {B[1, 1] = 0, B[1, 2] = 0, B[1, 3] = 0, B[1, 4] = 0, B[1, 5] = 0, B[1, 6] = 0, B[1, 7] = 0, B[1, 8] = 0, B[1, 9] = 0, B[1, 10] = 0, B[1, 11] = 0, B[1, 12] = 0, B[1, 13] = 0, B[1, 14] = 0, B[1, 15] = 0, B[1, 16] = 0, B[1, 17] = 0, B[1, 18] = 0, B[1, 19] = 0, B[1, 20] = 0});
Error, (in Optimization:-NLPSolve) could not store .2000*(4.61629127484374902+.6380*(.100000000000000019e-1*Gamma(3.)*Gamma(3.85)+.375000000000000116e-3*Gamma(4.)*Gamma(2.85))/Gamma(2.85)/Gamma(3.85))*(.6380*(.100000000000000019e-1*Gamma(3.)*D(Gamma)(3.85)+.375000000000000116e-3*D(Gamma)(4.)*Gamma(2.85)-.112350000000000015e-2*Gamma(4.)*Gamma(2.85))/Gamma(2.85)/Gamma(3.85)-.6380*(.100000000000000019e-1*Gamma(3.)*Gamma(3.85)+.375000000000000116e-3*Gamma(4.)*Gamma(2.85))/Gamma(2.85)/Gamma(3.85)^2*D(Gamma)(3.85)-.238097850000000034e-2)+.198207906600000037e-3*(.100000000000000019e-1*Gamma(3.)*Gamma(3.85)+.375000000000000116e-3*Gamma(4.)*Gamma(2.8...
NULL;
NULL;

NULL;

@Carl Love In this code i replaced "Gamma" to"GAMMA" syntax but same error(could not store) ocuured again

@Carl Love i replaced Gamma to GAMMA but the error repeated

@Carl Love"I used Gamma functions in my Maple code, each of which includes variables that are supposed to be differentiated with respect to, and finally, I used the command NLPSolve."

@Carl Love Thank you for your answer. by changing "Gamma" to "GAMMA" the error accured again!

Page 1 of 1