answersLogoWhite

0


Best Answer

{\displaystyle \Theta } (N2) algorithm, it would take on the order of 1012 steps to multiply two one-million-word numbers. Numerous algorithms have been developed to efficiently perform arithmetic operations on numbers stored with arbitrary precision. In particular, supposing that N digits are employed, algorithms have been designed to minimize the asymptotic complexity for large N. The simplest algorithms are for addition and subtraction, where one simply adds or subtracts the digits in sequence, carrying as necessary, which yields an O(N) algorithm (see big O notation). Comparison is also very simple. Compare the high-order digits (or machine words) until a difference is found. Comparing the rest of the digits/words is not necessary. The worst case is Θ {\displaystyle \Theta } (N), but usually it will go much faster. For multiplication, the most straightforward algorithms used for multiplying numbers by hand (as taught in primary school) require Θ {\displaystyle \Theta } (N2) operations, but multiplication algorithms that achieve O(N log(N) log(log(N))) complexity have been devised, such as the Schönhage–Strassen algorithm, based on fast Fourier transforms, and there are also algorithms with slightly worse complexity but with sometimes superior real-world performance for smaller N. The Karatsuba multiplication is such an algorithm. For division, see division algorithm. For a list of algorithms along with complexity estimates, see computational complexity of mathematical operations. For examples in x86 assembly, see external links. In some languages such as REXX, the precision of all calculations must be set before doing a calculation. Other languages, such as Python and Ruby extend the precision automatically to prevent overflow. The calculation of factorials can easily produce very large numbers. This is not a problem for their usage in many formulae (such as Taylor series) because they appear along with other terms, so that—given careful attention to the order of evaluation—intermediate calculation values are not troublesome. If approximate values of factorial numbers are desired, Stirling's approximation gives good results using floating-point arithmetic. The largest representable value for a fixed-size integer variable may be exceeded even for relatively small arguments as shown in the table below. Even floating-point numbers are soon outranged, so it may help to recast the calculations in terms of the logarithm of the number. But if exact values for large factorials are desired, then special software is required, as in the pseudocode that follows, which implements the classic algorithm to calculate 1, 1×2, 1×2×3, 1×2×3×4, etc. the successive factorial numbers. Constant Limit = 1000; % Sufficient digits. Constant Base = 10; % The base of the simulated arithmetic. Constant FactorialLimit = 365; % Target number to solve, 365! Array digit[1:Limit] of integer; % The big number. Integer carry,d; % Assistants during multiplication. Integer last,i; % Indices to the big number's digits. Array text[1:Limit] of character; % Scratchpad for the output. Constant tdigit[0:9] of character = ["0","1","2","3","4","5","6","7","8","9"]; BEGIN digit:=0; % Clear the whole array. digit[1]:=1; % The big number starts with 1, last:=1; % Its highest-order digit is number 1. for n:=1 to FactorialLimit do % Step through producing 1!, 2!, 3!, 4!, etc. carry:=0; % Start a multiply by n. for i:=1 to last do % Step along every digit. d:=digit[i]*n + carry; % The classic multiply. digit[i]:=d mod Base; % The low-order digit of the result. carry:=d div Base; % The carry to the next digit. next i; while carry > 0 % Store the carry in the big number. if last >= Limit then croak("Overflow!"); % If possible! last:=last + 1; % One more digit. digit[last]:=carry mod Base; % Placed. carry:=carry div Base; % The carry reduced. Wend % With n > Base, maybe > 1 digit extra. text:=" "; % Now prepare the output. for i:=1 to last do % Translate from binary to text. text[Limit - i + 1]:=tdigit[digit[i]]; % Reversing the order. next i; % Arabic numerals put the low order last. Print text," = ",n,"!"; % Print the result! next n; % On to the next factorial up. END; With the example in view, a number of details can be discussed. The most important is the choice of the representation of the big number. In this case, only integer values are required for digits, so an array of fixed-width integers is adequate. It is convenient to have successive elements of the array represent higher powers of the base. The second most important decision is in the choice of the base of arithmetic, here ten. There are many considerations. The scratchpad variable d must be able to hold the result of a single-digit multiply plus the carry from the prior digit's multiply. In base ten, a sixteen-bit integer is certainly adequate as it allows up to 32767. However, this example cheats, in that the value of n is not itself limited to a single digit. This has the consequence that the method will fail for n > 3200 or so. In a more general implementation, n would also use a multi-digit representation. A second consequence of the shortcut is that after the multi-digit multiply has been completed, the last value of carry may need to be carried into multiple higher-order digits, not just one. There is also the issue of printing the result in base ten, for human consideration. Because the base is already ten, the result could be shown simply by printing the successive digits of array digit, but they would appear with the highest-order digit last (so that 123 would appear as "321"). The whole array could be printed in reverse order, but that would present the number with leading zeroes ("00000...000123") which may not be appreciated, so this implementation builds the representation in a space-padded text variable and then prints that. The first few results (with spacing every fifth digit and annotation added here) are: This implementation could make more effective use of the computer's built in arithmetic. A simple escalation would be to use base 100 (with corresponding changes to the translation process for output), or, with sufficiently wide computer variables (such as 32-bit integers) we could use larger bases, such as 10,000. Working in a power-of-2 base closer to the computer's built-in integer operations offers advantages, although conversion to a decimal base for output becomes more difficult. On typical modern computers, additions and multiplications take constant time independent of the values of the operands (so long as the operands fit in single machine words), so there are large gains in packing as much of a bignumber as possible into each element of the digit array. The computer may also offer facilities for splitting a product into a digit and carry without requiring the two operations of mod and div as in the example, and nearly all arithmetic units provide a carry flag which can be exploited in multiple-precision addition and subtraction. This sort of detail is the grist of machine-code programmers, and a suitable assembly-language bignumber routine can run much faster than the result of the compilation of a high-level language, which does not provide access to such facilities. For a single-digit multiply the working variables must be able to hold the value (base-1)2 + carry, where the maximum value of the carry is (base-1). Similarly, the variables used to index the digit array are themselves limited in width. A simple way to extend the indices would be to deal with the bignumber's digits in blocks of some convenient size so that the addressing would be via (block i, digit j) where i and j would be small integers, or, one could escalate to employing bignumber techniques for the indexing variables. Ultimately, machine storage capacity and execution time impose limits on the problem size. IBM's first business computer, the IBM 702 (a vacuum-tube machine) of the mid-1950s, implemented integer arithmetic entirely in hardware on digit strings of any length from 1 to 511 digits. The earliest widespread software implementation of arbitrary-precision arithmetic was probably that in Maclisp. Later, around 1980, the operating systems VAX/VMS and VM/CMS offered bignum facilities as a collection of string functions in the one case and in the languages EXEC 2 and REXX in the other. An early widespread implementation was available via the IBM 1620 of 1959–1970. The 1620 was a decimal-digit machine which used discrete transistors, yet it had hardware (that used lookup tables) to perform integer arithmetic on digit strings of a length that could be from two to whatever memory was available. For floating-point arithmetic, the mantissa was restricted to a hundred digits or fewer, and the exponent was restricted to two digits only. The largest memory supplied offered 60 000 digits, however Fortran compilers for the 1620 settled on fixed sizes such as 10, though it could be specified on a control card if the default was not satisfactory. Arbitrary-precision arithmetic in most computer software is implemented by calling an external library that provides data types and subroutines to store numbers with the requested precision and to perform computations. Different libraries have different ways of representing arbitrary-precision numbers, some libraries work only with integer numbers, others store floating point numbers in a variety of bases (decimal or binary powers). Rather than representing a number as single value, some store numbers as a numerator/denominator pair (rationals) and some can fully represent computable numbers, though only up to some storage limit. Fundamentally, Turing machines cannot represent all real numbers, as the cardinality of ℝ exceeds the cardinality of ℤ.

