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
-
2
votes1
answer134
viewsFind number with smaller number of decimals between two other numbers
The final part for data arithmetic compression is to find a number, which is among other 2 numbers, and which has the smallest number/decimal places! Example: Number between 0.1234 and 0.1245. The…
-
2
votes1
answer989
viewsHow to quickly calculate the sum of dividers in Python?
I would like to know how to quickly calculate the sum of the divisors of a natural number n, where 2 <= n < 109. For small numbers, I perform this operation quietly with the following code: n…
-
2
votes1
answer1112
viewsHow to calculate MODA with bimodal value in a date.frame in R?
I need to calculate the MODA of online values in a data.frame. As in R there is no function already set for FASHION, I used a custom function: moda = function(x) { z = table(as.vector(x)) names(z)[z…
-
2
votes1
answer265
viewsCompute square root with input from typed text
I’m not getting the calculator to take the root of a number that the user types. The most I got was what is in the code, but regardless of the screen value, it only returns the root value of 2…
-
2
votes2
answers284
viewsHow to calculate division using subtraction operation only?
I’m trying to put a command line that does division from subtraction into a dictionary but would be causing error, would know where I’m going wrong? x = float(x) y = float(y) num = 0 if y != 0: if…
-
2
votes1
answer90
viewsHow to make a generic implementation of the Bisection method in MATLAB?
Good night, I’m having the following problem: The code developed in Matlab to calculate roots of the equation using bisection method is bugging, perhaps in the calculation process (loops); The idea…
-
2
votes5
answers2164
viewsSquare root manually in Javascript
I’m trying to manually calculate square root in Javascript. Theoretically it was to stop at 100 according to the value that is in the variable number, but it continues to multiply. Code sample: var…
-
2
votes1
answer15
viewsProblem compiling Math. h
Good evening, when I try to use some function of Math. h and put as argument a variable and try to compile I get an error. Can you explain to me why this is happening? Follow an example code:…
-
1
votes2
answers1167
viewsHow to generate Math.Run from a value other than 0?
Hey guys, I just got to know the Math.Andom method and I already know how to generate values from 0 to another number through multiplication, e.g.: Math.Random()*20. But I’m wondering how I can do…
-
1
votes1
answer618
viewsCalculate rest with 2 Biginteger numbers
How to calculate the rest with "%" from two Biginteger numbers?
-
1
votes0
answers50
viewsDrying method and bvp
Is asked to resolve m* d 2 y/dt=-g-gamma*dy/dt such that y(20)=0, with the initial conditions I’ve already put in the code. What is wrong? %3. [value,x0,numIter] = f_secante(@find0_p3,0, 1, 0.0001,…
-
1
votes1
answer168
viewsDivision of a line into a number of segments
I need to divide a line into several segments, and all segments need to be formed by whole numbers. But sometimes the division of distância / segmentos results in a truncated number that does not…
-
1
votes2
answers895
viewsCalculation of the Z value of the normal distribution
Good morning, I’m having a problem calculating the Z-value in the normal distribution. Also the calculation of t and sigma t constants are giving me 0, which is impossible. I’ll put the code and…
-
1
votes1
answer243
viewsPseudo Code Chess
They put a challenge to me to solve through pseudocode: A chess board with only the King and Queen. What is the minimum and maximum number of moves to checkmate the King? Black King, White Queen I…
-
1
votes1
answer105
viewsComplementary error function in java?
How to calculate complementary error function in java ?…
-
1
votes1
answer4344
viewsEquation of 1° degree in C
How can I implement a algorithm calculating an equation of 1° grade in C? I know that a first-degree equation to be solved must follow three steps: 1°: Group the numbers on one side of the = all…
-
1
votes1
answer541
viewsCalculate the diameter of a circle to fill the rectangle according to the mouse position
My question is more for math than programming. but Anyway... I am creating a small script to determine the position (which is done by the mouse) and the diameter of a circle that is inside a…
-
1
votes1
answer46
viewsNew position X and Y depending on direction and distance?
I’m doing a mini shooting game on XNA but I’m not able to imagine how to calculate the following: Knowing the position of the center of the image, the direction in which it is pointing and the…
-
1
votes2
answers2258
viewsHow can I calculate the width when resizing an image that must be 3 X 4, knowing only the height?
Use the PHP to be able to process images in a given system. I need the photos to contain the 3x4 ratio. That’s how the system works: 1 - User takes webcam photo. 2 - An ajax is sent to PHP to…
-
1
votes1
answer38
viewsThe angles are crazy!
I’m creating a simple orbiting system, where you have the earth and the sun, created on the basis of a UserControl, the problem is I don’t know why the angle gets crazy by placing an angle on the…
-
1
votes3
answers2438
viewsDoubt in Calculation of %
Could anyone explain to me how to make the following formula? I have 3 values: Valor_Vendido, Valor_Minimo_A_Ser_Vendido and %_Atingida. Example: I sold 500 reais and the Valor_Minimo_A_Ser_Vendido…
-
1
votes2
answers1306
viewsHow to use exponent in Pascal?
I have a problem to solve, where the PG formula uses exponent other than two (squared), and cannot use sqrt(). How can I resolve this in Pascal in an intuitive way? I know you can’t use it ** also.…
-
1
votes0
answers153
viewsInverse matrix in block form
I have a 1 shape matrix (X and U are square): | X Y | | Z U | Which is the inverse of the matrix (which I don’t know) (A and D are square): | A B | | C D | I’m trying to get the inverse matrix of…
-
1
votes2
answers442
viewsHow to calculate the percentage of Likes?
How can I find a way to calculate two values to arrive at a percentage, for example: I have 100 Likes in a variable and 10 dislikes in another. In this example,(100 - 10 = 90) 90% of the people who…
-
1
votes0
answers69
viewsRepulsion method based on Helbing model
I’m developing a crowd simulator following Helbing’s Social Forces model, only I’m having a problem at the moment of the collision between agents. When the collision occurs the repulsion method is…
-
1
votes0
answers70
viewsCombination of several items
I have a set of items and each item has the following elements: E = (índice, espessura, largura, demanda) i = índice; e = espessura; l = largura; d = demanda; I have two more variables: int min,…
-
1
votes2
answers200
viewsHow to convert text into file to number with decimals?
I have this data written in the text file "000001010" (you only have this data), but I wanted when it was for the variable to be like this 10.10. I’m reading the file data like this: var linhas =…
-
1
votes2
answers3159
viewsPython Taylor series with no angle and error margin
Hello! I need to assemble a program that calculates sine, cosine and exponential Taylor series in Python, but the program cannot accept an angle value, only x, number of series terms and an…
-
1
votes1
answer236
viewsHow to make a MDC algorithm with just sum and subtraction?
How do I make an algorithm that calculates the MDC of two numbers only using sum and subtraction operations? It is prohibited to use operators other than those requested.
-
1
votes1
answer1708
viewsCalculate php percentage
I have two numbers, one of them is fixed (1700) and one will always be alternating between 0 and 1700, I want to calculate the percentage of that number that is alternating, for example, when the…
-
1
votes1
answer862
viewsCreate algorithm that calculates LOG in visualg
I’ve been given a list of exercises to do in Visualg and I’m having doubts in one of these exercises: "Enter the number and base on which to calculate the logarithm of that number and print it." I…
-
1
votes0
answers40
viewsHow to check the margin of an element?
I have a code to resize an element, I need to capture the resize from a margin of 18 pixels: $(document).on("mousedown",".image",function(me) { var move = $(this); var fm = matrix(this); var sv =…
-
1
votes1
answer68
viewsHow to catch the points of a circle through an angle in a Cartesian plane?
Imagine a circle with a radius of five on the Cartesian plane. By analogy I already know the following angles: 0° (ou 360°): (x = 5, y = 0) 90° : (x = 0, y = 5) 180° : (x = -5, y = 0) 270° : (x = 0,…
-
1
votes3
answers6982
viewsCalculate the standard deviation of a vector
I’m having trouble solving the following equation: Here is the code: #include <stdio.h> #include <math.h> int main(){ float m, media, sigma, p; int vetor[10]; media = 0; m = 0; sigma =…
-
1
votes1
answer115
viewsDivision does not generate the expected result
When I do the division of mul / total_filhos_mul the variable mul is zeroed, if I don’t make this division she gets the correct value. What may be happening? #include <stdio.h> int main(){ int…
-
1
votes1
answer3574
viewsCalculate percentage
Largura * Complemento = Subtotal + Porcentagem = Total subtotal.Text = (Convert.ToDouble(largura.Text) * Convert.ToDouble(complemento.Text)).ToString(); total.Text = (Convert.ToDouble(subtotal.Text)…
-
1
votes1
answer548
viewsCheck whether double variable is empty or numeric
How can I check if the variable a, b or c were not informed, and if in case they were not informed return all the code ? How can I also check if the letter "x" for the variable was entered in the…
-
1
votes2
answers61
viewsVariable keeps zeroed in a mathematical expression
My little show is like this: public void CalculaProporção() { decimal contagemSubida = 0 , contagemDescida = 0; int cSubida = 6, cDescida = 4, range = 10; contagemSubida +=…
-
1
votes2
answers706
viewsI calculate value with Comma with Vue.JS
Good afternoon, Vue.JS can calculate directly in mustache {{}} but when a value comes with comma, Nan appears the result that is, if the variable is value = 2 and I do {{ value - 1 }} it displays 1…
-
1
votes2
answers806
viewsMathematical logic betting on the lottery
I can’t think of the mathematical logic of the following issue: Three friends played the lottery. In case they win, the prize must be apportioned in proportion to the amount each gave for the…
-
1
votes1
answer178
viewsTake the result of an expression in c++
I’m almost done with my expression interpreter. But I have no idea how to do the most important part : The result I’d learn a lot from any idea. main.cpp #include <string> #include…
-
1
votes1
answer963
viewsDraw with different percentages
I have a "box open" system, which works as follows: The box can have X items (as much as you want) where each item will have Y% to be earned, being: # or #.1% (no more decimal places) That is: the…
-
1
votes0
answers214
viewsBhaskara Calculator functionality in PYTHON
Hello, I am still a student and I would like to know if some way to make more compact is Bhaskara calculator that I made. I’d like one that shows every step as she does. print('BHASKARA SOLVER')…
-
1
votes1
answer1047
viewsZerodivisionerror: integer Division or modulo by zero
The code: janela=[] for i in range(100): if(len(leitura)%i == 0): janela.append(i) The mistake I get is this: Zerodivisionerror: integer Division or modulo by zero…
-
1
votes3
answers562
viewsMath library
You guys have a question. I’m giving a study in the library Math. What’s the difference between: Ceil, floor and trunc?? The idea is to take the floating part of the number. Hug!
-
1
votes1
answer66
viewsAfter compiling and running, the algorithm shows "recorded excess floating point", why?
Algorithm to find out if a number is prime, giving the floating point excess error. #include<stdio.h> int main(){ int n, i, divisivel; divisivel =0; printf("Digite um numero para saber se eh…
-
1
votes0
answers680
viewsHow to subtract two large vectors?
I want to calculate the vector difference between two large vectors. I am able to subtract a list of matrices for a matrix and put it to the power of 2 (train["quest_emb"][0] -…
-
1
votes1
answer47
viewsComplexity of simple algorithm
I’m having difficulty in this exercise of complexity of algorithms, someone can give a light? Prove that if f(n) = -n then f(n) is O(1). One idea I had was that for any positive n, f(n) will be less…
-
1
votes1
answer193
viewsRepetition system how to store a value
Make a program that receives the age, height and weight of 25 people. Calculate and show: The number of persons over the age of 50; The average height of people between 10 to 20 years; The…
-
1
votes1
answer78
viewsFastest way to calculate a/b+c/d with float
You can operate four floats in the formula a/b+c/d (two divisions and a sum) mathematically equivalent to the formula (a*d+b*c)/(b*d) (three products, one division and one sum). It is known that…