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

Isolate a block area from the rest of the Mathcad sheet

Regular Member

Isolate a block area from the rest of the Mathcad sheet

I am still using MC 11.2

 

Sometimes I solve a set of math exercises, let say three of them, in the same MC document since they belong to the same exam.

I was looking for a way to separate completely one exercise from the others, not only in terms of  layout (using "Insert Area"), but also in terms of variable definitions. In this way a variable defined in the first exercise would not be seen (and used) in the second and third exercise. This to avoid overlappings of data.

 

Is there a way to do this, like a command "clear variables", or isolation blocks,  that are in use in other math software? If not, is there a workaround to achieve the same result?

 

Thank you.

Tags (1)
20 REPLIES 20

Re: Isolate a block area from the rest of the Mathcad sheet

Hi Anthony,

 

Mathcad does not have a 'clear variables' command. (Prime has,  but there are other things it doesn't have...).

Separate sheets gives the best isolation.

The second best is to undefine your variables at/after the end of every exrcise, using

var := var

to undefine the variable 'var', that is, it removes any definition (numeric or only the symbolic ones) attached to var.

The third best is to use unique variable names in each of your exercises. Attach the exercise number to each of your variables e.g...

 

Success!
Luc

Re: Isolate a block area from the rest of the Mathcad sheet

Just reset the symbolic variables and give new values to the constants.

Re: Isolate a block area from the rest of the Mathcad sheet

Hi,

Luc has the answer but has not gone far enough.  He said

"The second best is to undefine your variables at/after the end of every exercise, using

var := var

to undefine the variable 'var', that is, it removes any definition (numeric or symbolic) attached to var."

 

What he didn't add was you could put all these var:=var statements into a region which could be collapsed and leave just a line between each exercise.

 

Cheers

Terry

Re: Isolate a block area from the rest of the Mathcad sheet

Thanks Luc,  MFranc and Terry,

I knew the "trick" of redefining the variable. But when there are many of them, there is the risk of leaving something behind.

Luc and Terry: the trick of clearing the variable with var := var seems not working in MC 11.2 (at least, with numeric values).

I agree, that apart of putting a single exercise in a single sheet, the other workaround is to add numbering to variables, according to the exercise that is referring to.

 

A.

Re: Isolate a block area from the rest of the Mathcad sheet

Anthony,

 

you are right.

var := var     only clears the symbolic definition of var. It leaves the numeric definition intact. For that you need to use MFranc's suggestion: Redefine var numerically. But then it's defined symbolically as well, but with a numeric value; that will impact subsequent symbolic manipulations using var.

Seems the third-best option might be the best option when you want all exercises in one sheet.

Or you solve all exercises the way I advise to do generally:

1. First solve your problem (as much as possible) purely symbolically; using undefined or cleared symbols.

2. Then fill in the numbers (if needed), which involves defining numerical values to variables as applicable.

 

Either way, you have to keep track of any variables you use.

 

Success!
Luc

Re: Isolate a block area from the rest of the Mathcad sheet

To reset a variable symbolically AND numerically you may use the two step procedure shown in the picture.

But it sure is cumbersome and failure-prone to do so with all variables one by one.

B.png

The variable name "_-y-_" simply was chosen to ensure(?) its a name still undefined and unused.

Numerical clearing could be done using a vector, but symbolical clearing must be done singly one by one:

B2.png

 

Re: Isolate a block area from the rest of the Mathcad sheet

And the order in which you 'undefine' does matter.

First do the numeric, then the symbolic.

If you reverse that, your variable will be symbolically defined to whatever you chose as undefined symbol.

 

Success!
Luc

Re: Isolate a block area from the rest of the Mathcad sheet

Thanks Werner_E you too.

 

I don't know if the following is too naive. But I notice that it is enough to use (at least for numeric definitions) the following to clear variables' content.

 

var :=.  (i.e. dot).

or also var :=""  (enough to type once the double inverted comma).

 

The first works also by putting in a vector all variables, and then equalizing the vector to this:=.

 

Re: Isolate a block area from the rest of the Mathcad sheet

Hmm, nice find, but it's not quite the same I fear.

LM_20190905_Undefine.png

(I wonder if Mathcad 15 is the same.)

 

Luc