[Mathematica] Accuracy of a function

In summary, the conversation discusses a problem with a function and how to force a certain accuracy on its arguments. One person suggests using SetAccuracy[], while another suggests using numeric functions or N[exp, decimal number] to control the precision.
  • #1
guerom00
93
0
Hello all :smile:

I have a very complicated function, let's call if f.

My problem : f[0.01] does not give the same result as f[1*^-2] because of accuracies. In the first case, the argument 0.01 has machine precision which is not sufficient in my case and the result is wrong.
In the second case, the argument 1*^-2 has infinite precision. This infinite precision is being carried out throughout the function and the final result is correct.

So, you see my point : how to force a certain accuracy on the argument of a function ?

Thanks in advance :smile:
 
Physics news on Phys.org
  • #2
I answer to myself : I found SetAccuracy[] which I can apply to the argument of my function. Is that the correct way to do ?
 
  • #3
Well if you just make the input of your function have infinite precision that will carry through unless you use numeric functions. In those you can use AccuracyGoal and WorkingPrecision, otherwise if you just need to keep a certain number of decimals you can use N[exp,decimal number] which may help.
 

1. How does Mathematica determine the accuracy of a function?

Mathematica uses a combination of numerical methods and symbolic computations to determine the accuracy of a function. It takes into account the precision of the input data and the algorithm used to compute the function.

2. Can I adjust the accuracy of a function in Mathematica?

Yes, you can adjust the accuracy of a function in Mathematica by specifying the precision or accuracy of the input data or by using specific options within the function.

3. What is the difference between precision and accuracy in Mathematica?

In Mathematica, precision refers to the number of significant digits in a number, while accuracy refers to the error or deviation from the true value. A function can have high precision but low accuracy if the calculated values are consistently close to each other but far from the actual value.

4. How can I check the accuracy of a specific function in Mathematica?

You can use the built-in function Precision[function] or Accuracy[function] to check the precision or accuracy of a specific function in Mathematica. Additionally, you can use the N[function] command to see the numerical approximation of the function.

5. What are some common issues that can affect the accuracy of a function in Mathematica?

Some common issues that can affect the accuracy of a function in Mathematica include rounding errors, loss of precision due to large or small numbers, and the use of approximate numbers or functions. It is important to be aware of these potential issues and to specify the desired accuracy in your calculations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
217
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
257
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
Back
Top