User Avatar

Marcella Predovic

Lvl 10
3y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: If it costs Rs.2400 to fence a square field at the rate of Rs.6 per m, find the length of the side and thearea of the field?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

If it costs 5 cents per square yard to plant a field how much does it cost to plant a field that is 90 yards wide?

You cannot answer this without knowing the length of the field as well.


How much will it cost to carpet a room that is 13 feet by 15 feet and the carpet costs 2.78 a sq foot?

First work out the area of the floor. Area = width * length 13*15= 195. So there are 195 square feet. The carpet costs 2.78 per square foot, so multiply 195 by 2.78. $542.10


How much does it cost to repave a driveway in Ohio?

It costs an average of $3.10 a square foot for asphalt. It costs on average $4.85 a square foot for concrete.


A solid cubical block of fine wood costs Rs 256 at Rs 500 per meter square find its volume and the length of each side?

i think there would be 500 per meter cube instead of 500 per meter square.


What is the cost to steam clean a room w wide and l long if it costs 10 cents per square foot to clean it?

As area in a "room" is width times length, and, as it costs 10 cents per square foot to steam clean that room's floor, find the width and the length in feet, then multiply them together to find the area of the room in square feet, and then divide that area by 10 cents. You'll get the answer in cents. To find the answer in dollars, divide the area of the room by 0.1 dollars per square foot instead. Then you'll have your steam cleaning cost for the room in dollars. Area of the room = length x width (Insure that each is in feet. Convert if you have to.) Aroom = l x w Cost of cleaning = 10 cents per square foot, or $0.10 per square foot Cleaning cost = Aroom / 0.10 = Answer in $


Concrete costs per square foot?

how much does concrete cost per square foot


Square foot commercial construction costs?

What are the square foot construction costs for a 3-story condo building and a 10-story condo building in Chandler, Arizona ? - Terry


A fence is to be built to enclose a rectangular area of 260 square feet. The fence along three sides is to be made of material that costs 6 dollars per foot and the material for the fourth side costs?

In addition to the information provided, you need to know the length of at least one of the sides, to calculate the length of the other sides. Then, for each side, multiply the length (in feet) by the cost per foot, and add everything together.


What is the approx length and width of 23 cents of square land?

Cents, as in money, I assume. Land costs vary a lot from one place to another; it really doesn't make sense to talk about a "typical" value. Once you get the price per square meter in your neighborhood, divide the amount of money you want to spend by the price per square meter, to get the amount of square meters you'll buy. Of course, for $0.23, you'll usually get less than a square meter, and nobody will sell such a small part of a lot. - Also, if you want the land to be a square, once you have figure out the amount of square meters, take the square root to calculate the length of one side of the square.


How much do it cost to go to Times Square?

I dont think it costs anything to go to times square


A box with no top has a square base and a volume of 125m3 If the material for the bottom costs 5 per square meter and 2 per square meter for the sides express the cost as a function of the length?

This solution should be right assuming length refers to the dimension that is not part of the square side:V = 125125 = L x W2W2 = 125 / LW = (125 / L)1/2C = 5W2 + 2(4 x L x W)C = (625 / L) + 8L(125 / L)1/2


If your carpet costs 52.00 per square foot how much does it cost per square yard?

cost of per square yard will be 468.00.