Most voted "mathematics" questions
Mathematics is the science of logical and abstract reasoning that studies quantities, structure, measurements, spaces and variations. Any math questions on this site should be related to programming.
Learn more…369 questions
Sort by count of
-
8
votes1
answer1752
viewsVectors and Angles (Molecular Geometry)
Hello, I have a problem, more mathematical than computational, to solve, but I haven’t been able to solve it myself until now... I have a set of three atoms connected to each other forming an angle…
-
8
votes2
answers2364
viewsJosephus problem (recursive)
This is the resolution, recursively made in C++, of josephus problem, where n is equal to the number of persons in the circle, and k is the number of step to be taken for the next person. #include…
-
8
votes1
answer2823
viewsWhat does i-esimo mean in an array?
Which means i-th, I’m having a hard time understanding its use in arrays and matrices.
-
8
votes1
answer37813
viewsWhat is the difference between Tautology, Contradictions and Contingencies?
Anyone who studies Mathematics or develops algorithms should know that Mathematical Logic is essential for several areas of knowledge, eg: in computing (programming), so I would like to know, what…
-
8
votes2
answers5108
viewsWhat is the difference between Logical Implication and Logical Equivalence?
I am studying mathematical logic and programming logic, and I would like to know the difference between Logical Implication and Logical Equivalence?
-
8
votes3
answers1793
viewsHow to divide integers and get value with decimal part?
I am trying to divide the following values into c#: Double media = 0.0; int soma = 7; int cont = 2; media = soma / cont; Is returning 3.…
-
8
votes3
answers3452
viewsWhat is an absolute value?
Viewing the Mysql documentation you can find the mathematical function ABS(x), to which the absolute value of x. mysql> SELECT ABS(2); -> 2 mysql> SELECT ABS(-32); -> 32 What exactly is…
-
8
votes1
answer276
viewsCHALLENGE: Algorithm for updating rectilinear motion uniformly varied aiming inertia at a certain end point
Question I want an algorithm that updates (from an instant to another, with a certain time interval between the two) a uniformly varied movement aiming at a final value making the fastest possible…
-
7
votes2
answers969
viewsHow to do an optimization with inequality restriction?
Suppose I want to minimize the following function: -(5-(x1-2)^2-2*(x2-1)^2) s.a. x1+4*x2 < 3 For optimization problems without restriction I can use the following code. fr <- function(x){ x1…
-
7
votes2
answers1118
viewsTesting primes in C
I am trying to develop in C a program in which the user puts a sequence of numbers and the same should determine whether the numbers are primes or not. Just follow my code: #include <stdio.h>…
-
7
votes1
answer1031
viewsHow do I know if a point (x, y) is within the filled percentage of a pie chart?
I arrived at this code showing whether a point (x, y) is inside or outside a circle on a Cartesian plane. def dentro_fora(p, x = 0, y = 0): r = cx = cy = 50 if (x - cx)**2 + (y - cy)**2 < r**2:…
-
7
votes1
answer5112
viewsHow to detect what are the common points between two circles?
I need assistance for the following program: Receive from the keyboard the equations of two circles: c1= X^2+y^2+ax+by+c=0 c2= X^2+y^2+a2=x+by+c=0 and show if the circles have points in common,…
-
7
votes1
answer535
viewsHow does atan2 function?
I have the following scenario: The angle should be chosen so that it always points directly to the mouse. Find the angle relative to the X axis (then 0 is straight to the right and PI/2 is straight…
-
7
votes1
answer2211
viewsIs there a module function of a number in C#?
Example : module of -1 (|-1| = 1). I’ve done some research on the internet but all I think is the division module (%). I am trying to circumvent the common way of passing a negative number to a…
-
7
votes2
answers602
viewsError splitting image in half using Python
I’m trying to split an image in half using the code below, but I’m having a feedback error. Code: import cv2 import numpy as np # Read the image img = cv2.imread("IMD015.png") width = img.shape #…
-
7
votes1
answer521
viewsHow to correctly multiply the decimal type in C#?
I’m multiplying monetary values in C#, and for that I’m using the type decimal to store these values. I have noticed that in it there is a method called Multiply(), which receives two values and…
-
6
votes1
answer2170
viewsWhat does 1e+24 Chrome console mean?
I noticed that when I type in Chrome console 1000000000000000000000000 he returns me 1e+24. And when I type 1000000000000000009901591 he also returns to me 1e+24 whereas 1000000000000000000000000 is…
-
6
votes4
answers3093
viewsFunction to check if number is prime in Javascript
In PHP would use: for($i = 3; $i <= ceil(sqrt($num)); $i = $i + 2) { if($num % $i == 0) return false; } What function to check using JS?…
-
6
votes6
answers22962
viewsHow to calculate percentage?
I have a variable that dynamically receives from the database, a floating number that is the percentage to be taken out of a certain value. How do I take this percentage away from a value? For…
-
6
votes2
answers1071
viewsShow more accuracy in C++
I have this program: int main(){ double x=2; cout << sqrt(x); } I would like to show the result as accurately as possible. Thank you!
-
6
votes1
answer518
viewsHow to make a program to calculate constant mathematical expressions
I have a job to build an algorithm that calculates expressions coming from a TXT file in this format. 10+20*(30)/ 25. I know this is a recursive descending analyzer, but I have no idea where to…
-
6
votes3
answers11601
viewsHow to calculate the Euclidean distance
I want to calculate the Euclidean distance by the following formula: So I tried, making this code: #define SLEEP_1 1000 void HeaderClass::DistanciaEuclidianaEntrePontos() { int x1, x2, y1, y2,…
-
6
votes1
answer1270
viewsCalculate cubic root
I’m having trouble creating the following Root and LN buttons. I have buttons that should be very similar as for example the normal square root and the log. I tried to create the following for the…
-
6
votes2
answers644
viewsArc tangent function in C#
I did the following calculation on the calculator: arctg(50/10) = 78,69° However, when doing in the code, using the function Math.Atan, the result is as follows: Is there any other way to calculate…
-
6
votes2
answers348
viewsRoot with Bigdecimal
I’m racking my brain to turn a root into a code. I know it works kind of like this: Math.pow(625, (1.0/4)) = raiz 4ª de 625 = 5 My headache is that my dice are BigDecimals Sting prazoIn =…
-
6
votes2
answers1725
viewsHow to increase number to fractional power?
I would like to know how to raise a number to a fractional power, for example 2^2.5, 3^0.7 ? For positive integers it works more or less like this : #include <iostream> #include <math.h>…
-
6
votes1
answer740
viewsAdd sequence of numbers in Javascript
Let’s assume that the user type the value 40391, so I need to add incrementally all values from 1 up to 40390, which results in the value 815696245. Today I do it with a simple for but I realized…
-
6
votes7
answers1523
viewsHow to calculate the median of a line in a date.frame in R?
I have a database and my goal is to perform some behavior analysis of classes per line. Example: print(DADOS) Linha A B C D E L1 4 3 2 2 4 L2 1 11 1 1 1 L3 0 1 2 3 4 L4 2 0 0 8 0 Using the example…
-
6
votes1
answer182
viewsAlgorithm O(n log n) to identify contiguous intervals given a range list
I have the following problem: Given a list with n continuous intervals, return a list of m continuous intervals such that: every point of the entry list is contained in any of the intervals of the…
-
6
votes5
answers427
viewsHow to run faster a code that calculates the number of factorial digits of a number?
The code must print how many digits have the factorial of N. I am trying to perform a simple factor challenge on the URI site and when I submit the code the answer is always "Time limit exceeded",…
-
5
votes2
answers552
viewsDividing 1/2 in C#
In some videos on numberphile about the Zeno’s Paradox the teacher of the video tried to explain how this paradox worked using hands to hit Palamas (I do not know how to explain this but I will…
-
5
votes3
answers18598
viewsHow to find the rest of the division?
I’m studying a workbook I found on the net, she asks for an exercise but did not teach to do it in the previous pages, I tried and it did not work, I thank you for your help. Make a program that…
-
5
votes4
answers205
viewsHow do you round it up in PHP?
What is the function of php to round up? Example: 1.1 move on to 2…
-
5
votes1
answer355
viewsIntegration between PHP and R
I am developing a project with php and decided to use R for statistical calculations. But I’m not sure how to accomplish this integration. If there is a "design pattern" for situations like this.…
-
5
votes1
answer4952
viewsHow to generate random values for a known distribution?
I am aware that, for example runif(1000,0,3) generates 1000 random values for a uniform distribution for x between 0 and 3. But how to do this for any probability density function? Every clue is…
-
5
votes1
answer1131
viewsComplex numbers in C++
I’m new to C++ and would like to know how to use complex numbers: double real[2]={2,5}; double imaginario[2]{7,9}; cout << "Soma: " << real[0]+real[1] << "+" <<…
-
5
votes2
answers8376
viewsConvert a positive decimal number into negative
I have the following query: Valor1 = '200.000,00'; select Valor1 from TB1 Is there any function that converts a positive number to negative?
-
5
votes1
answer606
viewsDoubt with signaled binary sum
I’m studying operations with binary numbers flagged and I came up with a question I’d like you to clarify: by adding two numbers with 6 bits being 001111(+15) and 010110(+22) I got the result…
-
5
votes1
answer16303
viewsHow to make and calculate the Frequency Distribution Table in R?
I’m trying to make the Frequency distribution table in R, however, I am not succeeding due to some formulas and calculations that I cannot implement in R. The structure of the frequency distribution…
-
5
votes1
answer279
viewsMachine Scheduling - Graph Theory
I am making a list of graph theory exercises and I have enclosed in a question that has the following statement: Machines are given 1, . . . , n and time intervals I1, . . . , In. For each i, an…
-
5
votes1
answer1239
viewsWhat is an Adjacency Matrix?
Whenever read something in relation to graph theory I stumble upon a term called Adjacency matrix, it seems to me that this is strongly related to this theory. Therefore, I would like to know more…
-
5
votes1
answer641
viewsCalculate integral trapezoid mode
I need to calculate integral with the trapezoid method. I believe the error may be in the for. They had tested them step by step and it worked. function integratrapezio(){ var elmbasea =…
-
5
votes2
answers432
viewsPermutations of an integer disregarding the zeros on the left
I have the following problem: Given an input n I have to calculate the number of possible permutations with the digits that compose it. For example, if n = 123 I have 6 numbers that can be formed:…
-
5
votes1
answer1694
viewsTorque calculator in C
I have this function that converts decimal to binary, but then how do I sum the bits, or use the & (and), etc. ? Use the operator & do we have to count to 2 decimal places? Ex: 25 & 25…
-
5
votes1
answer105
viewsAverage is not calculated
I need to write a code that reads only 20 integer values, at the end add the positive numbers and average the negative numbers. It normally adds up the positives but when it arrives at the time of…
-
5
votes1
answer65
viewsWhy does Std::Ceil produce different results for float and double?
Follows the code: #include <iostream> #include<math.h> using namespace std; int main() { float calculo = 4.347 * 20 * 100; double calculo2 = 4.347 * 20 * 100;…
-
5
votes1
answer258
viewsWhat is Lambda calculus?
I heard about it once, but I don’t understand its relationship to programming. Where I could apply this knowledge in development?
mathematicsasked 4 years, 10 months ago Luan 372 -
5
votes1
answer116
viewsHow to find the intersection between a line and a mathematical function?
I have a problem where I need to find the intersection of two mathematical functions. I have the formula of the first function and two coordinates, where ab and cd are my points. To pass these…
-
5
votes1
answer1155
viewsGet the smallest positive number that is divisible by all numbers from 1 to 20
I made a code in a way that works, but it doesn’t look anything pythonic, and takes a lot of time. i = 1 numero = 1 while i != 0: if numero % 1 == 0 and numero % 2 == 0 and numero % 3 == 0 and…
-
4
votes1
answer265
viewsHow do I calculate the size of the tag source in a tag cloud?
I have a cloud of tags and want to change the font size of each tag as you use them. I need to have a minimum size and a maximum size. What would be the formula to calculate tag size?…