Author Topic: you say you're pretty good at numbers....hehehehe  (Read 6208 times)

0 Members and 1 Guest are viewing this topic.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« on: February 06, 2004, 08:47:20 PM »
I came across this formula for calculating the circular equivalent of  a rectangular duct and I managed to string it out so it works...here it is:

Code: [Select]
(* 1.3 (exp(/(log (/ (expt (* A B) 5) (expt (+ A B) 2)))8)))

where A and B are reals; solves for D (diameter)

I wonder if someone could rearrange this equation ,so that if I knew :
B and D I could find A or if I knew A and D I could find B

Go ahead, give it shot...I've only been on it ALL day! :oops:

mohobrien

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #1 on: February 06, 2004, 09:13:48 PM »
This looks like a challenge!
Is this really what expt is?
Function EXP, EXPT

Syntax:


exp number => result

expt base-number power-number => result



Arguments and Values:


number---a number.

base-number---a number.

power-number---a number.

result---a number.


Description:


exp and expt perform exponentiation.

exp returns e raised to the power number, where e is the base of the natural logarithms. exp has no branch cut.

expt returns base-number raised to the power power-number. If the base-number is a rational and power-number is an integer, the calculation is exact and the result will be of type rational; otherwise a floating-point approximation might result. For expt of a complex rational to an integer power, the calculation must be exact and the result is of type (or rational (complex rational)).

The result of expt can be a complex, even when neither argument is a complex, if base-number is negative and power-number is not an integer. The result is always the principal complex value. For example, (expt -8 1/3) is not permitted to return -2, even though -2 is one of the cube roots of -8. The principal cube root is a complex approximately equal to #C(1.0 1.73205), not -2.

expt is defined as b^x = e^x log b. This defines the principal values precisely. The range of expt is the entire complex plane. Regarded as a function of x, with b fixed, there is no branch cut. Regarded as a function of b, with x fixed, there is in general a branch cut along the negative real axis, continuous with quadrant II. The domain excludes the origin. By definition, 0^0=1. If b=0 and the real part of x is strictly positive, then b^x=0. For all other values of x, 0^x is an error.

When power-number is an integer 0, then the result is always the value one in the type of base-number, even if the base-number is zero (of any type). That is:


 (expt x 0) ==  (coerce 1 (type-of x))

If power-number is a zero of any other type, then the result is also the value one, in the type of the arguments after the application of the contagion rules in Section 12.1.1.2 (Contagion in Numeric Operations), with one exception: the consequences are undefined if base-number is zero when power-number is zero and not of type integer.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #2 on: February 06, 2004, 09:21:22 PM »
that's it...  Now I've thrown down the gaunlet!  :shock:

mohobrien

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #3 on: February 06, 2004, 09:25:30 PM »
take a look at the brackets. one too many.

9 "(" and only 8 ")"

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
you say you're pretty good at numbers....hehehehe
« Reply #4 on: February 06, 2004, 09:35:02 PM »
Code: [Select]
(setq b (/ (* pi (expt (/ d 2) 2)) a))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #5 on: February 06, 2004, 09:35:40 PM »
syntax  is correct ..substitute 12.0 for all A's and B's then run it in editor should come up with 13.118

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #6 on: February 06, 2004, 09:42:19 PM »
Good try CAB! but if you use 12.0 for both A and B, the circular equivalent is 13.118...therefore if you use these as input  13.118 as D and 12.0 as A ,you should logically derive 12.0 as B. Yours comes up with 11.2627

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
you say you're pretty good at numbers....hehehehe
« Reply #7 on: February 06, 2004, 09:56:59 PM »
i did not get 13.118  as dia, i got 13.5406

 
Code: [Select]
(defun c:test()
  (setq a     12.0
          b     12.0
          area (* a b)
   )
  (setq dia (* (sqrt(/ area pi)) 2))
 

  (setq b (/ (* pi (expt (/ dia 2) 2)) a))
  (princ)
)
(princ)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
you say you're pretty good at numbers....hehehehe
« Reply #8 on: February 06, 2004, 09:59:34 PM »
mohobrien,

your way over my head :)

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #9 on: February 06, 2004, 10:08:46 PM »
AH! therein lies the rub! ASHRAE (american Society of heating, refrigerating and ac engineers) say that the equivalent area in sq inches is NOT the same once you changed the shape of the duct because of friction losses. That is why they use the equation I posted.  :roll:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
you say you're pretty good at numbers....hehehehe
« Reply #10 on: February 06, 2004, 11:31:36 PM »
Oh, I see,  not equivalent area but equivalent flow characteristics.

I did find the formula but the math is too much for me. Perhaps
someone can convert it.


I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

