m1 = Piecewise[{{5.27107*10^-16 Cos[1.57088 x1] -
2.80045*10^-17 Cosh[1.57088 x1] + 0.707304 Sin[1.57088 x1] +
0.0000332641 Sinh[1.57088 x1], x1 <= 1.66667},
{0.35357 Cos[1.57088 (-1.66667 + x1)] +
0.000226813 Cosh[1.57088 (-1.66667 + x1)] -
0.612135 Sin[1.57088 (-1.66667 + x1)] -
0.00022711 Sinh[1.57088 (-1.66667 + x1)], x1 >= 1.66667}}]
m2=Piecewise[{{(-2.11473*10^-15 Cos[2.35624 x1] -
7.8246*10^-16 Cosh[2.35624 x1] + 0.707039 Sin[2.35624 x1] -
3.76568*10^-6 Sinh[2.35624 x1]),
x1 <= 1.66667}, {-0.499992 Cos[2.35624 (-1.66667 + x1)] -
0.0000955323 Cosh[2.35624 (-1.66667 + x1)] -
0.500104 Sin[2.35624 (-1.66667 + x1)] +
0.0000955355 Sinh[2.35624 (-1.66667 + x1)], x1 >= 1.66667}}]
m3 = Piecewise[{{-1.67621*10^-7 Cos[2.13353 x1] -
5.30286*10^-7 Cosh[2.13353 x1] + 0.816848 Sin[2.13353 x1] +
0.0187942 Sinh[2.13353 x1] , x1 <= 1.66667}, {
-0.328821 Cos[2.13353 (-1.66667 + x1)] +
0.328821 Cosh[2.13353 (-1.66667 + x1)] -
0.089538 Sin[2.13353 (-1.66667 + x1)] -
0.328852 Sinh[2.13353 (-1.66667 + x1)] , x1 >= 1.66667}}]
m4 = Piecewise[{{-1.7389*10^-6 Cos[2.88372 x1] +
1.92984*10^-6 Cosh[2.88372 x1] + 0.346661 Sin[2.88372 x1] +
0.00564411 Sinh[2.88372 x1] , x1 <= 1.66667}, {
-0.345138 Cos[2.88372 (-1.66667 + x1)] +
0.345138 Cosh[2.88372 (-1.66667 + x1)] +
0.722795 Sin[2.88372 (-1.66667 + x1)] -
0.345139 Sinh[2.88372 (-1.66667 + x1)], x1 >= 1.66667}}]
W = Expand[c1*m1 + c2*m2 + c3*m3 + c4*m4];
Wxx = Expand[(D[W, {x1, 2}])];
in1 = Expand[(Wxx)^2];
in2 = Expand[W^2];
terms1 = List @@@ List @@ in1;
integrals1 = GatherBy[#, MemberQ[#, x1, Infinity] &] & /@ terms1;
v1 = (Total[(Times @@@
integrals1[[All, 1]])*(NIntegrate[Times @@ #, {x1, 0, 4},
Method -> {Automatic, "SymbolicProcessing" -> 0}] & /@
integrals1[[All, 2]])]);
terms2 = List @@@ List @@ in2;
integrals2 = GatherBy[#, MemberQ[#, x1, Infinity] &] & /@ terms2;
t1 = (Total[(Times @@@
integrals2[[All, 1]])*(NIntegrate[Times @@ #, {x1, 0, 4},
Method -> {Automatic, "SymbolicProcessing" -> 0}] & /@
integrals2[[All, 2]])]);
I have a working code, but I am getting some warning messages and the codes seem bit lengthy. How to reduce it without compromising on the results. I am using numerical integration function. If I go for regular integration it takes a lot of time to get the result.
L1=1, {c1 -> 1, c2 -> 1, c3 -> 1, c4 -> 1}
. Code run without messages. $\endgroup$