Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Students Click Here

mathcad: hot to create cycle from equations

mathcad: hot to create cycle from equations

mathcad: hot to create cycle from equations

Hi everybody!

I have a question: I wrote a worksheet with many many equations and variables, defined with ":="

Now, I need to trasform the simple calculation in a cycle, in order to repeat the calculation with many iput data; the problem is that variables have to be defined "locally" for the cycle, with the "left arrow".

I wonder if tere is a simple and quick way to chanche the definition of the variables (they are quite a lot) from "general" (:=) to local (<winky smile. I wouldn't like to redefine all variables smile.

I am a new user of mathcad, so I apologize if I post a stupid question.

Hope for an answer.

RE: mathcad: hot to create cycle from equations

Do you have a worksheet you can post so we can get a better idea of what's going on?

Are you trying to create a if/then sort of statement? or a function of a function sort of thing?

Programming statements in MathCAD take a bit more practice, but the tutorials are pretty straightforward. It's like a really ugly version of C++.

g(x), f(x) and f(g(x)) work in mathcad pretty easy... there's some order to the definition of the statements that's pretty strict, but nothing that can't be solved by banging your head against it.

RE: mathcad: hot to create cycle from equations


thanks for your answering. Unfortunately now I can't post the worksheet, but I think the easiest way is to trasform the equations I wrote in a function, and then giving everytime the new data.

What I was trying to do was to transform a simple set of equations in a "for" cicle, so that I could import "n" rows of data, and perform the calculation "n" times with the data of each row.


Simple set:

x:= 1
y:= 2
z:= 3

f:= x + y

g:= f + z


n11 n12 n13
N:= n21 n22 n23 so that ni1 = x; ni2 = y; ni3 = z
n31 n32 n33

for i:1,3

f[i := ni1 + ni2

g[i := f[i + ni3

end for

Now, reading you advices, I think the best way is to trasform the set in a funcion of x,y,z, and specifing x,y,z each time.

Thanks for answering

RE: mathcad: hot to create cycle from equations

Have you considered using a range variable instead to iterate over the variables?


fi:= Ni,1 + Ni,2
gi:= fi + Ni,3

(I'd probably re-write it to use functions because that's my natural tendency, but range variables can be useful and easier for others to follow)

RE: mathcad: hot to create cycle from equations

I have tried to do it, but the division is a problem because I need a scalar value....

RE: mathcad: hot to create cycle from equations

In what context is division a problem? Can you post an example of the kind of expression that prevents you using range variables?

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.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


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
Design for Additive Manufacturing (DfAM)
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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close