

|
 |
| Programming > Forth > Re: Taylor seri... |
|
| << Topic |
< Post |
Post 4 of 6 Topic 4019 of 4053
|
Post > |
Topic >> |
Re: Taylor series FSIN, FCOS, FTAN
by Albert van der Horst <albert@[EMAIL PROTECTED]
>
Apr 27, 2008 at 05:04 PM
| In article
<ab4909ea-1f40-4f3d-92b3-0fab3aad2038@[EMAIL PROTECTED]
>,
The Beez' <hansoft@[EMAIL PROTECTED]
> wrote:
>On Apr 27, 12:30 pm, Albert van der Horst <alb...@[EMAIL PROTECTED]
>
>wrote:
>> For large values you should do range reduction. It amount to
>> subtraction multiples of 2*pi and such. At least try to land
>> in the [-PI, PI] interval.
>> It is wise to at least take that from the sources I supplied. This
>> greatly affects precision. If you omit range reduction, with your
>> Taylor series, it still works in principle.
>> For Chebychev it breaks down.
>
>: REDUCE.2PI \ x
> PI*2 \ x pi2
> FOVER FOVER F/ \ x pi2 x/pi2
> FLOOR \ x pi2 i(x/pi2)
> FOVER F* \ x pi2 mod(x,pi2)
> FROT \ PI2 MOD(X,PI2) X
> FSWAP F- \ PI2 MOD(X,PI2)
> FOVER 2E F/ FOVER \ PI2 MOD PI MOD
> F< IF FSWAP F- ELSE FNIP THEN ;
>
>I took this one from your source, but I'm unable to figure out what
>you're trying to do at:
>
> FOVER 2E F/ FOVER \ PI2 MOD PI MOD
>
>Where does "2E" come from all of a sudden? And why isn't it converted
>to a float before using it?
This is ugly shorthand for 2.0e0. That IS a float.
If the reduced number is greater than pi , another 2pi is
subtracted. You get pi by dividing by 2 (which need not
be an efficient thing to do in your situation).
>
>Hans Bezemer
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@[EMAIL PROTECTED]
&=n http://home.hccnet.nl/a.w.m.van.der.horst


|
6 Posts in Topic:
|
"The Beez'" < |
2008-04-26 04:12:45 |
|
Albert van der Horst < |
2008-04-27 10:30:59 |
|
"The Beez'" < |
2008-04-27 08:32:25 |
|
Albert van der Horst < |
2008-04-27 17:04:51 |
|
"The Beez'" < |
2008-04-27 08:45:45 |
|
"The Beez'" < |
2008-04-28 02:33:38 |
|
Post A Reply:

|
|
|
|