Assuming we have that

$$

N = iiint f(r,theta, phi) r^2 sin theta mathrm{d}r mathrm{d} theta mathrm{d} phi

$$

I wish to write an expression using a change of variables:

$$

frac{dN}{dt} = iint f(r,theta, phi) r^2 sin theta frac{mathrm{d}r}{dt} mathrm{d} theta mathrm{d} phi

$$

However, based on the solutions to this expression, it seems that this expression is not quite correct and it requires an absolute value:

$$

frac{dN}{dt} = iint f(r,theta, phi) r^2 sin theta left| frac{mathrm{d}r}{dt} right| mathrm{d} theta mathrm{d} phi

$$

which is similar to a Jacobian should the limits of integration not be flipped as per this stackexchange answer. However, given that there are no limits of integration in the above expression – that is, neither r not t are being integrated over, I am not sure of the precise justification for the absolute value or if it is legitimate.

# Tag: calculus

## calculus and analysis – question on correct use of Limit for multivariable function

V 12.1 on windows.

This limit $lim_{(x rightarrow 0,yrightarrow 0)} frac{x^2-y^2}{x^2+y^2}$ depends on the direction. So the limit does not exist, or could be written as Maple does it, which is $-1dots1$, here is the help from Maple on this:

How can one get Mathematica to give this result? Now Mathematica says the limit is $1$. I tried the `Direction`

option but not able to make it change its mind.

```
f = (x^2 - y^2)/(x^2 + y^2);
Limit(f, {x -> 0, y -> 0})
(* 1 *)
```

But we see the limit depends on the direction

```
Limit(Limit(f, x -> 0), y -> 0)
(* -1 *)
Limit(Limit(f, y -> 0), x -> 0)
(* 1 *)
```

Here is also Maple to confirm

```
restart;
f:=(x^2-y^2)/(x^2+y^2);
limit(f, (x=0,y=0));
```

Btw, this is not the only one I found, here is another

```
f = (x^2*y^2)/(x^4 + y^4);
Limit(f, {x -> 0, y -> 0})
(* 0 *)
```

Maple gives

```
restart;
f:=x^2*y^2/(x^4+y^4);
limit(f,(y=0,x=0))
(* 0 .. 1/2 *)
```

And another one (this one is from youtube actually, so you can see they also say there the limit does not exist)

```
f = (x^4 - 4 y^2)/(x^2 + 2 y^2);
Limit(f, {x -> 0, y -> 0})
(* 0 *)
restart;
f:=(x^4-4*y^2)/(x^2+2*y^2);
limit(f, (x=0,y=0));
(* -2 .. 0 *)
```

So I have feeling I am not using Limit in Mathematica correctly, or missing something about its correct use, but do not now know how to correct it. As I said, I tried different `Direction`

option.

## calculus and analysis – Plot of Integrate[expr] not matching NIntegrate[expr] (Imaginary Part is flipped?)

I am interested in getting an analytic form for the integral of an expression. When I integrate my expression, I get a very clean result, but with a very complicated “Condition” attached to it, which looks like this (code provided at end):

I am interpreting that this integral “blows up” for some very complicated situation, but otherwise has a single solution. Now if I grab that solution and plot the real and imaginary parts as a function of the variable $Delta_p$, I observe that the analytical solution disagrees with its numerical counterpart.

The plots of the Real part (of the analytic integral vs the numerical integral) seems to be pretty close:

But the plots of the imaginary part (of the analytic integral vs the numerical integral) disagree by a negative sign:

The imaginary part is somehow flipped! Any ideas what is going on? Why is this issue happening?

Here is my code for obtaining these results:

