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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Prime 5 issues with indexing

KhariH
8-Gravel

Prime 5 issues with indexing

Hi all, 

I was writing a solution guide for my engineering students and keep getting errors in my Solve Block. I have removed all the unnecessary bits, and boiled it down to just the issues I am having in my sheet. I'm trying to get the solve block to provide multiple solutions based on different conditions of the constraint equation. In my document I was able to get it to work in the first solve block (off to the side in the work space I have my initial solve block where I hardcoded the equations just as a double check) however in my solve block on the second page "determination of beam base needed to provide eq stiff..." I'm not able to condense the 6 constraint equations like I was before. I tried indexing 1-6 and kept getting errors in my "find" statement and my output was a [6x1] nested matrix of [6x1] matrices. 

 

TLDR: trying to index a solve block instead of hardwriting eqtns

ACCEPTED SOLUTION

Accepted Solutions
Fred_Kohlhepp
23-Emerald I
(To:KhariH)

Are you teaching engineering or Mathcad?

 

If you're teaching Mathcad, then you need to answer the problem in the solve block, and the answer is that you have two vectors in this equation, E and b, so you need to "vectorize" the constraint so it gets multiplied element by element rather than a dot product (note the arrow above the RHS:

Fred_Kohlhepp_0-1614312991555.png

If you're teaching engineering, then you need to save the solve blocks for when you really need them and remind the class about high school algebra.  (See attached)

View solution in original post

5 REPLIES 5
ttokoro
20-Turquoise
(To:KhariH)

image.pngimage.png

Fred_Kohlhepp
23-Emerald I
(To:KhariH)

Are you teaching engineering or Mathcad?

 

If you're teaching Mathcad, then you need to answer the problem in the solve block, and the answer is that you have two vectors in this equation, E and b, so you need to "vectorize" the constraint so it gets multiplied element by element rather than a dot product (note the arrow above the RHS:

Fred_Kohlhepp_0-1614312991555.png

If you're teaching engineering, then you need to save the solve blocks for when you really need them and remind the class about high school algebra.  (See attached)

Got it thanks!

Werner_E
25-Diamond I
(To:KhariH)

Fred had already shown that the key to success is vectorization and I fully agree with him that in that case a solve block (or a symbolic solve as shown by ttokoro) is overkill and not necessary.

 

For more complicated formulas a solve block might be appropriate and I always would suggest to set up the calculations not for vectors but just so that they work for single scalars, turn the calculations into functions dependent on the input variables and only at last call them vectorized with vector arguments. You gain much more versatility and IMHO its less failure prone.

In case of your second solve block this would look like this:

Werner_E_0-1614334848550.png

You may also consider making EI.st and h additional arguments of the function. That way you could put the function on top of the sheet and define your variables later and call the function multiple times with different variable sets for comparison.

Of course with this simple formula you would actually just use something like

Werner_E_1-1614335373735.png

instead of a solve block.

 

Got it thank you! I'll practice those two methods because I think they'll come in handy..looking back at my approach I definitely agree that a simple symbolic solve would have been better..My end goal here was actually to make some of the calculations "future-proof"

Announcements

Top Tags