       Re: Tabulating expressions dependent on two variables

• To: mathgroup at smc.vnet.net
• Subject: [mg112427] Re: Tabulating expressions dependent on two variables
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Wed, 15 Sep 2010 04:38:50 -0400 (EDT)

```On 9/14/10 at 5:14 AM, nbbienia at cyf-kr.edu.pl (Leslaw Bieniasz)
wrote:

>How should one modify the following code, in order to accurately
>tabulate a function f[x,y] of two variables, instead of the function
>f[y] of one variable? The values of x and y should be all
>combinations of the values of y indicated below.

>-----------------
>
>In:= Table[{N[y],SetPrecision[f[y], 70],Precision[f[y]]},
>{y,  { 1/10^19, 2/10^19, 5/10^19,

<snip>

>2 10^14, 5 10^14, 10^15,      2 10^15, 5 10^15
>
>}}]
>TableForm[%]

There is no fundamental difference between accurately tabulating
a function of two variables and tabulating a function of one
variable. Your best choice regardless of the number of variables
is to do

N[f[x,y], desiredDigits]

It is better to use N than SetPrecision for this task since
SetPrecision simply changes the precision of every numerical
value to what you specify then the evaluation is done. In
contrast, has adaptive algorithms that attempt to obtain the
number of digits asked for. For example,

In:= Precision[%]

Out= 20.

In:= SetPrecision[Sin, 20]

Out= 0.82687954053200256

In:= Precision[%]

Out= 17.1674

Note, this example comes straight from the documentation for
SetPrecision. You really should read the documentation and
tutorials for N and SetPrecision.

In addition, the results you get will greatly depend on the