Artes
  • Member for 10 years
  • Last seen this week
  • Warsaw, Poland
What is the difference between Reduce and Solve?
103 votes

In Some Notes on Internal Implementation especially in Algebra and Calculus one finds interesting subtleties and differences between these two functions, e.g. The code for Solve and related functions ...

View answer
How do I clear all user defined symbols?
Accepted answer
101 votes

Maybe this ? ClearAll["Global`*"]

View answer
How to calculate scalar curvature, Ricci tensor and Christoffel symbols in Mathematica?
68 votes

General remarks In General Relativity we work in a 4-dimentional Lorentzian manifold i.e. there is a metric tensor $g$ of signature $(+,-,-,-)$ or $(-,+,+,+)$. Theses signatures are mathematically ...

View answer
How to calculate contour integrals with Mathematica?
Accepted answer
65 votes

The integrand has two singular points: Solve[ 4z^2 + 4z + 3 == 0, z] {{z -> 1/2 (-1 - I Sqrt[2])}, {z -> 1/2 (-1 + I Sqrt[2])}} At infinity it becomes zero: Limit[ 1/Sqrt[ 4 z^2 + 4 z + 2], ...

View answer
How do I work with Root objects?
Accepted answer
65 votes

A shorter introduction to working with Root objects is in the below answer. Solutions to algebraic or transcendental equations are expressed in terms of Root objects whenever it is impossible to find ...

View answer
Finding real roots of negative numbers (for example, $\sqrt[3]{-8}$)
56 votes

In general, a typical root of a negative number is complex, so you need to get rid of most roots. A nice approach would be Root, e.g. Root[ x^3 + 8, #] & /@ Range[3] {-2, 1 - I Sqrt[3], 1 + I ...

View answer
Finding unit tangent, normal, and binormal vectors for a given r(t)
Accepted answer
47 votes

Mathematica wouldn't be much helpful if one applied only formulae calculated by hand. Here we demonstrate how to calculate the desired geometric objects with the system having a definition of the ...

View answer
Labeling individual curves in Mathematica
Accepted answer
47 votes

You can make use of the following options in Plot, e.g. : Plot[ Tooltip @ {x^2, x^3, x^4}, {x, -2, 2}, PlotStyle -> {Red, Green, Blue}, PlotRangePadding -> 1.1] /. {Tooltip[{_, ...

View answer
Assign the results from a Solve to variable(s)
Accepted answer
36 votes

You can do this : s = Solve[y^2 == 13 x + 17 && y == 193 x + 29, {x, y}]; xx = s[[All, 1, 2]]; yy = s[[All, 2, 2]]; Now you can access solutions, this way xx[[1]], yy[[2]]. If you prefer to ...

View answer
Plotting complex numbers as an Argand Diagram
Accepted answer
35 votes

Defining the function F and a subset of its domain : pts : F[z_] := (5 - I z)/(5^2 + z^2) pts = {-7, -2, 0, 2, 7}; the most straightforward way fulfilling the task is based on ParametricPlot and ...

View answer
Plotting complex Sine
33 votes

You can plot in 3 dimensions only real and/or imaginary parts of a function. One can make use of Plot3D, but since there was a question how the sine function looks like on the unit circle, first I ...

View answer
Is there a way to use functions like Prime[n] within Solve[]?
Accepted answer
32 votes

If not assumed otherwise m and n can be whatever, so you can do e.g. this : Solve[ Prime[n] + Prime[m] == 100, {n, m}, Integers] {{n -> 2, m -> 25}, {n -> 5, m -> 24}, {n -> 7, m -&...

View answer
Interlacing a single number into a long list
32 votes

Absolutely unbeatable : Tuples[{{1997}, data1}] All other methods are much slower even Verbeia's {1997,#}&/@ data1 or dws' Thread[{1997, data1}] Tuples[{{1997}, data1}] === ({1997, #} & /@ ...

View answer
How can I implement the method of Lagrange multipliers to find constrained extrema?
Accepted answer
31 votes

We define the function f and multiple constraint functions g1, g2: f[x_, y_, z_] := x y + y z g1[x_, y_] := x^2 + y^2 - 2 g2[x_, z_] := x^2 + z^2 - 2 then, in order to find necessary conditions for ...

View answer
Can Reduce *really* not solve for x here?
Accepted answer
31 votes

Use Reduce[(1/x) Cosh[x/2] == Sqrt[2], x, Reals] or Solve[(1/x) Cosh[x/2] == Sqrt[2], x, Reals] the latter yields {{x -> Root[{-E^(-(#1/2)) - E^(#1/2) + 2 Sqrt[2] #1 &, 0....

View answer
Meaning of backtick in floating-point literal
31 votes

The default value of $NumberMarks Automatic means that ` should by default be used in arbitrary-precision but not machine-precision numbers. Arbitrary-precision numbers can contain an arbitrary ...

View answer
Differential geometry add-ons for Mathematica
31 votes

The modern differential geometry is a vast subject and while not specified exactly what you need the question is a bit too general. I would rather point out a few references. If you are looking for ...

View answer
Add a vector to a list of vectors
Accepted answer
30 votes

I recommend using Transpose twice since it is more efficient than other approaches. Moreover Plus has the Listable attribute, thus one need not map Plus over a list (vector). Transpose[v1 + ...

View answer
Finding the number of solutions to a diophantine equation
30 votes

There is an especially useful function for this kind of task: FrobeniusSolve[{a, b, c}, d] for finding the list of all solutions to the equation a x + b y + c z == d, where a,b,c are given positive ...

View answer
How to get intersection values from a parametric graph?
29 votes

We couldn't be really pleased if we didn't exploit existing Mathematica functionality to get exact solutions. Here we provide them with Reduce rewriting the given system to an exact one and using a ...

View answer
Plotting Complex Quantity Functions
Accepted answer
29 votes

The way you could use ContourPlot here, assuming your variable f is complex (f == x + I y) : eqn[x_, y_] := (25 Pi ( x + I y) I)/(1 + 10 Pi ( x + I y) I) {ContourPlot[Re@eqn[x, y], {x, -1, 1}, {y, -...

View answer
Bug in mathematica analytic integration?
28 votes

This is indeed a serious and problematic issue. We know many similar problems with symbolic integration which provides Integrate. There were some improvments in newer versions of the system but also ...

View answer
Solve symbolically a transcendental trigonometric equation and plot its solutions
Accepted answer
28 votes

General remarks These are are crucial aspects of solving equations symbolically: So far (in general) Mathematica cannot solve transcendental equations when two unknowns are involved, nevervetheless ...

View answer
How does one set a logarithmic scale in a ContourPlot?
28 votes

Instead of doing some transformation on the original ContourPlot we can do an exponential rescaling of the original variables in the ContourPlot, so this is somewhat different approach to get roughly ...

View answer
How to find lattice points on a line segment?
27 votes

There are many ways to proceed, the best one uses FrobeniusSolve : I Since we know, that a x + b == y /. Solve[{-4 a + b == 11, 16 a + b == -1}, {a, b}] // Simplify {3 x + 5 y == 43} we find ...

View answer
Random numbers that sum up to specific value
25 votes

There are much better programming methods in Mathematica than loops. Here is an approach based on IntegerPartitions, it chooses 5 numbers that sum up to 35: RandomChoice[ IntegerPartitions[35, {5}]]...

View answer
Using D to find a symbolic derivative
25 votes

There is no need to play around with ReplaceAll, Rule, Block, Module or whatever using D, since you have an oparator Derivative really fulfilling your needs while you need not bother if the arguments ...

View answer
How can I generate this "domain coloring" plot?
24 votes

This is a good way : DensityPlot[ Rescale[ Arg[Sin[-x - I y]], {-Pi, Pi}], {x, -Pi, Pi}, {y, -Pi, Pi}, MeshFunctions -> Function @@@ {{{x, y, z}, Re[Sin[x + I y]]}, ...

View answer
Paths integrals in the complex plane
23 votes

For this function: f[z_] := (1 - E^z + z)/(z^3 (z - 1)^2) there are no branch cuts in the complex plane therefore we simply use Cauchy integral theorem and the related formula of the complex residue,...

View answer
About multi-root search in Mathematica for transcendental equations
23 votes

One can use Solve as well, e.g. s = Solve[ BesselJ[1, x]^2 + BesselK[1, x]^2 - Sin[ Sin[x]] == 0 && 0 < x < 10, x] Solve::incs: Warning: Solve was unable to prove that the solution ...

View answer
1
2 3 4 5
16