# Pythagorean theorem in equations

I am trying to calculate the Pythagorean theorem in an equation. But,
I have never used the exponential function, and am having problems
getting it to work.
Basically, I am just unsure of the correct syntax for the exponential
function. I think once I figure that out, I can get it to work,
maybe.
The equation (in layman's terms) that I need to use is: X=sqr(A^2 +
B^2) where A & B are the known values. But, when using the
exponential function, I don't know where or how to tell it to raise to
the 2nd power, in the syntax. The help doesn't help any either.
What I have currently is "D1@Sketch1" = sqr(exp("D2@Sketch1") +
exp("D3@Sketch1")). What is the correct syntax to tell it that the
exponential is the power of 2? Or am I just completely off-base to
begin with????
Thanks,
Seth
"Seth Renigar" a écrit dans le message de news: snipped-for-privacy@e65g2000hsc.googlegroups.com...
Not really the answer, but from my old days in Fortran, I would simply write "D2@Sketch1"*"D2@Sketch1" for "D2@Sketch1"^2
HIH JM

Seth,
exp("D3@Sketch1") is e^"D3@Sketch1"
You need something like hyp=sqr("D3@Sketch1"^2+"D3@Sketch2"^2)
SW Equations use VBA functions, operators and syntax, so you can look up more in the macro editor's help.
Dale,
OK, that works. Thank you.
Basically, this is not using the built in SW exponential function syntax. It is using a more conventional syntax. This does make it much more simple. But, just out of curiousity, what would the correct syntax be if you really wanted to use the built in SW exponential function? I know nothing about VBA...
Seth
I'm not sure what you mean by "built in exponential function". Syntax in the dimension modify box? Anyhow, for equations VBA *is* the built-in function, with all the same limitations and capabilities: one-line IF functions, random number functions (fun!), and some trig functions missing (use trig identities to get cotangent, etc.)
Way back in 2000 (I think), they was a bug where you could see the mechanism for this under certain circumstances. Basically, the SW equations seemed to be translated into VBA statements for evaluation.
What I mean by the built in function is:
When you use the Add Equation dialog box and click the exponential button, SW puts in " exp( ) " and then needs more information. It needs the dimension you want to raise, and the power you want to raise that dimension to. My question is what would the syntax be to enter this missing information, using this "built-in" button?
Maybe its just me thats not understanding something correctly... I'm not dumb by no means. But, I am not a math wiz either.....
Seth
I see. The problem isn't density, maybe tunnel vision. I know both very well. The equation editor has both the exponential funtion (e^x) and exponentiation (x^y). The "^" is down in the RH corner. You want to use an exponent (2) to square a quantity. "Exponential function" is the inverse of the natural log, which you don't want.
The "exp()" function is simply the WRONG function to use. "exp(n)" raises "e" to the "n" power (e=2.7818281828...).
The caret "^" is used to raise to a power. Since you are only squaring, you can also simply multiply the number by itself.
There is a square root function, "sqr()". You can also get square root by raising to power of 0.5 (i.e. "n ^ 0.5")
Whowa.... Yep, I was way off base with this one... Never noticed the "^" in the RH corner....
Thanks for all your help, and tolerating my stupidity... : )
Seth

#### Site Timeline

• Has anyone saved an older copy of 3Dconnexion drivers? The filename will...
• next in

• Hey SW gurus, I've had this problem for a while starting back in SW2005 on W2k...
• previous in

• I apparently saved a part in the rolled back state while working in an assembly....
• last updated in

• I am trying to create a boundary surface relation in SolidWorks, while selecting...
• last posted in