Sqrt()

This is a discussion on Sqrt() within the A Brief History of Cprogramming.com forums, part of the Community Boards category; It's convoluTed, look here for a definition....

  1. #16
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    It's convoluTed, look here for a definition.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  2. #17
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Mathworld is a good reference for mathematical topics. Here is another definition of convolution.

    http://mathworld.wolfram.com/Convolution.html

  3. #18
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    The reason i want to know this is to find the length of a line, unless some1 knows a way to not use sqrt

  4. #19
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Why do you want to use sqrt() to find the length of a line? What line?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #20
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    ill post my basic code
    Code:
    FOR a = 1 TO SQRT((x1 - x) + (y1 - y))
    x = x + .5
    y = (y + ((y1 - y) / (x1 - x) / 2))
    DOT x, y
    NEXT
    Not using the sqr route the line would be to long or too short

  6. #21
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Calculating the length of a line. You mean the theorem of Pythagoras?
    http://mathworld.wolfram.com/PythagoreanTheorem.html

    Back to the original question:

    >I'm not neccessarily looking to find out how to do it (I could
    >easily find the answer myself), but to see if someone knows the
    >formula for it. My math teahcer said she used to know, but she
    >hasn't used it in so long that she forgot what it is.

    The same with me. I learned it in the math lessons at university, but it is a long time ago that I did that, like some other math I currently don't use much anymore. If I would see the algorithm I will probably understand it again, but I currently don't remember how to do it.

  7. #22
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Use sin cos or tan if you don't wish to use the square root function.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  8. #23
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    How do i use cos() to do it??

  9. #24
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Do you know any of the other lengths and or angles?
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  10. #25
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    The above code will plot a line from x,y to x1,y1

  11. #26
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Then all you need to do is take the arctan of opposite side/ adjacent side to get an angle then use cos or sin with the appropiate length of one of the sides.

    why in the world do you want to do this without using a sqrt function?
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  12. #27
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    You confuse me, i never use geometry exept for my circle() function

  13. #28
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Do you know any trig.?
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  14. #29
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    i cant use -metery

  15. #30
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    That sucks, why not?
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2006, 05:37 PM
  2. sqrt() function help
    By willc0de4food in forum C Programming
    Replies: 5
    Last Post: 03-14-2005, 09:07 PM
  3. SQRT Mystery...
    By KneeLess in forum C Programming
    Replies: 7
    Last Post: 03-23-2004, 07:49 AM
  4. sqrt
    By modec in forum C Programming
    Replies: 3
    Last Post: 04-16-2003, 08:19 AM
  5. how sqrt ?
    By sambs1978 in forum C Programming
    Replies: 3
    Last Post: 09-20-2001, 09:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21