cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Iterate Simultaneous Equations

Mike12345
4-Participant

Iterate Simultaneous Equations

I'm trying to solve a system of simultaneous equations with a given value that changes. I attached a simplified worksheet to illustrate this. I used the variable 'I' to represent the position in the input matrix. I would like Mathcad to return the values of x0,y0, x1,y1, and x3,yall at one time for each value of Theta. I really don't know where to start on this. Any help would be appreciated.

 

Thanks

15 REPLIES 15

You may consider turning the solve block into a function dependent on theta:

B.png

turn the solve block into a function.  (And be careful not to reassign variables!)

LucMeekes
23-Emerald III
(To:Mike12345)

Like this?

LM_20180822_Simultaneous.png

 

Success!
Luc

Mike12345
4-Participant
(To:Mike12345)

Thanks everyone for your responses. I thought that they were exactly what I needed, however when I went to apply the methods in my actual calculations of 11 equations, it will not solve. It will solve when the input angle is a given number (say 0 and 10 degrees), but fails when it is a vector consisting of the same angles. I attached a file illustrating this. Any idea why this is happening would be greatly appreciated.

You can't continue naming different things the same.

Sorry, I should've been more clear on what I was doing. I put both angles in there so one could be dragged before or after the other to illustrate the problem I'm having. Ideally, I would only have the vector definition, but in the end I only have one definition of the angle. I need ThetaLT to be a vector that is used in the equations. I noticed the way you redefined it, ThetaLT is used but ThetaLTg is not used in the equations.

theta.LT should not be defined before the solve block at all!

The solve block is set up for a theta.LT being a single scalar provides as argument of the solve block function.

The problem is that you calculate in front d.LT, F.UL, theta.lift and theta.link

You have to turn all of them into functions of theta.LT and use those functions in your solve block!

Capture.PNG

When you turn a solve block into a function (which you did) It works like any other Mathcad Function.  The definition has a dummy variable in it:

Capture1.PNG

And when you evaluate the function, the value in the parenthesis is substituted for the dummy:

Capture2.PNG

When I looked in your solve block I saw theta.LT (the dummy variable) in a lot of places.  Rather than try to alter all of those, I renamed the vector of angles you wanted to evaluate, then typed that name into the function to get the solution vectors:

Capture3.PNG

So I'm lazy!

Looking at your sheet, there are other problems. 

Capture.PNG

You define things above the solve block in terms of the solve block dummy variable.  These will not change in the solve block when the variable changes.  They need to be functions of the variable.

 

 

Thanks everyone. You all got me on track now. I'm trying to define everything in terms of ThetaLT. I did it very roughly and it looks to be working.


@Mike12345 wrote:

Thanks everyone. You all got me on track now. I'm trying to define everything in terms of ThetaLT. I did it very roughly and it looks to be working.


Yes, it should work OK if all is dependent on theta.LT:B.png

 

 

 

Mike12345
4-Participant
(To:Werner_E)

Thanks! I rewrote the equations and now I can solve it similar to what's shown below. I would like to use each row as a vector input into another calculation. Is there a way to extract a vector for each row? Like below, except F1x is pulled from 'Table' instead of defined

 

LucMeekes
23-Emerald III
(To:Mike12345)

Your system can be solved symbolically, although I admit, the solution will not be a nicely presentable set of functions. It's big... no HUGE (because it exceeds my current limit of output.)

See here:

 

LM_20180823_solve.png

The yellow box at the far right indicates that a solution was found.

Using the submatrix function you should be able to extract all Fxx as a function of all other parameters, even in Mathcad 15...

 

Success!

Luc

 

I gave MuPad 10 minutes to find a solution, but, alas, to no avail.

When I then tried to work on another file while the symbolics still were busy in your file, Mathcad crashed 😞

LucMeekes
23-Emerald III
(To:LucMeekes)

Indeed, the system can be solved symbolically, but the symbolic result is so huge, it can't be worked with.

Turns out it just requires to solve a set of linear equations. A comfortable way of solving that is to use lsolve.

LM_20180823_Solver1.pngLM_20180823_Solver2.pngLM_20180823_Solver3.pngLM_20180823_Solver4.pngLM_20180823_Solver5.png

Success!
Luc

Top Tags