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
-
1
votes2
answers379
viewsA simple question using % in JS
I’m learning Javascript and came across a question that was solved by another, but used a % (dollar sign) in the code. I’m still too layy to understand, but could someone explain to me the real…
-
1
votes1
answer39
viewsError in meter division
Why is my code performing the wrong average division because of the variable contador? int numero,contador, soma; float media; soma = 0; for (contador = 1; contador <= 3; contador++) {…
-
1
votes2
answers162
viewsOutput: Nan | Bhaskara Formula (quadratic function) in javascript
I’m trying to solve a problem of Uri online Judge for bhaskara formula, but my Output always comes out "Nan" and I don’t know where I went wrong! Input: 10.0 20.1 5.1 var input =…
-
1
votes1
answer85
viewsHelp for Linear Dilation calculations in Python
Hello. This is my first post on Stackoverflow so a thousand pardons if I ever make a mistake. Guys, can you help me? I’m trying to develop a code in Python that can calculate the Linear Dilation of…
-
1
votes2
answers315
viewsGiven a number, get the digit of tens
Write a function that takes an integer number of up to three digits and returns to dozens quantity of that number. Do not make type transformations. Input: (2) Output: 0 Input: (85) Output: 8 Input:…
-
1
votes1
answer332
viewsSum of digits of a string only works when I do a subtraction I don’t understand
The program receives a string size up 10^6 and add the digits. I made the code, but to each loop 48 is added to the sum variable. If I modify the tenth line as soma = soma + nome[x] - 48 the problem…
-
1
votes1
answer112
viewsHow NOT to round up figures?
I need an exact value but my code always rounds down: float percentageUsed = 6050492416 / 8258998272; System.out.println(String.format("Porcentagem: %.2f", percentageUsed)); In case I had to return…
-
1
votes1
answer554
viewsCalculation of salary needs to limit houses
An employee of a company receives salary increase annually: It is known that: This employee was hired in 1995, with initial salary of R $ 1.000,00; In 1996 he received a 1.5% increase over his…
-
1
votes3
answers89
viewsWrong calculation of percentage
How exactly is it made to use the switch correctly? Here in the code, the case 1 and 2, they function normally, but in case 3 and 4, at the time of division by 2, or by 3, to know the plots, always…
-
1
votes3
answers5809
viewsHow to fix "Valueerror: invalid literal for int() with base 10: '' - Python?
Summary of my program/ problem: I need to draw at an ATM between 10 and 600 reais. When running the program, any value above 100 it prints correctly, but if I put any value below 100 it presents the…
-
1
votes1
answer208
viewsHow to place arrows on the graph of a parametric curve - Python - Plotly
I posted that same question earlier on stack overflow (in English). I’m new in python and I’m learning to plot parametric functions using plotpy. Therefore, I "challenged" myself to write a code…
-
1
votes1
answer398
viewsCalculation of cubic root in vectors
Hello! I am doing an exercise where it is necessary to calculate the cubic root of 10 numbers stored in a vector and transfer them from vector A (where the numbers were read) to vector B ( where…
-
1
votes2
answers108
viewsHow to get the product to scale two vectors in Javascript?
In python, if I have two vectors, I can get the scalar product using numpy. Following example: x=np.array([2,4,6]) y=np.array([1,3,5]) np.dot(x,y) Returns: 44 I’m looking for an equivalent function…
-
1
votes1
answer16
viewsHow to hide decimals in pascal?
I’m making a currency converter and I’m having trouble with the decimals, for example: "$1.0 equals R$ 0.18248175182481752" I would like to know how to hide the decimals from the second house. The…
-
1
votes2
answers99
viewsfind intersections in two graphs in python
I have a very simple but functional code. It obeys two mathematical functions, testing different values of x and returning the coordinates of the point if the result of the two functions is the same…
-
0
votes1
answer879
viewsAdd and remove percentage
On a certain screen I take a value and add 10% on top of that value. 100,00 + 10% = 110,00 I save the final amount (110.00). I’m having difficulty in picking up the final amount (110.00) and taking…
-
0
votes1
answer230
viewsSAS Linear Regression
I’m working on a project where I develop trend change indicators. One of them involves linear regression looking at 12 months, that is, I enter with 12 consecutive points of a time series and I want…
-
0
votes1
answer1851
viewsCalculation of moving average in MATLAB
How to calculate the average of 12 months of a time series in MATLAB, so that by fixing Jan to ten the year you want the average, the month of Jan of year x is the average of Jan to ten of the year…
-
0
votes1
answer130
viewsConverting split expression to C++ to C#
I have the following condition in C++ and would like to move to C#. The problem I’m having is with the function div error: The name 'div' does not exist in the Current context if (quant > 0) {…
-
0
votes1
answer1175
viewsHow to resize image with fixed width
I’m having trouble resizing an image to a specific width, I can only resize proportionally according to width or height. With only: <?php $original_width = x; $original_height = y; $redimensionar…
-
0
votes1
answer1359
viewsSomeone knows a library that calculates integral and derivatives in java
I wonder if anyone knows a library that calculates integral and derivatives in java.
-
0
votes3
answers913
viewsMultiple of 10 closest to a sum
def multiplo(x): somamulti= somaImpares(x) + somaPares(x) if somamulti/10==0: return somamulti/10 else: return In this function I did what happens is the following: the somamulti sum 2 values, in…
-
0
votes2
answers1482
viewsHow can I complete the harmonic mean?
I wonder why my code is not returning the correct values, because when I type the value it does not calculate correctly, how to enter with two notes, both valid 5.0 and 5.0, the exit should be 5.0…
-
0
votes1
answer176
viewsIt is better to use common division or Shift and Soma operations on 8bit microcontrollers
Considering programming for 8bit microcontrollers, we know that even for this microcontroller, the compilers have reached a unique level of optimization that allows us to program focused only on the…
-
0
votes1
answer944
viewsCalculate total cart in php
I’m with a question I made a shopping cart and the freight calculation using the webservice from the post office. Now I need freight to add to the total amount more I’m not getting.Someone could…
-
0
votes0
answers78
viewsFriedman’s Test Κ
I have a question. I read that the Κ test of Riedman was something like this: Friedman’s Κ test attempts to figure out the period of the cipher by calculating several values of Κ(C,C n)n, where C n…
-
0
votes2
answers4700
viewsHow to find out if a number is odd or even?
How to find odd and odd pairs from this list? Sub kati() For li = 1 To 10 For col = 1 To 10
-
0
votes2
answers189
viewsHow to calculate the distance in fewer lines?
I have this exercise on C to calculate the distance between two points using structs, but he repeats the point code a lot, to x and y, how to do it in fewer lines or use array? #include…
-
0
votes1
answer674
viewsHow to add duplicate values of an object arrayList and keep only 1 of each duplicated object?
Hello I have the following problem and I’m having a lot of difficulty in solving it. I have a code that applies a mathematical formula. This formula ends up being applied several times. each time it…
-
0
votes1
answer131
viewsHow to find the sum of two numbers in an array that matches the input value
How to do this without the need to make two bonds. Sample method: function getPairNumbers($array, $valor) { //aqui viria o método }
-
0
votes1
answer83
viewsWhy is it when I do two operations with integer numbers and save the result in a double it gives me a 0.0 return?
Example: double teste = 673/5455 * 100; System.out.println(teste); It prints 0.0 and this is not the result of the account... why it happens?
-
0
votes3
answers101
viewsWhat condition can I develop to avoid duplicating values?
How to avoid duplicate numbers in this random generator? var soma = 0 while (soma < 1000) { soma += parseInt(Math.random() * 100) document.write(soma + "<br>") } As it goes running, it…
-
0
votes1
answer67
viewsPercentage of 0 to 5
I have an IMDB (Internet Movie Data Base) number, in case the number is 7.7 out of 10. I need to put this number on a scale from 0 to 5 (integers only). On the basis of this reply:…
-
0
votes1
answer120
viewsPercentage of Interest on Price
All right? I’m having trouble finding the interest rate of a plot (read funding), knowing some final values. Given the following formula: pmt = (PV.i) / (1 / (1 - (1+i)^n) ) This is standard Price…
-
0
votes0
answers44
viewsHow to obtain exact results from simple arithmetic calculations?
I tested simple arithmetic calculations in multiplex languages. I tested some calculations in python console: >>> 0.1+0.1 0.2 >>> 0.1+0.2 0.30000000000000004 >>> 10*0.67…
-
0
votes1
answer96
viewsHow to generate a filter to remove outliers from a time series in Matlab?
would like to create a low-pass filter to remove outliers from a time series. Are sea surface temperature data (tsm), in this series there are some data that are outliers and do not know very well…
-
0
votes2
answers4702
viewsHow to convert date difference from seconds to hours/days?
I made a little program in python that he takes the current time, the time, convert in seconds and subtract from each other to know the difference between him. My doubt is, how do I convert these…
-
0
votes1
answer437
viewsHow to create this expression in C#
At first, the program I made the calculation using the following expression: valorComDescontos = valorTotal - (valorTotal * percentual); Where the valorTotal is a value assigned by the user (a…
-
0
votes1
answer63
viewsWhy can’t I change a variable in C by performing an arithmetic operation with it?
I’m not getting the expected result: libraries ... int main (void){ float c,r; setlocale(LC_ALL,""); printf("Digite o salário\n"); scanf("%f",&c); printf("Digite o reajuste percentual:\n");…
-
0
votes0
answers142
viewsMysql - Value limit for mathematical operations
I am in doubt about the following situation: I have two values not stored in table. Valor 1: 9223372036854775806 (Onde este é o valor máximo de um tipo de dado BIGINT) Valor 2:…
-
0
votes1
answer4468
viewsMean numbers of a matrix in C
I need to create a program that will build me a matrix and give me back the media of your numbers. I already have the matrix built but I can’t average the values. The code I already have:…
-
0
votes2
answers97
viewsHow to get neighboring values at the given offset of an array?
I’m having trouble extracting a portion of any sequentially indexed array, such as a single crease(). The problem is that I need to specify a starting offset and a limit greater than or equal to 1.…
-
0
votes3
answers633
viewsC: Delta, X1 and x2 result always giving 0.000000
I’m learning C in college, and I’m stuck with this algorithm. I can’t find the error. It can differentiate whether delta is greater or less than zero, but always prints delta, X1 and x2 as 0.000000…
-
0
votes2
answers118
viewsIncorrect value in subtraction of binary numbers using strings
I made this code and it basically gets two numbers in binaries (no separation of spaces between bits), and Performa (at least in the values I tested) the subtraction correctly. I tried to prevent…
-
0
votes1
answer2140
viewsHow to define the tangent function in python?
I would like someone to help me define the tangent function using python with constraints at points where the function does not exist (pi/2 + k*pi(k integer). Thanks in advance.
-
0
votes1
answer104
viewsHow to print fraction in floating point format?
How can I print a fraction in the floating format in C++? I searched what this format would look like, but found nothing. E.g : 5 __ 3
-
0
votes1
answer997
viewsMethod for harmonic media calculation!
Ola I need help to perform a harmonic media calculation of an "infinite" series, so to speak. Ex. I have a data capture system that is always injecting information into a BD. However there are many…
-
0
votes1
answer418
viewsI want the index of a cell, given the column and row numbers
I was having some problems with array2D in c# so I decided to try using a normal array Suppose I have column 4 (red) and row 3 (blue), which is the formula for me to get the number that corresponds…
mathematicsasked 6 years, 5 months ago Cauã 59 -
0
votes1
answer40
viewsdoubts with percentages logic
Hi, I have a question about a percentage problem... Ana earns R $ 5.000,00 and Julio earns R $ 9.0000,00. They have in common a debt of R $ 6.000,00 and want to pay this amount in proportion to the…
-
0
votes1
answer842
viewsCombinatorial Analysis - Generate n! arrangements
I need an algorithm that manages all possible arrangements for n elements in n positions, that is to say, n! is the amount of possible arrangements, as in the example below: n = 3 3! = 6 arranjos…