Re: on-line calculator
- From: Julio Di Egidio <julio@xxxxxxxxxxxxx>
- Date: Thu, 08 May 2008 16:22:54 EDT
David W. Cantrell wrote:
Julio Di Egidio <julio@xxxxxxxxxxxxx> wrote:
troymius wrote:sure
[...]
In the code, pi is only defined with a limited
precision (16 digits or
so), so to get a completely correct answer for
tan(pi/2) i would have
to implement some kind of a logic... I am not
how to do that yet.
Easy answer: with (closed) interval arithmetic!
It's not quite as easy as you thought; see below.
Furthermore, I doubt that the OP would want his
calculator to give answers
as intervals.
Hmm, why not? For instance, on the built-in Win calculator I simply get a NaN, which is anyway not that useful. Conversely, from an interval to a float (say, for display purposes) you just need a MID function or something like that. Not to mention, again, the fact that as soon as you go to graphing results, you *have* to think in terms of intervals.
Moreover, given all that there is about closed computation and the bounding of errors, I really do not see where the problem is, unless you are referring at algebraic systems with infinite precision, and, even in that case, are results really *correct* in any case, given also implied errors in measurements (the OP is an engineer)?
Am I missing something (maybe in some broader picture)?
In that realm:interval:
pi = 'exact-pi' +- err
or rather, pi is the (topologically closed)
(still closed)
pi = ['exact-pi'-err, 'exact-pi'+err]
With closed interval arithmetic, then you'd get the
interval:
tan(pi/2) = [overflow, infinity]
No. There would need to be a corresponding negative
interval unioned with
that (since the tangent function is negative for
arguments slightly larger
than pi/2).
Yes, that is right: as I said I didn't think out my "calculation" too much, I was just trying to hint at a possible approach, and one actually that to me is very powerful for (obvious?) reasons, including the relative easiness of implementation.
In any case, you make me curious: would I be right in thinking that a correct answer might have been (implying we are in IR*):
tan(pi/2) = [-oo,-owf] u [+owf,+oo] c [-oo,+oo]
so, by containment:
tan(pi/2) = [-oo,+oo]
-LV
.
David
Hope my "calculation" is correct as I did it fromthe top of my head. In
any case, the idea behind it should be clear enoughonce you also think
that, when graphing your results, you always end updrawing rectangles...
maybe note that I am
Let me know if you need further pointers, and also
myself trying to build (although in my spare time)a system for
parsing/calculating/graphing, based on closedinterval arithmetic, to
eventually put on the web. Maybe we could join theefforts with an open
source/free software kind of project?
-LV
[...]
- Follow-Ups:
- Re: on-line calculator
- From: David W . Cantrell
- Re: on-line calculator
- References:
- Re: on-line calculator
- From: David W . Cantrell
- Re: on-line calculator
- Prev by Date: Re: determine function
- Next by Date: Re: determine function
- Previous by thread: Re: on-line calculator
- Next by thread: Re: on-line calculator
- Index(es):
Relevant Pages
|