# Cannot solve a system of linear equations

I have four known functions, $$u_i(x)$$, and I suspect that all these four functions satisfy an operator, through a common force function, or at least a common force function type $$(h(x)$$, with some parameters, where each parameter could be adapted to the operator.

The "native" (unparametrized) operator is:

$$$$\label{NLS_operator} P_i:=-\frac{1}{2}\frac{d^2}{dx^2}+|u_i(x)|^2$$$$

$$i=1,2,3,4$$, the index of the respective known function. These functions are Fourier series ($$L^2$$ functions), and they are very long. See them at the bottom of this post. I would like to prepare a system of ODEs which are formed by the equation:

$$$$P_{\beta_i} u_i(x)=h_i(x)$$$$ $$\beta$$ is the parameter that we multiply to the operator (for simplicity) or we can consider it as a nonlinear term (function) which we add to the operator and $$h(x)$$ are the unknown force functions, $$h$$.

Here the force function $$h$$ should be in the form $$h(x)=Ae^{-\lambda(x-x_0)^2}.$$

Since I have four known $$u(x)=\{u_1, u_2, u_3, u_4\}$$, I should get:

$$P_{\beta} u_1(x)=h(x)\\ P_{\beta} u_1(x)=h(x)\\P_{\beta} u_3(x)=h(x)\\P_{\beta} u_4(x)=h(x)$$

With $$h(x)=Ae^{-\lambda(x-x_0)^2}$$

so we have three unknowns, $$A$$, $$\lambda$$ and $$x_0$$ plus the unknown parameter $$\beta$$. This makes 4 unknowns,and four linear equations.

Example 1: Let for example $$u_1=e^{2it}$$, $$u_2=e^{4it}$$, $$u_3=e^{-3it}$$ and $$u_4=e^{-5it}$$. Then we get the prepared inputs :

d[t_] = E^(2*I*t)
D2d[t_] = D[d[t],{t,2}]


The second

g[t_] = E^(4*I*t)
D2g[t_] = D[g[t],{t,2}]


the third:

b[t_] = E^(-3*I*t)
D2b[t_] = D[b[t],{t,2}]



and the fourth:

u[t_] = E^(-5*I*t)
D2u[t_] = D[u[t],{t,2}]


Then we arrange this such that we can solve for $$\lambda$$, $$\beta$$ , $$x_0$$ and $$A$$.

For this use Solve do:

Solve[{-1/2*D2d[t] + (Abs[d[t]])^2*d[t] ==
A*E^(-λ (t - B))^2/β,
-1/2*D2g[t] + (Abs[g[t]])^2*g[t] ==
A*E^(-λ (t - B))^2/β,
-1/2*D2b[t] + (Abs[b[t]])^2*b[t] ==
A*E^(-λ (t - B))^2/β,
-1/2*D2u[t] + (Abs[u[t]])^2*u[t] ==
A*E^(-λ (t - B))^2/β}, {B, A, β, λ}]


With this I get NO result.

Here is the actual question I am seeking an answer for

Let the given functions be $$u_1=d(t),u_2=g(t),u_3=b(t), u_4=u(t)$$ given below

d[t_] = 139.85 + (15.8404 + 4.76022 I) E^(-I t) + (15.8404 -
4.76022 I) E^(I t) + (4.64917 -
3.3024 I) E^(-2 I t) + (4.64917 +
3.3024 I) E^(2 I t) + (7.42191 -
0.300123 I) E^(-3 I t) + (7.42191 +
0.300123 I) E^(3 I t) + (0.340877 -
2.54665 I) E^(-4 I t) + (0.340877 +
2.54665 I) E^(4 I t) + (7.72422 +
6.71332 I) E^(-5 I t) + (7.72422 -
6.71332 I) E^(5 I t) + (3.16511 -
9.14479 I) E^(-6 I t) + (3.16511 +
9.14479 I) E^(6 I t) + (3.31502 +
2.18874 I) E^(-7 I t) + (3.31502 -
2.18874 I) E^(7 I t) + (9.31827 +
6.94538 I) E^(-8 I t) + (9.31827 -
6.94538 I) E^(8 I t) + (5.87173 +
18.8341 I) E^(-9 I t) + (5.87173 -
18.8341 I) E^(9 I t) + (8.75949 +
14.7107 I) E^(-10 I t) + (8.75949 -
14.7107 I) E^(10 I t) + (19.2903 +
7.78329 I) E^(-11 I t) + (19.2903 -
7.78329 I) E^(11 I t) - (3.39063 -
18.5502 I) E^(-12 I t) - (3.39063 +
18.5502 I) E^(12 I t) + (3.58427 +
18.7438 I) E^(-13 I t) + (3.58427 -
18.7438 I) E^(13 I t) + (2.66129 +
20.0781 I) E^(-14 I t) + (2.66129 -
20.0781 I) E^(14 I t) - (8.46335 -
9.96867 I) E^(-15 I t) - (8.46335 +
9.96867 I) E^(15 I t) - (8.50037 -
1.20377 I) E^(-16 I t) - (8.50037 +
1.20377 I) E^(16 I t) - (1.36102 -
16.9315 I) E^(-17 I t) - (1.36102 +
16.9315 I) E^(17 I t) - (5.78964 -
2.96094 I) E^(-18 I t) - (5.78964 +
2.96094 I) E^(18 I t) + (2.14681 +
8.29635 I) E^(-19 I t) + (2.14681 -
8.29635 I) E^(19 I t) - (3.91145 -
10.7712 I) E^(-20 I t) - (3.91145 + 10.7712 I) E^(20 I t);
g[t_] = 13.87 + (9.25477 + 1.51787 I) E^(-I t) + (9.25477 -
1.51787 I) E^(I t) + (1.08996 +
0.300406 I) E^(-2 I t) + (1.08996 -
0.300406 I) E^(2 I t) - (1.96638 +
1.26469 I) E^(-3 I t) - (1.96638 -
1.26469 I) E^(3 I t) + (0.218112 -
0.308038 I) E^(-4 I t) + (0.218112 +
0.308038 I) E^(4 I t) + (1.90783 +
1.17281 I) E^(-5 I t) + (1.90783 -
1.17281 I) E^(5 I t) + (1.09081 +
0.353231 I) E^(-6 I t) + (1.09081 -
0.353231 I) E^(6 I t) + (0.173557 -
1.10369 I) E^(-7 I t) + (0.173557 +
1.10369 I) E^(7 I t) + (0.224736 -
0.475649 I) E^(-8 I t) + (0.224736 +
0.475649 I) E^(8 I t) + (0.215461 +
0.922754 I) E^(-9 I t) + (0.215461 -
0.922754 I) E^(9 I t) + (0.127993 +
0.559526 I) E^(-10 I t) + (0.127993 -
0.559526 I) E^(10 I t) + (0.557846 -
0.59431 I) E^(-11 I t) + (0.557846 +
0.59431 I) E^(11 I t) + (0.801299 -
0.286539 I) E^(-12 I t) + (0.801299 +
0.286539 I) E^(12 I t) + (0.301617 +
0.825404 I) E^(-13 I t) + (0.301617 -
0.825404 I) E^(13 I t) + (0.115336 +
0.833234 I) E^(-14 I t) + (0.115336 -
0.833234 I) E^(14 I t) + (0.786769 +
0.0749826 I) E^(-15 I t) + (0.786769 -
0.0749826 I) E^(15 I t) + (1.03796 -
0.0574653 I) E^(-16 I t) + (1.03796 +
0.0574653 I) E^(16 I t) + (0.302552 +
0.238826 I) E^(-17 I t) + (0.302552 -
0.238826 I) E^(17 I t) + (0.032363 +
0.135126 I) E^(-18 I t) + (0.032363 -
0.135126 I) E^(18 I t) + (0.952115 -
0.0508812 I) E^(-19 I t) + (0.952115 +
0.0508812 I) E^(19 I t) + (1.59932 +
0.164806 I) E^(-20 I t) + (1.59932 - 0.164806 I) E^(20 I t);
b[t_] = 22.2253 + (6.05951 + 1.26288 I) E^(-I t) + (6.05951 -
1.26288 I) E^(I t) - (2.28516 +
0.718175 I) E^(-2 I t) - (2.28516 -
0.718175 I) E^(2 I t) + (3.48496 +
1.91013 I) E^(-3 I t) + (3.48496 -
1.91013 I) E^(3 I t) + (1.02469 -
1.28294 I) E^(-4 I t) + (1.02469 +
1.28294 I) E^(4 I t) + (1.18499 +
0.102604 I) E^(-5 I t) + (1.18499 -
0.102604 I) E^(5 I t) + (1.05572 +
0.532558 I) E^(-6 I t) + (1.05572 -
0.532558 I) E^(6 I t) + (1.43148 -
1.00592 I) E^(-7 I t) + (1.43148 +
1.00592 I) E^(7 I t) + (1.14346 +
1.19477 I) E^(-8 I t) + (1.14346 -
1.19477 I) E^(8 I t) + (1.43917 +
0.795927 I) E^(-9 I t) + (1.43917 -
0.795927 I) E^(9 I t) + (1.91234 +
2.80903 I) E^(-10 I t) + (1.91234 -
2.80903 I) E^(10 I t) + (3.70871 +
2.25491 I) E^(-11 I t) + (3.70871 -
2.25491 I) E^(11 I t) + (3.20857 +
0.708758 I) E^(-12 I t) + (3.20857 -
0.708758 I) E^(12 I t) - (0.407118 -
0.0128365 I) E^(-13 I t) - (0.407118 +
0.0128365 I) E^(13 I t) + (0.747326 +
0.854073 I) E^(-14 I t) + (0.747326 -
0.854073 I) E^(14 I t) - (1.65033 -
1.69294 I) E^(-15 I t) - (1.65033 +
1.69294 I) E^(15 I t) - (1.70632 -
1.04809 I) E^(-16 I t) - (1.70632 +
1.04809 I) E^(16 I t) + (1.05899 +
1.95888 I) E^(-17 I t) + (1.05899 -
1.95888 I) E^(17 I t) + (1.36781 -
0.334041 I) E^(-18 I t) + (1.36781 +
0.334041 I) E^(18 I t) + (1.98706 -
0.0544715 I) E^(-19 I t) + (1.98706 +
0.0544715 I) E^(19 I t) + (0.890154 +
0.772225 I) E^(-20 I t) + (0.890154 - 0.772225 I) E^(20 I t);
u[t_] = 93.2259 + (9.87447 + 1.23806 I) E^(-I t) + (9.87447 -
1.23806 I) E^(I t) - (7.28392 +
0.41437 I) E^(-2 I t) - (7.28392 -
0.41437 I) E^(2 I t) + (12.8921 -
2.58731 I) E^(-3 I t) + (12.8921 +
2.58731 I) E^(3 I t) - (2.22197 -
2.18978 I) E^(-4 I t) - (2.22197 +
2.18978 I) E^(4 I t) + (11.0601 -
0.575458 I) E^(-5 I t) + (11.0601 +
0.575458 I) E^(5 I t) - (1.22048 -
2.68096 I) E^(-6 I t) - (1.22048 +
2.68096 I) E^(6 I t) + (6.47151 +
1.21344 I) E^(-7 I t) + (6.47151 -
1.21344 I) E^(7 I t) + (0.260353 +
4.33147 I) E^(-8 I t) + (0.260353 -
4.33147 I) E^(8 I t) + (0.61904 +
3.37889 I) E^(-9 I t) + (0.61904 -
3.37889 I) E^(9 I t) - (0.585492 -
2.98757 I) E^(-10 I t) - (0.585492 +
2.98757 I) E^(10 I t) + (1.95162 +
8.81749 I) E^(-11 I t) + (1.95162 -
8.81749 I) E^(11 I t) + (0.534066 +
11.0168 I) E^(-12 I t) + (0.534066 -
11.0168 I) E^(12 I t) - (1.45227 -
11.017 I) E^(-13 I t) - (1.45227 +
11.017 I) E^(13 I t) - (0.987428 -
6.69947 I) E^(-14 I t) - (0.987428 +
6.69947 I) E^(14 I t) - (4.88124 -
6.62883 I) E^(-15 I t) - (4.88124 +
6.62883 I) E^(15 I t) - (2.56445 -
4.71859 I) E^(-16 I t) - (2.56445 +
4.71859 I) E^(16 I t) - (4.16251 -
5.0285 I) E^(-17 I t) - (4.16251 +
5.0285 I) E^(17 I t) - (3.24296 -
2.11604 I) E^(-18 I t) - (3.24296 +
2.11604 I) E^(18 I t) - (4.22329 -
0.335417 I) E^(-19 I t) - (4.22329 +
0.335417 I) E^(19 I t) + (0.506471 -
0.205546 I) E^(-20 I t) + (0.506471 + 0.205546 I) E^(20 I t);


Then we declare the second differential operator:

D2u[t_] = D[u[t], {t, 2}];
D2b[t_] = D[b[t], {t, 2}];
D2g[t_] = D[g[t], {t, 2}];
D2d[t_] = D[d[t], {t, 2}];


and we prepare the system of algebraic equations:

 sys=[{-1/2*D2d[t] + (Abs[d[t]])^2*d[t] ==
A*E^(-λ*I* (t - B))^2/β,
-1/2*D2g[t] + (Abs[g[t]])^2*g[t] ==
A*E^(-λ*I* (t - B))^2/β,
-1/2*D2b[t] + (Abs[b[t]])^2*b[t] ==
A*E^(-λ *I*(t - B))^2/β,
-1/2*D2u[t] + (Abs[u[t]])^2*u[t] ==
A*E^(-λ *I*(t - B))^2/β}, {B, A, β, λ}]


How can I solve this system?

NSolve Does not work, Reduce gives "This system cannot be solved with the methods available to Reduce.", and Solve seems not to converge..

An idea is to dicretize the functions $$u$$ into a set of vectors, and then use these discretized functions to identify the force functions $$h$$. But this I am not sure may work?

With Alex's suggestion, we obtain:

D2u[t_] = D[u[t], {t, 2}];
D2y[t_] = D[y[t], {t, 2}];
D2g[t_] = D[g[t], {t, 2}];
D2d[t_] = D[d[t], {t, 2}];
Du[t_] = D[u[t], {t, 1}];
Dy[t_] = D[y[t], {t, 1}];
Dg[t_] = D[g[t], {t, 1}];
Dd[t_] = D[d[t], {t, 1}];
NSolve[{-1/2*D2d[t] + (Abs[d[t]])^2*d[t] + I*u[t]*Du[t] ==
A*E^(-λ *I*(t - B))^2/β,
-1/2*D2g[t] + (Abs[g[t]])^2*g[t] + I*g[t]*Dg[t] ==
A*E^(-λ*I* (t - B))^2/β,
-1/2*D2y[t] + (Abs[y[t]])^2*y[t] + I*y[t]*Dy[t] ==
A*E^(-λ *I*(t - B))^2/β,
-1/2*D2u[t] + (Abs[u[t]])^2*u[t] + I*d[t]*Dd[t] ==
A*E^(-λ *I*(t - B))^2/β},
{B, A, β, λ}]


However, there are no changes currently, NSolve is running for hours.

• You'll have to investigate why there is no solution. If you're sure that a solution exists for your particular set of functions, you could try solving a simplified version of your problem first or a numerical solution to find out what's going on. May 16, 2023 at 13:54
• Another thing I noticed is, that you wrote "e^(...)". What you probably mean is "Exp[...]", because lowercase e by default is not defined to be Euler's number, only uppercase E, so alternatively you could write E^(...). May 16, 2023 at 14:10
• Basically you have A*E^(-\[Lambda] (t - B))^2/\[Beta] set equal to four different expressions. There would certainly be no solutions for {B, A, \[Beta], \[Lambda]} as the variables, except possibly for special values of t (probably not, since it reduces to three equations in one unknown). -- You should change the e^ to E^ in the question. Copying nonworking is discouraging. May 19, 2023 at 1:29
• Your functions are complex, your forces are real. No wonder you get no solution. May 19, 2023 at 10:58
• Equations that are not overdetermined may still be inconsistent. Small example (2 eqs, 2 unknowns): $1 = x+y,\ 2 = x+y$; $x+y$ cannot simulataneously be $1$ and $2$, even though there are two degrees of freedom on the face of it. May 19, 2023 at 14:52

My take on it, FWIW:

The system to be solved is

{-1/2*D2d[t] + (Abs[d[t]])^2*d[t] ==
A*E^(-λ*I* (t - B))^2/β,
-1/2*D2g[t] + (Abs[g[t]])^2*g[t] ==
A*E^(-λ*I* (t - B))^2/β,
-1/2*D2b[t] + (Abs[b[t]])^2*b[t] ==
A*E^(-λ *I*(t - B))^2/β,
-1/2*D2u[t] + (Abs[u[t]])^2*u[t] ==
A*E^(-λ *I*(t - B))^2/β}


Its form is

\eqalign{ \text{LHS}(d(t)) &= \text{RHS}(B,A,\beta,\lambda,t) \cr \text{LHS}(g(t)) &= \text{RHS}(B,A,\beta,\lambda,t) \cr \text{LHS}(b(t)) &= \text{RHS}(B,A,\beta,\lambda,t) \cr \text{LHS}(u(t)) &= \text{RHS}(B,A,\beta,\lambda,t) \cr }

The four left-hand sides LHS() depend on four different functions of $$t$$ but have the same form. The four right-hand sides are identical functions of the parameters $$B,A,\beta,\lambda$$ and the independent variable $$t$$.

So the system consists of four different things equal to the same thing. The only way for the system to be consistent is for the four different things to happen to turn out to be equal. Which they aren't. (It's easy to check because they are Laurent polynomials in $$z=e^{it}$$.) Therefore the system is inconsistent.

