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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
39 views

Implementing an algebraic equation in Base R

I'm new to algebraic equations in R and am trying to implement the following equation in R (below). However, as precise as I have tried to be, I expect the answer to be 0.050865 but instead I get 11....
Simon Harmel's user avatar
  • 1,153
0 votes
0 answers
52 views

Finding an operation that satisfies a specific requirement in "lean"

I have already define four boolean operations: def bnot : bool → bool | tt := ff | ff := tt def band : bool → bool → bool | tt b := b | ff b := ff def bor : bool → bool → bool | tt b := tt | ff ...
ANQI LIU's user avatar
0 votes
2 answers
85 views

Solve Algebraic Equation in SQL

I would like to use SQL to solve an algebraic equation for market share solving for the quantity of Product 1 to achieve a target market share. Data: Target: 35% Equation: ([Product 1 Quantity] * [...
Tim R's user avatar
  • 35
0 votes
0 answers
23 views

why does summing in cvxpy will occur broadcasting error

I having a problem of value error with my code. It keeps showing cannot broadcast dimensions (5,)(5,3). I am still learning how to use cvxpy so I cannot find the way to solve it. The problem is at &...
user1155920's user avatar
0 votes
0 answers
13 views

Isomorphic free groups - SymPy

I wonder if there is a function on the SymPy module (Python) which determines whether two free groups are isomorphic. For example, given the following free groups : F, a, b = free_group("a, b&...
Arthur Filippi's user avatar
0 votes
0 answers
11 views

Functions for module invariants in Sage

I am new to programming in general but in my project, I am required to work with a finite set $S = {A_1,...,A_n}$ of $m \times n$ matrices over a finite ring $R$, and the submodule $M$ they generate. ...
JBuck's user avatar
  • 101
1 vote
2 answers
36 views

Mathematica - Rational Exponent Not Showing Radical Symbol

I'm struggling with getting Mathematica to show the radical symbol when calculating a rational exponent. An example would be something like "X^(-1/5)". Currently, the outputs just show the ...
Christopher Austin's user avatar
0 votes
0 answers
27 views

bmp280 temperature compensation calculation wrong in datasheet

I'm working on a project that uses a BMP280 sensor. The raw temperature / pressure values have to be compensated using calibration values stored in the device. This is now about the temperature ...
Gambanishu Habbeba's user avatar
1 vote
1 answer
93 views

Is it possible / practical to convert a 3d line segment to a point in 2d so that I can easily measure points from it's origin?

Consider the following scenario: I have a line segment in 3d to track an ideal approach to a given runway. Aircraft's objective is to try to fly ON this particular line into the touchdown zone, ...
Wetter42's user avatar
1 vote
0 answers
20 views

Eval function not working when solving for a string

I'm creating a math calculator that replaces variables with their respective values using string splicing. Once i have both sides of the equation with variables substituted for their values, whenever ...
Nekomane's user avatar
1 vote
3 answers
98 views

Solving an algebraic equation with sympy

I have this algebraic equation that can be solved in WolframAlpha: but it cannot be solved in Python. There is this error: NotImplementedError: multiple generators [10**x, 2**x] No algorithms are ...
George Yeo's user avatar
0 votes
1 answer
37 views

How to extract all coefficients for a particular variable

I have done some calculations in sympy, and the result is below: (I use [expr].coeff(u1) method) X1*X2*(u1 - u2 + u3 - u4)/(4*a*b) + X1*(-u1 + u2 + u3 - u4)/(4*a) + X2*(-u1 - u2 + u3 + u4)/(4*b) + u1/...
Никита Петров's user avatar
0 votes
0 answers
73 views

Fast polynomial division with remainder

I need a fast way to get the remainder from the division of two polynomials in c++. In "Modern Computer Algebra 3rd Edition" i found in the chapter 9 this pseudocode for the division using ...
Faby's user avatar
  • 1
0 votes
0 answers
27 views

Probability m randomly selected Boolean n-vectors is likely to span the whole space

What probability of a set of m randomly selected Boolean n-vectors is likely to span the whole space, provided m = Ω(nlog 2n)? I know probability at least 1/2 then m randomly selected Boolean n-...
Bazo's user avatar
  • 1
0 votes
0 answers
46 views

Is there an algorithm for finding every isolated singular point on an algebraic variety, or a programming language that implements this?

(note: this question was closed on math stack exchange before it was answered, so I'm asking it here) Suppose one wishes to test if a given surface f(x,y,z,w) = 0 in projective 3 space has singular ...
drfpslegend's user avatar
2 votes
2 answers
45 views

I need help finding mathematical expressions of logic gates

My problem is super niche, but I need help finding ways to express logic gates with simple mathematical expressions. I already have Not, And, & Xor, but I can't figure out Or. And is y=a*b, Not is ...
RipMoney's user avatar
1 vote
0 answers
32 views

How to perform optimal number distributions

The program I am working on has the following positive integers: TL = L1*C1 + L2*C2 TL = h1*r1 + h2*r2 hMAX>=r1>r2 TL, L1, C1, L2, C2 and hMAX are known. I need to determine h1, r1, h2 and r2 ...
user2296309's user avatar
0 votes
0 answers
59 views

SOP Boolean expression of state variable and output of a Moore FSM

Disclaimer: I'm studying for an exam, but I don't have to hand in anything. I have the state transition diagram of the FSM and its states encoding: I want to find the Sum-Of-Products Boolean ...
Angelo's user avatar
  • 57
0 votes
0 answers
39 views

Using python to check if two matrices are similar

I've long done this problem by hand, or by using other algebraic techniques, but am facing ever more problems where the algebraic techniques are failing and I'm falling back on by hand computations ...
J.D. Evans's user avatar
0 votes
1 answer
109 views

Conjugate gradient implementation converging on wrong values

I'm trying to write a simple conjugate gradient method function in C++ - pretty simple right? But it literally can't solve any systems of equations. It converges but onto the completely wrong values. ...
Will Denny's user avatar
0 votes
2 answers
24 views

Sympy count_ops returning incorrect result?

I'm doing a simple test with sympy (python=3.10, sympy=1.12) and I don't understand why the result seems wrong (results below): Code: from sympy import * x0, x1, x2 = symbols('x0 x1 x2') print(...
user5406764's user avatar
  • 1,689
0 votes
1 answer
50 views

How can I multiply two dataframes in Python as I would in algebra (row x column)?

I would like to multiply two dataframes as a would do in algebra (row x column). (i,:)*(:,i). How can I do this with python (I really can't beleave that in 2 h I haven't had a solution ... algebra ...
my enlightend god's user avatar
-1 votes
1 answer
67 views

Find appropriate matrix which Scales the square S to 4 times its area using python

Let S be the square with vertices (-1,1), (1,1), (1,-1), (-1,-1). Let the matrix representation of the vertices be: Each column of the matrix represents a vertex of the square. Find an appropriate ...
Asis's user avatar
  • 1
1 vote
0 answers
53 views

Lua function for inverse proportional output

I want to write a function in lua that given a number from 0 to 1, it decreases proportionally another number from 0.1 to 0.001. I tried to apply the proportional inverse y=1/x but is not working as ...
StealthYakumama's user avatar
1 vote
1 answer
139 views

How to un-linearize the depth buffer value

I use this function to linearize the depth value in my shaders: float linearize_depth(float d, float zNear, float zFar) { return zNear * zFar / (zFar + d * (zNear - zFar)); } What function would ...
HenriV's user avatar
  • 23
0 votes
1 answer
53 views

Alternatives to brute force algebra with additive/sigma functions

I have an equation 7405 210000 = Σ (x * (1 - 1/y)^n) n = 0 My goal is to find various x and y values that make it true. I also require for x and y to be whole numbers. The way I have ...
chriscrutt's user avatar
0 votes
0 answers
25 views

Defining KPI by algebra math

I'm having supplier for which i need to describe KPI algorithm. So i will not do the math solution or design IT system to do that, i need to give mathematical model that someone will use to create IT ...
Dione Saturn's user avatar
0 votes
3 answers
75 views

How to return xy-coordinates of a mathematical function into a dataframe of arbitrary length?

I want to get a dataframe containing n numbers of xy-coordinates that describe a linear function between two points P1(x1, y1) and P2(x2, y2) . My approach would be to find the xy-coordinates of two ...
Keizei's user avatar
  • 5
2 votes
2 answers
311 views

combinations of multiplication of numbers

Given a positive integer, n, return the number of possible ways such that k positive integers multiply to n. Order matters. Example n = 24 k = 2 (1, 24), (2, 12), (3, 8), (4, 6), (6, 4), (8, 3), (12, ...
артем костриков's user avatar
0 votes
0 answers
53 views

Creating a linear combination for the Reduced Row Echelon Matrix

I want to create a code that gets an Augmented matrix (Concatenating A and B) and produce the linear combination of the system in terms of the free variables. The free variables will be given the ...
edge selcuk's user avatar
0 votes
0 answers
52 views

For an algebra of programming, is it better to use function-level programming or functional programming and why?

For his "Algebra of Programming" John Backus used the function-level style, which avoided lambda variables. Functional programming, on the other hand, uses Lambda variables. Does it matter ...
fpstefan's user avatar
0 votes
1 answer
54 views

Finding all possible solution pairs to an algebra problem with constraints in python

I am trying to use python to create list of all pairs of numbers between 2 and 75 that average to 54, where each value in each solution pair can go up to 6 decimal places. And so I want to have a list ...
LostinSpatialAnalysis's user avatar
1 vote
1 answer
122 views

How do I represent algebraic terms in C++ using classes: a term can be raised to a vector of terms

I'm trying to make an algebraic parser, and I've gotten decently far. I'm at the point where I can successfully multiply polynomials. Full code here. Use the constructors along with the '*' overload ...
avighnac's user avatar
  • 396
0 votes
0 answers
30 views

Factorising numbers with a lowest common factor above a certain amount in python

I'm in the process of creating a calculator for algebra using python - it can currently expand any number of brackets and collect like terms. This time, I'm working on factorising single brackets. The ...
Hugo Thompson's user avatar
0 votes
0 answers
47 views

Analytical tensoralgebra in Python

I wish to do some analytical tensor / linear algebra equations, where, for example, the order of multiplication matters. I am familiar with the Sympy package, but could not find any analytical way to ...
Mark's user avatar
  • 45
0 votes
1 answer
43 views

Can't integrate summation with sympy

I would like to compute the integral of a summation: import sympy as sp t = sp.Symbol("t") n = sp.Symbol("n", integer=True, positive=True) sum_term = sp.Sum(sp.exp(-(n*sp.pi)**2 * ...
Rémi Delaporte-Mathurin's user avatar
0 votes
0 answers
28 views

Looking for algebraic primitive function solver code for math

I want to solve primitive functions algebraic for math class. I have been looking around and have found a lot of websites that have this function, but not any open source code! The basic functionality ...
Nils Malmberg's user avatar
-2 votes
1 answer
66 views

Why my python Armstrong number code doesnt work

So ive done an armstrong number code using python and it works fine till the sum of individual digits but after that it doesnt work i will type the code and send a screenshot to show in picture. ...
ConTresillo's user avatar
0 votes
1 answer
111 views

Sympy subs does not working for subexpression. Is there a way to solve this?

subs (from sympy library in Python) does not replace a subexpression in all cases except simple ones. MATLAB copes with this task perfectly. Is it possible to somehow achieve the same result as in ...
Александр Алексеев's user avatar
0 votes
0 answers
32 views

How do I set 2 expressions equal to eachother and solve for x [duplicate]

I need python to solve a fairly simple algebra equation for one variable. How can I set 2 simple equations equal to each other and return the value of x? Example: x+4 = 2(-x+5) desired output: 2
tv_dinner's user avatar
0 votes
0 answers
33 views

what is a and b in the equation below, where a and b cannot be 0 and must be a positive integer

The equation is 7a^3=11b^5. It cannot be 0 and both must be a positive integer. I have tried substitution and everything in algebra I know (not including calculus). Trial and error doesn't work ...
Martin Kulina's user avatar
0 votes
0 answers
211 views

C# - Calculate relative angle(0-180) between 2 angles(0-360 and 0-360)?

Im trying to find the relative angle between 2 given angles: For example: Angle A: 280degrees Angle B: 80degrees Relative angle = 160 degrees OR Angle A: 200degrees Angle B: 010Degrees relative angle:...
user avatar
0 votes
1 answer
137 views

Quadratic Bezier curve arc length

I am trying to calculate the length of a quadratic Bezier curve. Found a solution and a formula to calculate the length of the entire curve in a "closed form" - without having to do numeric ...
Igor Shmukler's user avatar
-2 votes
1 answer
35 views

Middle point of weighted X Y

I'm trying to get the middle point of X Y and Weight values, but I didn't found the correct formula to get that. For example in the picture I've added a few points with a few weights and I need to ...
Sebas Bejenaru's user avatar
-2 votes
1 answer
102 views

VBA Sigma Formula With Factorial

Need to count sigma with x = 0.7 Thats my version of code, but it doesnt work properly, need help: Private Sub UserForm_Click() Dim k As Long Dim Numerator As Double Dim Result As Double x = 0.7 For ...
xktg's user avatar
  • 41
-1 votes
1 answer
38 views

Given that we have the radius of this line and the coordinate A, how can we calculate the coordinate C?

Given we have the radius of this circle and the coordinates of A, how can I calculate the coordinate of C? C is also at the furthest part away from the line, or in other words a line going form A to C ...
Realhervee's user avatar
1 vote
1 answer
109 views

VBA Sigma Formula

I got a task in university, but have no idea how to solve it. Need help. Tried to solve it with cycle, but dont think that its right. For k = 1 To 10 For i = 1 To k n! = 1 * 2 * n S = S * ...
xktg's user avatar
  • 41
-1 votes
1 answer
61 views

how to convert numbers so that it can plot range on graph

our graph is from 0-64. However, our data is 0-100. How can i convert our data so that it would plot on our graph? It does not have to be absolutely accurate, ball park is ok.
SA DL's user avatar
  • 73
0 votes
1 answer
183 views

Is it Possible to Build a Ray Tracer for an Arbitary Shape?

Yesterday, I started looking into ray-tracing, and it seems that there are many algorithms for redering spheres and other common shapes. However, I want to be able to render an arbitrary 3D shape ...
William Ryman's user avatar
0 votes
0 answers
59 views

solving for a variable in an equation with a modulo

new to python, bad at math. im trying to make a program where you input variables into the equation (x*y-z)%4==0. i have: x=int(input()) y=int(input()) z=int(input()) if (x*y-z)%4==0: print("...
halitosis's user avatar

1
2 3 4 5
18