Skip to main content
1-Visitor
August 17, 2010
Question

variable definition...

  • August 17, 2010
  • 3 replies
  • 6341 views

hi,

is there a way to declare variiables that is not "globally" recognized?

say,

on a given "region"', say page 1, i want to use variables x,y,z and assign values to them,

then on page 2, i will still use variables x,y,z and assign them different values..

and there will be no connection between the values of x on page 1 of that on page 2.

---

so why i want to use the same variables? i'm solving a number of book problems that uses the same variable.

say, on Q1 and Q2, the question is to find the value of x given these parameters..

---

i can only achieve what i want by creating a new worksheet for another problem.

and i find having 10 problems and 10 seperate worksheets a little tedious..

thanks in advance

3 replies

24-Ruby IV
August 17, 2010

You can use two or more variables with same names but with different styles. They will be different variables.

1-Visitor
August 17, 2010

In Mathcad, variables are not global, unless you use the global equals.

If you define x:= 1 the value of x from there on down is 1. If just below you define x:=2, then, the value of x above the second definition is still 1, but below it, x = 2.

So you can insert a number of problems, and just keep redefining your variables for each problem.

Mona

1-Visitor
August 17, 2010

Example in attached image.

Mike

gLanzer1-VisitorAuthor
1-Visitor
August 18, 2010

thanks mike,

you got my question right.

i thought that is not permissible, guess ím wrong

(i'm getting a warning "This expression redefines a previously defined variable" - which NOW i know that i can safely "ïgnore")

1-Visitor
August 18, 2010

Nowel Lubi wrote:

thanks mike,

you got my question right.

i thought that is not permissible, guess ím wrong

(i'm getting a warning "This expression redefines a previously defined variable" - which NOW i know that i can safely "ïgnore")

No prolem.

You can turn the warnings off by clicking tools/preferences/warning and unchecking the variables box.

Mike

1-Visitor
August 17, 2010

In Mathcad, the argument to a function redefines itself at the point you re-range. If for instance you have ranged x:= -2,-1.999..2 and now you want to free the quick plot for the auto plot you declare x:= [it turns red] and the quick plot will plot in its default range -10..10 in 100 increments . Your question is not clear, not to say confusing.

MCADrange_1.gif

jmG

1-Visitor
August 17, 2010

jean Giraud wrote:

Your question is not clear, not to say confusing.

Jean,

Look at my image, his question is simple - he just wants to re-define variables without adding alpha or numerical symbols.

Having said that the poster could just do as in the attached image.

Mike

1-Visitor
August 18, 2010

I have replied more wisely as the very essence of the question made no sense. There are plenty of qs in the CD that do just what the collab wants. Variables are indefinitely redefinable. x1,y1,z1 ... x2, y2, z2 ... etc don't make sense either. Just care that if x, y, z are discretized, for the next use they have to be nulled, same thing with the any vector/array, i.e: null before reusing.

Jean