mohobrien

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #11 on: February 06, 2004, 11:47:51 PM »
My last math class was 1969. I don't think I could have figured this one then either.
But I see why my back bedroom was so cold when the temp went to -48C last week. I used corrugated tin foil for ducting and I hear that five feet of that is like trying to push heat down 250 feet of straight pipe.
 Back to topic:
                     I'm out of my league. All I can say is you'd have to use differential equations to figure it the other way. I'm lost.
Code: [Select]
(* 1.3
        (exp (/ (log (/ (* 248832.0(* B B B B B) )
           (+ 144 (* 24 B) (* B B))
    )
       )
       8
    )
        )
     )

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #12 on: February 07, 2004, 12:08:35 AM »
That 's the one CAB! Don't feel bad guys..I've been on this one LONG time and haven't figured it out yet! Small minds=lower tax brackets...I'm in the lowest.
Maybe the heavy hitters like Stig or Keith, Daron or Se7en can have a go at it....  :D

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16727
  • Superior Stupidity at its best
you say you're pretty good at numbers....hehehehe
« Reply #13 on: February 07, 2004, 02:02:33 AM »
Ok, I have looked at this and to be quite honest with you, my algebra is a little rusty.

What I have managed to decipher basically gets you down to the point where the quadratic formula "should" come into play, but after looking at it for a bit, I am confused about how to exactly get the answer to an equation that requires the variable from another equation.

For example....

X = AB^5
Y = (A+B)^2
Z = X/Y

Z is known
A is known
B is unknown
So, the problem is you must calculate X or Y before you can calculate Z

Now if anyone can solve this bit of the equasion for X and/or Y I can finish the modifications.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #14 on: February 07, 2004, 09:05:53 AM »
Exactly Keith...that was about as far as I got, could not figure out how to isolate A or B

Perhaps someone has an alternate way.. the problem is that this is the equation to calc a round  IF you know the square size..problem  is  I'm starting with a round and need to go to square (or rectang) :(

Ron Heigh

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #15 on: February 07, 2004, 09:47:40 AM »
On a different note:
If you use a math software like MathCAD, you can input the formula and define the variables.
It will then allow you assign values to some and tell you what the remaining variable needs to be to satisfy the equation.
If you can derive the Lisp equivalent, look here.
http://www.mathcad.com/products/

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
you say you're pretty good at numbers....hehehehe
« Reply #16 on: February 07, 2004, 12:53:01 PM »
When all else fails use a Sledge Hammer. :shock:

CAB


Code: [Select]
(defun Rnd_to_Sqr(Dia ; dia of round duct
                  A   ;; side A of square duct
                  / loop fuzz B)
  ;;  Returns Side B of square duct
  (setq B A  ; B is target
        fuzz 0.001
        loop T)

  (while loop
    (setq Dia2 (* 1.3
                  (exp
                    (/
                      (log
                        (/
                          (expt (* A B) 5) (expt (+ A B) 2)
                        )
                       )
                     8)
                   )
                  )
          )
      (if(equal Dia2 Dia fuzz)
       (setq loop nil); done
       (setq B (* B (/ Dia Dia2)))
      )
  )
  (princ)
  B
 )
(princ)


