## How to calculate Laurent series in mathematica about some point zo and annulus a

Thanks for contributing an answer to Mathematica Stack Exchange!

But avoid

• Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

## plotting – Difficulty refactoring a graphics point from displaying a tooltip to a label when using show to combine point with a plot

I have a Plot(...) of a system of linear equations and a function graphicsPoint(...) that generates a graphics point to show where the lines intersect. The Tooltip(...) version of graphicsPoint(...) at the intersection point works but a Labeled(...) version is preferred which should be placed next to but above the graphics point.

I am aware of using Callout(...) but this is not preferred because it needs to wrap one of the equations which are generated by another function and would greatly complicate the code for that function. However if I am misunderstanding it’s use and can be done without wrapping one of the equations I am open to it.

Below are two versions of the graphicsPoint(...).

Here is the desired plot of system of two linear equations. This works…

plot = Plot({(1 - x)/2, -2 - 3 x}, {x, -3, 1}, PlotRange -> {-1, 3},
PlotStyle -> Thick, PlotLabels -> {y == (1 - x)/2, y == -2 - 3 x},
AxesLabel -> {x, y}, ImageSize -> {Automatic, 200})


This tooltip version of graphicsPoint(...) works alone and when combined with plot=Plot(...) using Show(plot,graphicsPoint(...))

graphicsPoint(loc_ : {0, 0}, color_ : Red, size_ : 8) :=
Block({graphic},
graphic = If(Length(loc) == 2, Graphics, Graphics3D);
graphic({
color, AbsolutePointSize(size), Tooltip(
Point(loc), loc,
TooltipStyle -> {22, Black, Background -> LightBlue}
)
}));
graphicsPoint({-1, 3})
Show(plot, graphicsPoint({-1, 3}))


graphicsPoint2(...) is the attempted refactor of said graphics point replacing Tooltip(...) with Labeled(...). It only halfway works alone as it does label the point but far below it at the very bottom of the bounding box rendering it almost useless. It creates an error when combined using Show Also note that the BaseStyle for Labeled(...,BaseStyle) is mostly ignored by Mathematica…

graphicsPoint2(loc_ : {0, 0}, color_ : Red, size_ : 8) := Block({fn},
fn = If(Length(loc) == 2, Graphics, Graphics3D);
Labeled(
fn({
color,
AbsolutePointSize(size),
Point(loc)
}
),
loc, BaseStyle -> {22, Black, Background -> LightBlue})
);

graphicsPoint2({-1, 3})
Show(plot, graphicsPoint2({-1, 3}))


## redirect – How to point godaddy domain homepage to WIX and subfolders to bluehost?

I have a domain from godaddy which I point to Bluehost with an A-record. This works fine and I can then host the website and email from Bluehost.

But now I want to host just the homepage on WIX, and leave the rest of the site on Bluehost. I can setup a redirect from Bluehost to WIX but then the user sees an unfriendly URL in the address bar.

Is there was to do fix this neatly (so the user does not see the WIX url in the address bar), either with a tweak to the redirect, or changes to the DNS etc?

Many thanks!

## Cancellation of inequalities in floating point arithmetic

In finite precision floating point arithmetic the associative property of addition is not satisfied. This is, it is not always the case that $$(a+b)+c=a+(b+c)$$
Even $$a=(a+b)-b$$ is not always true.

To prove that $$x+y is equivalent to $$x with real numbers we can add $$-y$$ on both sides of $$x+y to get $$(x+y)-y and then from this $$x=x+(y-y). But I can’t repeat the last step for floating point.

Question 1: Are the inequalities $$x+y and $$x equivalent in finite precision floating point arithmetic?

Question 2: Are the inequalities $$x+yleq z$$ and $$xleq z-y$$ equivalent in finite precision floating point arithmetic?

Motivation: There is that interview problem that given an ordered array of numbers and a threshold it asks for the number of pairs of numbers of the array which sum is not larger than the threshold. Possible solutions aside, I wanted to understand the particular point of the dangers of switching between testing $$x+y (and also $$leq$$ depending on which variant of the problem is presented) and testing $$x (or $$leq$$).

## Visitor Pattern: what’s the point of the accept method?

I’m trying to fully understand the visitor pattern. What I’ve learnt so far (correct me if I’m wrong) is:

• It’s about adding operations to classes, without modifying the source code of those classes. Or put another way, to bend the OOP approach to have functions and data structures separated.
• It’s a common misunderstanding that it has to do with hierarchies of objects (although it can be very useful in that case).

