Iterate Simultaneous Equations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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,y3 all at one time for each value of Theta. I really don't know where to start on this. Any help would be appreciated.
Thanks
- Labels:
-
Programming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You may consider turning the solve block into a function dependent on theta:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
turn the solve block into a function. (And be careful not to reassign variables!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can't continue naming different things the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
And when you evaluate the function, the value in the parenthesis is substituted for the dummy:
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:
So I'm lazy!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Looking at your sheet, there are other problems.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Success!
Luc