Algorithm Definition and 724 Threads

  1. G

    Finding the recurrence from an algorithm

    I need some help. I am having a hard time find the recurrence when given an algorithm in c++. The algorithm is a Max search: Its where the program goes through the array from first element to last, or last to first (depends on how you program it) to look for the largest value. In this case it...
  2. S

    Mathematica Help with Prim's Algorithm in Mathematica

    This is my project of Spanning Tree by using Prim's Algorithm , I have to implies this problem (#4, PIC is attached) into Mathematica ( I have version 6 btw). Which we never learned in class. Its my Applied Math class, all we do/did is theorems. We never learned a single thing about this program...
  3. I

    Langevin dynamics random force term generation algorithm

    Hi, Can anyone tell me an algorithm to generate the stationary Gaussian distribution R(t) with \langle R(t) \rangle = 0 (zero mean) \langle R(t) R(t')^{T} \rangle = A \delta(t-t') , A = 2 \gamma k_B T m (autocorrelation) ? What I just wrote is from the Wikipedia article "Langevin...
  4. E

    Many-Body Numeric Integration Algorithm

    That is to say, how does one go about it for a non-separable partial differential equation? Let me preface by saying that I am not asking for an answer of perturbation theory, variational theory, mean-field theory, or some sort of self-consistent guess-and-check method (i.e., coupled...
  5. A

    Improving a Galaxy Generation algorithm

    Hello there, I'm developing a 4x Space Opera game. For my galaxy generation algorithm I'm using an improved version of the "Accrete" one, which I'm sure some of you may have heard. It generates fairly believable planets. Rocky ones are placed in the inner system, while gas giants in the outer...
  6. I

    How to accelerate the SVD algorithm?

    I've written a program in c language in terms of the GR SVD algorithm. To my dispointment,its performance is worse than the svd of matlab. I wish to get to know which algorithm the MATLAB used. Who may tell me? Thanks.
  7. S

    Testing a Lanczos (tridiagonalization) algorithm

    So I implemented a tridiagonalization algorithm, however I don't know if the result that I am receiving is accurate. Does anyone know of an easy way of testing this? I suppose it is possible to scour around for code, but it would be difficult to find matching code. So if anyone knows anything...
  8. D

    Grover's algorithm on entangled states

    If you run Grover's algorithm on the first qubit of any of the Bell states, does it destroy the entanglement? If not, wouldn't it be a way to communicate faster than light?
  9. C

    Regarding Floyd's cycle-finding algorithm

    Well I understand what is happening - the tortoise moving 1 step, and the hare moving 2 steps and finally coinciding at a point. But I want a mathematical proof of this - ie; when you have 2 counters moving in a cycle, one going 1 step, the other 2 steps, then they finally meet at a point.
  10. A

    Help in Explaining POSIT algorithm (3D maths)

    Hello Everyone, This is my fisrt post! I have been suggested that this forum's members may be able to help me, this thread was orginially posted in another forum, they have re-directed me towards this community! : {original post} Hi guys, I've been doing some background hobby...
  11. C

    C/C++ Solving Error in C++ Digit Algorithm Program

    I wrote a program to find the number of digits of an integer, but I always get the wrong result. Could someone point out the error? Here's the source code: #include <iostream> #include <cmath> using namespace std; int main() { int i=53443; cout<<log(i); return 0; }...
  12. R

    C/C++ How to Create a Spiralling Algorithm in C++ for Printing Patterns

    Hey, I got an assignment to write and algorithm in C++ to print this pattern: 35 34 33 32 31 30 16 15 14 13 12 29 17 04 03 02 11 28 18 05 00 01 10 27 19 06 07 08 09 26 20 21 22 23 24 25 As you...
  13. H

    How to Find the Shortest Path Through N Points in a Weighted, Undirected Graph?

    I've got a small assignment to do on graphs but it's a bit frustrating that no standard algoritms such as Dijkstra, Bellman-Ford, etc. can be used or at least I don't know how could they help. Given a graph one is to find shortest path through N points. That's it. Starting point can be...
  14. B

    What Algorithm Generates 5-Digit Numbers from a, b, and c?

    I'm trying to figure out this little problem. I'm trying to figure out which algorithm is being used.I know the set of numbers is being used to generate the 5 digit number. I believe a Pseudo random number generator algorithm is being used. I know the set of number are being used as the seed...
  15. M

    Proof of Multiplicative Inverses of Coprime Numbers via Euclidean Algorithm

    Hi I am currently studying Information Theory. Could I please have anyone's ideas on the following question: Using the Euclidean algorithm, show that coprime numbers always have multiplicative inverses modulo each other. I tried the following proof, using Fermat's little theorem, let me...
  16. H

    Complexity of divide and conquer algorithm?

    Let's say I have some algorithm with complexity O(n^k) for some constant k. and let's say it runs in some time T. Now, I want to implement a divide and conquer approach for this algorithm, by dividing the problem in half each recursion. So basically, the first time i run my algorithm it will run...
  17. A

    Reliabilty of complex systems using F-V algorithm for approximation

    For a system with minimum cut set (C1,C2,C3),(C4,C5,C6) and (C4,C5,C7), Using the F-V algorithm, calculate the first and second order approximations given P[C1] =P[C1] = P[C2] =0.107, P[C3] =0.168,P[C4] =P[C5] =0.0478,P[C6] =0.0921,P[C7] =0.102 Answers, Ist order= 0.002366919, 2nd...
  18. P

    MATLAB Saving Matrices Generated by Matlab Algorithm

    Hi I have a question, I have to save to file the matrixs generated by an algoritm in Matlab. So i was wondering if is it possibile and how, to use in the filename a variable of the algoritm. Let's say "i" is the counter of my cicle and i would like to save the matrix generated at every cicle...
  19. D

    Proving a Division Algorithm for Real Numbers?

    How might I prove a Division Algorithm for the Real numbers? That is to say, if x, \alpha \in \mathbb{R}, then x=k \alpha + \delta for some k \in \mathbb{Z}, \delta \in \mathbb{R} with 0 \leq \delta < \alpha where k, \delta are unique.
  20. V

    Is My Integer Factorization Algorithm Flawed?

    I am posting an integer factorization algorithm that I have developed. I am hoping for feedback on any obvious flaws that I might have missed before writing a computer programme to test it out. Thanks in advance Visu
  21. I

    Top Algorithm Design Book Recommendations for Non-CS Programmers

    can someone recommend a good algorithm design book? like the end all be all of algo design? so that i don't have to read anything else cause I'm not a cs major just someone who wants to be decent at programming
  22. R

    Expectation for # Exchanges (Quicksort Algorithm)

    Hi I am reading Hoare's original paper where he derives the complexity of quicksort. I am trying to figure how he derives the expectation for the number of exchanges (sorry if this is a very CS-specific question): \frac{(N-r-1)(r-1)}{N} \frac{N}{6}+\frac{5}{6N} I can't see...
  23. J

    Shortest Path from Nodes C to F using Dijkstra's Algorithm

    Hi The purpose of this question is to find the shortest path from nodes c to f. I have attached the question using the below headings: Homework Statement An image showing a graph can be seen in the attachment Homework Equations The Attempt at a Solution A table can be...
  24. B

    Modular Algorithm for Solving Equations with Unknowns Modulo 100

    how can i solve this problem? [ x1= a (mod 100) , a= 20 (mod 37) ] [ x2= b (mod 100) , b= 15 (mod 37) ] [ x3= c (mod 100) , c= 18 (mod 37) ] must be ; x2= a.k + y (mod100) and x3= b.k + y (mod100) i need find b and c.. thank you best regards..
  25. S

    How Do You Calculate a(t+dt) Using the Velocity Verlet Algorithm?

    Homework Statement I am going to use the velocity verlet algorithm to simulate the position, velocity and acceleration at time t of some particle. Homework Equations We got the Langevin equation: a(t) = -v(t)/tau - U'(x) / m + F_f(t) / m Where tau is the mass divided by the friction...
  26. M

    Euclid's Algorithm Homework: Stuck & Need Help

    Homework Statement http://aycu33.webshots.com/image/44152/2001827062284448769_rs.jpgThe Attempt at a Solution pretty stuck...
  27. S

    MATLAB Finding Primes using Algorithm in MATLAB

    Hi all, i understand the following however i don't know how to put this on matlab. any help or hints will be very appreciated. The following algorithm enables us to identify the prime number up to a given integer N, by eliminating all non-primes in that interval. It starts from a lower end...
  28. P

    Maze generation algorithm for specified parts

    I am an undergraduate student studying mechanical engineering. We are doing a project called the labyrinth cutter, we're constructing a piece of artwork consisting of a a gantry connected to a cutter head. The cutter is supposed to cut out a labyrinth to a piece of music. I decided to use the...
  29. H

    Data Structures and Algorithm Analysis

    Has anyone here taken this class before? I've been in this class for two weeks, and I still can't get a feel for how difficult or time consuming it may be. My instructor keeps mentioning discrete mathematics (which I haven't taken), although it wasn't a prerequisite for the course. Additionally...
  30. B

    Estimating Pi with Twister Algorithm & Monte Carlo Simulation

    okay new problem here. I am doing a Monte Carlo simulation to estimate pi. The question deals with throwing darts randomly at a board with a radius 1 with a square inscribed in it. I have done a script that randomly selected a number b/w -1 and 1. Then I was supposed to generate the results of...
  31. S

    Fast Algorithm for Determining Path Existence in a Graph?

    Is there an algorithm which is O(1) or O(log n) (basically a very fast algorithm) which can tell whether there is a path from a node A to a node B in a graph? Thanks
  32. E

    The limit of a factoring algorithm

    Hi Ho! It is easy to observe that to get all factors of an integer n, one does not need to try whether a divides n for 1 < a < n. But, rather using the following observation: Suppose n is 24, then 24 / 1 = 24 24 / 2 = 12 24 / 3 = 8 24 / 4 = 6 -------------(!) 24 / 6 = 4 24 / 8...
  33. P

    Levenberg-Marquadt Algorithm (GSL implementation)

    Hello there, I have to fit a one term exponential curve: y = a*exp(-b*t), and I have to implement the fitting procedure in a C program. Some days ago I discovered the GSL (GNU Scientific Library), and I told myself better later than never ;-) When reading the GSL documentation and the...
  34. M

    Developing an Algorithm for Calculating Range of Oerlikon 20 mm Auto-Cannon

    I've been assigned a relatively funky physics project, and the process of writing the algorithm for said project has completely stumped me. I have chosen to research the Oerlikon 20 mm auto-cannon, and have done all of my research and am at the point where I am supposed to write an...
  35. M

    How Do I Design an Algorithm to Convert Height and Weight Measurements?

    Homework Statement The assignment was to design an algorithm that asks for a user's height in feet and inches and their weight in pounds. The output of user's height and weight is suppose to be the user's height in meters and the user's weight in kilos. So I'm basically just suppose to convert...
  36. michael879

    Solving Shor's Algorithm to Factor 15: Results & Analysis

    hey I have a quick question about this. I was trying to understand the QFT operator, so I manually used shor's algorithm to factor 15. I used 2 for the random number. My results seem a bit weird tho. below are the probabilities of observing each number (the correct answer is 4, since the...
  37. Z

    Simplify Decimal to Radical Decimal to Radical Algorithm

    decimal to radical algorithm? does anyone know if there is a method of writing a decimal number in its simplified radical form?? I really would like to know if there is
  38. C

    Deterministic time/space for an algorithm?

    can someone point me to some resources to help find deterministic time and space for algorithms? Is there any software I can download which will help me determine these? Also is there any software which will help me come up with a growth function? Perhaps plotting data etc.
  39. D

    Problem with summation algorithm

    Hi there, I'm trying to right a program for class that 1st assigns random single precission floats from 0 to 1 to the elements 1-d array and then sums them up. Next I'm supposed to compare to this thing called the Kahan summation algorithm for different values of N (array size) using the...
  40. michael879

    Understand Shor's Algorithm & Quantum Fourier Transform

    hey, from what I've read here: http://www.quantiki.org/wiki/index.php/Shor%27s_Algorithm , I understand most of the algorithm. The one thing that I don't get is what the quantum Fourier transform does to the input register. Can someone either explain how this works or what exactly it does?
  41. michael879

    Why is the brute force factoring algorithm exponential time?

    ok so I thought of this factoring algorithm, and I did some quick analysis on it (attached picture, time is in seconds * 5). It appears to be polynomial. However, when I see the basic brute force factoring algorithm I think that's also polynomial. So before I get excited over nothing. Can...
  42. Math Is Hard

    C/C++ Is It Challenging to Write a Perceptron Learning Algorithm in C++?

    Have you ever written a perceptron learning algorithm? http://en.wikipedia.org/wiki/Perceptron Which language did you use? Would it be overly complicated to try to write it in C++ (compared with, say, MATLAB)?
  43. A

    Generic algorithm for probability any propositional formula

    Ciao all, Is there a generic algorithm to compile the probability P(A) of any propositional formula A (provided that we have only the probability of each atoms constituting A)? For example, we have that A= a1 and not (a2 and a3 and ( not a4 and not a5 and not a6 ..) , or any other...
  44. C

    Guessing Number-Generating Algorithm

    Hey everyone. Before I get started on the actual problem, here's a quick background story: Last year my math teacher gave out passwords to check grades online. They were constructed in the following manner - 1st initial, 2nd initial, random 1 digit number. The students in the class...
  45. L

    How to Convert Between Julian Day and Gregorian Date?

    Hi guys, I have another weak problem here if you would care to help, please. I am trying to convert between the julian day and the gregorian date, and I found a eally good website:http://www.ortelius.de/kalender/calc_en.php The only problem is that when I run into the centennial cycle...
  46. S

    Nearest neighbor and cheapest link algorithm

    Homework Statement I need to calculate the relative error of the nearest neighbor algorithm. The book says it is the difference between the worst and nearest neighbor solution to the nearest neighbor solution. Does the mean that for example I have CITY A, find the fastest way to back to city...
  47. N

    Diagonalization Algorithm for Large Matrices: Any Suggestions?

    Does anyone here know of any fast algorithms to diagonize large, symmetric matrices, that are mostly zeros? (by large I mean 300x300 up to several million by several million)
  48. Q

    Ultra-lossless compression algorithm

    About a year ago I came up with an idea for a compression algorithm which could potentially compress any type of data (pictures, movies, text, ect) with equal ability, and could potentially compress it to 1/1000 or less of its original size. It is such a simple idea that I am sure that if it...
  49. C

    Genetic Replicative Algorithm and Administration

    if people in administration were educated and understood the genetic replicative algorithm/game theory as it applied to all life, would this knowledge result in an means of administration that would mean better quality of life for all people? Or would there be some counter-intuitive effect which...
  50. A

    Converting an algorithm into an equation

    Hello. I've got a simply ballistics program with a very simply algorithm to deal with air friction. However, I am trying to find a mathematical forumula equivalent. Here is the algorithm: G = accel due to gravity (universal constant) F = projectile air friction factor (constant for a given...
Back
Top