Your Algebra Homework Can Now Be Easier Than Ever!

Answers for Difference Equation

Electronic submission of homework as signments is strongly encouraged for the computer problems. For
the written part, you are encouraged (but not required) to typeset using LATEX or LYX (an easy-to-use
front-end of LATEX). For electronic submission, homework is due at 11.59pm on the due date. For paper
submission, homework is due in class on the due date.

0. (0 points) This exercise is for you to get familiar with the computing environment. Unless you are
proficient in setting up your own computer, you are urged to use the Linux (not Windows) computers
at the Mathlab SINC Site in Math Tower S-235 to do all your computing assignments. Before you can
log-on to the computers at the SINC site, you may need to go to the Mathlab SINC site in person
to activate your account on any of the Linux system by following the on-screen instructions. After
you log in , make sure you can run emacs (for editing), gv (for viewing eps files), and ddd (for debugging).

If you have a personal computer, after activating your Mathlab account you can remotely log onto the
computer “” from your PC. You need an ssh client and XWindows server
on your local computer (available on Linux, Mac OS X, and Cygwin on Microsoft Windows). You can
remotely log onto the computer using command where username should be changed to your own username, and -X and -Y options would ensure X Windows applications can be displayed on your local computer. After you remotely log onto the computer,
try to run gv, ddd, and emacs and make sure the windows are properly displayed on your local
computer. Practice using scp to copy files between you local and remote computers.

1. (25 points)

(a) (5 points) Use the given C program hw1_1a.c to compute an approximate value for the derivative
of a function using the finite difference formula

The program uses the test function tan(x) for x = 1, and determines the error by comparing with
(x)2 + 1. It prints out the magnitude of the error for h = 10-k, k = 0, . . . , 16, and plots the
magnitude of error as a function of h using log scale.

Read the program and follow its instruction to compile and run it. What is the minimum value
for the magnitude of the error? How does the corresponding value for h compare with the “ rule
of thumb”

(b) (10 points) The given program uses double- precision floating point numbers . Edit the program in
an editor (such as emacs) and modify the program to use single-precision floating point numbers.
Perform the same test, plot the results, and answer the two questions in part (a).

(c) (10 points) Modify the program to use the centered difference approximation

and repeat the same test as in (a) using both double-precision and single-precision floating point

For each part of the problem, turn in the modified part of the program, the plots, and your
explanations of the results.

2. (15 points) Starting from the code template hw1_2.c, complete the program to generate the first 60
terms in the sequence given by the difference equation

with starting values

Make a semi-log plot of the values you obtain as a function of k. The exact solution of the difference
equation is given by

which decreases monotonically as k increases. Does your graph confirm this theoretically expected
behavior? Explain your results. Turn in the modified part of the program, the plots, and your
explanations of the results.

3. (25 points) To solve the quadratic equation ax2 + bx + c = 0, one can use the standard quadratic

or the alternative formula

(a) Show that the alternative quadratic formula indeed gives the correct roots for the quadratic
equation (as suming exact arithmetic). When the standard quadratic formula would be more
accurate than the alternative formula and vice versa using floating point arithmetic ?

(b) Use the given sample C program hw1_3b.c for the standard quadratic formula to solve the
quadratic formula for the following coefficients in the following table. Fill the solutions into
the table.

(c) Enhance the robustness of the code to guard against

i. division by zero ,
ii. unnecessary overflow and underflow (e.g., by scaling the coefficients), and
iii. cancellation (e.g., by using alternative formula when appropriate).

You do not need to handle complex roots . Produce a similar table as in part (b). Turn in your
modified part of the program, a description of your changes, and the tables.

Prev Next

Start solving your Algebra Problems in next 5 minutes!

Algebra Helper
Download (and optional CD)

Only $39.99

Click to Buy Now:

OR is an authorized reseller
of goods provided by Sofmath

Attention: We are currently running a special promotional offer for visitors -- if you order Algebra Helper by midnight of May 24th you will pay only $39.99 instead of our regular price of $74.99 -- this is $35 in savings ! In order to take advantage of this offer, you need to order by clicking on one of the buttons on the left, not through our regular order page.

If you order now you will also receive 30 minute live session from for a 1$!

You Will Learn Algebra Better - Guaranteed!

Just take a look how incredibly simple Algebra Helper is:

Step 1 : Enter your homework problem in an easy WYSIWYG (What you see is what you get) algebra editor:

Step 2 : Let Algebra Helper solve it:

Step 3 : Ask for an explanation for the steps you don't understand:

Algebra Helper can solve problems in all the following areas:

  • simplification of algebraic expressions (operations with polynomials (simplifying, degree, synthetic division...), exponential expressions, fractions and roots (radicals), absolute values)
  • factoring and expanding expressions
  • finding LCM and GCF
  • (simplifying, rationalizing complex denominators...)
  • solving linear, quadratic and many other equations and inequalities (including basic logarithmic and exponential equations)
  • solving a system of two and three linear equations (including Cramer's rule)
  • graphing curves (lines, parabolas, hyperbolas, circles, ellipses, equation and inequality solutions)
  • graphing general functions
  • operations with functions (composition, inverse, range, domain...)
  • simplifying logarithms
  • basic geometry and trigonometry (similarity, calculating trig functions, right triangle...)
  • arithmetic and other pre-algebra topics (ratios, proportions, measurements...)


Algebra Helper
Download (and optional CD)

Only $39.99

Click to Buy Now:

OR is an authorized reseller
of goods provided by Sofmath
Check out our demo!
"It really helped me with my homework.  I was stuck on some problems and your software walked me step by step through the process..."
C. Sievert, KY
19179 Blanco #105-234
San Antonio, TX 78258
Phone: (512) 788-5675
Fax: (512) 519-1805

Home   : :   Features   : :   Demo   : :   FAQ   : :   Order

Copyright © 2004-2018, Algebra-Answer.Com.  All rights reserved.