Questions tagged [calculus-and-analysis]
Questions related to the calculus and analysis branches of Mathematica, including, but not limited to, limits, derivatives, integrals, series, and residues.
5,381 questions
3
votes
2
answers
228
views
Solving a coupled 2nd order differential equation numerically using NDSolve
I would like to solve the following system of differential equations numerically for two one-dimensional functions $R(x)$ and $\phi(x)$:
\begin{eqnarray}
c_1 \left(R''(x) - (\phi'(x))^2 R(x) \right) - ...
0
votes
1
answer
172
views
How does Mathematica define the indefinite integral $\int f(x) dx$? [closed]
How does Mathematica define the indefinite integral $\int f(x) dx$?
For example, if you input into Mathematica Integrate[Sin[x], x] it will return $-\cos(x)$ and ...
2
votes
1
answer
116
views
Integration of function involving ArcCsc with assumptions returns wrong answer
When I ask Mathematica (version 14.1) to do the following symbolic integration:
...
6
votes
1
answer
234
views
Is it valid for DSolve to return Indeterminate as a solution to a differential equation?
In V 14.3
Quit[]
ode=2*y[x]*D[y[x],{x,2}]==1+D[y[x],x]^2;
DSolve[ode,y[x],x,IncludeSingularSolutions->True]
Gives
Is it valid for DSolve to return ...
3
votes
2
answers
250
views
How to obtain this book solution for first order ode. Initial condition at infinity
This is problem 150, page 54, Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983.
...
4
votes
1
answer
148
views
How to implement a 2x2 operator in Mathematica?
I am trying to write a Mathematica program to compute the following:
For a given Hermitian matrix $\rho$, the operator $L_\theta$ with respect to a parameter $\theta$ is defined as:
\begin{equation}
...
6
votes
3
answers
368
views
Pure functions from pure functions
I study the behavior of spatial curves and it is very convenient to write curvature and torsion as pure functions (PF).
It is often necessary to obtain their combinations, integrals and differentiates ...
2
votes
1
answer
90
views
Definition of inverse Laplace transform [duplicate]
Although there is a ready-made code for the inverse Laplace transform in Mathematica, I want to manually write the code to define the inverse Laplace transform so I can modify it.
This is my attempt:
<...
3
votes
2
answers
204
views
Converting hypergeometric function to Struve form
In my question on MathOverflow, I was looking for a closed form result of the following sum:
$$\sum _{k=0}^n \frac{(-1)^{n-k} x^{2 k} (2 (n-k)-1)\text{!!}}{(2 k)\text{!!}}.$$
Someone suggested me to ...
2
votes
0
answers
92
views
How to define the derivative of variables inside an expression so chain rule can be correctly applied to the full expression
I don't use Mathematica as much and only use it for some specific tasks from time to time (mostly simplifying expressions and calculating integrals and derivatives).
Lets say I have an large ...
5
votes
2
answers
314
views
NDSolve exceedingly slow
I the following ODE with parameters
\begin{align}
B_e\: \theta''(s)+2(s-1)\cos\theta(s)=S_e\: f\left(\theta(s)\right),
\end{align}
with $0\leq s\leq 1$ and
\begin{align}
\theta(0)=0\:\:\:\text{and}\:\:...
1
vote
1
answer
145
views
Why DSolve gives solution to $y'=0$ with IC $y(0)=t$ as $y=t$?
I was trying to see if I can trick DSolve for the ode $y'=0$ which has solution $y=c_1$, so all solutions are constant lines (horizontal lines).
But then I asked it ...
1
vote
2
answers
163
views
Finding leading order behaviour of an integral
There is an integral whose leading order behaviour in terms of $p$ is what I want.
$$I(p) = \int_0^{D(p-1)} \log(1-Q^2e^{-x}) \, \mathrm dx,$$
where $D$ is really large and $p$ tends to 1.
For the ...
5
votes
1
answer
367
views
How to determine if ode is linear or not in Mathematica?
Mathematica does not have builtin function to determine if ode is linear or not.
Currently I use the code below, but it can give false negative. For example, the ode $\frac{1}{y'(x)} = x$ is linear ...
2
votes
2
answers
205
views
Differential forms in integrals
I'm working on a big integral which I want to define in terms of a wedge of differential forms. I had been using D[x] as a substitute for dx, but I can see based on ...
1
vote
1
answer
130
views
Real assumption in Mathematica and double integral
Consider the following integral: $$\int_{-27}^{27}\left(9-x^{\frac{2}{3}}\right)dx$$
In WolframAlpha if I assume the real-valued root, the answer is $\frac{972}{5}$.
Now rewrite the above integral via ...
5
votes
1
answer
334
views
DSolve returns only trivial solution for $t y' = 3y$
WRI CASE:5291279
The textbook says that the differential equation
\begin{align*}
t y' &= 3 y\\
y(0) &= 0
\end{align*}
has a solution $y= c_1 t^3$ for any $c_1$....
0
votes
3
answers
339
views
Numerical errors in NSum for $\sin(\sqrt{k})/k$ series
I'm encountering numerical accuracy issues when computing the infinite series:
NSum[Sin[Sqrt[k]]/Sqrt[k], {k, 1, ∞}, WorkingPrecision -> 20]
Despite setting <...
1
vote
1
answer
161
views
Why Integration of the given function is not working?
I wanted to integrate $\phi$ with respect to $\eta$. But Mathematica cannot perform the integration. The problem is with the $\sinh$ function but I could not replace it with any simple function except ...
0
votes
0
answers
69
views
FindRoot inside FindRoot sometimes not working
I was trying to find the root of a function which is in-turn given only by the solution of FindRoot. The following does work for some values. For others it produces the same error as without the ...
0
votes
1
answer
179
views
Equivalent integrals, different answers
Below are two equivalent definite integrals.
$$\begin{align*}S&=2\pi\int_0^\pi b\sin t\sqrt{a^2\sin^2t+b^2\cos^2t}\text dt\\
&=4\pi b\int_0^\frac{\pi}{2}\sin t\sqrt{a^2-(a^2-b^2)\cos^2t}\text ...
4
votes
2
answers
303
views
Conflicting results for the two forms of the same integral
(Edited to emphasize the point about assumptions).
Consider a simple integral:
Integrate[Exp[I x/2], {x, 0, 2 Pi}]
Mathematica produces the following answer: ...
1
vote
1
answer
302
views
What are the best publicly accessible AI programs , for writing reliably Mathematica programs?
I've been experimenting for a while with Claude, DeepThink, Copilot and Chat, and all are great for helping quickly beginner programmers with bad memory like me, but they also waste a lot of your time ...
4
votes
2
answers
503
views
Difficult integral where change of variables does not seem to help
Here is a difficult definite integral that Mathematica cannot seem to solve symbolically:
$$\int\limits_{-1}^1 \frac{1}{x} \sqrt{\frac{1+x}{1-x}} \ln \left( \frac{x^4 + \sqrt{2} x^3 + x^2 + \sqrt{2} x ...
15
votes
2
answers
575
views
Unexpected behavior of `Series` for version 14.3?
Bug introduced in 14.3 or earlier and persisting through 14.3.0 or later
Consider the simple example
$Version
Series[\[Chi],{\[Chi],0,0}]
Before version 14.3, the ...
2
votes
1
answer
248
views
Efficiently computing complicated multi-dimensional integrals involving Gaussian envelops
Consider a function like this
...
0
votes
0
answers
74
views
Finding Hopf bifurcations by minimizing distance of eigenvalues to the imaginary axis
It would be nice to find Hopf bifurcations in Mathematica by minimizing distance of eigenvalues to the imaginary axis. Since I always start from a stable fixed point, it suffices to NMaximize the ...
2
votes
3
answers
322
views
Finding parameters of function given its zeros and extrema
Let me use as an example a cubic function (the original problem is much more complicated)
f[x_] := a x^3 + b x^2 + c x + d;
I know that the function has:
zeros ...
0
votes
1
answer
613
views
Find positive-integer tuple satisfying constraints [closed]
I am reading an interesting paper One of the numbers ζ(5), ζ(7), ζ(9), ζ(11) is irrational by Zudilin. We fix odd numbers $q$ and $r$, $q\geq r+4$ and a tuple $\eta_0,\eta_1,...,\eta_q$ of positive-...
4
votes
1
answer
136
views
Partial derivative of a matrix with respect to a vector dimension?
So I found this definition in this paper, but I wanted to double check that this is actually correct because I heard that the Partial derivative of a mxn matrix with respect to a p vector is supposed ...
0
votes
0
answers
120
views
Handling abstract power series
I would like to do some abstract power series manipulation. I am defining a power series like this
func = Sum[Subscript[a,i] * x^i, {i, 0, M}];
When I try to take ...
4
votes
1
answer
244
views
Generating Poincaré sections
I would like to reproduce the Poincaré sections presented in this and this papers, which look like
The figures are for energy values of E=0.2 (a) and E=0.25 (b) in the Hamiltonian, which reads
$$H=\...
3
votes
0
answers
183
views
Mathematica demonstration of the expected volume of a random polytope in a ball
Related MSE post
I'm trying to make Mathematica demonstration of the paper The expected volume of a random polytope in a ball.
In the $d$-dimensional Euclidean space $E^d$ ($d \geq 2$), consider the ...
4
votes
2
answers
264
views
Speeding up conditional integration
I was wondering if there is a way to make this function faster
...
2
votes
1
answer
156
views
Overriding derivatives: function composition
I am having trouble overriding when I compose functions. Here is a simple example. I would like the first output below to be 10 g[x] as opposed to ...
2
votes
3
answers
301
views
Recursive Function with Integral
I am trying to recursively define the following function:
...
8
votes
1
answer
567
views
Mathematica code involving floor function
I am reading an interesting paper One of the numbers ζ(5), ζ(7), ζ(9), ζ(11) is irrational by Zudilin. Define $$\varphi_0(x,y):=\sum_{j=1}^{3}([y]+[\eta_0x-y]-[y-\eta_j x]-[(\eta_0-\eta_j)x-y]-2[\...
2
votes
1
answer
305
views
Calculating $\lim_{k\to\infty} \cos \left(\pi \sqrt{k^2+k+1}\right)$
It's easy to prove that Limit[Cos[π Sqrt[k^2 + k + 1]], k -> ∞] equals 0, however the latest Mathematica version claim it's ...
4
votes
0
answers
131
views
Difference in convergence behavior of Sum for two equivalent series
I am perplexed by the output of the following code:
...
2
votes
1
answer
155
views
Calculating Residual From PDE
Bug introduced in 14.2 or earlier.
I am trying to determine if my solution converges, by calculating the residual of my PDE.
...
0
votes
1
answer
176
views
Plotting branch cut along `Im[z]=0` axis
I have expressions $\log\frac{z}{z-1}$ and $\frac{1}{z \left( 1 + W_0\left(-\frac{1}{e z}\right) \right)}
$ visualized below. There's a branch cut along the Im[z]=0 ...
9
votes
1
answer
224
views
InverseMellinTransform unexpected result after Simplify
I'm having unexpected difference applying inverse Mellin transform after a simple algebraic rearrangement (1/(-1 + 2 s) vs ...
7
votes
6
answers
633
views
NDSolve not able to adjust condition in ODE
I'm trying to solve the equation
\begin{align}
\epsilon_b\:\theta''(s)-(l-s)\cos\theta(s)=\epsilon_\gamma\sin\theta(s)\cos\theta(s),
\end{align}
with $0\leq s\leq l$ and
\begin{align}
\theta(0)=0\:\:\:...
0
votes
0
answers
144
views
How to solve a regular integral with divergence analytically
I want to analytically integrate this integration
$$\int_0^{1 - 3/rs}\left(\frac{9 \sqrt{3} \sqrt{\frac{1}{\left(1-\frac{2}{\eta }\right) \eta ^2 \left(\frac{\eta
^2}{1-\frac{2}{\eta }}-27\right)}}}...
7
votes
1
answer
319
views
Is there a way to specify more practical default assumptions for Mathematicas Integrate function
As a result of repeated updates to Mathematica (12.3.1), the usage of integrate has become practically useless to an extent I consider ridiculous. To illustrate the problem take the following example
...
5
votes
2
answers
834
views
Why does Mathematica say that this integral diverges?
Mathematica 13.2 (on windows 10) is giving strange results for a simple integral, after making contradictory assumptions on a variable which is not in that integral.
In:
...
3
votes
1
answer
128
views
Programmatic construction of a differential operator
I am trying to construct a linear differential operator programmatically. My approach is based on the worked-out example in the NonCommutativeMultiply documentation....
1
vote
1
answer
113
views
Evaluating EGF at a set of given points given expression of OGF
I have the following ordinary generating function OGF
$$\frac{1}{(1-s)\left(1 + W_0\left(\frac{s}{e(1-s)}\right)\right)}$$
...
3
votes
1
answer
371
views
Error (bug?) in the calculation of a simple integral
On Mathematica ver.14.2.1.0 on a Raspberry Pi 5 with 8GB of RAM for the following simple integral:
Integrate[Sqrt[5 x - x^2], x]
I get the following result:
...
7
votes
2
answers
510
views
Bug when computing simple integral in Mathematica 14.1?
I found a bug when computing the following integral
$\int_0^{2\pi} \log ((e^{ix}-r)(e^{-ix}-r)) dx = 0$ for $0 \leq r < 1$ using Mathematica 14.1:
...