In mathematics and computer science, an algorithm ( (listen)) is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or to perform a computation. Algorithms are always unambiguous and are used as specifications for performing calculations, data processing, automated reasoning, and other tasks. In contrast, a heuristic is a technique used in problem solving that uses practical methods and/or various estimates in order to produce solutions that may not be optimal but are sufficient given the circumstances. As an effective method, an algorithm can be expressed within a finite amount of space and time, and in a well-defined formal language for calculating a function. Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a finite number of well-defined successive states, eventually producing "output" and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input.The concept of algorithm has existed since antiquity. Arithmetic algorithms, such as a division algorithm, were used by ancient Babylonian mathematicians c. 2500 BC and Egyptian mathematicians c. 1550 BC. Greek mathematicians later used algorithms in 240 BC in the sieve of Eratosthenes for finding prime numbers, and the Euclidean algorithm for finding the greatest common divisor of two numbers. Arabic mathematicians such as al-Kindi in the 9th century used cryptographic algorithms for code-breaking, based on frequency analysis.The word algorithm itself is derived from the name of the 9th-century mathematician Muḥammad ibn Mūsā al-Khwārizmī, whose nisba (identifying him as from Khwarazm) was Latinized as Algoritmi. A partial formalization of the modern concept of algorithm began with attempts to solve the Entscheidungsproblem (decision problem) posed by David Hilbert in 1928. Later formalizations were framed as attempts to define "effective calculability" or "effective method". Those formalizations included the Gödel–Herbrand–Kleene recursive functions of 1930, 1934 and 1935, Alonzo Church's lambda calculus of 1936, Emil Post's Formulation 1 of 1936, and Alan Turing's Turing machines of 1936–37 and 1939.
Hi, I am a ninth-grade student from Portugal with nothing to do, and I have decided that I want to build a simple regression algorithm in Desmos (the online calculator) to fit random binary inputs and maybe predict the next binary digits (although that part may take a considerable amount of...
Hello. Sorry if the title is a bit vague.
I'm doing this challenge (google foobar) and even though it's not very elegant to ask for help, it's not like I'm going to win any kind of prize for it. In any case I'd like some suggestions since my current solution fails 2 tests on 5. The most...
As a Bedouin schiek you own twenty-five horses. You want to find the three fastest. You have no clock or other device that measures time. Your racing field is wide enough that five horses can race unimpeded, so you can race five at a time and see how they place. You don't want to abuse your...
Hardly anyone would think of this solution. I even wonder how anyone would come up with the question. And it is even more amazing that the questioner and solver were not the same person.
Hi! I have studied Grover's algorithm for quantum search and I just want to
make sure that I understood it correctly: to make a number k of calls to the
oracle one needs to have k physical copies of the gate producing the oracle. In
quantum circuits there are no loops, hence a physical gate...
I know that when giving an algorithm to prove something we need to prove two things about the algorithm ( there’s another option which is to show time-complexity but that’s optional since it’s irrelevant to the proof):
1. Correctness
2. That it halts
But there are also algorithms/procedures...
For this problem,
For (i) the solution is,
However, I am somewhat confused how to follow the steps of the Gauss-Jordan Elimination algorithm from there. Do I have to eliminate the coefficients from ##x_2## and ##x_3## respectively from row 1 and the -5 coefficient from row 2 in the exact...
1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)
how...
Hi 🙂
I'd appreciate your help.
I have a bunch of livestock with an ear sensor on each, that sends me data about how much heat is going out of the ear.
I wanna take this data from each livestock and smooth it.
My question is, how to know which smoothing algorithm I should use to get an...
Let ## a, b, c ## and ## d ## be integers such that ## 225a+360b+432c+480d=3 ##.
Then ## 75a+120b+144c+160d=1 ##.
Applying the Euclidean algorithm produces:
## gcd(75, 120)=15, gcd(120, 144)=24 ## and ## gcd(144, 160)=16 ##.
Now we see that ## 15x+24y+16z=1 ##.
By Euclidean algorithm, we have...
I'm not asking it from "will it be secure" point of view, rather I'm asking textbook kind technically correct or not.
This is the algorithm (in the 3rd step of right figure, it should be generate y, typo)
I took p=23,g=5.
And picked x=4,y=5
I got the secret key as 12 and both got 12, so it...
It starts at 6:16
It's the part where he's pointing his hand in this picture. I didn't get it although it's pretty mechanical, so I'd like to learn that technique as this is really useful in RSA algorithm(rather than having to memorize some values). I've been searching for a method like that...
Here is a spreadsheet that demonstrates how Shor's algorithm works.
The user first enters a number 'N' that has only two prime factors. Then, the user enters a random integer 'x'. Shor's algorithm does the rest in the factorization of N. A different value for 'x' must be tried if the factoring...
I am new to the operating system and I want to know, Is it right Banker's Algorithm is mainly used to prevent deadlock? I picked this question from https://www.interviewbit.com/operating-system-mcq/ and I think it is also used for Solving deadlock, Can anyone know, Is this right?
I know that the maximum number of trees in a heap will be when all the trees are of smallest order as possible. Then, after performing CONSOLIDATE operation on the heap, all the newly created trees in the heap will be of different orders. Since in a different exercise I showed that the minimal...
An interesting approach to those eavesdropping devices in your life.
https://arxiv.org/pdf/2112.07076.pdf
ABSTRACT
Automatic speech recognition systems have created exciting possibilities for
applications, however they also enable opportunities for systematic eavesdropping.
We propose a method...
This is the weighted, directed acyclic graph I created in JavaScript
class WeightedDirectedGraph {
constructor() {
this.adjacencyList = {};
}
addNode(node) {
if(!this.adjacencyList[node]) {
this.adjacencyList[node] = [];
}
}
addEdge(node1, node2, direction, weight) {...
I am coding the Viola-Jones algorithm in C# and I have a few questions. For finding an eye, after I have my integral Image, I am passing a 24 X 24 Rectangle across the whole image from left to right and top to bottom. I subtract the black area from the white. So right now, I am solving for the...
Step 1: Reduce RHS into singletons
F = {AB->C, C->A, BC->D, ACD->B, D->E, D->G, BE->C, CG->B, CG->D, CE->G}
Step 2: Reduce LHS redundant attributes
ACD->B has closure of A: A, C: C,A and D: D,E,G since A is in the closure of C we can remove A from ACD->B making it CD->B no other LHS could be...
Here is a solution, part of which doesn’t make any sense to me-:
->Why did we select c3,c1 and c3,c2 for 2nd generation?
-> why did we select os1,os2,c3,c2 for 3rd generation? (And what the heck is happening here? We are already in 3rd generation when even 2nd one is not complete?
-> then we...
https://lh3.googleusercontent.com/J-M_R31KFl76aXCRE4sxzAWI6iAldXG9fMI2k4YRMZo6vZY0w1DPUfV7tLc1w5IsVQX8uUkjgThzROZrbb3bc6kluAEmyiH63Z4BsXKT5Xr7X7mLxOwbR1L0y3ttoLitS6bOnwz-
Here is a solution, part of which doesn’t make any sense to me-:
->Why did we select c3,c1 and c3,c2 for 2nd generation...
https://slidetodoc.com/genetic-algorithms-an-example-genetic-algorithm-procedure-ga/
slide is taken from here. is this done total randomly or is it done pseudorandomly. I mean is there some forumula for randomness used in this case?
i learned about single point and double point crossover but...
Really need this. Tried googling but not many. 1 or 2 are there. I want this algorithm solved by hand to some problem. IDK what kinds of problems exists. but one is knapsack problem. there is analytics vidya's tutorial but I want something else, more direct, more clear...Any resource you can...
The DFS in action doesn't relate to the pseudocode as you can see it. My confusion starts from dfs in action, step 4. I could write essay about it, but you can see it yourself as well and spot that algorithm and dfs in action doesn't match up properly. or is it only me?
This is not a homework...
Hi,
I am a math noob and need to understand what is the best mathematical formula for fair distribution. The problem statement is as follows:
We choose 2 numbers at a given time to distribute donations at a particular instance in time (The numbers from 1-6500 represent community members...
Hey guys, how you doing?
Im here to ask for you help. I am writing my bachelor paper as an implementation/review of the TPP algorithms out there. Almost every paper that I read references the Ramesh algorithm, that returns an exact solution for TPP problems, but I just can't find the algorithm...
Say p=5, q=11
z=(p-1)*(q-1)
=40
d relatively prime to z, so d=27
de mod z=1
27e mod 40=1
e=3
$C=M^e mod \; n$
For d, M=4
C=$4^3 mod 55$
Am I right here?
I'm a freelance web developer and right now I'm stuck into a mathematical(probability) issue where I'm developing an answer filtering tool.
This tool works as follows:
1) There are six questions that the user will be asked
2) Based on the answer of first question, my server will decide which...
I'am interested in the notation of the approximation in quantum phase estimation algorithm.
In the literature there are different definitions, which I divide into two cases here. Both different in their definition of the ##\delta##. In both cases I start with a quote of the source and show an...
In HHL algorithm, does the controlled unitary (Hamiltonian simulation part of Quantum phase estimation) depend on Hermitian matrix coefficients and how?
Hello,
I have a question about the measurement of a qubit in the computational basis. I would like to first state what I know so far and then ask my actual question at the end.What I know:
Let's say we have a qubit in the general state of ##|\psi\rangle = \alpha|0\rangle + \beta|1\rangle##. Now...
Hi all!
I've been trying to find a reasonable way to solve following problem:
N people meet each others in groups of K people such that no one meets more than once.
If I'm not mistaken, this requires two things:
N must be divisible by K
N - 1 must be divisible by K - 1.
Let's assume these...
Hello, I am learning trying to set up a code that searches for a certain pattern in the text by implementing Rabin-Karp Algorithm.
When setting up the Rabin Karp hash function, I have been told that I should set a value q in order to lower the time complexity of the function, and that q should...
Hey! 😊
The algorithm of the Booth for multiplying signed numbersrs of fixed complement representation decimal point by 2 is implemented by multi-consecutive digit stain control of the multiplier, so after each test the algorithm proceeds by $N$ digits (e.g. for $3$-bit control step $N$ is...
Hello! I am just getting started learning about quantum computing so I apologize if this questions is trivial, but I am a bit confused about the Grover's algorithm. As far as I understand (I read it from here), assuming there is just one solution, you start with N qubits, you put them in an...
Let us suppose I have a string in this form,
string = 'CıCCkCnow CwCho CyCou CaCre but CwChat CaCm CıC'
Now I won't to take each word between 'C' and convert it into an upper case letter. For example, the above string should turn into
new_string = 'I know Who You Are but What Am I'
what kind...
Hello everybody,
I should evaluate the complexity of this graph coloring algorithm.
To do this, I use the adjacency matrix in which the graph nodes are the elements on the diagonal, while the elements outside the diagonal indicate if a node is adjacent to another ##(A_{i,j} = 1)## or not...
I have to solve the 1D Time-independent Schrödinger equation (TISE) using the shooting algorithm. As far as I understood from this video on Shooting method for solving BVP, I will have to solve the problem by using IVP solvers (like RK2 or RK4 methods), and guess a value for the derivative of...
I have a camera that take pictures of square boxes that are really close to one another. There is a light that is Illuminating the boxes but when I try and isolate a single but in my picture, I am reading higher values then what I should be. If I remove the other boxes and only do one box, I am...
I have seen "radioactivedecay.py" python library which employs measured experimental data for its calculations. I have seen models that solve the system of differential equation with numerical algorithms to predict the proportion of nuclides at any given time. But I have yet to see a...
I tried to write to the code, but I got confused in line 46 & 59.Every new added bus increases the dimension of the Z matrix, and since we have 3 busses, the dimension of Z should be [3x3]. I formed a for loop in case of adding a new bus to add a new row and new column (increases the...
I ran into an interesting video on Youtube yesterday, about a fast way to compute the reciprocal of the square root of a number. I.e., to compute this function:
##f(x)= \frac 1 {\sqrt x}##
The presenter is John Carmack. If you search for "Fast Inverse Square Root — A Quake III Algorithm" you'll...
Recently I have shared a question about a program called SimpleMC and how to run it.
Running a Github File on VS code for windows 10- File system problem ( | Physics Forums
I am trying to understand an MCMC program. I manage to run it, but I am trying to understand the meaning of the some...
I posted in the same sub-forum about complexity in mathematics and whether it is determinate. Seemingly, the consensus is that there's no definitive way in assessing a proofs complexity in a manner that is rigorous in regards to any other theorems or otherwise stated in a systematic way other...
Here is the function that I have written:
import numpy as np
def ode_euler_forward(odefun, y_initial, x_range, num_steps):
"""
Solves a system of non-stiff ODEs using Euler's forward algorithm.
Parameters
----------
odefun : callable(x, y1, y2, ...)
The function...
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...
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...