```
expr = 1/W Sqrt(Log(2)/(Pi)) 1/(
1 + ((CapitalDelta)/
W)^2) (I (-4 ((CapitalDelta) + (CapitalDelta)c1)^2 +
4 ((CapitalDelta) + (CapitalDelta)c1) ((CapitalDelta) +
(CapitalDelta)c2) +
2 (Gamma) ((CapitalGamma) +
2 I (-(CapitalDelta) + (CapitalDelta)c1 -
(CapitalDelta)c2 - (CapitalDelta)p)) +
2 I (CapitalGamma) ((CapitalDelta)c1 - (CapitalDelta)p) +
8 ((CapitalDelta) + (CapitalDelta)c1) ((CapitalDelta) +
(CapitalDelta)p) -
4 ((CapitalDelta) + (CapitalDelta)c2) ((CapitalDelta) +
(CapitalDelta)p) -
4 ((CapitalDelta) + (CapitalDelta)p)^2 +
(CapitalOmega)c2^2))/(2 (Gamma) ((CapitalGamma) +
2 I (-(CapitalDelta) + (CapitalDelta)c1 -
(CapitalDelta)c2 - (CapitalDelta)p)) ((CapitalGamma) -
2 I ((CapitalDelta) + (CapitalDelta)p)) +
I (2 (CapitalGamma)^2 ((CapitalDelta)c1 - (CapitalDelta)p) +
8 ((CapitalDelta) + (CapitalDelta)c1)^2 ((CapitalDelta) +
(CapitalDelta)p) +
8 ((CapitalDelta) + (CapitalDelta)c2) ((CapitalDelta) +
(CapitalDelta)p)^2 + 8 ((CapitalDelta) + (CapitalDelta)p)^3 -
2 ((CapitalDelta) + (CapitalDelta)c2) (CapitalOmega)c1^2
- 2 ((CapitalDelta) + (CapitalDelta)p) (CapitalOmega)c1^2 +
2 ((CapitalDelta) + (CapitalDelta)c1) (-4 ((CapitalDelta)
+ (CapitalDelta)c2) ((CapitalDelta) + (CapitalDelta)p) -
8 ((CapitalDelta) + (CapitalDelta)p)^2 +
(CapitalOmega)c1^2) -
2 ((CapitalDelta) + (CapitalDelta)p) (CapitalOmega)c2^2 +
I (CapitalGamma) (4 ((CapitalDelta) + (CapitalDelta)c1)^2
+ 4 ((CapitalDelta) + (CapitalDelta)c2) ((CapitalDelta) +
(CapitalDelta)p) + 8 ((CapitalDelta) + (CapitalDelta)p)^2 -
4 ((CapitalDelta) + (CapitalDelta)c1) ((CapitalDelta)
+ (CapitalDelta)c2 +
3 ((CapitalDelta) + (CapitalDelta)p)) -
(CapitalOmega)c1^2 - (CapitalOmega)c2^2)));
parameterRules = {(CapitalOmega)c1 ->
4, (CapitalOmega)c2 -> .1, (CapitalGamma) ->
1, (CapitalDelta)c1 -> 0, (CapitalDelta)s ->
0, (CapitalDelta)c2 -> 0, z -> 1, (Gamma) -> 0, (Phi) -> 0,
W -> 10};
(*Analytic Integration:*)
DL4lvldopplerPtoP(CapitalDelta) =
Integrate( expr, {(CapitalDelta), -(Infinity), (Infinity)}) //
Normal // Simplify;
analyticalSol = DL4lvldopplerPtoP(CapitalDelta) /. parameterRules;
(*Numeric Integration:*)
numericallyIntegraled = expr /. parameterRules // Simplify;
f((CapitalDelta)p_?NumericQ) :=
NIntegrate(
numericallyIntegraled, {(CapitalDelta), -(Infinity),
(Infinity)});
(*Plotting real and imag parts of (Analytic and Numeric):*)
Plot({Re(ComplexExpand(f((CapitalDelta)p))),
Re(ComplexExpand(analyticalSol))}, {(CapitalDelta)p, -10, 10},
Frame -> True,
FrameLabel -> {{None, None}, {"(CapitalDelta)p",
"Im(expr): Numeric Vs Analytic"}}, GridLines -> Automatic,
GridLinesStyle -> LightGray, BaseStyle -> 12)
Plot({Im(ComplexExpand(f((CapitalDelta)p))),
Im(ComplexExpand(analyticalSol))}, {(CapitalDelta)p, -10, 10},
Frame -> True,
FrameLabel -> {{None, None}, {"(CapitalDelta)p",
"Re(expr): Numeric Vs Analytic"}}, GridLines -> Automatic,
GridLinesStyle -> LightGray, BaseStyle -> 12, PlotRange -> All)
```

