Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.064 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'line:': 0.07; 'received:192.168.178': 0.07; 'length)': 0.09; 'subject:python': 0.11; '(x,': 0.16; 'angle': 0.16; 'coordinates': 0.16; 'multiples': 0.16; 'string': 0.17; 'trying': 0.21; 'subject:problem': 0.22; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'skip:- 10': 0.32; 'getting': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'expected': 0.35; 'received:209.85': 0.35; 'message-id:@gmail.com': 0.36; '(i.e.': 0.36; 'should': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:( 30': 0.38; 'sure': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'end': 0.40; 'your': 0.60; 'perfect': 0.63; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'reply-to:addr:gmail.com': 0.79; '180': 0.84; 'calculations': 0.84; 'bob': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:reply-to:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=7HtNfxovJwIjGdtQ1JDXzg5FH6nkdIRCEcUrzBvQLok=; b=UQYwdlOomlcSWYlXiLJSpflxvFYsH+hTiwm1mcklbBoYIEl7mwmVzgxHtNNRiwEYKg ZskudEUcEvm6IKcHNFv1SQl2fZ4o5NPmZThx9QSNYaN14x3CnGL3F34qmVC6xQ+pNVGy Fyb+i/mDb/XbuvKjXa8t+U/E6zOQTwwHZIRi+d1Qk/uv1fduwlVQGCTenEqP7cr72htu ukwnZuCzzv5BB8jU5MXFmhZLacuW8yLV/JLI1wcXsx2vJ5FELrBo1r+cMhNnWgltOxDJ ryEuPaVponmDMuDcgASf5r0GfRJVkT5Bhh36sYRoBpaplhiFREU/x0GRL9c0/aZnwwKu xhFQ== X-Received: by 10.14.3.133 with SMTP id 5mr11606842eeh.43.1360958246960; Fri, 15 Feb 2013 11:57:26 -0800 (PST) Date: Fri, 15 Feb 2013 20:57:27 +0100 From: Bob Brusa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: python math problem References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: bob.brusa@gmail.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360958249 news.xs4all.nl 6984 [2001:888:2000:d::a6]:45118 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38956 Am 15.02.2013 20:39, schrieb Kene Meniru: > I am trying to calculate the coordinates at the end of a line. The length > and angle of the line are given and I am using the following formula: > > x = (math.sin(math.radians(angle)) * length) > y = (math.cos(math.radians(angle)) * length) > > The following are sample answers in the format (x, y) to the given > length/angle values of the line: > > 120/0 = (0.0, 25.0) > 120/89 = (24.9961923789, 0.436310160932) > 120/90 = (25.0, 1.53075794228e-15) > 120/91 = (24.9961923789, -0.436310160932) > > Why am I getting a string number instead of the expected answer for 120/90 > which should be (25.0, 0.0). This happens at all multiples of 90 (i.e. 180 > and 270) > Kene, are you sure your length is 120? It seems to be 25. I did these calculations with length = 25 and then your numbers make perfect sense. Bob