Write a java program to compute the value of e

Assignment Help Basic Computer Science
Reference no: EM131289195

Write a Java Program to compute the value of e.

e is the base of the Natural Logarithms. The first few digits of e are: 2.7182818284590452353602874713527

There are many ways of calculating the value of e, but none of them ever give an exact answer, because eis irrational (not the ratio of two integers).

But it is known to over 1 trillion digits of accuracy!

Method 1:

For example, the value of (1 + 1/n)n approaches e as n gets bigger and bigger:

n

(1 + 1/n)n

1

2.00000

2

2.25000

5

2.48832

10

2.59374

100

2.70481

1,000

2.71692

10,000

2.71815

100,000

2.71827

In the equations that follow, "!" means factorial.

0! = 1, 1! =1, 2! = 2?1 = 2, 3! = 3?2?1 = 6, 4! = 4?3?2?1 = 24, 5! = 5?4?3?2?1 = 120, etc.

Method 2:

The Taylor series for the exponential function ex at a = 0 is

If x is zero, the value of e is equal to 1 + 1/1! + 1/2! + 1/3! + 1/4! + 1/5! + 1/6! + 1/7! + ... (etc)

Another way of expressing this series is the formula:   

The first few terms add up to: 1 + 1 + 1/2 + 1/6 + 1/24 + 1/120 = 2.718055556

Method 3:

Recently, new formulae have been developed by Brothers (2004) which make the calculation of e very efficient.

Your assignment is write a program that computes the value of e using all three of the methods described above for the values of n = 1,2,3,4,5,6,7,8,9,10, and 20. Your program must print out the value of e and the difference with the value of in Math. Make certain that the outputs are labeled as to which method is being used and what value of n was used.

Reference no: EM131289195

Questions Cloud

Contents of a directory are impacted : Discuss how the contents of a directory are impacted (and when and/or if they are available for use) when a file system is mounted on that directory.
Case study-database development : Note: The ACM Digital Library is a Strayer Library database located in iCampus > Campus & Library > Learning Resource Center > Databases.
The essay is about minimum wage : The essay is about minimum wage.- Develop a conclusion as the last paragraph(s) of the essay, starting with rephrasing your thesis statement and then presenting the major points of the topic and how they support your argument.
What if it is to be delivered at the end of six months : Assuming monthly compounding, what should the forward interest rate of a three-month T-bill be if it is to be delivered at the end of three months? What if it is to be delivered at the end of six months?
Write a java program to compute the value of e : There are many ways of calculating the value of e, but none of them ever give an exact answer, because eis irrational (not the ratio of two integers).
Evaluate policies and processes that promote a diverse work : Determine employment laws that apply to the selection, development, and management of employees.
What business interest would there be in your findings : What are your research questions? What type of tourists will be attracted to region X - what business interest would there be in your findings?  Tourism Authority, Airlines, Tourist Package Operators
Summation of all the digits : If the modulo 10 of the summation of all the digits is 1 then its valid MasterCard. Otherwise, the number customer has entered is an invalid card number. There are two other requirements that make this problem unique:
Explain the consequences for the spot market transaction : Explain the consequences for the spot market transaction and the forward market transaction if the $/£ spot exchange rate increases over the next six months.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Presentation on telecommunications technology

Need a 10 slides power point that is RELEVANT to Telecommunications technology

  Which of the following function calls is valid

Which of the following function calls is valid?

  Emergency rescue and immediate recovery

After the emergency rescue and immediate recovery ("first responder") phase, there is a need for a follow-up phase focused on restoring minimally acceptable functions - BEFORE what is traditionally known as the recovery phase begins. What can and ..

  Outlining the key ideas and the sequence

First of all, you are to prepare a background paper on your overall topic, briefly outlining the key ideas and the sequence of learning from Foundation Year to Year 7, but focused on ‘locating' your particular sub-topic and learning objectives wit..

  Drawback of discretionary access control model

Explain the main drawback of discretionary access control model (DAC).

  Question regarding the advantages of succession planning

What are the advantages of succession planning for all levels of management, instead of just top management?

  Discuss how the use of computers and technology have change

The four management tasks (planning, organizing, directing, and evaluating) existed long before computers.

  How many 0-address instructions can still you can fit

Write code to implement the expression: A= (B + C) * (D - E) on 3-, 2-, 1- and 0-address machines. In accordance with programming language practice, computing the expression should not change the values of its operands.

  Using positive edge triggered t

Using positive edge triggered T flip flops, show the design of a modulo 7 asynchronous counter that counts 0,1...6,0, etc. You may assume that your flip flop

  Cause of the problem and possible solutions

Using the web for research, suggest the most likely cause of the problem and possible solutions. What could be causing the desktop icons to be missing

  Why is rarp used in one case versus arp

Why is RARP used in one case versus ARP? This one is complex and I don't know how to do it

  Discuss the protection mechanisms

Discuss the protection mechanisms you consider best suited for the technological innovation you have selected for your final project and how those mechanisms fit within the control continuum

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd