Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: critical points of a third order polynomial fit (simplification)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68490] Re: [mg68466] critical points of a third order polynomial fit (simplification)
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 7 Aug 2006 01:41:11 -0400 (EDT)
  • References: <200608060656.CAA23460@smc.vnet.net> <5951C758-2C5C-4727-AD67-41E11F62F79E@mimuw.edu.pl> <acbec1a40608060838n1c214499ledaa6ebdc94e0ebc@mail.gmail.com> <A35E92CF-D0AD-4DB3-8BCF-C23ECF0E51A4@mimuw.edu.pl> <acbec1a40608060945k24193537uf04f334949cede30@mail.gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

On 6 Aug 2006, at 18:45, Chris Chiasson wrote:

> Per offlist discussion with Andrzej Kozlowski, it is seen that
> Mathematica is capable of detecting the numerical ill conditioning in
> this problem when using arbitrary precision numbers. This can be
> tested by appending the following replacements to the definition of
> bracket:
>
> /. x_Real?InexactNumberQ :> SetPrecision[x, 14]
>
> /. x_Real?InexactNumberQ :> SetPrecision[x, 32]


Actually, what hapens in this case is that unless you use precision  
of at least 24 both expressions will return the same (not very  
useful) output: {ComplexInfinity, Indeterminate}. You need precision  
of at leat 25 to get one guaranteed correct digit, in which case you  
will get


Precision[x/.rep[3]/.rep[5]//InputForm]

1.42222


Precision[x/.rep[4]/.rep[5]//InputForm]

1.42222

With lower precision at some point of the computation Mathematica  
attempts to evaluate 1/0``11.03871382942938 (which it interprets as  
ComplexInfinity) issues a warning to the effect that it encountered  
division by zero and then returns the answer {ComplexInfinity,  
Indeterminate}. Although this answer is not very useful, it will be  
the same for both expression and you can see from it that Mathematica  
arrived at an approximate 0, which has 0 digits of Precision (and 11  
of accuracy). This tells you that you should significantly increase  
the precision of your input.

All of this can be avoided by using exact numbers in the input and  
writing everything as

N[expression to be computed,n]

where n is the number of correct digits you want to have in the  
output. Mathematica should then itself choose the right precision in  
the input that guarantees the requested number of digits in the  
output. I think that in most cases this approach is more efficient  
and convenient than using SetPrecision.

Andrzej Kozlowski


  • Prev by Date: Re: Re: returning a variable's name, rather than the variable's contents
  • Next by Date: Re: Re: Finding the Number of Pythagorean Triples below a bound
  • Previous by thread: Re: critical points of a third order polynomial fit (simplification)
  • Next by thread: Re: critical points of a third order polynomial fit (simplification)