Thread: ABOUT CALCULATION - Biorhythms

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    141

    ABOUT CALCULATION - Biorhythms

    HI EVERYONE,,

    this is my function and i will state the problem at the bottom..

    Code:
    //calculate the physical cycle which has physical curve 23 days
    double physicalCycle(Date& dob, Date& currentDate)
    {
       double score;
       double distance = distanceFromDobAndCurrentDate(dob, currentDate);
       
       score = 100 * sin(360*(distance/23));
       return score;
    //check - the answer should be 63.10879473
    }
    when i entered
    dob: 1 1 1969
    current date: 1 6 2004

    the output of the physical cycle should be 63.10879473 but it is wrongly output which is -80.---

    can someone tell me wat is the problem, is it the formula or..?

    this is the website u can calculate the physical cycle http://www.orcapia.com/froggy/biorhy...&detl=1&save=1

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Have you checked that the distance is calculated correctly? Have you taken into account that sin takes radians, not degrees? (To convert from degrees to radians multiply by pi and divide by 180)
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    141
    i though tat sin is in the library..

  4. #4
    Registered User
    Join Date
    Jan 2006
    Posts
    141
    yes the distance is 100% sure correct

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Date calculation program
    By putty88 in forum C Programming
    Replies: 5
    Last Post: 04-17-2009, 07:24 AM
  2. Problem with modulo calculation
    By manutdfan in forum C Programming
    Replies: 6
    Last Post: 01-12-2009, 03:37 PM
  3. C# calculation problem
    By Diablo02 in forum C# Programming
    Replies: 13
    Last Post: 10-25-2007, 08:42 PM
  4. Help with calculation and loop
    By Betty in forum C Programming
    Replies: 7
    Last Post: 04-10-2006, 05:37 AM
  5. help with pay calculation program
    By shugstone in forum C++ Programming
    Replies: 2
    Last Post: 02-17-2003, 09:38 AM