Numerical Minimization of Large ExpressionCombined numerical minimization and maximizationusing array elements in minimization$L_infty$ norm minimizationNumerical Instability?Simple minimization not evaluatingMinimization and integrationIssue with numerical minimizationMinimization over the integersProducing a smooth curve from numerical minimizationoptimization problem with NDSolve and Import cannot get any results, even without error message
How do researchers send unsolicited emails asking for feedback on their works?
PTIJ: Where did Achashverosh's years wander off to?
Which partition to make active?
Would mining huge amounts of resources on the Moon change its orbit?
Pre-Employment Background Check With Consent For Future Checks
How to balance a monster modification (zombie)?
Are hand made posters acceptable in Academia?
Will my managed file get deleted?
Why is participating in the European Parliamentary elections used as a threat?
What is this high flying aircraft over Pennsylvania?
Single word to change groups
Mortal danger in mid-grade literature
How are passwords stolen from companies if they only store hashes?
Print last inputted byte
Do I need an EFI partition for each 18.04 ubuntu I have on my HD?
What is the difference between something being completely legal and being completely decriminalized?
When is composition of meromorphic functions meromorphic
Have any astronauts/cosmonauts died in space?
Should a narrator ever describe things based on a characters view instead of fact?
Determine voltage drop over 10G resistors with cheap multimeter
Unfrosted light bulb
How to understand 「僕は誰より彼女が好きなんだ。」
Weird lines in Microsoft Word
UK Tourist Visa- Enquiry
Numerical Minimization of Large Expression
Combined numerical minimization and maximizationusing array elements in minimization$L_infty$ norm minimizationNumerical Instability?Simple minimization not evaluatingMinimization and integrationIssue with numerical minimizationMinimization over the integersProducing a smooth curve from numerical minimizationoptimization problem with NDSolve and Import cannot get any results, even without error message
$begingroup$
I want to minimize a function which contains ArcTan
functions. The function is also very complicated.
I have the following code.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q=x1[t],y1[t],x2[t],y2[t],x3[t],y3[t],x4[t],y4[t],x5[t],y5[t],x6[t],y6[t];
CE =
-0.609155 + x1[t]^2 + y1[t]^2,
-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] + y2[t])^2,
-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 + y2[t])^2,
-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] + y6[t])^2,
-0.428366 + ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]],
-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] + y4[t])^2,
-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] + y5[t])^2,
-0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]],
-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] + y6[t])^2,
-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] + y3[t])^2,
-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]]
;
y6Start = 0.15 LenFact;
VPenalty=3.90351 + 1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2)^2 + (-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 [Degree] < [Theta]1 < 180 [Degree],
20 [Degree] < [Theta]21 < 95 [Degree],
145 [Degree] < [Theta]3 < 180 [Degree],
80 [Degree] < [Theta]5 < 100 [Degree], 0 < y6[t] < y6Start,
q, Reals, MaxIterations -> 10^4]
It is running for several hours with no result. Can any body suggest any specific way of minimizing such large scale expression? I also could not give initial points. It is always showing syntax error. Is it not possible to give one initial point only for each variable?
mathematical-optimization
$endgroup$
add a comment |
$begingroup$
I want to minimize a function which contains ArcTan
functions. The function is also very complicated.
I have the following code.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q=x1[t],y1[t],x2[t],y2[t],x3[t],y3[t],x4[t],y4[t],x5[t],y5[t],x6[t],y6[t];
CE =
-0.609155 + x1[t]^2 + y1[t]^2,
-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] + y2[t])^2,
-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 + y2[t])^2,
-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] + y6[t])^2,
-0.428366 + ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]],
-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] + y4[t])^2,
-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] + y5[t])^2,
-0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]],
-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] + y6[t])^2,
-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] + y3[t])^2,
-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]]
;
y6Start = 0.15 LenFact;
VPenalty=3.90351 + 1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2)^2 + (-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 [Degree] < [Theta]1 < 180 [Degree],
20 [Degree] < [Theta]21 < 95 [Degree],
145 [Degree] < [Theta]3 < 180 [Degree],
80 [Degree] < [Theta]5 < 100 [Degree], 0 < y6[t] < y6Start,
q, Reals, MaxIterations -> 10^4]
It is running for several hours with no result. Can any body suggest any specific way of minimizing such large scale expression? I also could not give initial points. It is always showing syntax error. Is it not possible to give one initial point only for each variable?
mathematical-optimization
$endgroup$
$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
And what abouty6Start
?
$endgroup$
– Henrik Schumacher
2 days ago
2
$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
y6Start = 0.15 LenFact; This is about finding the static equilibrium of a mechanism. Static equilibrium states can be found by minimizing the potential energy function.
$endgroup$
– Soumyajit Roy
2 days ago
add a comment |
$begingroup$
I want to minimize a function which contains ArcTan
functions. The function is also very complicated.
I have the following code.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q=x1[t],y1[t],x2[t],y2[t],x3[t],y3[t],x4[t],y4[t],x5[t],y5[t],x6[t],y6[t];
CE =
-0.609155 + x1[t]^2 + y1[t]^2,
-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] + y2[t])^2,
-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 + y2[t])^2,
-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] + y6[t])^2,
-0.428366 + ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]],
-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] + y4[t])^2,
-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] + y5[t])^2,
-0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]],
-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] + y6[t])^2,
-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] + y3[t])^2,
-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]]
;
y6Start = 0.15 LenFact;
VPenalty=3.90351 + 1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2)^2 + (-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 [Degree] < [Theta]1 < 180 [Degree],
20 [Degree] < [Theta]21 < 95 [Degree],
145 [Degree] < [Theta]3 < 180 [Degree],
80 [Degree] < [Theta]5 < 100 [Degree], 0 < y6[t] < y6Start,
q, Reals, MaxIterations -> 10^4]
It is running for several hours with no result. Can any body suggest any specific way of minimizing such large scale expression? I also could not give initial points. It is always showing syntax error. Is it not possible to give one initial point only for each variable?
mathematical-optimization
$endgroup$
I want to minimize a function which contains ArcTan
functions. The function is also very complicated.
I have the following code.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q=x1[t],y1[t],x2[t],y2[t],x3[t],y3[t],x4[t],y4[t],x5[t],y5[t],x6[t],y6[t];
CE =
-0.609155 + x1[t]^2 + y1[t]^2,
-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] + y2[t])^2,
-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 + y2[t])^2,
-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] + y6[t])^2,
-0.428366 + ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]],
-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] + y4[t])^2,
-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] + y5[t])^2,
-0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]],
-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] + y6[t])^2,
-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] + y3[t])^2,
-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]]
;
y6Start = 0.15 LenFact;
VPenalty=3.90351 + 1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2)^2 + (-1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 [Degree] < [Theta]1 < 180 [Degree],
20 [Degree] < [Theta]21 < 95 [Degree],
145 [Degree] < [Theta]3 < 180 [Degree],
80 [Degree] < [Theta]5 < 100 [Degree], 0 < y6[t] < y6Start,
q, Reals, MaxIterations -> 10^4]
It is running for several hours with no result. Can any body suggest any specific way of minimizing such large scale expression? I also could not give initial points. It is always showing syntax error. Is it not possible to give one initial point only for each variable?
mathematical-optimization
mathematical-optimization
edited 2 days ago
Soumyajit Roy
asked 2 days ago
Soumyajit RoySoumyajit Roy
1809
1809
$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
And what abouty6Start
?
$endgroup$
– Henrik Schumacher
2 days ago
2
$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
y6Start = 0.15 LenFact; This is about finding the static equilibrium of a mechanism. Static equilibrium states can be found by minimizing the potential energy function.
$endgroup$
– Soumyajit Roy
2 days ago
add a comment |
$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
And what abouty6Start
?
$endgroup$
– Henrik Schumacher
2 days ago
2
$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
y6Start = 0.15 LenFact; This is about finding the static equilibrium of a mechanism. Static equilibrium states can be found by minimizing the potential energy function.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
And what about
y6Start
?$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
And what about
y6Start
?$endgroup$
– Henrik Schumacher
2 days ago
2
2
$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
y6Start = 0.15 LenFact; This is about finding the static equilibrium of a mechanism. Static equilibrium states can be found by minimizing the potential energy function.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
y6Start = 0.15 LenFact; This is about finding the static equilibrium of a mechanism. Static equilibrium states can be found by minimizing the potential energy function.
$endgroup$
– Soumyajit Roy
2 days ago
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
I corrected typos. The code is fast and gives an answer, albeit with messages.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q = x1[t], y1[t], x2[t], y2[t], x3[t], y3[t], x4[t], y4[t], x5[t],
y5[t], x6[t],
y6[t]; CE = -0.609155 + x1[t]^2 +
y1[t]^2, -0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2, -1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2, -1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2, -0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] +
y6[t]], -0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2, -0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2, -0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] +
y5[t]], -0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2, -0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2, -ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]];
VPenalty = 3.90351 +
1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 +
x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] +
x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] +
x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] +
x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] +
x5[t])^2 + (-y4[t] + y5[t])^2)^2 + (-1.88925 + (-x1[t] +
x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] +
x6[t])^2 + (-y5[t] + y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
With[y6Start = 0.15 LenFact,
eqbr = NMinimize[VPenalty[[1, 1]],
Flatten[CE] == Table[0, Length[CE]], Pi/2 < [Theta]1 < Pi,
20*Pi/180 < [Theta]21 < 95*Pi/180, 145*Pi/180 < [Theta]3 < Pi,
80*Pi/180 < [Theta]5 < 100*Pi/180, 0 < y6[t] < y6Start, q,
Reals]]
(*1652.07, x1[t] -> -0.729157, y1[t] -> 0.278358, x2[t] -> -0.573507,
y2[t] -> 0.397027, x3[t] -> -0.457944, y3[t] -> 0.374765,
x4[t] -> 0.423225, y4[t] -> 0.460944, x5[t] -> 0.60875,
y5[t] -> 0.431194, x6[t] -> 0.611298, y6[t] -> 0.582379*)
$endgroup$
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
HereVPenalty[]
is a non-linear function, so the min can be local.
$endgroup$
– Alex Trounev
2 days ago
add a comment |
$begingroup$
The method "RandomSearch"
usually gives a result reasonably quickly (other than using FindMinimum
). It's less robust, though, than the other methods. The following takes about 30 sec.
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °,
145 ° < θ3 < 180 °, 80 ° < θ5 < 100 °, 0 < y6[t] < y6Start, q,
Method -> "RandomSearch"]
NMinimize::incst: NMinimize was unable to generate any initial points satisfying the inequality constraints...
(*
161.292, x1[t] -> -0.718754, y1[t] -> 0.30422, x2[t] -> -0.567146,
y2[t] -> 0.427983, x3[t] -> -0.452162, y3[t] -> 0.402877,
x4[t] -> 0.424915, y4[t] -> 0.523793, x5[t] -> 0.611471,
y5[t] -> 0.501395, x6[t] -> 0.610863, y6[t] -> 0.652602
*)
While NMinimize
did not find good starting points, it found a solution within the constraints:
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °, 145 ° < θ3 < 180 °,
80 ° < θ5 < 100 °, 0 < y6[t] < y6Start /.
Last@eqbr
(* True, True, True, True, True *)
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193379%2fnumerical-minimization-of-large-expression%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
I corrected typos. The code is fast and gives an answer, albeit with messages.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q = x1[t], y1[t], x2[t], y2[t], x3[t], y3[t], x4[t], y4[t], x5[t],
y5[t], x6[t],
y6[t]; CE = -0.609155 + x1[t]^2 +
y1[t]^2, -0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2, -1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2, -1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2, -0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] +
y6[t]], -0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2, -0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2, -0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] +
y5[t]], -0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2, -0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2, -ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]];
VPenalty = 3.90351 +
1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 +
x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] +
x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] +
x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] +
x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] +
x5[t])^2 + (-y4[t] + y5[t])^2)^2 + (-1.88925 + (-x1[t] +
x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] +
x6[t])^2 + (-y5[t] + y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
With[y6Start = 0.15 LenFact,
eqbr = NMinimize[VPenalty[[1, 1]],
Flatten[CE] == Table[0, Length[CE]], Pi/2 < [Theta]1 < Pi,
20*Pi/180 < [Theta]21 < 95*Pi/180, 145*Pi/180 < [Theta]3 < Pi,
80*Pi/180 < [Theta]5 < 100*Pi/180, 0 < y6[t] < y6Start, q,
Reals]]
(*1652.07, x1[t] -> -0.729157, y1[t] -> 0.278358, x2[t] -> -0.573507,
y2[t] -> 0.397027, x3[t] -> -0.457944, y3[t] -> 0.374765,
x4[t] -> 0.423225, y4[t] -> 0.460944, x5[t] -> 0.60875,
y5[t] -> 0.431194, x6[t] -> 0.611298, y6[t] -> 0.582379*)
$endgroup$
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
HereVPenalty[]
is a non-linear function, so the min can be local.
$endgroup$
– Alex Trounev
2 days ago
add a comment |
$begingroup$
I corrected typos. The code is fast and gives an answer, albeit with messages.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q = x1[t], y1[t], x2[t], y2[t], x3[t], y3[t], x4[t], y4[t], x5[t],
y5[t], x6[t],
y6[t]; CE = -0.609155 + x1[t]^2 +
y1[t]^2, -0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2, -1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2, -1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2, -0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] +
y6[t]], -0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2, -0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2, -0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] +
y5[t]], -0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2, -0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2, -ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]];
VPenalty = 3.90351 +
1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 +
x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] +
x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] +
x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] +
x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] +
x5[t])^2 + (-y4[t] + y5[t])^2)^2 + (-1.88925 + (-x1[t] +
x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] +
x6[t])^2 + (-y5[t] + y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
With[y6Start = 0.15 LenFact,
eqbr = NMinimize[VPenalty[[1, 1]],
Flatten[CE] == Table[0, Length[CE]], Pi/2 < [Theta]1 < Pi,
20*Pi/180 < [Theta]21 < 95*Pi/180, 145*Pi/180 < [Theta]3 < Pi,
80*Pi/180 < [Theta]5 < 100*Pi/180, 0 < y6[t] < y6Start, q,
Reals]]
(*1652.07, x1[t] -> -0.729157, y1[t] -> 0.278358, x2[t] -> -0.573507,
y2[t] -> 0.397027, x3[t] -> -0.457944, y3[t] -> 0.374765,
x4[t] -> 0.423225, y4[t] -> 0.460944, x5[t] -> 0.60875,
y5[t] -> 0.431194, x6[t] -> 0.611298, y6[t] -> 0.582379*)
$endgroup$
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
HereVPenalty[]
is a non-linear function, so the min can be local.
$endgroup$
– Alex Trounev
2 days ago
add a comment |
$begingroup$
I corrected typos. The code is fast and gives an answer, albeit with messages.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q = x1[t], y1[t], x2[t], y2[t], x3[t], y3[t], x4[t], y4[t], x5[t],
y5[t], x6[t],
y6[t]; CE = -0.609155 + x1[t]^2 +
y1[t]^2, -0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2, -1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2, -1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2, -0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] +
y6[t]], -0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2, -0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2, -0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] +
y5[t]], -0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2, -0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2, -ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]];
VPenalty = 3.90351 +
1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 +
x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] +
x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] +
x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] +
x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] +
x5[t])^2 + (-y4[t] + y5[t])^2)^2 + (-1.88925 + (-x1[t] +
x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] +
x6[t])^2 + (-y5[t] + y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
With[y6Start = 0.15 LenFact,
eqbr = NMinimize[VPenalty[[1, 1]],
Flatten[CE] == Table[0, Length[CE]], Pi/2 < [Theta]1 < Pi,
20*Pi/180 < [Theta]21 < 95*Pi/180, 145*Pi/180 < [Theta]3 < Pi,
80*Pi/180 < [Theta]5 < 100*Pi/180, 0 < y6[t] < y6Start, q,
Reals]]
(*1652.07, x1[t] -> -0.729157, y1[t] -> 0.278358, x2[t] -> -0.573507,
y2[t] -> 0.397027, x3[t] -> -0.457944, y3[t] -> 0.374765,
x4[t] -> 0.423225, y4[t] -> 0.460944, x5[t] -> 0.60875,
y5[t] -> 0.431194, x6[t] -> 0.611298, y6[t] -> 0.582379*)
$endgroup$
I corrected typos. The code is fast and gives an answer, albeit with messages.
LenFact = 1.3745/0.31571;
xC = 0.157392 LenFact; yC = 0.035495 LenFact;
q = x1[t], y1[t], x2[t], y2[t], x3[t], y3[t], x4[t], y4[t], x5[t],
y5[t], x6[t],
y6[t]; CE = -0.609155 + x1[t]^2 +
y1[t]^2, -0.0383062 + (-x1[t] + x2[t])^2 + (-y1[t] +
y2[t])^2, -1.64323 + (-0.685234 + x2[t])^2 + (-0.154534 +
y2[t])^2, -1.88925 + (-x1[t] + x6[t])^2 + (-y1[t] +
y6[t])^2, -0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] +
y6[t]], -0.783885 + (-x3[t] + x4[t])^2 + (-y3[t] +
y4[t])^2, -0.0353049 + (-x4[t] + x5[t])^2 + (-y4[t] +
y5[t])^2, -0.25649 + ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] +
y5[t]], -0.0228637 + (-x5[t] + x6[t])^2 + (-y5[t] +
y6[t])^2, -0.0138516 + (-x2[t] + x3[t])^2 + (-y2[t] +
y3[t])^2, -ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]];
VPenalty = 3.90351 +
1.13817*10^6 (2.74102 - 1. ArcTan[x1[t], y1[t]])^2 +
3006.52 (2.92648 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]])^2 +
1082.47 (2.78921 -
1. ArcTan[-0.685234 + x3[t], -0.154534 + y3[t]] +
ArcTan[-1. x3[t] + x4[t], -1. y3[t] + y4[t]])^2 +
6825.76 (2.48452 - 1. ArcTan[x1[t], y1[t]] +
ArcTan[-1. x1[t] + x6[t], -1. y1[t] + y6[t]])^2 +
239.418 y1[t] + 29.1166 y2[t] + 6.00899 y3[t] + 7.28423 y4[t] +
4.93484 y5[t] + 97.0584 y6[t] +
1.90484*10^8 ((-ArcTan[0.685234 - x2[t], 0.154534 - y2[t]] +
ArcTan[-x2[t] + x3[t], -y2[t] + y3[t]])^2 + (-0.25649 +
ArcTan[-x3[t] + x4[t], -y3[t] + y4[t]] -
ArcTan[-x4[t] + x5[t], -y4[t] + y5[t]])^2 + (-0.428366 +
ArcTan[-x1[t] + x2[t], -y1[t] + y2[t]] -
ArcTan[-x1[t] + x6[t], -y1[t] + y6[t]])^2 + (-0.609155 +
x1[t]^2 +
y1[t]^2)^2 + (-1.64323 + (-0.685234 +
x2[t])^2 + (-0.154534 +
y2[t])^2)^2 + (-0.0383062 + (-x1[t] +
x2[t])^2 + (-y1[t] +
y2[t])^2)^2 + (-0.0138516 + (-x2[t] +
x3[t])^2 + (-y2[t] +
y3[t])^2)^2 + (-0.783885 + (-x3[t] +
x4[t])^2 + (-y3[t] +
y4[t])^2)^2 + (-0.0353049 + (-x4[t] +
x5[t])^2 + (-y4[t] + y5[t])^2)^2 + (-1.88925 + (-x1[t] +
x6[t])^2 + (-y1[t] +
y6[t])^2)^2 + (-0.0228637 + (-x5[t] +
x6[t])^2 + (-y5[t] + y6[t])^2)^2);
[Theta]1 = ArcTan[x1[t], y1[t]];
[Theta]21 = ArcTan[x2[t] - x1[t], y2[t] - y1[t]];
[Theta]3 = ArcTan[x3[t] - xC, y3[t] - yC];
[Theta]22 = ArcTan[x6[t] - x1[t], y6[t] - y1[t]];
[Theta]41 = ArcTan[x4[t] - x3[t], y4[t] - y3[t]];
[Theta]42 = ArcTan[x5[t] - x4[t], y5[t] - y4[t]];
[Theta]5 = ArcTan[x6[t] - x5[t], y6[t] - y5[t]];
With[y6Start = 0.15 LenFact,
eqbr = NMinimize[VPenalty[[1, 1]],
Flatten[CE] == Table[0, Length[CE]], Pi/2 < [Theta]1 < Pi,
20*Pi/180 < [Theta]21 < 95*Pi/180, 145*Pi/180 < [Theta]3 < Pi,
80*Pi/180 < [Theta]5 < 100*Pi/180, 0 < y6[t] < y6Start, q,
Reals]]
(*1652.07, x1[t] -> -0.729157, y1[t] -> 0.278358, x2[t] -> -0.573507,
y2[t] -> 0.397027, x3[t] -> -0.457944, y3[t] -> 0.374765,
x4[t] -> 0.423225, y4[t] -> 0.460944, x5[t] -> 0.60875,
y5[t] -> 0.431194, x6[t] -> 0.611298, y6[t] -> 0.582379*)
answered 2 days ago
Alex TrounevAlex Trounev
7,9031521
7,9031521
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
HereVPenalty[]
is a non-linear function, so the min can be local.
$endgroup$
– Alex Trounev
2 days ago
add a comment |
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
HereVPenalty[]
is a non-linear function, so the min can be local.
$endgroup$
– Alex Trounev
2 days ago
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
Thanks Alex. At least the constraints are matching to a reasonable degree. Although I am still not sure about the obtained value of Vtotal to be the global one.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
Here
VPenalty[]
is a non-linear function, so the min can be local.$endgroup$
– Alex Trounev
2 days ago
$begingroup$
Here
VPenalty[]
is a non-linear function, so the min can be local.$endgroup$
– Alex Trounev
2 days ago
add a comment |
$begingroup$
The method "RandomSearch"
usually gives a result reasonably quickly (other than using FindMinimum
). It's less robust, though, than the other methods. The following takes about 30 sec.
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °,
145 ° < θ3 < 180 °, 80 ° < θ5 < 100 °, 0 < y6[t] < y6Start, q,
Method -> "RandomSearch"]
NMinimize::incst: NMinimize was unable to generate any initial points satisfying the inequality constraints...
(*
161.292, x1[t] -> -0.718754, y1[t] -> 0.30422, x2[t] -> -0.567146,
y2[t] -> 0.427983, x3[t] -> -0.452162, y3[t] -> 0.402877,
x4[t] -> 0.424915, y4[t] -> 0.523793, x5[t] -> 0.611471,
y5[t] -> 0.501395, x6[t] -> 0.610863, y6[t] -> 0.652602
*)
While NMinimize
did not find good starting points, it found a solution within the constraints:
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °, 145 ° < θ3 < 180 °,
80 ° < θ5 < 100 °, 0 < y6[t] < y6Start /.
Last@eqbr
(* True, True, True, True, True *)
$endgroup$
add a comment |
$begingroup$
The method "RandomSearch"
usually gives a result reasonably quickly (other than using FindMinimum
). It's less robust, though, than the other methods. The following takes about 30 sec.
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °,
145 ° < θ3 < 180 °, 80 ° < θ5 < 100 °, 0 < y6[t] < y6Start, q,
Method -> "RandomSearch"]
NMinimize::incst: NMinimize was unable to generate any initial points satisfying the inequality constraints...
(*
161.292, x1[t] -> -0.718754, y1[t] -> 0.30422, x2[t] -> -0.567146,
y2[t] -> 0.427983, x3[t] -> -0.452162, y3[t] -> 0.402877,
x4[t] -> 0.424915, y4[t] -> 0.523793, x5[t] -> 0.611471,
y5[t] -> 0.501395, x6[t] -> 0.610863, y6[t] -> 0.652602
*)
While NMinimize
did not find good starting points, it found a solution within the constraints:
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °, 145 ° < θ3 < 180 °,
80 ° < θ5 < 100 °, 0 < y6[t] < y6Start /.
Last@eqbr
(* True, True, True, True, True *)
$endgroup$
add a comment |
$begingroup$
The method "RandomSearch"
usually gives a result reasonably quickly (other than using FindMinimum
). It's less robust, though, than the other methods. The following takes about 30 sec.
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °,
145 ° < θ3 < 180 °, 80 ° < θ5 < 100 °, 0 < y6[t] < y6Start, q,
Method -> "RandomSearch"]
NMinimize::incst: NMinimize was unable to generate any initial points satisfying the inequality constraints...
(*
161.292, x1[t] -> -0.718754, y1[t] -> 0.30422, x2[t] -> -0.567146,
y2[t] -> 0.427983, x3[t] -> -0.452162, y3[t] -> 0.402877,
x4[t] -> 0.424915, y4[t] -> 0.523793, x5[t] -> 0.611471,
y5[t] -> 0.501395, x6[t] -> 0.610863, y6[t] -> 0.652602
*)
While NMinimize
did not find good starting points, it found a solution within the constraints:
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °, 145 ° < θ3 < 180 °,
80 ° < θ5 < 100 °, 0 < y6[t] < y6Start /.
Last@eqbr
(* True, True, True, True, True *)
$endgroup$
The method "RandomSearch"
usually gives a result reasonably quickly (other than using FindMinimum
). It's less robust, though, than the other methods. The following takes about 30 sec.
eqbr = NMinimize[VPenalty[[1, 1]], Flatten[CE] == 0,
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °,
145 ° < θ3 < 180 °, 80 ° < θ5 < 100 °, 0 < y6[t] < y6Start, q,
Method -> "RandomSearch"]
NMinimize::incst: NMinimize was unable to generate any initial points satisfying the inequality constraints...
(*
161.292, x1[t] -> -0.718754, y1[t] -> 0.30422, x2[t] -> -0.567146,
y2[t] -> 0.427983, x3[t] -> -0.452162, y3[t] -> 0.402877,
x4[t] -> 0.424915, y4[t] -> 0.523793, x5[t] -> 0.611471,
y5[t] -> 0.501395, x6[t] -> 0.610863, y6[t] -> 0.652602
*)
While NMinimize
did not find good starting points, it found a solution within the constraints:
90 ° < θ1 < 180 °, 20 ° < θ21 < 95 °, 145 ° < θ3 < 180 °,
80 ° < θ5 < 100 °, 0 < y6[t] < y6Start /.
Last@eqbr
(* True, True, True, True, True *)
answered 2 days ago
Michael E2Michael E2
149k12200480
149k12200480
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193379%2fnumerical-minimization-of-large-expression%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
2 days ago
$begingroup$
And what about
y6Start
?$endgroup$
– Henrik Schumacher
2 days ago
2
$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
2 days ago
$begingroup$
y6Start = 0.15 LenFact; This is about finding the static equilibrium of a mechanism. Static equilibrium states can be found by minimizing the potential energy function.
$endgroup$
– Soumyajit Roy
2 days ago