问题描述:

I am trying to use mathematica to solve the following system of equation, but I can not for the life of me get it to work. I have the following:

`Stiffness = ((Y*A)/L )*{{1, -1, 0, 0}, {-1, 2, -1, 0}, {0, -1,`

2, -1}, {0, 0, -1, 1}} // MatrixForm

Displacements = {{0}, {a}, {b}, {0}} // MatrixForm

Force = {{x}, {(7*L^3 )/162}, {(10*L^3)/81}, {y}} // MatrixForm

I need to solve:

`Stiffness * Displacements = Force`

When I use LinearSolve it just spits back the input command. I need to solve for a, b, x, and y. Thanks for the help.

```
In[1]:= Stiffness = ((Y*A)/L)*{{1,-1,0,0},{-1,2,-1,0},{0,-1,2,-1},{0,0,-1,1}};
Displacements = {0, a, b, 0};
Force = {x, (7*L^3)/162, (10*L^3)/81, y};
Solve[Stiffness.Displacements == Force, {x, y, a, b}]
Out[4]= {{x-> -((17 L^3)/243), y-> -((47 L^3)/486), a->(17 L^4)/(243 A Y), b->(47 L^4)/(486 A Y)}}
```

Don't use //MatrixForm unless you just want something pretty to look at, BUT which you cannot then use for any subsequent calculations.

Don't use * when you want vector or matrix multiply, use .

Don't think you can get column vectors by wrapping every element inside another layer of {}

If Solve isn't working for a matrix problem then the first thing to look at is the matrix problem without Solve so you can see if your dimensions all match up.