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


Groups > comp.lang.python > #38956 > unrolled thread

Re: python math problem

Started byBob Brusa <bob.brusa@gmail.com>
First post2013-02-15 20:57 +0100
Last post2013-02-15 20:57 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python math problem Bob Brusa <bob.brusa@gmail.com> - 2013-02-15 20:57 +0100

#38956 — Re: python math problem

FromBob Brusa <bob.brusa@gmail.com>
Date2013-02-15 20:57 +0100
SubjectRe: python math problem
Message-ID<mailman.1843.1360958249.2939.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web