If the physics of the source problem has a solution, I'd suggest there's an error somewhere in the Mathematica setup. I don't know enough to say what, though. I have some doubts that even one of the equations of the system could be solved, since the LHS on the face of it does not look analytic (or differentiable) and the RHS does. I'm probably wrong about that, because I think that perhaps d[t], g[t], b[t], u[t] are real-valued, making Abs[] unnecessary. In any case, it won't matter if the problem in the previous paragraph cannot be addressed.

• You can take an average of the four functions resulting by $LHS(d(t)=0$, that would be $LHS(d(t)+LHS(u(t)+LHS(y(t)+LHS(g(t))/4$, and it will still look too similar to $LHS(d(t))$. So the average of the LHS's is in fact close to $LHS(d(t))$. Therefore, if the system of equations in the OP should have a solution, it should be very similar to LHS(d(t) May 23, 2023 at 8:18
• @Vangsnes (1) Solve is an exact solver and does not do fitting or approximate solutions. So finding a function "close to" or "similar to" another requires a different approach. (2) You seem to say $\text{LHS}(d(t))=0$ and "the average of the LHS's is in fact close to $\text{LHS}(d(t))$: Why not say more simply that the average of the LHS's is in fact close to 0? I'm not sure I'm understanding correctly. May 23, 2023 at 13:57
• Because I was looking for a type of solution. The average of LHS(d(t)) and all the other three is a messy function. The only pattern there is that there is a $E^{CIt}$ term everywhere in it. May 23, 2023 at 14:07