Mathematica: Solving system of three equations

In summary, even though you have tried rationals instead of decimals, tried Simplify and FullSimplify, you still have a forest of products of square roots of multivariate quadratics and I suspect there needs to be a different approach.
  • #1
ll235
2
0
Hello,

I am new to mathematica, and I am having trouble using the solve/nsolve to solve my system of three equations.

Attached is my code so far. Any help would be greatly appreciated. It gets stuck in the loop section of the code. I have also pasted the code below.

Thanks!
Alicia

Defining reference conditions

In[3]:= l0 = Sqrt[0.375];
s0 = 0.5 ;
k = 1;


Using prestress to define

In[6]:= \[Xi] = 1 - lR/l0;

In[7]:=
lR[\[Xi]val_] := l0 (1 - \[Xi]val);

In[10]:=
lRvalues = Table[lR[\[Xi]range], {\[Xi]range, {0.0, 0.1, 0.5, 0.9, 1.0}}];



Defining cable lengths

In[11]:= Clear[sx, sy, sz]
l1[sx_] := 0.5 Sqrt[sx^2 + sy^2 - 2 sy + 2];
l2 := 0.5 Sqrt[sy^2 + sz^2 - 2 sz + 2];
l3[sx_] := 0.5 Sqrt[sz^2 + sx^2 - 2 sx + 2];

In[15]:=
F1[lR_] = k (l1[sx] - lR);
F2[lR_] = k (l2 - lR);
F3[lR_] = k (l3[sx] - lR);


F1values = Table[F1[lr], {lr, lRvalues}];
F2values = Table[F1[lr], {lr, lRvalues}];
F3values = Table[F1[lr], {lr, lRvalues}];

In[59]:= F1values[[1]] /. sx -> 0.5

Out[59]= -0.612372 + 0.5 Sqrt[2.25 - 2 sy + sy^2]


sxval = Range[0.5, 2, 0.5];
For[j = 1, j < Length[sxval] + 1, j++,
For[i = 1, i < Length[F1values] + 1, i++,
Solve[{(F1values[] /. sx -> sxval[[j]]) (1 - sy)/l1[sxval[[j]]] ==
F2values[] sy/l2,
F2values[] (1 - sz)/l2 == (F3values[] /. sx -> sxval[[j]]) sz/
l3[sxval[[j]]],
T == 2 ((F1values[] /. sx -> sxval[[j]]) sxval[[j]]/
l1[sxval[[j]]] + (F3values[] /. sx -> sxval[[j]]) (
sxval[[j]] - 1)/l3[sxval[[j]]])}, {T, sy, sz}]
(*sy1=NSolve[(F1values[]/.sx ->sxval[[j]]) (1-sy)/l1[sxval[[j]]]==
F2values[] sy/l2,sy,Reals]//FullSimplify;*)
(*Print[sy1]*)
]
]
 
Physics news on Phys.org
  • #2
Here is the attachment
 

Attachments

  • FinalProject_Post.nb
    16.4 KB · Views: 510
  • #3
I would change these
F1[lR_] = k (l1[sx] - lR);
F2[lR_] = k (l2 - lR);
F3[lR_] = k (l3[sx] - lR);
to these
F1[lR_] := k (l1[sx] - lR);
F2[lR_] := k (l2 - lR);
F3[lR_] := k (l3[sx] - lR);

If you can justify that your square roots of quadratics that appear in all of your denominators can be cross multiplied to get rid of those denominators then this might give Mathematica fewer possible zero denominators to worry about and possibly speed things up.

But even with that, with trying rationals instead of decimals, trying Simplify and FullSimplify, you still have a forest of products of square roots of multivariate quadratics and I suspect there needs to be a different approach.
 

1. How can Mathematica solve a system of three equations?

Mathematica has a built-in function called Solve that can be used to solve a system of three equations. The syntax for using this function is Solve[{eq1,eq2,eq3},{x,y,z}], where eq1,eq2,eq3 are the three equations and x,y,z are the variables to be solved for.

2. Can Mathematica solve systems of equations with complex numbers?

Yes, Mathematica can solve systems of equations with complex numbers. The function Solve can handle complex numbers, and the output will also be in the form of complex numbers.

3. Is there a limit to the number of equations that Mathematica can solve?

There is no specific limit to the number of equations that Mathematica can solve. However, the computation time and memory required may increase as the number of equations increases, so it is recommended to use a powerful computer for solving larger systems of equations.

4. Can I use Mathematica to solve a system of differential equations?

Yes, Mathematica has a function called DSolve which is specifically designed for solving differential equations. The syntax is similar to Solve, but the equations must be written in the form of y'[x] = f[x,y[x]].

5. Is it possible to solve a system of equations with both numerical and symbolic solutions?

Yes, Mathematica has the ability to find both numerical and symbolic solutions to a system of equations. This can be achieved by using the NSolve function for numerical solutions and Solve for symbolic solutions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
5K
Back
Top