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

Stereotypical names

Can a Gentile theist be saved?

Is it legal to discriminate due to the medicine used to treat a medical condition?

Are Warlocks Arcane or Divine?

Can a controlled ghast be a leader of a pack of ghouls?

Simple recursive Sudoku solver

How can I successfully establish a nationwide combat training program for a large country?

Can a Bard use an arcane focus?

Why are on-board computers allowed to change controls without notifying the pilots?

Are taller landing gear bad for aircraft, particulary large airliners?

Adding empty element to declared container without declaring type of element

Simulating a probability of 1 of 2^N with less than N random bits

How do ultrasonic sensors differentiate between transmitted and received signals?

Resetting two CD4017 counters simultaneously, only one resets

How did Monica know how to operate Carol's "designer"?

Can I use my Chinese passport to enter China after I acquired another citizenship?

Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?

Meta programming: Declare a new struct on the fly

Female=gender counterpart?

Is exact Kanji stroke length important?

I2C signal and power over long range (10meter cable)

What is the term when two people sing in harmony, but they aren't singing the same notes?

How can I raise concerns with a new DM about XP splitting?

Partial sums of primes



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
    Mar 16 at 15:43










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:45






  • 2




    $begingroup$
    And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:47











  • $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
    Mar 16 at 15:50















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
    Mar 16 at 15:43










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:45






  • 2




    $begingroup$
    And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:47











  • $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
    Mar 16 at 15:50













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 Mar 16 at 15:47







Soumyajit Roy

















asked Mar 16 at 15:39









Soumyajit RoySoumyajit Roy

1809




1809











  • $begingroup$
    I am sorry. I have incorporated CE in the code now.
    $endgroup$
    – Soumyajit Roy
    Mar 16 at 15:43










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:45






  • 2




    $begingroup$
    And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:47











  • $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
    Mar 16 at 15:50
















  • $begingroup$
    I am sorry. I have incorporated CE in the code now.
    $endgroup$
    – Soumyajit Roy
    Mar 16 at 15:43










  • $begingroup$
    And what about y6Start?
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:45






  • 2




    $begingroup$
    And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
    $endgroup$
    – Henrik Schumacher
    Mar 16 at 15:47











  • $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
    Mar 16 at 15:50















$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
Mar 16 at 15:43




$begingroup$
I am sorry. I have incorporated CE in the code now.
$endgroup$
– Soumyajit Roy
Mar 16 at 15:43












$begingroup$
And what about y6Start?
$endgroup$
– Henrik Schumacher
Mar 16 at 15:45




$begingroup$
And what about y6Start?
$endgroup$
– Henrik Schumacher
Mar 16 at 15:45




2




2




$begingroup$
And after all: What is the context? This looks a bit like discrete bending energy minimization with some angle constraints... Maybe the problem can be rephrased into another one that is simpler to solve.
$endgroup$
– Henrik Schumacher
Mar 16 at 15:47





$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
Mar 16 at 15:47













$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
Mar 16 at 15:50




$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
Mar 16 at 15:50










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
    Mar 16 at 16:30










  • $begingroup$
    Here VPenalty[] is a non-linear function, so the min can be local.
    $endgroup$
    – Alex Trounev
    Mar 16 at 17:10


















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
      Mar 16 at 16:30










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      Mar 16 at 17:10















    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
      Mar 16 at 16:30










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      Mar 16 at 17:10













    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 Mar 16 at 16:07









    Alex TrounevAlex Trounev

    8,0681621




    8,0681621











    • $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
      Mar 16 at 16:30










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      Mar 16 at 17:10
















    • $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
      Mar 16 at 16:30










    • $begingroup$
      Here VPenalty[] is a non-linear function, so the min can be local.
      $endgroup$
      – Alex Trounev
      Mar 16 at 17:10















    $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
    Mar 16 at 16:30




    $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
    Mar 16 at 16:30












    $begingroup$
    Here VPenalty[] is a non-linear function, so the min can be local.
    $endgroup$
    – Alex Trounev
    Mar 16 at 17:10




    $begingroup$
    Here VPenalty[] is a non-linear function, so the min can be local.
    $endgroup$
    – Alex Trounev
    Mar 16 at 17:10











    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 Mar 16 at 17:24









        Michael E2Michael E2

        149k12201481




        149k12201481



























            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

            Moe incest case Sentencing See also References Navigation menu"'Australian Josef Fritzl' fathered four children by daughter""Small town recoils in horror at 'Australian Fritzl' incest case""Victorian rape allegations echo Fritzl case - Just In (Australian Broadcasting Corporation)""Incest father jailed for 22 years""'Australian Fritzl' sentenced to 22 years in prison for abusing daughter for three decades""RSJ v The Queen"

            Who is our nearest planetary neighbor, on average?Santa Claus flies to the South PoleSeven Spheres of Unequal Mass, a weighing problem with a twistDescribe a large integerFast Mental Calculation of $7.5^7$Math in Space (without the help of celebrities)Find the value of $bigstar$: Puzzle 8 - InequalityWho drinks beer while running anyway?A Crucial DeliveryRanking And AverageHow long will my money last at roulette?

            Daza language Contents Vocabulary Phonology References External links Navigation menudaza1242Daza"Dazaga"eeee178086576