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[1]:= 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[9]:= Precision[%] Out[9]= 20. In[10]:= SetPrecision[Sin[1000], 20] Out[10]= 0.82687954053200256 In[11]:= Precision[%] Out[11]= 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 nature of your function. In particular, your range for y is quite a large dynamic range, 34 orders of magnitude. Such a large range makes it likely you will run into limitations on size for arbitrary precision numbers.