(defun c:test()
  (setq SideA 12.0
        dia 13.118
        SideB (Rnd_to_Sqr dia SideA)
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Water Bear

  • Guest
Bravo!!
« Reply #17 on: February 07, 2004, 02:27:16 PM »
CAB ..I wouldn't believe it if I hadn't seen it with my own eyes! Idon't quite understand HOW u made it work..but it works! :D  Bravo! and thank you

DParcon

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #18 on: February 07, 2004, 06:17:11 PM »
Water Bear,

  Here's your conversion formulas:

     To get A, B & D known: A = (0.836812758 x D X D) / B  

     To get B, A & D known: B = (0.836812758 x D X D) / A  

  Above formulas were derived from round to square formula:

     Round to Square (A=B): A = 0.914774703 x D

  You can also use an iteration loop in lisp based on the
  original formula (as posted by CAB).

  Have fun.

  Don

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #19 on: February 07, 2004, 08:44:45 PM »
Thanx Don ..those sure make it easy

I compared various examples using a Trane ductulator with CAB's hammer, and he is VERY accurate...

thanx again, and welcome to the club. :wink:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
you say you're pretty good at numbers....hehehehe
« Reply #20 on: February 07, 2004, 09:11:37 PM »
Revised the routine to make sure A is a real, else it won't work.

Don you formula only works if sides are 12x12?

Code: [Select]
(defun Rnd_to_Sqr(Dia ; dia of round duct
                  A   ;; side A of square duct
                  / loop fuzz B)
  (if (= (type a) 'INT);; make sure A is a REAL
    (setq A (* A 1.0))
  )
  (setq B A  ; B is target
        fuzz 0.001
        loop T)

  ;;  Returns Side B of square duct
  (while loop
    (setq Dia2 (* 1.3
                  (exp
                    (/
                      (log
                        (/
                          (expt (* A B) 5) (expt (+ A B) 2)
                        )
                       )
                     8)
                   )
                  )
          )
      (if(equal Dia2 Dia fuzz)
       (setq loop nil); done
       (setq B (* B (/ Dia Dia2)))
      )
  )
  (princ)
  B
 )
(princ)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #21 on: February 08, 2004, 12:06:35 AM »
I've tried Don's but I get inconsistent results. Case in point:

25 inch round to something by 12

(0.836812758 x 25 X 25) / 12 = 43.58399

Trane ductulator indictates it should be 49

If I use CAB's hammer I get  48.8559 :roll: close enough for me!
That's almost a 260 sq in difference.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #22 on: February 08, 2004, 11:38:08 AM »
However,in all fairness to Don, using his original equation I get:


0.914774703 x 25.0 = 22.869367575

compared using ASHRAE formula:

Code: [Select]
(* 1.3 (exp(/(log (/ (expt (* 22.869367575 22.869367575) 5) (expt (+ 22.869367575 22.869367575) 2)))8)))
the answer comes up 25.0!

And plugging into CABs'hammer:

(Rnd_to_Sqr 25.0 22.869367575) you get 22.8694  :P

Q.E.D.

DParcon

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #23 on: February 08, 2004, 12:47:38 PM »
WaterBear,

  In the formulas I've posted, the round to square is the
  accurate one since it was derived from the ASHRAE formula.
  Since you're the one in need of a shorcut, you can verify
  the accuracy of the formula for all cases. I repeat, I can
  vouch for the accuracy on round to square cases only. The
  formulas for the rectangular duct was derived using an equal
  area method using the area of the square duct equivalent of
  the round duct. I've not tested the conversion formulas and
  the accuracy might be questionable. Sorry for the confusion,
  as I was hoping that you'll be able to see through the formulas.

Water Bear

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #24 on: February 08, 2004, 01:28:38 PM »
Don't get me wrong I fully appreciate your taking time out to assist in this puzzle...
Everyone has a different angle of attack for a given problem, which is why I come here.
Just for the record, I ended up using a combination of BOTH methods!

Thanx again.... :D

daron

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #25 on: February 09, 2004, 09:52:59 AM »
I am not that good at math. Stig, is my algebra go to.

DEVITG

  • Bull Frog
  • Posts: 430
round to rectangle duct
« Reply #26 on: February 09, 2004, 05:58:52 PM »
After searching and asking a lot about it I got this answer from the EFUNDA.

I had post on the lily pond at this link , it is a xls file that allow to calc the b side given the diameter and the a side.
It explain it self and give the credit to ACRODUSTER1 , a fellowmember of EFUNDA .
http://theswamp.org/lilly.pond/devitg/red2rect.xls
efunda could be found at
http://www.efunda.com/forum/forum.cfm
Location @ Córdoba Argentina Using ACAD 2019  at Window 7

SMadsen

  • Guest
you say you're pretty good at numbers....hehehehe
« Reply #27 on: April 14, 2004, 03:14:27 PM »
Quote from: Daron
I am not that good at math. Stig, is my algebra go to.


Daron, that kinda made me feel obliged to answer!  *GRRRRrrr*

But, I could only get as far as D^4/1.3^4 = (A^2.5 * B^2.5)/(A + B) ... soooo, I went to a math guy and he cracked it! Only took him a few month :)

Here's his formula written for AutoLISP:

Code: [Select]

(defun testit (s1 s2)
  (* 1.3 (/ (expt (* s1 s2) 0.625)(expt (+ s1 s2) 0.25)))
)

(defun C:EQDUCT (/ a b d di x1 x2 y)
  (setq di (getreal "\nEnter diameter of round duct: ")
        b (getreal "\nEnter side in rectangular duct: ")
  )
  (setq d (/ (expt di 4.0) (expt 1.3 4.0)) ;;2.8561)
        y  (sqrt b)
        x1 (* (expt (/ (* 2 d) (* 5 (expt y 5.0))) (/ 1.0 3.0)) 2.0)
        x2 (- x1
              (/ (- (* (expt y 5.0) (expt x1 5.0))
                    (* d (expt x1 2.0))
                    (* d (expt y 2.0))
                 )
                 (- (* 5.0 (expt y 5.0) (expt x1 4.0))
                    (* 2.0 d x1)
                 )
              )
           )
  )
  (setq a (expt x2 2.0))
  (mapcar 'princ (list "\nMissing side = "
                       (fix a)
                       "\nTest: Input diameter: " di
                       "\n      Calculated diam.: " (setq d (testit a b))
                       )
         
          )
  (princ)
)


There is a built-in deviation of 4-5% but it can be controlled by putting it into a loop like (while (< (/ (abs (- x2 x1))(abs x2)) n) ... ) where n is the allowed accuracy.