One thing to note is that I tweaked the conditional expression to just be a normal expression. If I don’t do this, I cannot obtain a plot anymore, and if I try to look at my analytic expression, I get the form:

```
Cell(CellGroupData({Cell(BoxData(
RowBox({"Simplify", "(",
RowBox({
RowBox({"Re", "(",
RowBox({"ComplexExpand", "(", "analyticalSol", ")"}), ")"}), ",",
" ",
RowBox({"Element", "(",
RowBox({"(CapitalDelta)p", ",", " ", "Reals"}), ")"})}),
")"})), "Input",
CellChangeTimes->{{3.799702119453383*^9, 3.799702156106647*^9}, {
3.7997022143955765`*^9, 3.7997022256841283`*^9}},
CellLabel->"In(97):="),
Cell(BoxData("Undefined"), "Output",
CellChangeTimes->{
3.7997020940830355`*^9, 3.799702157040344*^9, {
3.7997022211933966`*^9, 3.799702226293498*^9}},
CellLabel->"Out(97)=")
}, Open ))
```

Any help would be greatly appreciated!

## calculus – Need help in understanding the integration part of this question

Thanks for contributing an answer to Mathematics Stack Exchange!

- Please be sure to
*answer the question*. Provide details and share your research!

But *avoid* …

- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

## calculus – $lim_{xtoinfty} (sqrt{x+1} + sqrt{x-1}-sqrt{2x})$ using little o function

Problem has to be solved specifically using little o function. I was going to transform $sqrt{x+1}$ into $1+frac{1}{2}x+o(x)$ and $sqrt{2x}$ into $1+frac{1}{2}t+o(t)=1+frac{1}{2}(2x-1)+o(2x)$ but I don’t know what to do with $sqrt{x-1}$. Then, I tried:

$$lim_{xtoinfty} (sqrt{x+1} + sqrt{x-1}-sqrt{2x})=lim_{xtoinfty} (1+frac{1}{2}x+o(x)-1-frac{1}{2}(2x-1)+o(2x) +sqrt{x-1})=lim_{xtoinfty}(frac{1}{2}x+o(x)-frac{1}{2}(2x-1)+o(2x) +sqrt{x-1})$$

What should I do next (if this is correct)? What to do with two different o-functions ($o(x)$ and $o(2x)$) and with $sqrt{x-1}?$

## calculus and analysis – Derivative for conditional expectation of non-independent gaussian variables is increasing

Consider two non-independent gaussian random variables:

$$(t,c)∼text{BiNormal}((𝜇𝑡,𝜇𝑐),(𝜎𝑡,𝜎𝑐),𝜌)$$

I’m interested in understanding when (i.e. for which values of the distribution parameters) it’s true that $$frac{partial E(t |c<f(t)+x)}{partial x}>0$$

where

```
f(t_):=b*CDF(NormalDistribution(μa, σa), t)
```

**What I’ve tried:**

I’ve tried generating an analytical expression for the conditional

expectation, but this fails (output same as input)

```
Expectation(t (Conditioned) c < b*CDF(NormalDistribution(μa, σa), t) + x,
{t, c} (Distributed) BinormalDistribution({μt, μc}, {σt, σc}, ρ))
```

I’ve also tried spelling out the expectation via integrals over the

joint distribution, and then taking derivatives. This does produce a

valid analytical output, but I cannot reduce the expression (error

message *“This system cannot be solved with the methods available to
Reduce”*)

```
D(Integrate(t*PDF(BinormalDistribution({µt, µc}, {σt, σc}, ρ), {t, c}),
{c, -∞, CDF(NormalDistribution(µa, σa), t) + x}, {t, -∞, ∞})/
Integrate(PDF(BinormalDistribution({µt, µc}, {σt, σc}, ρ), {t, c}),
{c, -∞, CDF(NormalDistribution(µa, σa), t) + x}, {t, -∞, ∞}), x)
```

Here is a related question on the analytical treatment of this problem: https://math.stackexchange.com/questions/3692958/parameters-for-which-conditional-expectation-of-non-independent-gaussian-variabl

## What does Lambda Calculus teach us about data?

- Can we generalize that data is just a suspended computation?
- Is this true for other models of computation?
- What books, or papers, one should read to better understand the nature of data and its relation to computation?

Some context: as a software developer, I got used to the concept of data so much that I never considered its true nature. I’d very much appreciate any references that could help me better understand the general connection between data and computation.

## Spivak’s Calculus Chapter 1, Question 19a

I found this post as solution to the question. Here’s a quote for easy reference.

Supposing $y_1$ and $y_2$ are not both $0$, and that there is no number $lambda$ such that $x_1=lambda y_1$ and $x_2=lambda y_2$, then $$begin{array}{tcl}0 &<& (lambda y_1-x_1)^2 + (lambda y_2-x_2)^2 \ &=& lambda^2 (y_1^2+y_2^2)-2lambda(x_1y_1+x_2y_2)+(x_1^2+x_2^2),end{array}$$ and the equation $$lambda^2 (y_1^2+y_2^2)-2lambda(x_1y_1+x_2y_2)+(x_1^2+y_1^{2 *})=0 \$$

hasnosolution $lambda$. So by problem 18(a) we must have $$Bigg(frac{2(x_1y_1+x_2y_2)}{({y_1}^2+{y_2}^2)}Bigg)^2-frac{4({x_1}^2+{x_2}^{2 *})}{({y_1}^2+{y_2}^2)} < 0,****** \$$ which yields the Schwarz inequality.

Notice the heavily asterisked line. I don’t understand how we derive this. I recognize that this is “completing the square.” Question 18 emphasized that $b^2 – 4c < 0$ means $x^2 + bx + c > 0$. Except, in this problem, it’s not clear why he choose the $b$ the way he did. Where does the 2 come from? In the sense that, isn’t $b = frac{-2(x_1y_1+x_2y_2)}{({y_1}^2+{y_2}^2)}$.

## calculus and analysis – Understand output of Integration

Could someone help me understand the output of the following Integration in Mathematica?

Specifically,

(a) what is the meaning of “True”?

(b) Why is the answer in two parts which seem to overlap i.e. x >= 1, and x > 0, but one part is still subtracted from the other?

(c) If the evaluated integral is plotted, it’s showing up as a smooth curve, but the result itself doesn’t get any more compact with FullSimplify?

```
$Assumptions = Element(x, Reals) && Element(x1, Reals) && t > 0 && k > 0;
G1=Tanh(Sqrt((x - x1)^2)/Sqrt(2))
G01 = FullSimplify(Integrate(G1*1, {x1, 0, 1}))
```

Output with Mma 12.0 on Windows 10

```
Piecewise({{-1 + x + Sqrt(2)*Log(4/(1 + E^(Sqrt(2)*(-1 + x)))),
x >= 1}}, 1 - x + Sqrt(2)*
Log(1 + E^(Sqrt(2)*(-1 + x)))) - Piecewise({{x + Sqrt(2)*Log(4/(1 + E^(Sqrt(2)*x))), x > 0}}, -x + Sqrt(2)*Log(1 + E^(Sqrt(2)*x)))
```

## Line integration in pauls notes calculus III

Why did he use [0,2] as the limits of integration in the 3ed curve after substituting the value of x = 1 in x, shouldn’t the limits be [0,1] as in the X axis, so the last integration becomes 4 , please correct me if I am wrong .. Thanks