Questions tagged [equation]
A statement that the values of two expressions are equal indicated by the sign = .
equation
2,134
questions
122
votes
16
answers
102k
views
Equation (expression) parser with precedence? [closed]
I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis.
Using this method, however, leaves ...
107
votes
6
answers
237k
views
How to label each equation in align environment?
I wonder how to label each equation in align environment? For example
\begin{align} \label{eq:lnnonspbb}
\lambda_i + \mu_i = 0 \\
\mu_i \xi_i = 0 \\
\lambda_i [y_i( w^T x_i + b) - 1 + \xi_i] = 0
\end{...
63
votes
7
answers
163k
views
How to write equations in html? [closed]
I want to write some complex mathematical equation in my web page. Is there any plugin or anything for this?
56
votes
3
answers
135k
views
number several equations with only one number
How can I number several equations in a align environment using only one number?
For example
\begin{align}
w^T x_i + b \geqslant 1-\xi_i \text{ if } y_i=1, \nonumber \\
w^T x_i + b \leqslant -1+\...
47
votes
16
answers
42k
views
Math equations on the web
How can I render Math equations on the web? I am already familiar with LaTeX's Math mode.
44
votes
7
answers
69k
views
Equation parsing in Python
How can I (easily) take a string such as "sin(x)*x^2" which might be entered by a user at runtime and produce a Python function that could be evaluated for any value of x?
42
votes
2
answers
127k
views
Solve an equation using a python numerical solver in numpy
I have an equation, as follows:
R - ((1.0 - np.exp(-tau))/(1.0 - np.exp(-a*tau))) = 0.
I want to solve for tau in this equation using a numerical solver available within numpy. What is the best way ...
40
votes
5
answers
193k
views
How can I solve equations in Python? [closed]
Let's say I have an equation:
2x + 6 = 12
With algebra we can see that x = 3. How can I make a program in Python that can solve for x? I'm new to programming, and I looked at eval() and exec() but I ...
40
votes
6
answers
47k
views
Is it possible to plot implicit equations?
I would like to plot implicit equations (of the form f(x, y)=g(x, y) eg. X^y=y^x) in Matplotlib. Is this possible?
38
votes
7
answers
106k
views
Latex: how to break a line inside $$
I want to manually break a line inside $$:
$$something something <breakline> something else$$
I tried \\, \newline, and \linebreak but none work. Ideas?
33
votes
4
answers
15k
views
how to handle an asymptote/discontinuity
When plotting a graph with a discontinuity/asymptote/singularity/whatever, is there any automatic way to prevent Matplotlib from 'joining the dots' across the 'break'? (please see code/image below).
I ...
27
votes
16
answers
81k
views
Simplest way to solve mathematical equations in Python
I want to solve a set of equations, linear, or sometimes quadratic. I don't have a specific problem, but often, I have been in this situation often.
It is simple to use wolframalpha.com, the web ...
26
votes
2
answers
8k
views
Documenting equations with deqn and roxygen
I'm using \deqn{}{} with roxygen2 to document equations for a function in a package. The LaTeX (the 1st argument to deqn) renders fine because white space is ignored in LaTeX equations, but I have a ...
26
votes
4
answers
71k
views
How do I break a long equation over lines?
I am trying to add an equation in a new line. The problem is that the equation is too long for the line, and I need to break it manually. Otherwise, it just overlaps to the right column, or to the ...
23
votes
5
answers
36k
views
JavaScript equation solver library
Is there a JavaScript library or function that will solve equations for variables?
Such as 9 = 3 + x and solve for x. But it should also solve more advanced equations that include sine, cosine, and ...
21
votes
3
answers
16k
views
General - Is there a way to calculate an average based off of an existing average and given new parameters for the resulting average?
Lets say, we're calculating averages of test scores:
Starting Test Scores: 75, 80, 92, 64, 83, 99, 79
Average = 572 / 7 = 81.714...
Now given 81.714, is there a way to add a new set of test ...
21
votes
5
answers
62k
views
Calculate the position of an accelerating body after a certain time [closed]
How do I calculate the position of an accelerating body (e.g. a car) after a certain time (e.g. 1 second)?
For a moving body that it not accelerating, it is a linear relationship, so I presume for an ...
20
votes
5
answers
36k
views
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<String, Integer> vars = new ...
19
votes
3
answers
20k
views
Calculating opacity value mathematically
How is opacity calculated mathematically?
There is opacity value in Photoshop, CSS etc. Actually this opacity is the transparent behavior of a layer. That we all know.
But how is it calculated ...
17
votes
6
answers
1k
views
The shortest path between two integers by adding or subtracting
Here's the description of this problem:
You are given two integers a and b. You want to find the shortest sequence of operations necessary to transform a into b, where at each step you are allowed ...
16
votes
5
answers
19k
views
Mathematical equation manipulation in Python
I want to develop a GUI application which displays a given mathematical equation. When you click upon a particular variable in the equation to signify that it is the unknown variable ie., to be ...
15
votes
5
answers
52k
views
Plot equation showing a circle
The following formula is used to classify points from a 2-dimensional space:
f(x1,x2) = np.sign(x1^2+x2^2-.6)
All points are in space X = [-1,1] x [-1,1] with a uniform probability of picking each x....
15
votes
8
answers
105k
views
How to Solve Equations with java?
I have three equations like the following ones:
x + y + z = 100;
x + y - z = 50;
x - y - z = 10;
How can I find the values of x, y, and z with Java?
String equation1="x+y+z=100;";
String equation2="...
15
votes
4
answers
52k
views
Typesetting LaTeX fraction terms to be larger in an equation
I have the following formula in LaTeX, based on Fisher's Exact Test. (NOTE: requires the use of the amsmath package for \binom.)
\begin{equation}
P(i,j) = \sum_{x=|N(V_i) \cap V_j|}^{\min\{|V_j|, |...
15
votes
1
answer
3k
views
Equation Parsing Library C++ [closed]
I'm sure there must be something like this somewhere but I can't seem to find anything useful on here or Google. I had hoped Boost might have something but alas not.
What I'm after is a lightweight ...
14
votes
3
answers
9k
views
Guarded Equations in Haskell
Can somebody provide me with an easy to understand explanation of a guarded equation as it is used in Haskell and also its mathematical sense?
14
votes
3
answers
32k
views
How can I split a string into tokens?
If I have a string
'x+13.5*10x-4e1'
how can I split it into the following list of tokens?
['x', '+', '13', '.', '5', '*', '10', 'x', '-', '4', 'e', '1']
Currently I'm using the shlex module:
str =...
14
votes
2
answers
369
views
Equation Threading: Why the default behavior?
I recently rediscovered a small package by Roman Maeder that tells Mathematica to automatically thread arithmetic and similar functions over expressions such as x == y. Link to Maeder's package.
...
13
votes
2
answers
15k
views
Latex - \multicolumn within an align* environment [closed]
I would like to have a \multicolumn like effect within an align* environment, as shown in the code snippet (which doesn't work) below. I.e., I want the text to be aligned with the leftmost column, but ...
13
votes
3
answers
1k
views
Haskell: Equation Expander 1+(1+(1+(1+(…))))=∞
Does there exist a equation expander for Haskell?
Something like foldr.com: 1+(1+(1+(1+(…))))=∞
I am new to Haskell I am having trouble understanding why certain equations are more preferable than ...
12
votes
6
answers
106k
views
RMSE (root mean square deviation) calculation in R
I have numeric feature observations V1 through V12 taken for a target variable Wavelength. I would like to calculate the RMSE between the Vx columns. Data format is below.
Each variable "Vx" is ...
12
votes
5
answers
16k
views
Safely evaluate simple string equation
I'm writing a program in which an equation is inputted as a string, then evaluated. So far, I've come up with this:
test_24_string = str(input("Enter your answer: "))
test_24 = eval(test_24_string)
...
12
votes
5
answers
15k
views
Solving a simultaneous equation through code
This seems like an incredibly simple and silly question to ask, but everything I've found about it has been too complex for me to understand.
I have these two very basic simultaneous equations:
X = ...
12
votes
2
answers
4k
views
What are the state-of-art methods for solving functional equations?
Suppose that you want to find a λ-calculus program, T, that satisfies the following equations:
(T (λ f x . x)) = (λ a t . a)
(T (λ f x . (f x))) = (λ a t . (t a))
(T (λ f x . (f (f ...
11
votes
1
answer
12k
views
Is there a way to control the font size in the equation in JupyterNotebook?
In Jupyter Notebook markdown cells, is there a way to make the font size larger in the equation?
c = $\frac{a}{b}$
I triedc = \large{$\frac{a}{b}$} but it doesn't work.
11
votes
2
answers
35k
views
Solve system of two equations with two unknowns
Solve the system of two equations with two unknowns below:
a1, b1, c1, a2, b2 and c2 are inputted by the user himself.
I've been trying to find a math solution for the problem first and I can't seem ...
11
votes
1
answer
4k
views
Convert an equation to Python
I have several equations and need to convert it into Python. The problem is that I tried to plot a graph according to the equation. However, the graph that I get is not the same as the original one.
...
11
votes
6
answers
699
views
Equation parser efficiency
I sunk about a month of full time into a native C++ equation parser. It works, except it is slow (between 30-100 times slower than a hard-coded equation). What can I change to make it faster?
I ...
10
votes
5
answers
20k
views
How to solve a math equation in a programming language?
I need help to solve this formula ((n * 2) + 10) / (n + 1) = 3, preferably in PHP. (The numbers 2, 10 and 3 should be variables that can be changed.)
I'm able to solve this equation on paper quite ...
10
votes
1
answer
30k
views
\right) doesn't work on LaTeX multiline equation
I'm writing an equation on LaTeX and when I want to close the formula with \right) it doesn't work. I'll post my code here to see if anyone can help me:
\begin{equation*}
\begin{split}
&\...
10
votes
1
answer
11k
views
How to find the points of intersection of a line and multiple curves in Python?
I have data represented in the figure.
The curves were extrapolated and I have a line whose equation is known. The equation of curves are unknown. Now, how do I find the points of intersection of ...
9
votes
5
answers
56k
views
How to sort table using function/equation only
How can I sort a table in sheet 1 like
A B C D E
3 7 3 6 5
into another table in sheet 2
A C E D B
3 3 5 6 7
by using function only?
9
votes
3
answers
17k
views
convert RGB to grayscale in C
I used many formulas to convert from RGB to grayscale, but didn't get good results compared to GIMP.
I already tested the following formulas:
gray = (int)(0.299 * r + 0.587 * g + 0.144 * b);
gray = ...
9
votes
6
answers
1k
views
generating equation png files based on mathematical input
I was wondering what options were available to generate .png based on the kind of input one feeds a graphing calculator.. so
(y^2 + 5x + 3) / ((3x + 3) + 5y + 18)
would return
The only thing I've ...
9
votes
2
answers
11k
views
Solve this equation with fixed point iteration
How can I solve this equation
x3 + x - 1 = 0
using fixed point iteration?
Is there any fixed-point iteration code (especially in Python) I can find online?
9
votes
3
answers
1k
views
Solving a Variable Equation defined by the User
Answers in C, Python, C++ or Javascript would be very much appreciated.
I've read a few books, done all the examples. Now I'd like to write a simple program.
But, I already ran into the following ...
9
votes
1
answer
915
views
Why doesn't css-calc() work when using 0 inside the equation?
I'm using calc() to set the top: attribute in a class. I need some help understanding how calc() gets used - two equations I believe should have the same result don't. (The top equation isn't ...
9
votes
5
answers
33k
views
How can I find equation of a plot connecting data points in Matlab?
I have various plots (with hold on) as show in the following figure:
I would like to know how to find equations of these six curves in Matlab. Thanks.
9
votes
2
answers
9k
views
Looking for a .NET Math Equation Editor and Solver Control [closed]
I am looking for a 3rd party custom control that can handle both editing and solving simple math equations (with image generation).
I know about LaTeX and using its syntax to generate images of math ...
9
votes
1
answer
940
views
Flash library for math equations and graphs, like DragMath and PetitGrapheur
I'm working on e-learning solution and our project requires free or commercial component for math formulas and graphs rendering.
Use cases are:
built in flash or flex;
compose math equlation like in ...