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
-
0
votes3
answers75
viewsHow to calculate a FOR for 6 in 6 increments it give an echo?
I have a simple FOR that I need that every 6 increments it sends an echo with a message, follows code: $carros = array("Volvo", "BMW", "Toyota", "Alfa Romeu", "WV", "Teste", "test2", "Teste4",…
-
0
votes1
answer2728
viewsDetermine recursive Python derivative calculus
I need to create an algorithm so that it determines in N times the derivative of a X function. However I still have some problems to implement recursive functions, I still can’t get a good idea of…
-
0
votes1
answer424
viewserror in Math.sqrt
I’m using the module Math in python, and I came up with a problem, when using Math.sqrt for the 75 root, it returns me 7.5, even using float(), and the root is around 8.66 How can I fix this problem…
-
0
votes1
answer469
viewsHow complex is the algorithm?
I’m learning how to calculate the complexity of algorithms using Big-O notation, but I’m having difficulties with the algorithm below: a=0 for(int i = n; i>0; i -=2){ for(int j = i+1;…
-
0
votes1
answer737
viewsPlot function in PYTHON or MATLAB
People need to plot a function and I can not find cool tools for it, because the function has by definition constant, and I thought to use a programming language for this, but I do not know python ,…
-
0
votes1
answer180
viewsFast calculation of square root and its multiplicative inverse in float
Knowing the algorithm "0x5F3759DF" (or "fast inverse square root"), we easily imagine a gross number of variants of it to calculate square root and inverse multiplicative of it in single-Precision…
-
0
votes1
answer296
viewsHow do I use the "Math.Max" method in C# without creating a lot of variables?
I’m trying to solve an exercise that’s like this: Make an algorithm that reads the height and enrollment of ten students. Show the enrollment of the highest student and the lowest student And my…
-
0
votes1
answer390
viewsProblem with calculating the mean in C language
I’m doing this exercise: 4 - Write an algorithm that reads a set of 50 chips, each one containing the height and sex of a person (1 = male and 2 = female), and calculates and prints: The biggest and…
-
0
votes0
answers29
viewsChanging Solver for global optimization in MATLAB
I have a solver called Solvopt and it is good to solve my problem of Soft and unrestricted minimizing, but usually it stops at minimal locations. On the university computer I have all the toolboxes…
-
0
votes1
answer1982
viewsdefine a polynomial of any degree in Python
I work with numerical calculus, my goal is to make use of a "least Squares". I’m defining a function in Python as follows: def F(P,x): return P[0] + P[1]*x + P[2]*x**2 + P[3]*x**3 Then I will define…
-
0
votes0
answers218
viewsCalculation for quantity of JAVASCRIPT photovoltaic panels (JQUERY)
I did a calculation test based on the formula of this video: https://www.youtube.com/watch?v=NdFHC3gv63U I used the following algorithm: function simular() { var radiacao = 5.6; var tarifa = 0.71;…
-
0
votes2
answers113
viewsProblem with C++ code
I was writing a code and I stagnated on some problem along the way. Follow below for more details: Enunciation Afonso is in line to buy tickets to his concert favorite band. Afonso is at the end of…
-
0
votes1
answer180
viewsHow to calculate the MFCC?
Hello, these days I woke up wanting to learn about voice recognition, with a brief research I found on the MFCC, so I decided to study and found this material through a google search: -…
-
0
votes1
answer181
viewsDistance between a line and a point in three-dimensional space
Let’s say there are three points in a 3D space (dots A, B and P). Let’s also say that there is a straight line through A and B. What I’m trying to do, actually, is find out if a reta AB intercept…
-
0
votes3
answers2069
viewsCalculate the arithmetic mean of the integers between 15 (inclusive) and 100 (inclusive)
I need to calculate the arithmetic average of the integers between 15 (inclusive) and 100 (inclusive). I made this code: x=0 for i in range(15,101): x=x+i print('%d / %d = %5.1f' % (x,i,x/i)) If the…
-
0
votes1
answer53
viewsPotentiation with array
I thought of the following code to calculate the square of each value in array: double []vetor = {1,2,3,4,5,6,7,8,10}; double result = 0; foreach(double posicao in vetor){ result = Math.Pow(posicao,…
-
0
votes2
answers46
viewsUnrecognised error
I have to do a function where I present the result of the mean and standard deviation: def challenge2(*args): """return average and standard deviation""" t=0 for i in lista: t=i**2…
-
0
votes1
answer65
viewsTake values from a vector and use in a function
I have a vector XC[i] where Gero with the code below: for(i = 0;i<N_Volumes;i++){ double XC[i]; XC[i] = (xC0+=delta_x)-1.0; printf ("XC[%d]= %f\n", i, XC[i])}; I want to take these values from…
-
0
votes0
answers33
viewsHow best to calculate the "intermediate" intervals between two dates
I’m developing a system in Laravel with Fullcalendar v4. When creating an "event", this event has execution date (dtstart) and expiration date (until), however there will be intermediate events,…
-
0
votes1
answer925
viewsSeries of Taylor for cos(x) - in C
I’ve been trying to calculate this sum, but I’m having trouble making the factorial work... someone can help me identify my mistake? . Where x is the angle in radians and N the number of terms of…
-
0
votes1
answer41
viewsTake only values after the comma in a double
What is the best way in Dart to pick up the value after the comma/point in a double? Ex: double x = 21.16; How do I get only 16? How do I get only 21? I’m using the x.truncate();.…
-
0
votes0
answers64
viewsCHALLENGE: MQO curve adjustment or similar with minimization of other types of error measurements
Context The MQO (ordinary least squares) method is known to receive: a function model f parameter x (which can represent several parameters) from a model with coefficients c[1], c[2], ..., c[o],…
algorithm performance mathematics numerical-analysis square-minimaasked 5 years, 4 months ago RHER WOLF 1,529 -
0
votes1
answer315
viewsHow do I do a simple math calculation on Tkinter?
I’m trying to make a simple mathematical calculation in Python but when I try to use my code it doesn’t work My code : import tkinter as tk from math import * win = tk.Tk() win.title("Calculadora de…
-
0
votes1
answer86
viewsMathematical and logical operators in Visualg
Why the codes highlighted in asterisk do not work the way I chose? I realized that using the smaller number first and the bigger number second, it works normally, but I’ve been itching to know why…
-
0
votes2
answers43
viewsDivision does not display numbers after the comma
My algorithm in all tests println(), is working and in logic also however, the numbers after the comma it does not demonstrate. public class Exe27 { public static void main(String[] args) { // TODO…
-
0
votes0
answers61
viewsHow to detect and calculate the angle of an object inside a python image?
I’m trying to write a code that detects lines and calculates an angle within a binary image (not necessarily this one, but always a similar spray). I read a few things about Hough Transform and even…
-
0
votes1
answer366
viewsCompound interest in Python using "while"
Recently I was trying to solve an exercise to learn Python, but I found big problems when I tried to calculate compound interest. I used the mathematical formula of the amount and simply I have no…
-
0
votes1
answer71
viewsHow to implement the sine function using Taylor series in Python?
I’m having a little trouble with my code. I need to create a code that calculates the sine of an angle using the Taylor series, in the range of [-pi, +pi]. Thus, the sine function repeats. That is,…
-
-1
votes2
answers3910
viewsGet first digits of a number in Java
How do I take part of an integer number in Java? For example, I have a variable int a = 12345678, and the user wants to receive only 4 digits.
-
-1
votes1
answer102
viewsCalculate miscellaneous percentages
I have a sales system, where each user has an X percentage on their sale, at the moment I have 15 users, 10 of them with 5% profit on each sale, and the other 5 have 8% profit on each sale. So I…
mathematicsasked 8 years, 7 months ago Cassiano José 1,385 -
-1
votes1
answer694
viewsError using Pow(a,b)
#include <stdio.h> #include<math.h> int main() { double pi = 3.14159; double R, A; scanf("%lf", &R); A = (pi)* pow(double R, int 2); printf("%lf\n", A); return 0; } This code is…
-
-1
votes1
answer1275
viewsCalculate annual salary
• Model an employee. He must have the employee’s name (String), the department where he works (String), your salary (double), the date of entry into the bank (String) and your ID (String). • Create…
-
-1
votes1
answer122
viewsProblem with passing parameters/return of function matrices in C
I’m having a problem with a job I have to do in C consisting of, get the inverse matrix through the adjunct matrix. So far this is what I’ve been able to produce in C# and then tried to rewrite in…
-
-1
votes1
answer551
viewsQuaternions in Unity3d
Well... I wish I knew more about Quaternions in Unity... I didn’t understand very well what they do... and why they use the Quaternions and not the Angles of Euler... I didn’t find good material…
-
-1
votes2
answers1378
viewsHow to calculate potentiation only using the sum operation?
I would have made a code that does multiplication from the sum, but I would like to know how I can make power by the sum, without using times(*). x = (input('Digite um número: ')) y = (input('Digite…
-
-1
votes1
answer328
viewsHow to increase the number of floats in python
I made a program that encrypts a message, but it doesn’t work when the message is great because the result gets big. I would like to know how to make python show me the result, no matter the message…
-
-1
votes1
answer52
viewsFormat string to print square root, exponent
Hey, there, you guys! would like to know how to print on the screen, a formatted string that shows the symbols of square, exponent and other mathematical symbols? It would go something like this: x…
-
-1
votes1
answer280
viewsSyntax error in mathematical equation (pyflakes E)
The code below, written in python, has syntax error in the equation Ff. I searched for problems related to closing the parentheses, rewrote the equation and still get the error message. While…
-
-1
votes1
answer273
viewsHow to calculate a value in a given range?
I have to make the following calculation: I have an input number (say 1.3), which is in my range A, which goes from 0 to 3, and I need a corresponding value in range b (which is inversely…
-
-1
votes3
answers144
viewsCalculate the value of a multiplication using only summation and subtraction operators
I tried to write a program in which I must calculate the result of a multiplication through sum and subtraction operators only. I can’t write anything that works, follow the code as close as I got:…
-
-1
votes4
answers276
viewsPrime numbers with Python
Trying a thousand ways to get this result. Always returns the same thing. number = int(input('Numero: ')) if number >= 1: for i in range(1, number): if number % i != 0: print(number, 'é primo')…
-
-1
votes3
answers123
viewsProblem when denying receipt of a certain value
I need to create a code that receives 2 notes and me average them and I have to necessarily make my program only receive values from 0.0 to 10.0 what is not happening: n1 = float(input('Dígite sua…
-
-1
votes1
answer45
viewsCalculate the chargeback in percentage of the final value C#
Good evening, the question is more about calculation than programming. The problem is this: if I sell something I must add 15% service charge. var total = 100; var acrescimoPercent = 15.00; var…
-
-1
votes1
answer28
viewsGeneric mapping multiple numerical ranges
I’m writing a code, for making decisions on an 8bit microcontroller, an AVR. I get 8 range of double values, limited by Vf_max and Vf_min, I don’t know which will be the biggest in each track. As in…
-
-1
votes1
answer48
viewsPercentage of one value over another
I would like to show how many percent represented a sale on the total amount. For example: Valor total 100. Produto 1 representou :10% do valor total produto 2: 80% Produto 3: 10% Only I’m doing the…
-
-1
votes1
answer41
viewsHow to turn Document.write into column
I’m trying to make an HTML calculator in Javascript. I already made the calculator, but I’m having trouble passing the results to HTML text. I tried to put in Document.text, but it gets all stuck.…
-
-1
votes1
answer36
viewsHow to get the x and y coordinates in a circle from an angle
I’m trying to create an analog clock and my idea was the following one would get the angle corresponding to the hour and then discover the position x e y of that angle in a circle and draw a line…
-
-2
votes2
answers844
viewsHow to transform a mathematical expression into a C language
How can I turn it into C language?
-
-2
votes1
answer41528
viewsCalculation of percentage in C
" Encode, Compile and run a C program that receives the the basic salary of an employee, calculate and show the salary to be received, knowing that this employee has a 5% bonus on the basic salary,…
-
-2
votes3
answers797
viewsCount numbers 1 in binary number after decimal base conversion
In this program I need to count the number 1 present in the binary number after decimal base conversion. Follow the code: #include<stdio.h> #include<stdlib.h> #include<string.h>…