Calculating minimum N so that error<10^-7 on matlab

In summary, to calculate the minimum N in Matlab to achieve an error less than 10^-7, you can use the formula N = log((b-a)/e)/log(2), where a and b are the bounds of the interval and e is the desired error. Other formulas such as the Taylor series or Euler-Maclaurin formula can also be used, but the mentioned formula is commonly used in Matlab. To check the accuracy of the calculated N, you can use the linspace() function to generate a vector of equally spaced points and calculate the error at each point. If all errors are below the desired threshold, the N value is accurate enough. If not, you can try increasing the number of points or using a different formula
  • #1
Daviddd
2
0
20150524_170415.jpg
image.png
 
Physics news on Phys.org
  • #2
Irrelevant...
Please ignore the post
 

Related to Calculating minimum N so that error<10^-7 on matlab

1. How do I calculate the minimum N in Matlab to achieve an error less than 10^-7?

To calculate the minimum N, you can use the formula N = log((b-a)/e)/log(2), where a and b are the bounds of the interval and e is the desired error. In Matlab, you can use the function log10() to calculate the base 10 logarithm and log2() to calculate the base 2 logarithm.

2. Can I use a different formula to calculate the minimum N?

Yes, there are other formulas that can be used to calculate the minimum N, such as the Taylor series formula or the Euler-Maclaurin formula. However, the formula mentioned above is the most commonly used in Matlab for this purpose.

3. How can I check if my calculated N is accurate enough?

You can use the built-in function linspace() in Matlab to generate a vector of N equally spaced points between a and b. Then, you can use this vector to calculate the error at each point and check if it is less than 10^-7. If all the errors are below the desired threshold, your N value is accurate enough.

4. What should I do if my calculated N is not accurate enough?

If your calculated N is not accurate enough, you can try increasing the number of points or using a different formula to calculate the minimum N. You can also check for any errors in your code or if the interval bounds are too large, which can affect the accuracy of the calculation.

5. Are there any limitations to using this method to calculate the minimum N?

Yes, this method assumes that the function you are evaluating is continuous and differentiable within the given interval. It also assumes that the error is evenly distributed throughout the interval. If these assumptions are not met, the calculated N may not be accurate enough.

Similar threads

  • Advanced Physics Homework Help
Replies
1
Views
681
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
10
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
889
  • Engineering and Comp Sci Homework Help
Replies
3
Views
849
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • General Math
Replies
5
Views
891
  • Advanced Physics Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
1K
Back
Top