I think I get it, but there is a thing that looks unnecessary to me, and that’s the accept method in the classes “to be visited”. Let’s set up a small example in Java. First the class hierarchy to be enriched with operations, but it’s not to be modified:

interface Animal {
void accept(AnimalVisitor visitor);
}

class Dog implements Animal {
void accept(Animal visitor) {
visitor.visitDog(this);
}
}

class Cat implements Animal {
void accept(Animal visitor) {
visitor.visitCat(this);
}
}


Then the visitor interface and a dummy implementation of that interface, representing an operation to make some sound.

interface AnimalVisitor {
// These methods could be just called "visit" and rely on overloading,
void visitDog(Dog dog);
void visitCat(Cat cat);
}

class MakeSoundVisitor implements AnimalVisitor {
void visitDog(Dog dog) {
// In a real case you'd obviously do something with the dog object
System.out.println("bark! bark bark!!");
}

void visitCat(Cat cat) {
System.out.println("meow meeeoooww!!");
}
}


And then an usage of all of this would be:

var makeSoundVisitor = new MakeSoundVisitor();
var cat = new Cat();
var dog = new Dog();

cat.accept(makeSoundVisitor);
dog.accept(makeSoundVisitor);


But I really don’t see the point of that accept call. If you’ve got the visitor and the objects to be visited, why not just pass these objects directly to the visitor and avoid the indirection? You could even get rid of the accept method on the Animal interface. Something like this:

var makeSoundVisitor = new MakeSoundVisitor();
var cat = new Cat();
var dog = new Dog();

makeSoundVisitor.visitCat(cat);
makeSoundVisitor.visitDog(dog);


Sources:

## how to convert android 10 phone to a software access point

I have an android 10 device which I would like to use use as software access point. I have broadband connection landline in my home. There are some corners where signals dont reach. So I want to use my spare android phone to convert it to a software access point. If this is some how possible then please let me know. I want my phone to be connected to the exisiting wifi network at a location in which signal is comming and at the same time want to convert the phone to work as an AP.
The phone is already connected to Wifi network in my ADSL router.

## differentiability – How to write a custom function to judge whether a binary function is differentiable at a certain point

We know that the necessary and sufficient conditions for a function of two variables to be differentiable at a certain point are complex.

Suppose the function $$z = f (x_ 1, x_ 2, …, x_n)$$ is defined in the neighborhood $$U$$ of the point $$P_ 0 (x_ {10}, x_ {20}, …, x_{n0})$$ , then the sufficient and necessary conditions for the function $$z = f (x_ 1, x_ 2, …, x_n)$$ to be differentiable at the point $$P_ 0 (x_ {10}, x_ {20}, …, x_{n0})$$ are: The n first-order partial derivatives of the function $$z = f (x_ 1, x_ 2, …, x_n)$$ at the point $$P_ 0 (x_ {10}, x_ {20}, …, x_{n0})$$ all exist, and $$f (x_ 1, x_ 2, …, x_n) – f (x_ {10}, x_ 2, …, x_n) – f (x_ 1, x_ {20}, …, x_n) – f (x_ 1, x_ 2, …, x_{n0}) + f (x_ {10}, x_ {20}, …, x_{n0}) = O (rho)$$ ;

Where $$(x_ 1, x_ 2, …, x_n) in U$$, $$rho = sqrt{(x_ 1 – x_ {10})^2 + (x_ 2 – x_ {20})^2 + … + (x_n – x_ {n0})^2}$$.

I already know that the following binary function $$f(x,y)$$ is differentiable at point {0,0}, but its two first-order partial derivatives are not continuous at {0,0}:
$$f(x, y)=begin{cases}(x^2 + y^2) sin(frac{1}{(x^2 + y^2)}), &(x, y) neq (0, 0) cr 0 , &(x, y)=(0, 0)end{cases}$$

I want to write a custom function to judge whether any binary function is differentiable at a certain point. How should I write this function?

For example, through this custom function, we can judge that the following binary function is not differentiable at {0,0}:

$$f(x, y)=begin{cases}frac{x^2y}{x^4 + y^2}, &(x, y) neq (0, 0) cr 0, &(x, y)=(0, 0)end{cases}$$

## Neighborhood of a point (real number)

How can we prove that every real number has infinitely many neighbourhoods?
I know that it is true because we can consider a symmetric epsilon neighborhood of a point and there are infinitely many number of such epsilons.
But how can we prove it rigorously?

