Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Explicit Calculation 2

Status
Not open for further replies.

ferryscott

Aerospace
Aug 18, 2008
14
Hi all,

In some reports, where variables have been stated earlier in the report it would be easier for those (other than myself) reading the document to see the values in the calcuation as well as the variables. Obviously this is as opposed to restating the values at the start of the calc (and wasting a lot of space).

Simple example (a=2in, b=3in, F=85ksi):

P=a*b*F
=2in*3in*85ksi
=5.1e5 lbf

I can show this calc using the explicit function with relative ease.

MY QUESTION:

What if i didn't have a=2in however? What if 'a' was calculated from two other variables, i.e. a=x-y (x=5in, y=3in)?

I then get:

P=a*b*F
=(x-y)*3in*85ksi (this is the line i get)
=2in*3in*85ksi (this is the line i need)***
=5.1e5 lbf

Is there any way of achieving this in Mathcad (v13)?

Thank you in advance.
 
Replies continue below

Recommended for you

You'll have include x and y in your calculation. E.g. explicit,a,x,y,b,F. This isn't quite what you want, but it is "explicit".
 
If 'a' is a simple calculation as in my example, that is ok. However if it is a more complex calc, this becomes more of a problem.

Is there a way of just showing the value of the variable 'a' and not it's origins?

Thanks again...
 
It's not very sophisticated, but why not just "echo" the current values of the relevant input variables just before you evaluate the expression; e.g.:

a =
b =
F =

P = a*b*F
P =
 
Hi Ferry,

I have the exact same problem, i was hoping to find a solution here.

I did have to use all above solutions in the past, but they are not what i am looking for (and very cumbersome in some cases)

Did you find another way?

Does one know of a function that would output the value stored in a variable as opposed to the formula it is made up ?

Does one know how to explicitly output a variable once it has passed thru an IF statement ?

Thank you
Thierry

(MATHCAD 13)
 
Hi there,

Sadly a simple solution never turned up. I've had to use a combination of two options.

The first is as JulianHardy says above.

The second achieves what I was after as far as the presentation of the report is concerned, however it involves using a little cheat which can really screw up your calculations if you don't keep a close eye on it.

Say x := y + z
then x = <some value>

Off the page, to the right of the visible border and slightly below the 'x = <some value>' line, I then REDEFINE 'x' MANUALLY to be equal to the value shown above.

i.e. x := <some value>

This is where the problems come in, obviously you need to make sure that this re-definition isn't interfering with your current calc, or declaration of x as a result of the calc.

Then, equally obviously, any changes you make to the calculations won't automatically carry through the document, you need to go through the document from your change downwards and redefine each of the values manually.

There's a huge scope for error in this, without being quite vigilant in your checking. I highlight each redefinition in some disgusting colour to make sure I don't forget to check them.

The plus point is that the variables are now stored as their value, rather than as their derivations.

I guess it's down to evaluating how important it is that you can display your calculations explicitly, against the added work and error risk of the above method. I personally use it for smaller forms, but avoid it for any lengthy calculations.

The answer to your question in a nutshell is no, i've not found a simple way which achieves this.

Maybe in some future version of mathcad this'll be possible. I haven't upgraded to v14 yet so I don't know whether it's fixed there or not.

Good luck,

Scott
 
Thanks Scott,

We'll we got around the exact same way, with the odd hand input, brigth red not to forget it. Unfortunately, as you say, it is taking out the automation and can lvery misleading if one value is forgotten.

Please update the thread if you ever find a way around.

Thanks
Thierry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor