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.

786 questions
150
votes
8 answers

How to transform black into any given color using only CSS filters

My question is: given a target RGB color, what is the formula to recolor black (#000) into that color using only CSS filters? For an answer to be accepted, it would need to provide a function (in any language) that would accept the target color as…
glebm
  • 17,803
  • 7
  • 45
  • 66
45
votes
5 answers

Comparing two values in the form (a + sqrt(b)) as fast as possible?

As part of a program that I'm writing, I need to compare two values in the form a + sqrt(b) where a and b are unsigned integers. As this is part of a tight loop, I'd like this comparison to run as fast as possible. (If it matters, I'm running the…
Bernard
  • 4,001
  • 1
  • 23
  • 48
41
votes
1 answer

What is the difference between SymPy and Sage?

What is the difference between SymPy and Sage a.k.a. SageMath?
Faouzi FJTech
  • 791
  • 2
  • 11
  • 26
38
votes
5 answers

Quaternions vs. Euler Angles

Hi What is the pros and cons of "Quaternions" and "Euler Angles" Method - Which one is faster? - Which one need less Computational Effort? - which one is more accurate, (in round off error)?
mrbm
  • 1,022
  • 1
  • 11
  • 36
31
votes
3 answers

What is a "multisorted algebra", and how do I use it to solve "real problems"?

Apparently, Alexander Stepanov has stated the following in an interview: “I find OOP [object-oriented programming] technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real…
29
votes
2 answers

What's the opposite of JavaScript's Math.pow?

I'm having a mental block here, and algebra not really being my thing, can you tell me how to re-write the JavaScript code below to derive the variable, c, in terms of a and b?: a = Math.pow(b, c); c = ? Thanks!
Premasagar
  • 14,223
  • 11
  • 27
  • 34
27
votes
11 answers

Abstract algebra and Programming

I am going to start learning Abstract Algebra- Groups, Rings,etc. I am interested to know any programming language, if at all which can help me learn/try the concepts I learn in theory. EDIT: I am not really looking at implementing what I learn. I…
user59634
27
votes
6 answers

Is there an expression using modulo to do backwards wrap-around ("reverse overflow")?

For any whole number input W restricted by the range R = [x,y], the "overflow," for lack of a better term, of W over R is W % (y-x+1) + x. This causes it wrap back around if W exceeds y. As an example of this principle, suppose we iterate over a…
ayane_m
  • 842
  • 1
  • 9
  • 24
26
votes
4 answers

Draw equidistant points on a spiral

I need an algorithm to calculate the distribution of points on a spiral path. The input parameters of this algorithm should be: Width of the loop (distance from the innermost loop) Fixed distance between the points The number of points to draw The…
Giulio Pierucci
  • 271
  • 1
  • 3
  • 5
25
votes
2 answers

How does a system like Wolfram Alpha or Mathematica solve equations?

I'm building a web-based programming language partially inspired by Prolog and Haskell (don't laugh). It already has quite a bit of functionality, you can check out the prototype at http://www.lastcalc.com/. You can see the source here and read…
sanity
  • 33,862
  • 40
  • 131
  • 218
24
votes
3 answers

Java/Scala library for algebra, mathematics

Can you advise me some flexible and powerful, yet fast library which could cover SciPy (both in performance and functionality). I found SciPy very expressive - but I want to try something in Scala. I read a little about Scala - but is not as…
Robert Zaremba
  • 6,780
  • 6
  • 40
  • 71
22
votes
11 answers

Is there any Mathematical Model or Theory behind Programming Languages?

RDBMS are based on Relational Algebra as well as Codd's Model. Do we have something similar to that for Programming languages or OOP?
Padmarag
  • 6,741
  • 1
  • 23
  • 29
20
votes
5 answers

Algebra equation parser for java

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 = "x + y + z"; Map vars = new HashMap(); vars.add("x", 2); vars.add("y",…
Alfredo Osorio
  • 10,547
  • 10
  • 49
  • 79
20
votes
16 answers

Mathematically Find Max Value without Conditional Comparison

----------Updated ------------ codymanix and moonshadow have been a big help thus far. I was able to solve my problem using the equations and instead of using right shift I divided by 29. Because with 32bits signed 2^31 = overflows to 29. Which…
Almost Famous
  • 539
  • 1
  • 6
  • 19
19
votes
4 answers

Calculating 1^X + 2^X + ... + N^X mod 1000000007

Is there any algorithm to calculate (1^x + 2^x + 3^x + ... + n^x) mod 1000000007? Note: a^b is the b-th power of a. The constraints are 1 <= n <= 10^16, 1 <= x <= 1000. So the value of N is very large. I can only solve for O(m log m) if m =…
square1001
  • 1,196
  • 7
  • 20
1
2 3
52 53