## algorithms – Intersection of line segments induced by point sets from fixed geometry

I am reading up on algorithms and at the moment looking at the below problem from Jeff Erickson’s book Algorithms.

I solved (a) by seeing a relationship to the previous problem on computing the number of array inversions. However, I am struggling with problem (b) as I cannot see how to reduce the circle point arrangement to an arrangement of points and lines that would be an input to the problem posed in (a). Assuming I have something for (b), I also cannot see how one might resolve (c).

For part (b), clearly every point $$p = (x, y)$$ satisfies $$x^2 + y^2 = 1$$ but I do not see how I might be able to use this fact to do the reduction. The runtime I am shooting for of $$O(n log^2 n)$$ also seems to tell me the reduction is going to cost something non-trivial to do.

Can anyone have some further hints/insights that might help with part (b) and potentially even part (c)?

## algorithm – Stepping from Point out on Archimedes Spiral for Length along Arc

Can any Archemedean spiral be derived from one common template?

Yes: you can verify this using the parametric equation itself. Let’s define the $$pitch$$ of a spiral to be the rate at which its radius changes as its angle changes. So your “unary” spiral is the spiral with $$pitch = 1$$:

$$Spiral_1(theta) = 1 cdot theta begin{bmatrix} cos theta \ sin thetaend{bmatrix}$$

And a spiral with any arbitrary pitch can be expressed as…

begin{align} Spiral_{pitch}(theta) &= pitch cdot theta begin{bmatrix} cos theta \ sin thetaend{bmatrix} \ &= pitch cdot Spiral_1(theta) end{align}

How can we compute a point a particular length further along the spiral from a given start point?

First we can differentiate our spiral function to get its rate of change:

begin{align} frac {d Spiral_{pitch}} {d theta}(theta) &= {pitch} begin{bmatrix} cos theta \ sin thetaend{bmatrix} + {pitch} cdot theta begin{bmatrix} -sin theta \ cos thetaend{bmatrix}\ &= {pitch} begin{bmatrix} cos theta -theta sin theta \ sin theta + theta cos thetaend{bmatrix} end{align}

And get its length:

$$left| left| frac {d Spiral_{pitch}} {d theta}(theta)right| right| =sqrt{{pitch}^2 left( left( cos^2 theta – 2 theta cos theta sin theta + theta^2 sin^2 theta right ) + left( sin^2 theta + 2 theta cos theta sin theta + theta^2 cos^2 theta right) right)} \ = {pitch} cdot sqrt{theta^2 + 1}$$

Then integrate this from our starting angle to our ending angle (using Wolfram Alpha):

begin{align} L &= {pitch} int_alpha^beta sqrt{theta^2 + 1}dtheta\ &= frac {pitch} 2 left( theta sqrt{theta^2 + 1} + lnleft(sqrt{theta^2 + 1} + thetaright) right) Biggr| ^ beta _alpha end{align}

Now inverting this beast is a mess, so in the past I’ve approximated it and then used the Newton-Raphson method a few times to reduce the error to within my needed precision. It’s a strictly increasing function whose slope changes very gradually, so it’s quite well-behaved for this use, thankfully.

// Compute the arc length from the origin to a given angle
// along a spiral with pitch = 1. radical = sqrt(angle*angle + 1)
float UnitSpiralArcLength(float angle, float radical) {
}

// Given a starting angle, compute a new angle that is a particular
// arc length away, along a spiral with a chosen pitch.
float ShiftSpiralAngle(float pitch, float startAngle, float signedLengthShift) {
// This square root is both the length of the derivative at this angle,
// and useful in computing the arc length up to that point, so let's cache it.
float radical = Mathf.Sqrt(startAngle * startAngle + 1f);

// On a pitch = 1 spiral, how far from 0 do we start?

// How far from zero do we want to end?
float targetLength = startLength + signedLengthShift / pitch;

// Start with a naive estimate of what angle gets us to here.
// We use derivative at start angle to guess how much angle to add.
float estimatedAngle = startAngle + (targetLength - startLength) / radical;

// Refine our estimate using the Newton-Raphson method.
// You can adjust a fixed iteration count, or use an error threshold.
for(int i = 0; i < 10; i++) {
radical = Mathf.Sqrt(estimatedAngle * estimatedAngle + 1f);
float error = UnitSpiralArcLength(estimatedAngle, radical) - targetLength;