Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Fortran program geom.f95 which accepts r as input, and evaluates the partial sums Sn for n 0, 1 , until Sn and Soo

image text in transcribed
Write a Fortran program geom.f95 which accepts r as input, and evaluates the partial sums Sn for n 0, 1 , until Sn and Soo agree to 5 decimal places. NB: You can evaluate the partial sums using the closed form 2, you don't need to manually sum the series using equation 1. (Although using equation 1 to check equation 2 would be some additional Fortran practice...) Your program should check that the value of r entered is in the requested range, and print a suitable message (and avoid doing any calculations) if it is not. It should write to the screen the value of n for which this agreement is reached, together with S and S in (non-exponential) decimal notation with 6 decimal places. What value of n is required for r 0.5? 2.6 In a famous anecdote, Srinivasa Ramanujan noted to G. H. Hardy that 1729 is the smallest number program that can be expressed as the sum of two cubes in two different ways. Write a fortran ramanujan.f95 that writes to the screen the two pairs of positive integers, a and b, that satisfy 3 1729 Hint: You should define nested do loops that consider all possible values of and b. over suitable ranges; inside the inner loop you should test for cascs that satisfy the required relation Harder (optional): adapt your Fortran program from above to find the next smallest integer that can similarly be expressed as the sum of cubes in two different ways. If you've done all of the above, please continue exploring Fortran via the Introduction to Fortran' bookle, the more comprehensive Detailed Fortran Notes', and/or some of the Fortran books on the course reading list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions