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

What is a ^ b and (a & b) << 1?

ERC721: How to get the owned tokens of an address

Are Roman Catholic priests ever addressed as pastor

My adviser wants to be the first author

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

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

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

Shortcut for setting origin to vertex

Are all passive ability checks floors for active ability checks?

Problem with FindRoot

Why won't this compile? Argument of h has an extra {

Professor being mistaken for a grad student

Describing a chess game in a novel

How well should I expect Adam to work?

How to deal with taxi scam when on vacation?

Official degrees of earth’s rotation per day

PTIJ: Who should I vote for? (21st Knesset Edition)

Life insurance that covers only simultaneous/dual deaths

Adventure Game (text based) in C++

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

I got the following comment from a reputed math journal. What does it mean?

Brexit - No Deal Rejection

How to make healing in an exploration game interesting

Is there a place to find the pricing for things not mentioned in the PHB? (non-magical)



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










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










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










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










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










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












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




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

            名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

            格濟夫卡 參考資料 导航菜单51°3′40″N 34°2′21″E / 51.06111°N 34.03917°E / 51.06111; 34.03917ГезівкаПогода в селі 编辑或修订