Click here to Skip to main content
15,891,682 members
Everything / Mathematics

Mathematics

mathematics

Great Reads

by William Hey
Classical number theories
by jurhas
A small simulator for a 6 axis articulated robot
by Ryan Scott White
A C# struct/class library for large Floating-Point numbers
by Gunnar S
Implementation of the Poisson Cumulative Distribution function for large Lambdas

Latest Articles

by Ryan Scott White
A C# struct/class library for large Floating-Point numbers
by Kenneth Haugland
Radiation from rectangular, circle and elliptic - shaped openings
by JorgeLuisOrejel
This article describes the implementation of Dijkstra's Smoothsort as a generic sorting algorithm in C#.
by Xavier Junqué i de Fortuny
Reduces/evaluates a real/complex math expression

All Articles

Sort by Updated

Mathematics 

12 Mar 2024 by OriginalGriff
If I try your values I get what I expect:SELECT (487-556)/556 Gives me 0 as it is integer arithmetic.SELECT (487.0-556.0)/556.0 Gives me -0.1241 because it's floating point arithmetic. Check your data sources and make sure the types are what you...
12 Mar 2024 by TLeisusmc
I am building a report and I put in the standard equation of (487-556)/556. The answer should be -.12. However, the result shows -334. How? I cannot think of any sequence that would equal -334. When I change it to (487-556/556) or 487-556/556 it...
27 Feb 2024 by Ryan Scott White
A C# struct/class library for large Floating-Point numbers
14 Jan 2024 by Kenneth Haugland
Radiation from rectangular, circle and elliptic - shaped openings
11 Dec 2023 by JorgeLuisOrejel
This article describes the implementation of Dijkstra's Smoothsort as a generic sorting algorithm in C#.
12 Oct 2023 by tour belitung
To check if a point is inside a triangle, there are several approaches you can use. One commonly used method is the "Barycentric Coordinate System" approach. Barycentric coordinates represent a point as a weighted sum of the vertices of the...
4 Oct 2023 by Unknown Boy 2023
(Geometry: points in triangle?) Suppose a right triangle is placed in a plane as shown below. The right-angle point is placed at (0, 0), and the other two points are placed at (200, 0) and (0, 100). Write a program that prompts the user to enter...
4 Oct 2023 by OriginalGriff
Do you have any idea how much work explaining code line by line is? Every single line needs a paragraph of explanation! For example: int next = r.Next(); Create a new variable called "next" which can hold a integer value. From...
14 Sep 2023 by Vishant Sandilya
Samodelkin, Professor decided make by hand volumetric model bricks from matches, and use the matches for edges. Length of edges of every brick equally for one match. For model’s construction of three bricks, he uses 28 matches. What least...
15 Aug 2023 by merano99
As jeron1 has already commented, according to the sketch, blocks of 12 matchsticks are obviously assembled at the edges. While you need all 12 matchsticks for the first block, you need only 8 for each further block. The result should not exceed...
15 Aug 2023 by Xavier Junqué i de Fortuny
Reduces/evaluates a real/complex math expression
15 Aug 2023 by OriginalGriff
What it is saying is that a brick is a cube, and has sides one match long. So a single brick requires 12 matches. If you put two bricks together, they can share matches: one needs 12, the other needs 4 less. For three or more bricks, each end...
15 Aug 2023 by Richard MacCutchan
Go back to the question and look at the picture. From that you can see that a brick at the end of a block requires 12 matches, and one inside the block requires 4. So from that you can easily calculate the number of matches required for any...
17 Jul 2023 by rtybase
Discussion of linear regression
8 Jul 2023 by Raul Otaño Hurtado
This article shows a simple way of interpolating a set of points using Bezier curves in WPF.
2 Jul 2023 by K. Khurshudyan
I need to solve this task but I cannot please help me. THE VARIABLE foundedThatUnknownInteger must be calculated and after that printed in here it must show mustFoundThisUnknownInteger but not simple printing but after calculating that...
2 Jul 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
1 Jul 2023 by Ryan Scott White
A fast, possibly the fastest, square root function for Big Integers and Floats in C# and Java.
13 Jun 2023 by Jack Devey
This post delves into the perplexing Monty Hall paradox, examining the probabilities associated with sticking or switching doors in the game scenario.
23 May 2023 by Avtem
So, the goal of the program is: 1) get an equation from the user with one unknown as a std::string (e.g. "62 = x * 1000") 2) solve the equation and print the value of the unknown (denoted as "x") What I have tried: i found TinyExpr, which is...
23 May 2023 by OriginalGriff
Quote: ... to implement such a functionality probably will require hundreds lines of code - parsing numbers, signs, operator precedence and of course testing and error handling. Yes, it would. Unfortunately, that's because it's a complex project...
11 May 2023 by Henry A Gabb, Nawal Copty
Accelerate Linear Algebra Computations with Standard, Open Approaches
31 Mar 2023 by sahil ajmeri 2022
i have the parameters of diamonds are Diameter, girdle, crown angle, crown height, bottom angle(pavilion angle), table diameter. i want to draw a diamond using this parameters. I am drawing diamond using points. where i have defined start point....
20 Mar 2023 by dj4400
Hi all, I have a 3d table that represents distance for a given height angle and temperature for example the table looks like this For angles from 0 through 45 to 90 and height from 0 through 200 to 600 and temperature from -5 through 10 to 25...
20 Mar 2023 by dj4400
Thanks all I have eventually understood how to create the 8 values input vector from my table and add the requested values for the interpolation. By using 1d interpolation as a base to 2d interpolation implementation and 2d interpolation as a...
16 Mar 2023 by Rick York
A function that does interpolation in three dimensions can have arguments something like this : double Interpolate3D( double xcoord1 , double ycoord1 , double zcoord1 , double value1 ...
16 Mar 2023 by Dave Kreskowiak
Think about what an interpolation operation is. You need to calculate a target value using known values you have. If you don't have known values for the value you're looking up, you need to get the key values around your lookup value, calculate...
16 Mar 2023 by Richard MacCutchan
The value of the angle will tell you which column to select for the other values. Select the correct row in the height and temparature table. Then select the cell from the column that corresponds to the angle.
12 Dec 2022 by All Yasser
Transfer a new matrix of elements in the given matrix as 3 elements. What I have tried: Transfer a new matrix of elements in the given matrix as 3 elements.
1 Dec 2022 by dejf111
Hi, I have a problem, in my project I have a List() and in it the Polylines have a Length property. I would like to round all Polyline in List to 5 places. What I have tried: listPolyline = listPolyline.Select(x => Math.Round(x =>...
1 Dec 2022 by Richard Deeming
To modify the items in a list, there's no need to create a new list. Just iterate over the items in the list and modify them. foreach (Polyline x in listPolyline) { x.Value = Math.Round(x.Value, 5); } The only complication comes if you're...
1 Dec 2022 by OriginalGriff
That's ... complicated. Rounding to "5 places" isn't really something you can do with float or double values, because they aren't stored as decimal values, there there isn't a "one-to-one" mapping from the binary representation of a floating...
19 Nov 2022 by sorauts
I'm looking to convert screen coordinates (from event.clientX, event.clientY) on jQuery mousemove, to world coordinates in my isometric WebGL project. I'm, also using gl-matrix. I initialise my viewport with; gl.viewport(0, 0, width, height)...
17 Nov 2022 by Jalem Raj Rohit
I have used:int(math.sqrt(last) - math.sqrt(first))for getting the answer, whereas it is not working for some test-cases. So, can anyone suggest me a fast algorithm for the above question.
9 Sep 2022 by MZain Asif
hi at first i wanted to calculate total with quantity which i manage to do then i wanted to create 1 quantity 500 and rest add 125 as quantity increase which was little complicated but somehow did it i know code written are not organize as...
9 Sep 2022 by Richard MacCutchan
Start with the value set to zero. Start a loop from 1 to 5 If the loop counter equals 1 add 500 to the value If the loop counter is less than 5 add 125 to the value If the loop counter equals 5, reset it to 1 and restart the loop. That should...
24 Jul 2022 by Luc Pattyn
I probably would go for a table based approach. Simply storing the values of the function you want over the domain of interest. This typically yields the fastest execution without any timing issues, at the expense of some storage space.
24 Jul 2022 by honey the codewitch
For reasons, I cannot simply generate a Triangle Wave of the frequency I need, but I have a sine wave and a square wave at that frequency. I cannot keep additional state. I need an algorithm to compute a triangle wave from a sine wave or a...
24 Jul 2022 by Greg Utas
From Wikipedia: It is possible to approximate a triangle wave with additive synthesis by summing odd harmonics of the fundamental while multiplying every other odd harmonic by −1 (or, equivalently, changing its phase by π) and multiplying the...
24 Jul 2022 by OriginalGriff
If you have a square wave of which you know the amplitude and period, can't you just create the triangle wave from that using simple geometry? Triangle wave - HandWiki[^] If the rise start point of the TW is synced with the rise of the SW, then...
21 Jul 2022 by Lara Thomas
Problem : Now you have to solve an interesting problem. Any integer n (where 1
21 Jul 2022 by merano99
Exactly the same question was asked here as well. math - How will I find out factorial from prime number? (c programming) - Stack Overflow[^]
20 Jul 2022 by CPallini
Quote: My question is how will I find out the factorial from this array (prime number) Suppose, I copy the prime numbers into an array then ? This is not the right question. Actually computing the factorial is not requested (on the contrary, the...
20 Jul 2022 by Patrice T
Quote: I can't understand how will I find out factorial from prime number? May be it is because you don't. The goal is not to find the factorial, but the product of primes that make the factorial. Quote: Please give me some clue . The goal is...
20 Jul 2022 by Greg Utas
This question is very poorly worded, but I think I get what it's looking for. It wants to factor a factorial into a product of prime numbers, where each prime number also has an exponent. n! = 1 x 2 x 3 x 4 x 5 x 6 ... x (n - 1) x n. If you...
26 May 2022 by Member 15650945
SELECT * FROM postcodelatlng WHERE ( 3958 * 3.1415926 * sqrt( (latitude - '.$lat.') * (latitude - '.$lat.') + cos(latitude/57.29578) * cos('.$lat.'/57.29578) * (longitude-'.$lon.') * (longitude-'.$lon.') ) / 180 )
26 May 2022 by Patrice T
Quote: this query is working perfectly fine .but i dont get the formula .how is it working . For distance between 2 point on earth, the answer is 'great circle formula' Great circle - Wikipedia[^] Great-circle distance - Wikipedia[^]
22 May 2022 by mohade3 ensafi
I want to create an Arc path over 3 points in 3D space. I decided to draw a circle over them and then extract sector from p1 to p3 that passes through P2. circle equation is: fc = @(a) center + cos(a).*(q1-center) + sin(a).*(q2-center); ...
14 Apr 2022 by Maciej Los
Try this: SELECT SUM(COALESCE(BSE.MinWageEarning, BSE.TotalBeforeMinWage)) - SUM(BSE.TotalBeforeMinWage) AS Bonus FROM vBookingSessionEmployees AS BSE ... For further details, please see: COALESCE (Transact-SQL) - SQL Server | Microsoft...
13 Apr 2022 by Steve Hageman
A Python Library to help make properly scaled Fourier Transforms including utility functions
12 Apr 2022 by Will Sewell
I have some code in a SQL stored procedure which changes negative values in a column to zero -Sum(Bonus) As Bonus, Case WHEN -Sum(Bonus)
26 Mar 2022 by Antony Fritzelas
Hi! I am currently developing a custom algorithm that implements the Havel-Hakimi algorithm choosing a node randomly. Unfortunately I have run into a logical error that is hard for me to trace (since I am a beginner in programming).I would...
26 Mar 2022 by KarstenK
Read and understand the theoritical basics and use some simple examples as test input for your code to see where the problem is.
15 Mar 2022 by Member 15047625
It's pretty much subset sum problem but slightly modified. There is a set A of integers, without limits to length of both set and integers (they can be so big that only BigInteger can contain them). And there is a target integer. Algorithm...
15 Mar 2022 by RickZeeland
See the C# example here: algorithm - Finding all possible combinations of numbers to reach a given sum - Stack Overflow[^]
15 Mar 2022 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
12 Mar 2022 by Golden Basim
I have this init data: - the total price includes the tax (totalPrice) = x - the Tax Percent % (taxPercent) = p how to calculate the value of the tax. What I have tried: i can calculate the total value using the tax percent. but i don't have...
12 Mar 2022 by OriginalGriff
Total = valueWithoutTax * (1 + TaxPercentage / 100) t = x * (1 + p / 100) So if x = 50 and p = 25% then: t = 50 * (1 + 25 / 100) t = 50 * (1 + 0.25) t = 50 * 1.25 t = 62.5 Therefore: x = t / (1 + p / 100) So if the total t is 62.5 and the tax...
1 Mar 2022 by W. García
A class module developed to evaluate mathematical expressions given as VBA strings
28 Feb 2022 by Joan M
Hello all, I have to measure a pallet full of pet food bags. That pallet will travel along the X axis at a constant speed. That pallet could not be perfectly aligned (slightly rotated). I have been given 1 array of 100 sensors that is placed...
28 Feb 2022 by Patrice T
Quote: Where could I find information and examples to get the best fitting rectangle given a set of points? The answer is always the same: you find information in your brain. - Once you have the sensors data, how do you make it a 2D matrix ? -...
28 Feb 2022 by Luc Pattyn
If I understand you correctly the sensor array can't discern bags and pallet, all you get is a matrix with zeroes and ones (representing "something" and "nothing"). If all the bags are within the bounds of the pallet, and assuming the pallet is...
2 Feb 2022 by 1298201
#include #include using namespace std; class payroll { private: string name; int day; int rate; int ot; int otrate; int sss; int phil; int pgibg; public : int get_info(); ...
2 Feb 2022 by OriginalGriff
When your code won't compile, start by looking at the error message. Pasting the legible part code into an online C++ compiler and trying to compile it, gives the first errors as: main.cpp:56:9: error: no match for ‘operator
2 Feb 2022 by _Asif_
It seems * you just copy the code from some website, incorrectly paste it * press F5 (run). * Got Compiliation Error * You came on Codeproject, paste the code again and asking to solve the problem, without putting any efforts at all. My...
22 Jan 2022 by shri harshan
I got different output. and I should take input of two numbers in a single variable that's why the taken split() function eg:- b = 12 24 What I have tried: a = int(input()) for i in range(a): b = input().split() c = b[0] d = b[1]...
22 Jan 2022 by CPallini
Elaborating Richard's solution... a = input().split() n1 = int(a[0]) n2 = int(a[1]) c = n1 d = n2 while c != 0: r = c c = d % c d = r gcd = d lcm = (n1*n2)//gcd print(gcd) print(lcm)
22 Jan 2022 by Richard MacCutchan
Having split the string, you need to convert the two numbers to integers: c = int(b[0]) d = int(b[1])
7 Jan 2022 by Member 12085717
I have a discontinuous list of numbers N (e.g. { 1, 2, 3, 6, 8, 10}) and i need to progressively create random pairs of numbers in N and store them in a list in which there can't be twice the same pair. For example for a list of 3 different of...
7 Jan 2022 by Annaarddy
Genetic algorithm will work for generating random pairs
27 Dec 2021 by Venkat Bhushan
Can someone explain Sergei-Nakariakov's algorithms such as "approximating the square-root" from his book "Cracking Programming Interviews: 500 Questions With Solutions" in an easy way What I have tried: nothing much on Can someone...
27 Dec 2021 by OriginalGriff
Nope, because I don't have a copy, so I have no idea what he is doing - and I'm not about to spend money on anything to do with "interview question and answer" sets as they are all a waste of time and effort. Interviews aren'#t run from a book,...
16 Nov 2021 by Ryan McAree
I am trying to perform Gauss-Jacobi method. I have 6x + 2y − z = 7 x + 2y + 8z = 11 2x − 6y + z = −3 having solved by hand I know that the solution should be x=1 y=1 z=1 However when attempting to solve this in python I am getting some...
16 Nov 2021 by OriginalGriff
Getting your code to run does not mean it is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the...
29 Oct 2021 by Member 15358161
Can someone help, don’t know how to solve this using loop in php. What I have tried: $pay = [20, 40 , 89, 300, 190, 15]; $Capital = 1000; I want the loop to achieve this result 1000-20 = 980 980-40 = 940 940-89 = 851 851-300 = 551 ...
29 Oct 2021 by Richard MacCutchan
Try this: foreach ($pay as $val) { $Capital -= $val; echo "Capital value: $Capital\n"; }
15 Sep 2021 by strangerick
Hello! I'm making a simple game in C# and i'm trying to slice my UI images into 9 smaller rectangles, so the image doesn't get stretched when drawing to different resolutions, but my current implementation does not seems correct and i would...
14 Sep 2021 by BillWoodruff
See if this gives you some ideas: // requires: // using System.Collections.Generic; // using System.Drawing; // must be a top-level class: i.e., non-nested public static class ShapeExtensions { // rectangles returned in column-major order ...
12 Sep 2021 by Ryan Peen
I am recieving the error seen in the question title when attempting to run my code which attempts to perform some math and will later desire to plot some conditional functions. My code is as follows import math import numpy as np def...
6 Sep 2021 by Member 15349353
If n is an integer, what is the next largest integer What I have tried: I dont know how to answer the question.
6 Sep 2021 by OriginalGriff
Have you considered n + 1 as a solution? It really depends on what you are doing: if you are talking number theory, then "n + 1" is right, but in computing it's not that simple because it depends on the data type - since they use a fixed amount...
6 Sep 2021 by Ryan Peen
In my code I am required to use a piecewise function within another defined function. But I am having some trouble attempting this. The code I have supplied obviously does not work but I structured it this way so you can see what I am going for. ...
6 Sep 2021 by Richard Deeming
Sounds like you're looking for a "conditional expression": 6. Expressions — Python 3.9.7 documentation[^] def f(λ,a,u,o1,o2): o = o1 if λ
26 Aug 2021 by CPallini
Suppose you have a way to compute the nth combination of two indices of your list. E.g. list { 4, 8, 9 } combination number pair 0 (4,8) 1 (4,9) 2 (8,4) Then you have two (or...
25 Aug 2021 by Patrice T
Quote: I could try to generate all possible pairs at the start, shuffle the list and pop one element each time I need to add a random pair to my list. Shuffling the complete list is the best overall option. Any other solution is a trade off,...
25 Aug 2021 by strangerick
Hello! I'm implementing a vertical scrollbar for a small game project and i'm having some issues with calculating local positions of the scrollbar Thumb and Content when the Viewport rectangle moves. At the moment, when i move the viewport, the...
25 Aug 2021 by Richard MacCutchan
// When the parent is resized, the scrollbar should be resized // to fit the new size of the viewport (excluding borders etc). // It is then just a matter of calculating the ratio of visible // data to the size the relevant dimension of the...
24 Aug 2021 by RickZeeland
The problem is probably caused because control coordinates are recalculated internally and have different values than you expect (depending on Windows scale and Font settings). See: Control.PointToScreen(Point) Method[^] And: Automatic Scaling -...
28 Jul 2021 by aroman
A ray tracing project
21 Jul 2021 by aroman
This blog entry shares a project that computes the band structure of a crystal having the diamond/zincblende structure, for various elements.
21 Jul 2021 by aroman
In this post we introduce the Fourier Transform and hint about some of its usages.
21 Jul 2021 by aroman
In this post I explore Lattice Boltzmann methods and build a related project
21 Jul 2021 by aroman
In this article I briefly explore Density Functional Theory
21 Jul 2021 by aroman
This post also introduces VTK, The Visualization Toolkit
21 Jul 2021 by aroman
The subject of this post is Time-Evolving Block Decimation.
21 Jul 2021 by aroman
In this post I implement a Density Matrix Renormalization Group program.
21 Jul 2021 by aroman
This post is about the relaxation method combined with a multigrid method applied on the Laplace equation.
21 Jul 2021 by aroman
In this article I discuss and make a program about Hartree-Fock.
21 Jul 2021 by rtybase
Andrica's conjecture is one of those mathematical statements which are extremely easy to formulate, but complicated to prove. This is my third attempt.
21 Jul 2021 by rtybase
Andrica's conjecture is one of those mathematical statements which are extremely easy to formulate, but complicated to prove.