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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Seperating Variables?

ptc-4223990
1-Visitor

Seperating Variables?

I use MathCAD Primarily for homework and I love it, but there is one problem. I set my problems up so that they go horizontally across the worksheet, and they work for them goes downwards for as long as needed. My problem is that the variables are being shared across all of them, and since most of our problems are similar, it gives me some difficulties. Right now I'm making due by setting up the variables for each problem differently, like voltage for problem 1, 2 and 3 are V.1 V.a and V.aa, but I would really like to find an actual solution. If I could just set a vertical line to disallow variable sharing, I would be happy. Also, how does one go about changing the units on an answer? I tried the insert unit but it wouldn't let me insert it, and now I just have to set the entire worksheet to use something like mA instead of A or something.

ACCEPTED SOLUTION

Accepted Solutions

Spencer Graff wrote:

I use MathCAD Primarily for homework and I love it, but there is one problem. I set my problems up so that they go horizontally across the worksheet, and they work for them goes downwards for as long as needed. My problem is that the variables are being shared across all of them, and since most of our problems are similar, it gives me some difficulties. Right now I'm making due by setting up the variables for each problem differently, like voltage for problem 1, 2 and 3 are V.1 V.a and V.aa, but I would really like to find an actual solution. If I could just set a vertical line to disallow variable sharing, I would be happy. Also, how does one go about changing the units on an answer? I tried the insert unit but it wouldn't let me insert it, and now I just have to set the entire worksheet to use something like mA instead of A or something.

Some things can be fixed and some can't. Mathcad works from top down and left to right. A variable defined with a value will be recognized to the right and below that definition. If you want to reuse a variable name, I suggest you make your worksheet vertical rather than horizontal, then a redefinition of a variable will be effective until it is redefined for the next problem. Note that it is possible to "free" a variable for the symbolic processor (see sheet)

Units we can do!

View solution in original post

3 REPLIES 3

Spencer Graff wrote:

I use MathCAD Primarily for homework and I love it, but there is one problem. I set my problems up so that they go horizontally across the worksheet, and they work for them goes downwards for as long as needed. My problem is that the variables are being shared across all of them, and since most of our problems are similar, it gives me some difficulties. Right now I'm making due by setting up the variables for each problem differently, like voltage for problem 1, 2 and 3 are V.1 V.a and V.aa, but I would really like to find an actual solution. If I could just set a vertical line to disallow variable sharing, I would be happy. Also, how does one go about changing the units on an answer? I tried the insert unit but it wouldn't let me insert it, and now I just have to set the entire worksheet to use something like mA instead of A or something.

Some things can be fixed and some can't. Mathcad works from top down and left to right. A variable defined with a value will be recognized to the right and below that definition. If you want to reuse a variable name, I suggest you make your worksheet vertical rather than horizontal, then a redefinition of a variable will be effective until it is redefined for the next problem. Note that it is possible to "free" a variable for the symbolic processor (see sheet)

Units we can do!

Thanks, the unit conversion works like a charm, and I guess I'll have to go vertically for my questions now, but at least I know how to release it.

wayne
12-Amethyst
(To:ptc-4223990)

In addition to what Fred said

Re-using variable names is not a problem, but

At the beginning of each problem, you should clear the variables, like setting each to 0 or a large number with units, or even with NaN (not a number), that way you will prevent a variable from bleeding into the next problem, and not realizing that you have not updated it yet.

With matrices, you should clear them also, because if you construct matrices element by element and the previous matrix was larger, those values outside the intended range will still be there.

If, as I often do, use something like V(x) and also want to use V as a single value of V(x), you could set a standard for yourself; I (and probable only me) use fV(x) and V at x, f indicating a function.

Same for matrices, where I often need a matrix V and a single value of V, so I typically use VV for the matrix, though I could be a little more consistent and use mV for a matrix.

I also go horizontally and down, otherwise the files get too long, but this should not make a difference. Sometimes going horizontally, you cannot tell visually if the adjacent expression is above or not, so use the aligning horizontally tool, and this will sort it out, especially for programs and matrices.

Announcements

Top Tags