MathGroup Archive 2006

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

Search the Archive

Re: setting precision locally within module

  • To: mathgroup at
  • Subject: [mg72460] Re: [mg72447] setting precision locally within module
  • From: "Chris Chiasson" <chris at>
  • Date: Fri, 29 Dec 2006 05:15:47 -0500 (EST)
  • References: <>

If you read the description of $Pre closely, you will probably notice
that it only applies to input. By the time your gauss function is
called (and Sets $Pre$nnn, which won't change $Pre anyway), it is too
late for $Pre to do anything.

It appears you are trying to write a pivoting operation for Gaussian

Why do you need to set the precision in the middle of your pivoting
routine? Can you just write the logic for the routine and then supply
it with numbers of the desired precision?

Are you concerned about formatting output? If that's the case, you can
easily do your computations and then specify the precision to which
you would like the numbers printed by using NumberForm or by directly
changing the precision of the numbers after the computation is
finished through the use of SetPrecision.

On 12/28/06, jltrahan at <jltrahan at> wrote:
> Hello,
> I'm trying to define the number of significant figures used for all
> calculations within a module. For example, I'm using the following syntax:
> gauss[dig_]:=Module[{$Pre=N[#,dig]&},
>          For[k=1,k<=n,k++,
>             For[i=k+1,i<=n,i++,multiplier=A[[i,k]]/A[[k,k]]]];
>          ...]
> I must be able to input any number of digits specified. I'd really
> appreciate any help.
> Thanks in advance,
> Jamie


  • Prev by Date: Why doesn't DSolve find all the solutions of this pde
  • Next by Date: Re: GraphPlot display anomaly
  • Previous by thread: setting precision locally within module
  • Next by thread: glibc version problem