Main Page | Report this Page
 
   
Science Forum Index  »  Math - Symbolic Forum  »  Maple 9.5
Page 1 of 1    
Author Message
John W. Adams
Posted: Tue Jun 05, 2007 12:15 pm
Guest
A is an integer sequence of length n. Compute integer values for i and
x, and update A by replacing the element A[i] with A[i]+x. What is the
best way to do this? The described calculations and replacement have to
be repeated many times.

John
Robert Israel
Posted: Tue Jun 05, 2007 2:03 pm
Guest
"John W. Adams" <jwa0@lehigh.edu> writes:

Quote:
A is an integer sequence of length n. Compute integer values for i and
x, and update A by replacing the element A[i] with A[i]+x. What is the
best way to do this? The described calculations and replacement have to
be repeated many times.

If n is fixed, your best bet is to make A an Array (or Vector).
Then just update by
A[i] := A[i] + x
--
Robert Israel israel@math.MyUniversitysInitials.ca
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Thu Jan 08, 2009 12:15 am