×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Placing "Given" solve blocks into loops

Placing "Given" solve blocks into loops

(OP)
I was wondering if there was a way to place a Given sove block within a while loop or for loop.  For instance, I would like to solve:

For x = 1-9

Given

f(x,a) = h(x,a)

Find(a)

Typically, I would just enter in x as a vector of numbers, however the system of equations I want to solve for is quite complex and does not permit vectors of data to be inputted.  Thus I am restricted to having x = a constant.  This means I have to vary x by hand and record the results of a by hand.  This is not very robust, and I know there has to be an alternative way.  Any help would be great.

CDR

RE: Placing "Given" solve blocks into loops

I'm curious, why can't you use vectors?  I have encountered such situations, but the solution usually depends upon why vectors can't be used.  The most common solution is to use the vectorization operator (it produces an ->) above the variable.  This forces a parallel compution method instead of matrix algebra.

HTH,

Imagineer

RE: Placing "Given" solve blocks into loops

(OP)
I am aware of the vectorize operator, and that could solve my problem.  The problem is I am using a database of formulas programed into mathcad which were not set up to hgandel vectors in the first place.  I could edit all of the equations, however since this database containes over 150 pages of mathcad code, it would be desirable not to have to modify them.  Using the "Given" solve block solves what I need very well for a single input value, I just thought that if there were a way to iterate a "Given" solve block that I could save myself the time of having to modify the entire database of equations, or prevent me having to repeat the solve block manually.

CDR

RE: Placing "Given" solve blocks into loops

Hi CDR,

I ran into the same problem.  I had a set of 3 non-linear equations that I needed to solve.  However, the solutions to the set was heavily dependent upon the initial values you input as guesses.

To get around that problem, I needed to automate the selection of guess values I used as inputs.  My solution is as follows.  If anyone else has a more efficient solution, please let me know!

Install VisSim -- it came on the Mathcad 2001 installation CD.  It allows you to insert Mathcad object blocks and connect them using signal wires.

Insert a Mathcad object.  You will need to assign your input values from the internal variables in0, in1, in2, etc to your guess variables of your Find() block.  Starting from the top, the black arrows on the left side of the Mathcad block represent in0, in1, in2.  You can add or delete inputs (and outputs) so that you have as many as you need.  Your mathcad object should save your data to a file.  I changed my filenames to reflect what input values I used.

Next, insert a file input block for each variable.  Connect the file input blocks to the mathcad object.  You may have to format your data into 2 columns -- leftmost column is the time (in the simulation) that the data is sent through the wire.  The second column is the data that you want sent.

You may need to put a dummy line at the end of your mathcad block that says 'out0 := 1' or something, and put a display block connected to the output.  This will make VisSim completely process your entire Mathcad file before it goes on to the next time value.  Also, the mathcad server may become busy and you'll have to continue pressing enter.

Then once you get your data files, you can import the data into Mathcad with the READPRN command (or a file input object) and process it from there.

This process is quite lengthy and cumbersome but it is the only way that I have found that will work.

If anyone from Mathsoft is reading out there, PLEASE PLEASE work on supporting Given-Find blocks in the Mathcad programming loops in the next version!!  (For you newbies out there, try typing in the word 'Given' into the first line of a programming structure and watch Mathcad crash and burn.....)

Hope this helps,
Matt
mattman206@hotmail.com

RE: Placing "Given" solve blocks into loops

It sounds to me as though you should create a function
usign the Given-find block solver, then access the function

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!