Questions tagged [algebra]

Algebra is the branch of mathematics concerning the study of the rules of operations and relations, and the constructions and concepts arising from them. Questions about algebra that are not related to programming are off-topic at Stack Overflow.

Together with geometry, analysis, topology, combinatorics, and number theory, algebra is one of the main branches of pure mathematics.

Elementary algebra, often part of the curriculum in secondary education, introduces the concept of variables representing numbers. Statements based on these variables are manipulated using the rules of operations that apply to numbers, such as addition. This can be done for a variety of reasons, including equation solving. Algebra is much broader than elementary algebra and studies what happens when different rules of operations are used and when operations are devised for things other than numbers. Addition and multiplication can be generalized and their precise definitions lead to structures such as groups, rings and fields, studied in the area of mathematics called abstract algebra.

873 questions
7
votes
2 answers

How to calculate a rotation matrix in n dimensions given the point to rotate, an angle of rotation and an axis of rotation (n-2 subspace)

I would like to calculate an (nxn) rotation matrix in the n-dimensional space given the following: The point to rotate. An angle of rotation. An axis of rotation (an (n-2) subspace that passes through the origin given by (n-2) unit vectors that…
David
  • 481
  • 3
  • 13
7
votes
5 answers

Can I calculate an element without looping through all preceding elements in my case (see the question body)?

I have 2 arrays of Doubles of the same length. Array a is filled with some data, array b is to be calculated. Each element of the array b equals a corresponding value from array a plus a weighted sum of all preceding elements in the array b. A…
Ivan
  • 63,011
  • 101
  • 250
  • 382
7
votes
0 answers

Do Scala types really form a lattice?

There seems to be a somewhat widespread conception that Scala types form a lattice. I can get three quarters of the way there, and define a semilattice by defining top = Any, bottom = Nothing, and meet = with. Then ≤ is at least mostly equivalent…
aij
  • 5,903
  • 3
  • 37
  • 41
7
votes
1 answer

Distance from a point to a polyhedron or to a polygon

I have a surface which is a polyhedron and I want to find the minimal distance between it and a given point P. Since the polyhedron is defined by many polygons in a 3d space, one way that occurs to me is to compare the distance to each polygon and…
Sambatyon
  • 3,316
  • 10
  • 48
  • 65
7
votes
1 answer

Displaying (nicely) an algebraic expression in PyQt

In my python program is a hierarchy of mathematical objects I've created, that represent mathematical formulae. For example, there's Collection, which is a series of Equations, which is a container of two Sums, Products, Quotients, Exponants or…
Anti Earth
  • 4,671
  • 13
  • 52
  • 83
6
votes
2 answers

Indexed Initial algebras for GADTs

In his paper Generics for the Masses Hinze reviews encoding of data type. Starting from Nat data Nat :: ⋆ where Zero :: Nat Succ :: Nat → Nat It can be viewed as an initial algebra NatF Nat -> Nat for NatF a = 1 + a Its Church representation…
nicolas
  • 9,549
  • 3
  • 39
  • 83
6
votes
3 answers

Can program be used to simplify algebraic expressions?

We know 1+2+...+n is equal to n(n+1)/2. But can we get the same result programatically if we don't know it in advance? About why I have such a question. Think of a more complex situation: X1+X2+...+Xk=n, where Xi is integer and >= 0. What's the…
Je Rog
  • 5,675
  • 8
  • 39
  • 47
6
votes
4 answers

Finding the single unknown in an equation

I need a library to be able to parse an equation an give me the result giving the inputs. For example something like this: String equation = "5 = 6 / z"; EquationSolver solver = new EquationSolver(equation); double result = solver.getResult();…
6
votes
3 answers

determining numerator and denominator in a relatively complex mathematical expression using python

I'm trying to convert calculator input to LaTeX. if a user inputs this: (3x^(x+(5/x)+(x/33))+y)/(32 + 5) I have to convert it to this: frac{3x^(x+frac{5}{x}+frac{x}{33})+y}{32 + 5x} however I am having issues with determining when a numerator…
tipu
  • 9,464
  • 15
  • 65
  • 98
6
votes
3 answers

Library for finding any solution of any number of linear equations with any number of variables

I have to finding any solution (there may exist many or none) of any number of given liner equations with any number of variables. In Java. What libraries and method use? What to implement? I want to make it with at least work as possible.
adf88
  • 4,277
  • 1
  • 23
  • 21
6
votes
4 answers

Algorithm(s) for rearranging simple symbolic algebraic expressions

I would like to know if there is a straightforward algorithm for rearranging simple symbolic algebraic expressions. Ideally I would like to be able to rewrite any such expression with one variable alone on the left hand side. For example, given the…
Gabe Johnson
  • 1,393
  • 4
  • 16
  • 28
6
votes
2 answers

What is the fastest way to calculate determinant?

I'm writing a library where I want to have some basic NxN matrix functionality that doesn't have any dependencies and it is a bit of a learning project. I'm comparing my performance to Eigen. I've been able to be pretty equal and even beat its…
Chase R Lewis
  • 2,119
  • 1
  • 22
  • 47
6
votes
2 answers

C# rounding with division

This program calculates the amount of instances an event occurs within time. The issue is that when I'm getting decimal numbers the program does not round how I want it to, for example: if i divide 7/5 i get 1, is it possible to get 2? the 'double'…
Adan
  • 453
  • 1
  • 10
  • 27
6
votes
6 answers

Fermat's little theorem in JS

I just tried to implement Fermat's little theorem in JavaScript. I tried it both ways, a^(p-1) mod p = 1 and a^p mod p = a mod p. function fermat(a, p) { return (((a ^ (p - 1)) % p) === 1); } and function fermat(a, p) { return ( ( a^p ) % p )…
fb55
  • 1,197
  • 1
  • 11
  • 16
6
votes
3 answers

Is it possible to solve an algebraic equation in R?

I want to find the solution of: -x^3+6*x^2+51*x+44=0 but with R. Is it possible? I found the package Ryacas, but nobody seems to be able to make it work. May sound trivial, but I'm not able to find an easy way to do this... Do you have an…
M. Beausoleil
  • 3,141
  • 6
  • 29
  • 61