Question

Task 1: Machine Epsilon (10 pts) Machine epsilon e is a characteristic of the CPU in ones computer. This machine constant is

use python
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#The executable file is as follows. It also contains the function to be defined in part 1:

################################ Code Starts Here ####################################

def machineEps():

epsilon = 1.0 # Assigning initial value of epsilon
  
while (1.0 + epsilon) != 1.0:

epsilon = epsilon / 2.0 # Dividing epsilon by 2 in every iteration of while loop
  
machine_epsilon = epsilon * 2 # Getting machine epsilon by multiplying final value of epsilon with 2

return machine_epsilon

def runTask1():

print("machine epsilon = ", machineEps()) # calling machineEps() function to print the statement in the prescribed format

if __name__ == '__main__':

   runTask1()

############################## Code ends here ###################################

# Save the file as "a3task1.py"

# Then execute it from the command prompt using command python "a3task1.py"

# Sample run:

Add a comment
Know the answer?
Add Answer to:
use python Task 1: Machine Epsilon (10 pts) Machine epsilon e is a characteristic of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Floating Point Representation Consider a computer that stores information using 10 bits words. The first bit...

    Floating Point Representation Consider a computer that stores information using 10 bits words. The first bit is for the sign of the number, the next 5 for the sign and magnitude of the exponent and the last 4 for the magnitude of the mantissa. The mantissa is normalized as described in class and in the textbook. a. Convert 1 00010 1001 to a base-10 system b. What is the highest number that can be stored on this computer? c. What...

  • Only Answer Part D! Thanks Floating Point Representation Consider a computer that stores information using 10...

    Only Answer Part D! Thanks Floating Point Representation Consider a computer that stores information using 10 bits words. The first bit is for the sign of the number, the next 5 for the sign and magnitude of the exponent and the last 4 for the magnitude of the mantissa. The mantissa is normalized as described in class and in the textbook. a. Convert 1 00010 1001 to a base-10 system b. What is the highest number that can be stored...

  • Task (Python) A lot of police investigations start off by examining where the potential suspects was...

    Task (Python) A lot of police investigations start off by examining where the potential suspects was at the time of the crime. This is often done by asking phone companies to provide lists of all mobile phones that was in the area where the crime was committed around the time when it was committed. If there is only one crime scene this is not a big problem but if there are several crime scenes then the task of cross referencing...

  • Debye's theory of solids gives the heat capacity of a solid at temperature T to be p) Jo(e*-1)2 Write a Python function cv (T) that calculates Cv for a given value of the temperature, for a sa...

    Debye's theory of solids gives the heat capacity of a solid at temperature T to be p) Jo(e*-1)2 Write a Python function cv (T) that calculates Cv for a given value of the temperature, for a sample consisting of 1000 cubic centimeters of solid aluminum, which has a number density of -б.022 x 1028 m-3 and a Debye temperature of 428 K Use your function to make a graph of the heat capacity as a function of temperature from T-5K...

  • What would be the IEEE 754 double precision floating point representation of 1.32487359893280124981233898124124 times 10^-17. For...

    What would be the IEEE 754 double precision floating point representation of 1.32487359893280124981233898124124 times 10^-17. For explanation, I want you to document the steps you perform, in this order: (1) What is n in decimal fixed point form (ddd.ddd,dd); (2) What is n in binary fixed point form (bbb.bbbb), storing the first 110 bits following the binary point); (3) What is the normalized binary number, written in the form 1.bbbbb...bbb times 2^e, storing 54 bits following the binary point) (4)...

  • 1. Questions (a) Truncations chooses the closest machine number in the direction towards zero. This implies...

    1. Questions (a) Truncations chooses the closest machine number in the direction towards zero. This implies that for positive numbers the result is less or equal than the original mumber while for negative numbers the result of truncation is larger or equal than the original number. Round to nearest chooses the closest machine number. This minimizes the absolute error imtroduced by the rounding (b) 32-bit significant: es 21-32 2-31=0.466 x 10-9. (c) In divisions the maximum relative error is the...

  • 3. Create a MATLAB script or function that takes converts a 10-element array, B, of zeros...

    3. Create a MATLAB script or function that takes converts a 10-element array, B, of zeros and ones and converts it into a floating point number, F, using the following rules: 1. The leading bit indicates a positive (0) or negative (1) number ii. Bits 2 through 4 are the binary representation of e, the exponent Ill Bits 5 through 10 represent the number precision as: (sign).(1 + bit5.2-1 + bith. 2-2 + ... + bit10.2-6). 2-3 iv. Finally, if...

  • answer 4, 5, 6, 7 using matlab Homework 10 1. Write the correct first-line syntax for...

    answer 4, 5, 6, 7 using matlab Homework 10 1. Write the correct first-line syntax for a user defined function that is named Feynman and has input variables q and e, and outputs L and M. (Comment out of this line). 2. Using zeros, ones, and eye commands write the one line syntax to create the following matrix: 00000 01100 01010 01001 3. Write the syntax for the user defined function that calculates the surface area and volume of a...

  • Please use python and show the code used. Question 1 5 pts data = 63.7 67.7...

    Please use python and show the code used. Question 1 5 pts data = 63.7 67.7 67.9 76 -901 80.3 84.8 93.9 84.8 76 80.3 85.8 89.3 93.9 98.5 95.9 183 -901 98.5 97.3 96.2 94 92 -901 88.7 85.9 87 85 88.9 84 82.5 83 81.3 77 79.3 72 -901 67 64 -981 62 -901 85 -901 67.7 72 98.5 97.3 103 84.8 62 -901 85.9 94 -901 98.5 89.3 93.9 93.9 96.2 81.3 67 95.9 88.3 84 82.5...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT