Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linear Solve Mathematica

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.

like image 485
mborland Avatar asked Apr 30 '26 22:04

mborland


1 Answers

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.

like image 152
Bill Avatar answered May 03 '26 00:05

Bill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!