Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Mathematica] Accuracy of a function

  1. Apr 27, 2010 #1
    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:
     
  2. jcsd
  3. Apr 27, 2010 #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 ?
     
  4. May 5, 2010 #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.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook




Loading...
Similar Threads for Mathematica Accuracy function Date
Mathematica Storing Mathematica output Mar 30, 2018
Mathematica Mathematica to MATLAB Mar 25, 2018
Mathematica Cannot do the integral of the Hyper-geometric function? Mar 11, 2018
Mathematica Cannot Plot This Function in Mathematica Feb 26, 2018
Important reason for squashing software bugs accuracy of scientific discoveries Dec 13, 2011