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

My adviser wants to be the first author

If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?

Have the tides ever turned twice on any open problem?

How to explain that I do not want to visit a country due to personal safety concern?

Fastest way to pop N items from a large dict

Are all passive ability checks floors for active ability checks?

How to write cleanly even if my character uses expletive language?

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Why Choose Less Effective Armour Types?

Draw saving money pig (Piggy Bank)

Why is the President allowed to veto a cancellation of emergency powers?

Bacteria contamination inside a thermos bottle

Min function accepting varying number of arguments in C++17

Simplify an interface for flexibly applying rules to periods of time

Have researchers managed to "reverse time"? If so, what does that mean for physics?

What is the Japanese sound word for the clinking of money?

What is the adequate fee for a reveal operation?

Unexpected result from ArcLength

How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?

Why did it take so long to abandon sail after steamships were demonstrated?

How to solve this challenging limit?

Passing arguments from one script to another

Pauli exclusion principle

How to make healing in an exploration game interesting



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













1












$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?










share|improve this question











$endgroup$











  • $begingroup$
    I am sorry. I have incorporated CE in the code now.
    $endgroup$
    – Soumyajit Roy
    4 hours ago










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    4 hours ago






  • 1




    $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
    4 hours 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
    4 hours ago















1












$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?










share|improve this question











$endgroup$











  • $begingroup$
    I am sorry. I have incorporated CE in the code now.
    $endgroup$
    – Soumyajit Roy
    4 hours ago










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    4 hours ago






  • 1




    $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
    4 hours 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
    4 hours ago













1












1








1





$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?










share|improve this question











$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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 4 hours ago







Soumyajit Roy

















asked 4 hours ago









Soumyajit RoySoumyajit Roy

1809




1809











  • $begingroup$
    I am sorry. I have incorporated CE in the code now.
    $endgroup$
    – Soumyajit Roy
    4 hours ago










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    4 hours ago






  • 1




    $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
    4 hours 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
    4 hours ago
















  • $begingroup$
    I am sorry. I have incorporated CE in the code now.
    $endgroup$
    – Soumyajit Roy
    4 hours ago










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    4 hours ago






  • 1




    $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
    4 hours 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
    4 hours ago















$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
4 hours ago




$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
4 hours ago












$begingroup$
And what about y6Start?
$endgroup$
– Henrik Schumacher
4 hours ago




$begingroup$
And what about y6Start?
$endgroup$
– Henrik Schumacher
4 hours ago




1




1




$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
4 hours 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
4 hours 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
4 hours 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
4 hours ago










2 Answers
2






active

oldest

votes


















2












$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*)





share|improve this answer









$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
    3 hours ago










  • $begingroup$
    Here VPenalty[] is a non-linear function, so the min can be local.
    $endgroup$
    – Alex Trounev
    2 hours ago


















2












$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 *)





share|improve this answer









$endgroup$












    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
    );



    );













    draft saved

    draft discarded


















    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









    2












    $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*)





    share|improve this answer









    $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
      3 hours ago










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      2 hours ago















    2












    $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*)





    share|improve this answer









    $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
      3 hours ago










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      2 hours ago













    2












    2








    2





    $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*)





    share|improve this answer









    $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*)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 3 hours ago









    Alex TrounevAlex Trounev

    7,8831521




    7,8831521











    • $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
      3 hours ago










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      2 hours 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
      3 hours ago










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      2 hours 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
    3 hours 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
    3 hours ago












    $begingroup$
    Here VPenalty[] is a non-linear function, so the min can be local.
    $endgroup$
    – Alex Trounev
    2 hours ago




    $begingroup$
    Here VPenalty[] is a non-linear function, so the min can be local.
    $endgroup$
    – Alex Trounev
    2 hours ago











    2












    $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 *)





    share|improve this answer









    $endgroup$

















      2












      $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 *)





      share|improve this answer









      $endgroup$















        2












        2








        2





        $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 *)





        share|improve this answer









        $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 *)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        Michael E2Michael E2

        149k12200479




        149k12200479



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Era Viking Índice Início da Era Viquingue | Cotidiano | Sociedade | Língua | Religião | A arte | As primeiras cidades | As viagens dos viquingues | Viquingues do Oeste e Leste | Fim da Era Viquingue | Fontes históricas | Referências Bibliografia | Ligações externas | Menu de navegação«Sverige då!»«Handel I vikingetid»«O que é Nórdico Antigo»Mito, magia e religião na volsunga saga Um olhar sobre a trajetória mítica do herói sigurd«Bonden var den verklige vikingen»«Vikingatiden»«Vikingatiden»«Vinland»«Guerreiras de Óðinn: As Valkyrjor na Mitologia Viking»1519-9053«Esculpindo símbolos e seres: A arte viking em pedras rúnicas»1679-9313Historia - Tema: VikingarnaAventura e Magia no Mundo das Sagas IslandesasEra Vikinge

            What's the metal clinking sound at the end of credits in Avengers: Endgame?What makes Thanos so strong in Avengers: Endgame?Who is the character that appears at the end of Endgame?What happens to Mjolnir (Thor's hammer) at the end of Endgame?The People's Ages in Avengers: EndgameWhat did Nebula do in Avengers: Endgame?Messing with time in the Avengers: Endgame climaxAvengers: Endgame timelineWhat are the time-travel rules in Avengers Endgame?Why use this song in Avengers: Endgame Opening Logo Sequence?Peggy's age in Avengers Endgame

            Are there legal definitions of ethnicities/races? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Legal definitions in the United StatesAre there truly legal limits on US interest rates?Are gender identity and sexual orientation federally protected?Why is there an apparent legal bias against digital services?What limits are there to the powers of individual judges in the United States legal system?Are women only scholarships legal under Irish / EU law?Is the term “race” defined by Public Law enacted by Congress of the United StatesIs there a legal definition of race in the US?Neighbors are spying for landlord on Renters is it legal?Are Protected Classes Bi-directional?