1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Artes Jan 22 '14 at 2:28
3
$\begingroup$

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)}}
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – mborland Jan 24 '14 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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