mathcad: hot to create cycle from equations
mathcad: hot to create cycle from equations
(OP)
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 (<
. I wouldn't like to redefine all variables
.
I am a new user of mathcad, so I apologize if I post a stupid question.
Hope for an answer.
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 (<
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
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: mathcad: hot to create cycle from equations
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.
Eg:
Simple set:
------------------
x:= 1
y:= 2
z:= 3
f:= x + y
g:= f + z
--------------------
cicle:
---------------------
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
i:=1..5
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
RE: mathcad: hot to create cycle from equations