Numerical Analysis Questions & Answers | |
|
|
No attached pictures are allowed in the QNA thread except if they are drawings. The mathematics must be typeset within your question using LATEX, not using pictures.
|
|
|
|
|
|
I don't understand the question fully. If I ask for the smallest positive number, then this can not be zero whether the number is normal or denormal because zero is not positive. I'll give you just 0.5 point bonus boost because you should put your question in more context so that I can understand better what you mean.
|
|
|
|
When using float variables in C, $\epsilon_{\rm mach}$ should be set to $6\times 10^{-8}$. But I won't take away points if you use a slightly more conservative value of $10^{-7}$. The order of magnitude is what counts here. It was a good question, I'll give you 1.5 points bonus boost for it.
|
|
|
|
No, this should read: $$ \epsilon_{\rm mach}=\frac{1+2^{-24}-1}{1} $$ The first two terms on the numerator $1+2^{-24}$ correspond to the sum of the smallest number 1 and the largest possible round-off error $2^{-24}$. The last term on the numerator is the smallest number 1. I'll give you 0.5 point bonus boost.
|
|
|
|
Yes you are right: in Question A1Q2b and A1Q2d, we are seeking the smallest possible positive number. Thanks for pointing this out. I'll give you 2 points bonus boost.
|
|
|
|
The exponent of the denormal number is the same as the smallest exponent (-126) but the difference is with the significant which is 0.f instead of 1.f. Thus, the maximum denormal number is just below the minimum positive normal number. If the exponent would be -127, then there would be a large gap between the smallest positive normal number and the largest denormal number. Not a good thing! I liked your question, I'll give you 2 points bonus boost.
|
|
|
|
I understand what is confusing you. When determining $g$, $e_\max$ refers to the maximum possible positive exponent. But in other cases it refers to the maximum possible positive exponent minus one (because the maximum positive exponent is reserved). They should have been written with 2 symbols in class to avoid confusion. In your notes, rewrite $e_\max$ to $e_\max^\prime$ when determining $p_\max$, with $e_\max^\prime=e_\max-1$. Good point, I'll give you 2 points bonus.
|
|
|
|
For A2Q3, there is no initial interval. For A2Q1, I have made a change to the question formulation. I'll give you 1.5 points bonus boost for pointing this out — I would have given more if you had not made spelling mistakes.
|
|
|
|
The secant method only needs one $x$ for the initial guess (it functions similarly to the Newton method). But you also need to specify a small $\Delta x$ initially to calculate the derivatives. Just set it to a small value of your choice: this won't affect much the convergence history as long as it is not too small.
|
|
|
|
I don't understand. Are you trying to code a sin(x) function? If so, there is no need to code it because the function sin(x) is already defined in the math library.
|
|
|
|
You can call it forward substitution if you wish, this is the correct term. In class, I mentioned that this is the same process as back substitution (but going from top to bottom rather than bottom to top) to make it clear that this is not a new type of process. I'll give you 1.5 point bonus boost for sharing this with the class.
|
|
|
|
Are you getting the same problem when solving it by hand? If not, then it means there is a bug in your C code. If yes, then outline the problem in another question below.
|
|
||
$\pi$ |