Skip to main content
29 votes
Accepted

How to assume all variables in my code are reals

You can do something like this: Simplify[Sqrt[x^2]] (* Sqrt[x^2] *) $Assumptions = _ ∈ Reals (* _ ∈ Reals *) Simplify[Sqrt[x^2]] (* Abs[x] *) This tells those ...
Szabolcs's user avatar
  • 236k
20 votes
Accepted

Logarithm of exponential

Since Log is a multi-valued inverse function of Exp, Mathematica doesn't evaluate Log[Exp[a]]...
Carl Woll's user avatar
  • 131k
19 votes

How to tell Mathematica that certain variables are real/imaginary, integer-valued, etc

$Assumptions = n > 0 && n ∈ Integers && L ∈ Reals && L > 0 You can type symbol in the form <...
Moonsun Pervez's user avatar
14 votes
Accepted

Reduce not making full use of list of assumptions?

What I believe is the issue here is what a statement in your Reduce like c ∈ Reals actually means. You say it's a condition (and ...
Sjoerd C. de Vries's user avatar
14 votes

Logarithm of exponential

The assumption a > 0 is needed when Simplify is called: ...
Coolwater's user avatar
  • 20.4k
13 votes
Accepted

Using Assuming with Reduce

Assuming >> Details: Assuming affects the default assumptions for all functions that have an Assumptions option. Assumptions is not an option for ...
kglr's user avatar
  • 399k
12 votes

Assumptions allowing to calculate an elliptic integral

There are two different issues: suboptimal handling of elliptic integrals in Mathematica, this is why Integrate with appropriate assumptions doesn't provide ...
Artes's user avatar
  • 57.6k
12 votes
Accepted

Linearity Assumption

K1 /: Derivative[k_][K1] /; k >= 2 := (0 &)
Henrik Schumacher's user avatar
11 votes

Complex number operations: telling Mathematica variables are real

The most complete and extendable answer is to define Conj[x_] := Refine[Conjugate[x], _Symbol ∈ Reals]; Then we get ...
Jess Riedel's user avatar
  • 1,525
11 votes
Accepted

Is there a way to automatically find the limits of integration given a set of constraints?

You can directly integrate over the region defined by the conditions: R = ImplicitRegion[x^2 + y^2 <= 1, {x, y}] Integrate[x^2, {x, y} ∈ R] π/4 If this ...
Henrik Schumacher's user avatar
10 votes
Accepted

Assumption on the range of a function

EDIT: Simplified per suggestion from @BobHanlon. This constructs assumptions by finding all occurrences of pattern f[_] in the expression being simplified: ...
kirma's user avatar
  • 19.1k
10 votes

Using Assuming with Reduce

There is a warning in the docs for FullSimplify: Some of the transformations used by FullSimplify are only generically correct. ...
Michael E2's user avatar
  • 239k
10 votes
Accepted

Simplify is not simplifying a compound inequality as expected

Something I've noted about Mathematica, is it is best to be complete in defining variable domains. Also define i as an integer, which you might think it implicitly ...
MikeY's user avatar
  • 7,183
10 votes
Accepted

How to best add assumption that many variables are positive?

$Assumptions = Element[{a, b, c, d, f}, PositiveReals] ; Simplify[Sign[a + b + c]] 1 ...
kglr's user avatar
  • 399k
10 votes
Accepted

Behavior of Solve with $Assumptions changed in 12.2

I think this is (seen by WRI as) an improvement, and the change is marked in the docs for Solve (noted in the comments). In the docs, it is also indicated how <...
Michael E2's user avatar
  • 239k
10 votes

Why Mathematica is treating the product of (specified) real variable as complex?

You are probably not using Mathematica correctly. First, you shouldn't put MatrixForm into SingularValueList. Second, the way ...
Domen's user avatar
  • 27.6k
9 votes

Simplify makes Mathematica forget that a matrix is Hermitian

There are two issues here. The first is that HermitianMatrixQ (in line with other Q functions) only applies quick checks that ...
mikado's user avatar
  • 16.8k
9 votes

How to get a manipulated plot of the intersection points of two curves without finding them numerically?

...
Bob Hanlon's user avatar
  • 160k
9 votes
Accepted

How to get a manipulated plot of the intersection points of two curves without finding them numerically?

...
kglr's user avatar
  • 399k
8 votes
Accepted

Get Mathematica to Apply Chu-Vandermonde Convolution

Add to the the assumptions that 1 + a > b + d ...
Bob Hanlon's user avatar
  • 160k
8 votes

Specify range of variable in a equation

Add Assumptions : zw=FullSimplify[ Integrate[t1^2*E^((1 - h)*s0*t1), {t1, 0, T}], Assumptions -> 0 < h < 1 ] Addendum ...
Ulrich Neumann's user avatar
8 votes
Accepted

Why isn't this expression returning true to being positive when it is clearly positive?

Simplify is at root an expression tree minimizer, equipped with some algebraic and logical transformations. As such, it may have the transformations needed to reach ...
Michael E2's user avatar
  • 239k
8 votes
Accepted

Mathematica tries to differentiate Abs[x] and this causes a problem?

Since Derivative[1][RealAbs][x] work, so we can use /. Abs -> RealAbs ...
cvgmt's user avatar
  • 77.8k
8 votes
Accepted

Making a substitution within a typeset integral

You could use the new in V 13.1 IntegrateChangeVariables int = Inactive[Integrate][Sqrt[Log[9 - x]]/(Sqrt[Log[9 - x]] + Sqrt[Log[x + 3]]), {x, 2, 4}] ...
Nasser's user avatar
  • 147k
8 votes
Accepted

Why is Assuming[...] ignoring the assumption?

Assuming works by adding conditions to $Assumptions. Some functions make use of $Assumptions ...
Goofy's user avatar
  • 3,570
7 votes

Defining the domain of positive real numbers

New in Mathematica 12 is PositiveReals (and others like NonNegativeIntegers, etc): ...
Carl Woll's user avatar
  • 131k
7 votes

Forcing Mathematica's Integrate to give more general answers

If $\alpha$ is complex, then yes, The imaginary part of alpha should be strictly greater than zero. If $\alpha$ is real, does it converge? If you complete the contour in the complex plane, with a ...
mjw's user avatar
  • 2,166
7 votes

Taking real and imaginary parts after reciprocal

If x=0, then 1/0 is ComplexInfinity. If you add the assumption that ...
Robert Jacobson's user avatar
7 votes
Accepted

Assuming a variable is imaginary

This needs FullSimplify. FullSimplify[x + Conjugate[x], Re[x] == 0] 0
m_goldberg's user avatar
  • 108k
7 votes
Accepted

How can I specify the assumption 'a' is much greater than 'b' (a>>b) in Mathematica?

Perhaps an alternative would be to do a series expansion by either expanding r around infinity or m around 0: ...
Hans Olo's user avatar
  • 1,838

Only top scored, non community-wiki answers of a minimum length are eligible