Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38952

python math problem

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'line:': 0.07; 'length)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:python': 0.11; '(x,': 0.16; 'angle': 0.16; 'coordinates': 0.16; 'multiples': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'string': 0.17; 'trying': 0.21; 'subject:problem': 0.22; 'header:User-Agent:1': 0.26; 'values': 0.26; 'header:X-Complaints-To:1': 0.28; 'skip:- 10': 0.32; 'getting': 0.33; 'received:comcast.net': 0.33; 'to:addr:python- list': 0.33; 'skip:: 10': 0.35; 'expected': 0.35; 'received:org': 0.36; '(i.e.': 0.36; 'should': 0.36; 'why': 0.37; 'skip:( 30': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'email addr:gmail.com': 0.63; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; '180': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Kene Meniru <Kene.Meniru@illom.org>
Subject python math problem
Followup-To gmane.comp.python.general
Date Fri, 15 Feb 2013 14:39:27 -0500
Organization illom.org
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host c-68-49-243-100.hsd1.md.comcast.net
User-Agent KNode/4.4.7
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To Kene.Meniru@illom.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1839.1360957179.2939.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360957179 news.xs4all.nl 6902 [2001:888:2000:d::a6]:59779
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38952

Followups directed to: gmane.comp.python.general

Show key headers only | View raw


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
::::::::::::::::::
KeMeniru@gmail.com

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

python math problem Kene Meniru <Kene.Meniru@illom.org> - 2013-02-15 14:39 -0500
  Re: python math problem John Machin <sjmachin@lexicon.net> - 2013-02-15 18:51 -0800

csiph-web