Machine epsilon is the smallest number when it is added to 1 your computer assumes it 1 briefely. It depends the physical features of your computer. After this definition let us create the pseudocode of a program that computes your machines' epsilons.
epsilon=1
DO
IF(1+epsilon<=1) EXIT
epsilon=epsilon/2
END DO
epsilon=epsilon*2
The code above is the pseudocode of a machine epsilon algorythm. I guess you know about pseudocode :) If you do not know do not be sorry since it is nothing :P It is a description of an algorythm that is language independent.YOu just write on what you think to do. That is it!
Now let me give you the Java code of that algorythm and the output of it.
import javax.swing.JOptionPane;
public class epsilon{
public static void main(String args[]){
double epsilon = 1.0;
for(int i=1; i<100000; i++){
if(epsilon+1.0<=1.0){
break;
}
else{
epsilon=epsilon/2.0;
}
}
epsilon=2*epsilon;
JOptionPane.showMessageDialog(null,"The epsilon of the machine is:"+epsilon);
}
}
Since i have explained each line of a java code example i think you can understand the steps and pseudocode helps you in this issue as well.
So my output is in the figure below. But do not be confused if you have not got the same output since it depends the physical features of your PC!
I will keep giving some java examples as well. Using Java in mathematic will suprise you or mathematics will suprise you ;)
Wednesday, March 26, 2008
Machine Epsilon
Sunday, March 23, 2008
Class Diagrams
Consider about a web site that is a course specific web site. As most of us related with it i mean with most of us as students :) A web site that has a user entry and admins as professors and tha assitants of them. Also there are invited speakers whom have been invited to the classes and whom are in the software development market. As i did not said yet the site is the web site of the sofware programming course! See the below explaniations as example to the class diagram of the system:
There are five classes in the system.
The description is as follows:
And at last the class diagram:
Most info about class diagram will be explained in the following article. ALso some other diagrams activity or use case diagram infos and examples for the same system will be added to it.
See yas:))