Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
I find your question a duplicate of at least a few another ones, e.g. How to Solve or LinearSolve A=I matrix equation?. In any case you can do: Solve[ Stiffness[[1]].Displacements[[1]] == Force[[1]], {a, b, x, y}] yielding {{a -> (17 L^4)/(243 A Y), b -> (47 L^4)/(486 A Y), x -> -((17 L^3)/243), y -> -((47 L^3)/486)}}. Incorrect usage: * and =, use . and == respectively i.e. (Dot and Equal) instead of Times and Set. –  Artes Jan 22 at 2:28

1 Answer 1

up vote 2 down vote accepted

There are a few things wrong with the code: MatrixForm is just for display, you have extra brackets in the lists, use dot . for matrix multiplication, double equals == to define an equation, and you need to ask it to solve for the desired variables:

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, {a, b, x, y}]

{{a -> (17 L^4)/(243 A Y), b -> (47 L^4)/(486 A Y), 
  x -> -((17 L^3)/243), y -> -((47 L^3)/486)}}
share|improve this answer
    
Thanks for answering the question on both sites, I forgot to delete the one over on StackOverflow after I posted here. I figured this place was more fitting. –  mborland Jan 24 at 21:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.