Questions tagged [computation]

Computation is paramount to the discipline of computer science, and deals with the type and use of computing technology in information processing, in particular, in the context of an algorithm, or a protocol.

From Wiki

In the theory of computation, a diversity of mathematical models of computers have been developed. Typical mathematical models of computers are the following:

  • State models including Turing machine, push-down automaton, finite state automaton, and PRAM
  • Functional models including lambda calculus
  • Logical models including logic programming
  • Concurrent models including actor model and process calculi
404 questions
5
votes
0 answers

Principal Component Analysis in PHP

I'm looking for a class or a function, or just a piece of code that would do Principal Component Analysis (PCA) in PHP. I am interested in reducing dimensionality of some data. I know that PHP is not the right language for heavy computation, so…
5
votes
1 answer

Execution speed of conditional instructions compared to mathematical functions

I will try to be as clear as I can with my question (not easy...it's not that clear for me as well). Suppose you have a set of IF...THEN instructions with multiple operands, for example IF ((a==0) && (b==1) && (c==1)) THEN x=1 ELSE IF ((a==0) &&…
Maxyone
  • 47
  • 7
5
votes
2 answers

Python, calculating the status of computation slows down the computation itself

This is a basic example of what I'm talking about: Count from 0 to 10000000 import time k = 0 beginning = time.time() while k < 10000000: k = k+1 elapsed = round(time.time()-beginning, 5) print (elapsed) Now with a sort of "status" of the…
Matteo
  • 413
  • 1
  • 3
  • 9
5
votes
2 answers

Stopping/Pickling/Unpickling/Resuming a computation

Is there any Haskell way of stopping/pickling/unpickling/resuming a computation ? Some relevant discussion about this seemed to happen here but there was no proper solution presented. Also that discussion is old. It would also be good, if there is…
Sibi
  • 47,472
  • 16
  • 95
  • 163
5
votes
2 answers

Why are there a finite number of Turing machines?

In Michael Sipser's Introduction to the Theory of Computation, he states: "some languages are not decidable or even Turing recognizable, for the reason that there are uncountably many languages yet only countably many Turing machines. Because each…
Archer
  • 111
  • 3
  • 10
4
votes
1 answer

How to compute the set of polygons from a set of overlapping circles?

This question is an extension on some computation details of this question. Suppose one has a set of (potentially overlapping) circles, and one wishes to compute the area this set of circles covers. (For simplicity, one can assume some…
J. Schmidt
  • 419
  • 1
  • 6
  • 17
4
votes
1 answer

Quick way to compute n-th sequence of bits of size b with k bits set?

I want to develop a way to be able to represent all combinations of b bits with k bits set (equal to 1). It needs to be a way that given an index, can get quickly the binary sequence related, and the other way around too. For instance, the…
Eduard
  • 127
  • 4
4
votes
1 answer

How can I substract 253 from 175(175-253) through 2's complement method?

For 2's complement, substraction process by computer. 176-253=176+(-253) 176=10110000 253=11111101 253(inverse)=00000010 253(complement)=00000010+1=00000011 -253=253(complement)=00000011 176+(-253)=10110000+00000011=10110011=179? but in fact…
4
votes
2 answers

Can a Turing machine perform Quicksort?

As far as I know, a Turing machine can be made to execute loops or iterations of instructions encoded on a Tape. This can be done by identifying Line separators and making the Turing machine go back until a specific count of Line separators is…
4
votes
3 answers

Processing Power - Mobile Devices vs Desktop - 100x difference?

Has anyone compared the processing power of mobile devices with PC? I have a very simple matrix work. Coded in Java, it takes ~115ms for my old PC to finish the work. THE VERY VERY SAME FUNCTION takes 17000 ms. I was very shocked. I didn't expect…
Kasra
  • 3,045
  • 3
  • 17
  • 34
4
votes
3 answers

How to calculate the mod of large exponents?

For example I want to calculate (reasonably efficiently) 2^1000003 mod 12321 And finally I want to do (2^1000003 - 3) mod 12321. Is there any feasible way to do this?
user3063864
  • 661
  • 2
  • 7
  • 18
4
votes
1 answer

How does a finite state machine perform division?

I am taking a course on models of computation and currently we are doing finite state machines. One my tasks is to draw out a FSM that performs division of 3; to simplify the model the machine only accepts numbers multiple of 3. I am not sure how…
Shagster
  • 43
  • 1
  • 5
4
votes
2 answers

Long mathematical computations in android app

I'm an amateur developer and I'm creating an Android app that will perform long mathematical calculation (involving multiple for-loops for example). I've read on the Android Developer website that Renderscript is a possible way of reducing…
user1246462
  • 1,228
  • 3
  • 11
  • 20
4
votes
2 answers

Determine elements of a matrix when sum of rows and columns are given

There is 4x4 matrix with all 4 diagonal elements zero. All other elements are non negative integers. Sum of all 4 rows and 4 columns are known individually. Is it possible to determine the remaining 12 elements of the matrix? Eg 0 1 1 0…
user1434997
  • 1,689
  • 2
  • 12
  • 12
4
votes
2 answers

In JavaScript, what are specific reasons why creating functions within a loop can be computationally wasteful?

In JavaScript, what are specific reasons why creating functions within a loop can be computationally wasteful? On page 39 of JavaScript the Good Parts, Douglas Crockford states, "Avoid creating functions within a loop. It can be computationally…
TheBrent
  • 2,853
  • 3
  • 16
  • 14
1
2
3
26 27