Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Excel Formula to Mathcad Formula 1

Status
Not open for further replies.

reggie3

Automotive
Oct 23, 2013
4


I am trying to convert a complex sum created in excel to something I can manipulate in Mathcad. I am very new to mathcad to any help would be greatly appreciated. Mathcad 14 and the excel is as follows.

'= 0.3*EXP(1.15*(1.16-0.00744*du-0.0246*Wd+(1-SQRT((LN(1+((20-Wb)/(20+Wb))))^2)-0.05*Wd)*0.2))+3/(Wc+Wd+We)-0.05

du, Wd, Wb, Wc, and We are variables.

 
Replies continue below

Recommended for you

The only bits that won't work are the functions

EXP e^

SQRT backslash or on a palette somewhere no doubt

LN loge I think.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Which version of Mathcad are you using? (i.e. "Mathcad Classic" version 15 or earlier, or the new "Prime" - the user interfaces are quite different.)

However, in both cases, you have a "Calculator" palette of common mathematical operators, so you just compose the expression as you see it algebraically on the printed page. There are "hot keys" for many mathematical operators and functions, but I just use the normal keyboard, and the "Calculator" palette.

"EXP" has an "e^x" symbol on the "Calculator" palette (or type "e^...")
"SQRT" has a Square Root symbol on the "Calculator" palette (and there's an "n'th root" option as well)
"LN" has an "ln" symbol on the "Calculator" palette (or type "ln(...)")

Hope this helps!

 
You can also use exp() instead of what I did then you don't have write e^.
 
Thank you for your help.

I am trying to figure out the behavior of the equation by creating a graph and trying to figure out what has the biggest weighting in the equation (Wd) I believe and the Wb value max is 20 I believe. Any suggestions would be great
 
am trying to figure out the behavior of the equation by creating a graph and trying to figure out what has the biggest weighting in the equation (Wd) I believe and the Wb value max is 20 I believe. Any suggestions would be great
I am not sure what you are trying to do and how you would define that "weighting" effect you'd like to maximize.

You have a function in 5 parameters (du and Wb to We). Are you trying to find a maximum of this function? You may consider using "maximize".
 
Could you explain maximize function?

I am trying to define the most important parameter, the one that affects the result the most.

Ultimately I would like to create a graph that shows the value of the function with multiple parameter values.


Thank you for your help
 
Could you explain maximize function?
Think Mathcads built-in help is pretty good and complete, but I'll attach a file showing it.

I am trying to define the most important parameter, the one that affects the result the most.
Still not clear how you would define "most affected" in terms of mathematics. Maybe using gradients?

Ultimately I would like to create a graph that shows the value of the function with multiple parameter values.
You have a function in 5 parameters - to graph you would have to hold a least 3 constant (3D-plot) or better even 4. So you have to decide what you want to see.

Find attached the sheet which finds (numerically) a local maximum of the function. The results depends strongly on the initial guess values, though.
 
 http://files.engineering.com/getfile.aspx?folder=402590c1-61c3-4990-9843-a8574a39381c&file=Expression2.xmcdz
To expand on what rmix22 says:

Presumably, your function describes some sort of physical process or phenomenon (you haven't given us many clues!), and each of the five parameters has a plausible range of values. In the absence of any understanding of the problem, mathematically, we can only assume that each of the parameters is valid for any value from negative infinity to positive infinity, but when modelling physical phenomena, the "valid" range is often much smaller. The mathematical solution could be visualised as a possibly very complex multi-dimensional "surface" with possibly many local maxima and minima (possibly an infinite number?), depending on the values of the 5 parameters, but if any or all of the parameters has a small valid range, the solution space could be much simpler, with only a small number of local maxima and minima; maybe only a single solution.

Consider a much simpler problem - find the maximum value of the expression:

z(x,y) = x^2 + y^2

By inspection, this function tends to infinity as either x or y approaches plus or minus infinity. However, if the valid ranges of x and y are [0.0 to 1.0] say, then there is only one maximum value that we are interested in:

z(1,1) = 2

Or an even simpler case: what is the maximum value of the following function?

y = sin(x) * x^2

There are an infinite number of local maxima and minima, each one bigger than the previous (as x increases), but if x lies in the range [0 to pi], there is a unique maximum vale of interest.

Hope this helps!

 
SQRT((LN(1+((20-Wb)/(20+Wb))))^2
In this part of the equation it seems that you are taking the square root of
LN(1+((20-Wb)/(20+Wb))) and then squaring it. This doesn't make sense.
 
@jghrist:
Don't you just LOVE "balancing" the parentheses in long expressions in Excel?!

Was the OP trying to:

a) Evaluate the terms inside the parentheses, then take the logarithm, then square it, then take the square root (which is pretty pointless); or
b) Evaluate the terms inside the parentheses, square it, take the logarithm, and then take the square root of the logarithm (which might be meaningful); or
c) Some of the embedded parentheses could be incorrectly nested, so who knows what the intent is?

It's so much easier to check your algebra in something like Mathcad rather than Excel - that alone is reason enough to go to Mathcad for complicated engineering expressions!

 
All parameters will take a value between 0 and 50 if that helps things. I am currently working on tightening the range and the result I want from the function has to fall between 0.65 and 0.95. I am trying to determine the working range of each of the parameters to achieve the target range. I know the Wd has the biggest influence on the final result.
 
jghrist said:
it seems that you are taking the square root of
LN(1+((20-Wb)/(20+Wb))) and then squaring it. This doesn't make sense
No. It's the other way round and it makes sense.

jhardy said:
then take the logarithm, then square it, then take the square root (which is pretty pointless)
You have to consider that a logarithm can be negative so the root would be imaginary. It seems that the intent is to avoid that. Alternative would be the use of the absolute value but squaring has the advantage of being a continuous and differentiable function, so it may have merits. You cannot get rid of the root and squaring unless you want to introduce an absolute value or an if condition, asking if Wb is greater than 20 (the log is negative then). But of course you could simplify the expression in the log.

reggie3 said:
All parameters will take a value between 0 and 50 if that helps things. I am currently working on tightening the range and the result I want from the function has to fall between 0.65 and 0.95. I am trying to determine the working range of each of the parameters to achieve the target range. I know the Wd has the biggest influence on the final result.
Fine to get some additional info at last. And you are looking for a maximum in that range or what is the goal?
You might consider eliminating Wc and We and replace Wc+We by a single variable. So one variable less to struggle with.
You may also consider a brute force attack using four nested loops to find whatever you are looking for.
Good luck!
 
It certainly isn't germane to the essence of the discussion here, but the equation that rmix22 is working with is missing a "du" in the last term.

David Simpson, PE
MuleShoe Engineering

"Belief" is the acceptance of an hypotheses in the absence of data.
"Prejudice" is having an opinion not supported by the preponderance of the data.
"Knowledge" is only found through the accumulation and analysis of data.
The plural of anecdote is not "data"
 
zdas04 said:
the equation that rmix22 is working with is missing a "du" in the last term
You are right - its seems it doesn't mater anymore for reggie3. But i am not sure what you mean. In the expression reggie3 posted in first place I see "du" only once and its there in my expression.
 
Dang, I'm sorry. I was looking at the .pdf that Occupant posted and they had added a "du" to the last term. The OP didn't have that term and your version looks like it matches his.

David Simpson, PE
MuleShoe Engineering

"Belief" is the acceptance of an hypotheses in the absence of data.
"Prejudice" is having an opinion not supported by the preponderance of the data.
"Knowledge" is only found through the accumulation and analysis of data.
The plural of anecdote is not "data"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor