3
votes

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.

1
Shouldn’t Displacements = {{0}, {a}, {b}, {0}} be Displacements = {0, a, b, 0}? The same change should apply for Force, IMO. How do you use the LinearSolve function? - Palec
What about solution = Solve[Thread[Stiffness . Displacements == Force], {a, b, x, y}]? See the “Properties & Relations” part of LinearSolve documentation. See in WolframAlpha. - Palec
I tried changing the displacements and force matrices as you recommended, and I got the same result. I have tried LinearSolve[Stiffness, Force], but was not sure of what the correct way of solving this problem would be. - mborland
Using solution = Solve[Thread[Stiffness . Displacements == Force], {a, b, x, y}] yields "This system cannot be solved with the methods available to Solve" - mborland
In WA it does not work, too. Don’t know the reason. Hope someone else helps you solve the problem. - Palec

1 Answers

4
votes
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.