Questions tagged [mathematical-expressions]

In mathematics, an expression is a finite combination of symbols that is well-formed according to rules that depend on the context. Symbols can designate numbers (constants), variables, operations, functions, and other mathematical symbols, as well as punctuation, symbols of grouping, and other syntactic symbols.

Strings of symbols that violate the rules of syntax are not well-formed and are not valid mathematical expressions. For example:

would not be considered a mathematical expression but only a meaningless jumble.

In algebra an expression may be used to designate a value, which might depend on values assigned to variables occurring in the expression; the determination of this value depends on the semantics attached to the symbols of the expression.

These semantic rules may declare that certain expressions do not designate any value; such expressions are said to have an undefined value, but they are well-formed expressions nonetheless.

In general the meaning of expressions is not limited to designating values; for instance, an expression might designate a condition, or an equation that is to be solved, or it can be viewed as an object in its own right that can be manipulated according to certain rules. Certain expressions that designate a value simultaneously express a condition that is assumed to hold, for instance those involving the operator to designate an internal direct sum.

Being an expression is a syntactic concept; although different mathematical fields have different notions of valid expressions, the values associated to variables does not play a role. See formal language for general considerations on how expressions are constructed, and formal semantics for questions concerning attaching meaning (values) to expressions.

261 questions
2
votes
5 answers

Check if string is following ISBN-13 in Java

Im trying to check if a string (important that it is a string) that im reading is correct accoring to the rules of ISBN-13. I found a formula For example, the ISBN-13 check digit of 978-0-306-40615-? is calculated as follows: s = 9×1 + 7×3 + 8×1 +…
Rocksteady
  • 271
  • 1
  • 4
  • 21
2
votes
2 answers

How to find variables in Julia using Linear Regression for Interpolation method?

There is an unknown function , and there are unknown coefficients k, l. Task is to estimate k, l using linear regression, through the data table. -2.0 1.719334581463762 -1.0 1.900158577875515 0.0 2.1 1.0 2.3208589279588603 2.0 …
2
votes
2 answers

How can I convert the given code to a mathematical function?

I am trying to convert a recursion into a mathematical formula. The code snippet (c++) below is a simplified variant. The values look like an exponential function, however I am trying to find a closed form. For example, rec(8, 6) is 1287. As an…
john
  • 23
  • 3
2
votes
2 answers

Split mathematic expression into array without splitting subexpressions between parentheses and single quotes

Let's say I have this string: 1 + 2 * (3 + (23 + 53 - (132 / 5) + 5) - 1) + 2 / 'test + string' - 52 I want to split it into an array of operators and non-operators, but anything between the () and ' must not be split. I want the output to be: [1,…
2
votes
2 answers

Assistance with Mathematica: using /. replace method with IF[] conditional

Let me first state that I am a Mathematica novice and this question is probably easily answered, but I have so far not been able to find any help for this specific problem scouring the internet. Here, I've basically summarized what I need my code to…
ZB18749
  • 49
  • 1
  • 6
2
votes
1 answer

How to extract some mathematical expressionfrom pdf using python?

I have a pdf which has math equations like this I am trying to extract the objective questions from a pdf file and convert them into csv file using python in such a way that each row of table contain a question, four options in each column and a…
2
votes
5 answers

C# - can I define a function on the fly from a user-supplied string formula?

I can define a func with a lambda expression as in: Func Fxy = ( (a,b) => a + b ) ); // Fxy does addition But what if I wanted to allow the user to supply the r.h.s. of the lambda expression at runtime ? String formula_rhs =…
tpascale
  • 2,516
  • 5
  • 25
  • 38
2
votes
1 answer

Multinomial coefficient code always delivers the same answer

I have written the following code in order to find the multinomial coefficient, however the same answer, 2.122e-314, always comes out. I've been sitting on this for a while now, and can't find what is missing. We are supposed to do this using…
user9078057
  • 187
  • 1
  • 6
2
votes
1 answer

Simplifying Sympy expressions as implicit functions of variables

I am wondering if there is any way to simplify Sympy expressions by rewriting the expression in terms of an already defined variable, making Python collect the terms fitting with that variable's definition. Thanks in advance.
2
votes
4 answers

How to find the numbers that satisfy (x - y * sqrt(2016.0)) / (y + sqrt(2016.0)) = 2016 using loops in C

I'm trying to find numbers that satisfy the clause (x - y * √ 2016) / (y + √ 2016) = 2016. Number x and y can be rational numbers. That's what I already tried: #include #include #include int main() { int x, y; …
Co_Co
  • 73
  • 1
  • 7
2
votes
2 answers

Why are these regular expressions not working?

I want a regex to match complex mathematical expressions. However I will ask for an easier regex because it will be the simplest case. Example input: 1+2+3+4 I want to separate each char: [('1', '+', '2', '+', '3', '+', '4')] With a restriction:…
Oscar Martinez
  • 621
  • 1
  • 8
  • 18
2
votes
1 answer

Getting every combination of X numbers given Y numbers?

I've come to a mathematical problem which for I can't program the logic. Let me explain it with an example: Let's say I have 4 holes and 3 marbles, the holes are in order and my marbles are A,B and C and also in order. I need to get every posible…
Lauro182
  • 1,597
  • 3
  • 15
  • 41
2
votes
2 answers

Java - How can one take all occurrences of a specific character in a string and shift them to a non-predefined position?

I want to replace the "cube root of" and "square root of" in a String to respectively "^(1/3)" and "^(1/2)", but after the operand. Making a simple replace would put "^(1/3)" and "^(1/2)" ahead of the numbers, but I need them to be after the numbers…
Cid
  • 66
  • 7
2
votes
2 answers

Vectorize repetitive math function in Python

I have a mathematical function of this form $f(x)=\sum_{j=0}^N x^j * \sin(j*x)$ that I would like to compute efficiently in Python. N is of order ~100. This function f is evaluated thousands of times for all entries x of a huge matrix, and therefore…
2
votes
3 answers

How to parse a string starting by the end c++

Added another example. I have a mathematical expression such as cos(pi*cos(pi * sin(pi*y))) and I want to solve it. I think the best way to parse it is starting by the end of the string. So, in the expression above: i = sin(pi*y) i = cos(pi*i) i =…
Elena
  • 39
  • 4