Algorithm Definition and 724 Threads

  1. C

    Det of Triangular-like Matrix & getting stuck in Algorithmic Proof

    Find determinant of following matrix: ## A = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n-1} & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n-1} & 0 \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ a_{n,1} & 0 & \cdots & 0 & 0 \end{pmatrix} ## Note: I tried to solve this question...
  2. Arman777

    Trying to find an algorithm for the Number Mastermind game

    I am trying to write a code to guess the secret number. For example, if I have a secret number called 412. My code will take the inputs as 120 - 0 312 - 2 439 - 1 where the numbers on the right gives the position of the correct digit at the correct location. I have thought some codes but it...
  3. person123

    MATLAB More Efficient Way of Computing Neighbors in Range

    Hi. I have a collection of points in 3D space. I'm using MATLAB to find all pairs of points within a certain range from one another. Right now I'm using rangesearch(X,X,r), where X is the collection of points and r is the range. These points are the locations of atoms and I am attempting to...
  4. person123

    MATLAB Computing Sections of a Graph Which Can Be Removed By Removing Two Edges

    Hi. I have graph which I am analyzing in MATLAB. I would like to determine sections of the graph which could be removed from the rest of the graph by removing only 2 edges. (The graph represents the network of atomic bonds from a simulation of silica, and I am attempting to locate strands of...
  5. S

    Efficient Q-Tree Algorithm: Understanding Parent-Child Relationships

    Hi, I don't get what the conditions below exactly means. Its which u they are talking about? Is the u the parent or children? Does it mean u = B? and the children are A,C,D? if u is in the quadtree rooted by v:NW then u:x < v:x and u:y ≥ v:y; Thanks,
  6. Francis

    A Quantum CSP Algorithm for Aircraft Recovery Problem

    The Aircraft Recovery Problem: consists of finding solutions for a disrupted aircraft flight schedule such that a set of constraints is satisfied, namely continuity, turn-round time, scheduled maintenance, and airport departure/arrival capacity. My approach consists of finding the domains for...
  7. Francis

    A Conditional phase shift for Grover's algorithm

    I am trying to understand the following deduction: "The conditional phase shift can be represented by the unitary operator 2|0> <0| - I:" for eq. 4a) I was expecting to be: [2 |0><0| - I] |0> = 2 |0> <0|0> - I|0> = 2|0> - |0> = |0> as for eq. 4b I can't understand it at all. Why does the...
  8. IreneFerri

    Problems with Landau Wang algorithm in fortran

    I have been struggling for over a month now with a problem I cannot fix. I would really appreciate any comment or guidance. Thank you! I am considering an Ising-like model with N agents that han hold one of the following 3 states, represented by vectors: state + : vector (1 0) state 0 : vector...
  9. user366312

    Interpolation in the Marching Square Algorithm

    Marching Square - article In the "Linear Interpolation" section This article discusses how to interpolate the values when the lines are oblique. For example, for Case#2 it has the following calculation: I have written the following source code to implement the Marching Square algorithm...
  10. w4y021

    Can a Body Language Algorithm Reveal Our True Emotions?

    These days there is a question confuses me if it can be real or not. 2-3 years ago when I was looking around papers about computer sciences on the web, I came across to a sceintific paper which mentions an algorithm about analysing your language even it's a foreign language. So when you speak...
  11. E

    B Algorithm for checking if a set of digits are all distinct

    If I give you 9 digits ##u_1, u_2, \dots, u_9##, is there an operation/set of operations you can perform to check whether all the digits from 1 to 9 are represented in that set? Just asking because my solution was a boring brute force check. I don't think anything useful becomes of the product...
  12. tomdodd4598

    I The period-finding circuit for Shor's algorithm

    I've been trying to learn about Shor's algorithm by writing out implementations of the circuit for modular exponentiation, ##{ a }^{ x }\; ({ mod }\; N)##, to find the period ##r## for small numbers such as: ##(N=15,\quad a=11)\quad \longrightarrow \quad r=2##, ##(N=35,\quad a=13)\quad...
  13. A

    Developing Algorithm to Recursively Walk Array: arr[4] Example

    I want to write code walk around the array recursively. For some reason I cannot share my code. Let's say I have a array like this: arr[4], I want to look 012 123 013 or 01 12 23 02 03 13. In code I write I can look 012 123 or 01 12 23 but I cannot look 013 or 02 03 13. What algorithm should I...
  14. S

    C/C++ Could someone translate this Donald Knuth algorithm to C/C++?

    [Can't embed image. Keep getting 500 Internal Server Error ...] https://i.stack.imgur.com/rmDuR.jpg Image added by mentor
  15. maistral

    Reaction kinetics + Gillespie algorithm: Propensity function?

    I'm trying to simulate a simple series reaction stochastically using Gillespie's algorithm. I found this file: What is this 'propensity function'? Say for example I have the simple reactions: A --(k1)--> R R--(k2)--> S are these 'propensity functions' the rates (a wild guess)? I mean; α1 =...
  16. Adec

    Comp Sci Galaxy simulation with the velocity Verlet algorithm

    To simulate the trayectories of solar systems around a black hole (i.e. a galaxy) I have 3 classes in C++: cSystem, cBlackHole and cGalaxy. cSystem assigns initial values of position, velocity, etc to a solar system. cBlackHole does the same but just for the black hole. And cGalaxy mixes...
  17. D

    What is the sum of existing partial products in Booth's Algorithm?

    Trying to understand Booth's Algorithm. There's some YouTube videos online but I decided I'd try by reading Booth's original paper http://bwrcs.eecs.berkeley.edu/Classes/icdesign/ee241_s00/PAPERS/archive/booth51.pdf Can anyone explain what is meant by "sum of existing partial products"? (Page 3...
  18. tomdodd4598

    I Number of qubits required for Shor's algorithm to factor a number < 2^n

    Hey there, There are plenty of proposed implementations of Shor's algorithm which require different numbers of qubits, ##q##, to be able to factor a number ##N## of size ##<2^n##, i.e. a number of length at most ##n## bits. Most of these require ##q## linear in ##n##; for example, this...
  19. A

    Code for BCC Lattice Algorithm: Start Here

    I need to write a code for my simulation for which I have to create bcc lattice. Can anybody suggest how I can start since I am jumbled up this 3d lattice coordinate writing?
  20. Z

    Prime Number Detection: Running Time of Algorithm

    Hi, I want to know if the algorithm to find prime number has running time O(sqrt(N)) or O(log^2N). log^2N is better than sqrt(N). Also for large values can it become a pseudo polynomial algorithm? Zulfi.
  21. bhobba

    Have you heard of the VDSR upscaling algorithm?

    Hi All Here is an interesting algorithm for up-scaling images: https://arxiv.org/pdf/1511.04587.pdf It has 20 3x3x64 (some I have read use 3x3x16) convolutions. Now my understanding of convolutions means, the first produces 64 images from the 64 filers, then in the second convolution each of...
  22. Arman777

    How Does the Verlet Algorithm Compare to R-K Methods in Energy Conservation?

    I am trying to understand the verlet algorithm but I am kind of stuck. I guess first we are findind the ##v(t + 1/2h)## then we are leaving it there and starting a loop for 8.78 ? Also I did not understand the meaning of the equation 8.78 ? We are never using ##v(t + 3h/2)## ? Or in the...
  23. S

    Text color detection algorithm giving pixels of text

    I'm creating a type of image processing software and I have a need to get the color that best represents text once I have identified the pixels in a region of text. I've tried using simple strategies like "averaging" the pixels or taking the most common pixel, but these produces bad results An...
  24. JorgeM

    Algorithm for the min. distance over a set of points randomly distributed

    The only restrictions are: -There are N points randomly distributed over an X-Y plane and it is necesary to pass every point at least 1 time, in order to get the path of the minimun distance throught all of them. -If does not matter how many times you pass any of this points. -You have to pass...
  25. T

    XOR algorithm to find the missing number in a given array

    Recently I have been reading up about the logical operations OR, AND and XOR. Whilst reading about XOR I cam across a method using XOR to find the missing number in a given array, but I just can't understand how or really why it works. The algorithm is displayed below. A = [2, 3, 1, 4, 6, 7]...
  26. V

    A On uniform boundedness of the GD algorithm

    Consider a function ##f\in\mathcal{C}^2## with Lipschitz continuous gradient (with constant ##L##)- we also assume the function is lowerbounded and has at least one minimum. Let ##\{x^k\}_k## be the sequence generated by Gradient Descent algorithm with initial point $x^0$ and step-size...
  27. V

    MHB Effect of Perturbation on Gradient Descent Sequence

    Consider a function $f\in\mathcal{C}^2$ with Lipschitz continuous gradient (with constant $L$)- we also assume the function is lowerbounded and has at least one minimum. Let $\{x^k\}_k$ be the sequence generated by Gradient Descent algorithm with initial point $x^0$ and step-size $0<\alpha<2/L$...
  28. jedishrfu

    Who needs qubits? Factoring algorithm run on a probabilistic computer

    https://arstechnica.com/science/2019/09/who-needs-qubits-factoring-algorithm-run-on-a-probabilistic-computer/
  29. B

    Pivoted Cholesky decomposition algorithm

    Hi at all! I need to implement the Pivoted Cholesky Decomposition in C++ and I know that is possible implement it without rows permutations. Where can I find the algorithm described clearly and/or codes example in other language to replicate in C++? Thanks!
  30. E

    Comp Sci Time Complexity Algorithm Proof

    Use the formal definition of Big-Oh to prove that if f (n) and g(n) are nonnegative functions such that f (n) = O(g(n)), f (n) + g(n) = Ω(g(n)). By the definition of Big-Oh: If f(n) and g(n) are non-negative functions such that f(n) = O(g(n)) there must be positive constants c and n0 such...
  31. F

    Complexity of this heap algorithm

    I'm trying to count running time of build heap in heap sort algorithm BUILD-HEAP(A) heapsize := size(A); for i := floor(heapsize/2) downto 1 do HEAPIFY(A, i); end for END The basic idea behind why the time is linear is due to the fact that the time complexity...
  32. Arman777

    1D peak algorithm (correct implementation)

    array_values = [[0], [0,0], [1,2], [3,1,2], [1,2,3], [4,6,2,1], [8,9,0,2,1]] def peakfinder(xarray): if len(xarray) == 0: print("You entered an empty error !") raise ValueError if len(xarray) == 1: return xarray[0] if len(xarray) == 2: return...
  33. Arman777

    Python How can I create a density reachable algorithm in DBSCAN

    I am new to data science and I am trying to create an algorithm for the DBSCAN. I can label each point as core-border-noise. But after this step I am stuck. How can I separate the density reachable cores and create clusters from these points ?
  34. matqkks

    I Proof of the Division Algorithm

    In many books on number theory they define the well ordering principle (WOP) as: Every non- empty subset of positive integers has a least element. Then they use this in the proof of the division algorithm by constructing non-negative integers and applying WOP to this construction. Is it...
  35. matqkks

    MHB Proof of the Division Algorithm

    In many books on number theory they define the well ordering principle (WOP) as: Every non- empty subset of positive integers has a least element. Then they use this in the proof of the division algorithm by constructing non-negative integers and applying WOP to this construction. Is it possible...
  36. Haorong Wu

    I In quantum search algorithm, how to interpret the effect of U(t)?

    In Nielsen's QCQI, in page 259, it reads, $$U \left ( \Delta t \right ) = \left ( \cos^2 \left ( \frac {\Delta t} 2 \right ) - \sin ^2 \left ( \frac {\Delta t} 2 \right ) \vec \psi \cdot \hat z \right ) I \\ -2 i \sin \left ( \frac {\Delta t} 2 \right ) \left ( \cos \left ( \frac {\Delta t} 2...
  37. R

    Algorithm analysis problem turned into a math problem

    The equation listed is the implicit form. I achieved this a weird way. \begin{array}{|c|c|c|} \hline 1 & 1 & 1*1 \\ \hline 2 & 6 & 2*3 \\ \hline 3 & 18 & 3*6 \\ \hline 4 & 40 & 4*10 \\ \hline 5 & 75 & 5 * 15 \\ \hline 6 & 126 & 6 * 21\\ \end{array} Focusing on the third column now, I can...
  38. S

    MHB Discrete maths problem - tracing an algorithm

    Hello, I'm working on a discrete mathematics for computing paper and am stuck on what a symbol is trying to convey. Sorry if this seems like a stupid question (I feel stupid for not being able to work it out myself), I've just started this subject and am still getting used to it. My question...
  39. FahdEl

    Equation of motion using Runge-kutta 4 and Verlet algorithm

    import numpy as np import matplotlib.pyplot as plt G=6.67408e-11 M=1.989e30 m=5.972e24 X0=-147095000000 Y0=0 VX0=0 VY0=-30300 T=365*24*60 def rk(ax,ay,x,y,vx,vy,h): t=0 n=int(T/h) A=[[t],[x],[y],[vx],[vy]] for i in range(1,n): k1x=vx k1y=vy q1x=ax(x,y)...
  40. L

    I Algorithm to determine the roulette curve

    I am trying to develop an equation or algorithm to determine the roulette curve that results from rolling a curve over another fixed curve. A general method to determine the roulette using any two curves, rolling and fixed, seems to be presented here...
  41. Z

    Time Taken by this Algorithm in Terms of m, p, t_add, t_s and t_w

    Hi, Kindly consider the Question 4.8 on the following link http://parallelcomp.uw.hu/ch04lev2sec18.html ##t_s## = start up time ##t_w## = per-word transfer time m = size of message p = number of processors The total time for communication for ##logp## steps is: ##T = (t_s + t_w*m) * log_2 p##...
  42. jedishrfu

    SmarterEveryDay on Youtube Video Algorithm Hacking

    SmarterEveryDay is posting a series of videos (this is the first one) on Youtube Video Identification hacking, what it is and how it affects what we see online. Its really good even though the notion of manipulating the Youtube algorithm is very disturbing.
  43. R

    Modified Euclidean Algorithm proof

    gcd(f_n,f_{n-1}) gcd[f_{n-1},f_n - f_{n-1}] gcd[(f_n - f_{n-1}), (f_{n-2} - f_{n-1})] gcd[(f_{n-2} - f_{n-1}),f_{n-3} - f_{n-2})] gcd[(f_{n-2} - f_{n-3}),(f_{n-4} - f_{n-3})] . . . gcd(f_2,f_1), where f_2 = 1, f_1 = 1 I assume LateX is not working yet. Not sure if I am on point here or not...
  44. PainterGuy

    MPPT algorithms, perturb and observe algorithm etc

    Hi, I had thought that "hill climbing method" is a general terminology to refer to methods such as perturb and observe and incremental conductance. The same is also said here, "The hill climbing based techniques are so named because of the shape of the power-voltage (P-V) curve. This technique...
  45. Q

    I "Basic" question about Grover's Quantum Computing algorithm

    Hi everyone, I'm a computer scientist (not a physicist), so I will ask a computer scientist's question. In all the descriptions I found of Grover's algorithm, there is an element that is puzzling the computer scientist in me: it seems that you need to tell the Oracle about the position of the...
  46. P

    I Why is the Phase Shift in Grover's Algorithm Applied to All Elements Except 0?

    Hi everybody, I've read some pages in Nielsens "Quantum Computing" book, it's very interesting, but especially at Grover's algorithm, there occurs a question for me. It is said that a phase shift is performed, which is defined as follows: ##|0\rangle \rightarrow |0\rangle \\ |x\rangle...
  47. P

    I Grover algorithm geometric interpretation

    Good day everybody, I'm currently working on the Grover algorithm. You can also illustrate this process geometrically and that's exactly what I have a question for. In my literary literature one obtains a uniform superposition by applying the Hadamard transformation to N-qubits. So far that's...
  48. E

    Programming algorithm expressed in math notation

    Hey everyone, I wasn't sure if this belonged in the general math forum or not, so I posted it here instead (mods - feel free to move if it belongs elsewhere). What I want to know is how to properly write out a computer algorithm in proper math notation. Take this code for example: Height...
  49. F

    Can someone recommend an algorithm to optimize this data

    I have a data set of samples, and I made up some variables that filter out unwanted samples from the data set. Say each sample has values ##\vec{x}=x_1, x_2,..., x_n##, and I know the values of ##\vec{x}## for each sample. Also, if I sum up all of the samples, I get a value, ##Z##, which tells...
  50. R

    MHB What Type of Math is Used in Fortune's Algorithm?

    I've heard that Fortune's Algorithm is the fastest algorithm yet found to generate a voronoi diagram. I am far from being able to understand it, but I got interested in it because I want to learn about procedural generation. My question is, what sort of mathematics would I have to be familiar...
Back
Top