## export – Exporting multiple lists (x1,y1…n) (x2,y2..n)of different lengths into same excel files separated by spaces of two columns between each (x,y) list?

I have multiple lists like this this with different lengths and different x, y values,

``````list1 = {{3., 1.49463}, {3.1, 1.49238}, {3.2, 1.49027}, {3.3, 1.48814}, {3.4,
1.48592}, {3.5, 1.48366}, {3.6, 1.48158}, {3.7, 1.47997}, {3.8,
1.47894}, {3.9, 1.47848}, {4., 1.47824}, {4.1, 1.47892}, {4.2,
1.47973}, {4.3, 1.4809}, {4.4, 1.48231}, {4.5, 1.48374}, {4.6,
1.48498}, {4.7, 1.48589}, {4.8, 1.4865}, {4.9, 1.4869}, {5.,
1.48717}}

list2 = {{0.3, 1.70796}, {0.4, 1.69032}, {0.5, 1.66887}, {0.6, 1.65187}, {0.7,
1.64455}, {0.8, 1.64575}, {0.9, 1.65089}, {1., 1.65581}}

list 3 = {4.1, 1.47892}, {4.2, 1.47973}, {4.3, 1.4809}, {4.4, 1.48231}, {4.5,
1.48374}, {4.6, 1.48498}, {4.7, 1.48589}, {4.8, 1.4865}, {4.9,
1.4869}, {5., 1.48717}}
``````

and so on until 10 lists and all of them have different lengths with some having (x,y) sets as much as 30 (x1,y1),(x2,y2) … (x30,y30) like that,

i want to list them list this in single excel sheet with two different options whichever you can guide,

list 1 x,y values (next list after two columns separation) –list 2 x,y values– (next list after two columns separation) -**list 3 x,y values****

list 1 x,y values (no separation)- list 2 x,y values– (no separation)- list 3 x,y values

## algorithms – Is weighted interval scheduling where the weights are the interval lengths simpler/faster

In weighted interval scheduling arbitrary weights are given to the intervals. A clean dynamic programming solution runs in $$O(n log n)$$ time.

If the weights of the intervals are their integer lengths, is the problem any simpler or solvable in linear time? We can assume the intervals are given in order of finish time so those don’t have to be sorted.

## mg.metric geometry – The product of the lengths of two line segments that belong to Newton line

I am looking for the proof of the following claim:

Consider a family of bicentric quadrilaterals with the same inradius length. Denote by $$P$$ and $$Q$$ the midpoints of the diagonals, and by $$I$$ the incenter. Then, $$|PI| cdot |QI|$$ has the same value for all quadrilaterals in the family.

The GeoGebra applet that demonstrates this claim can be found here.

## algorithms – List the lengths of all the prefix-suffixes in \$O(n^{1+epsilon})\$ time

A proper prefix of a string $$s$$ that is also equal to a suffix of $$s$$ is called a PS (prefix-suffix).

Given a string $$s$$ of length $$n$$ is there an algorithm listing the lengths of all the PSs in $$O(n^{1+epsilon})$$ time?

KMP can find the longest PS in linear time. Then we can note that the second longest PS is the longest PS of the longest PS so we can apply KMP iteratively but that is $$O(n^2)$$ in the worst case (e.g. if $$s=aaaadots a$$).

## sensor – How are focal lengths derived from camera calibration (resectioning) and pixel sensitive area related?

In camera calibration (camera resectioning process, e.g. camera calibration with OpenCV) does the result for focal lengths fx and fy depend on the photo-sensitive area inside the pixel ?

If I have a camera sensor (CCD/CMOS) with a perfect square grid arrangement of pixel elements, but each pixel element has rectangular pixel sensitive area (photodiode).
For example, pixel dimensions are a x a, but photosensitive area dimensions are 0.5*a x a.
Would result of camera calibration still be fx = fy ?

And what if the pixel sensitive area has some arbitrary shape due to additional electronics in CMOS ?

## mg.metric geometry – Bounds on the lengths of circuits in a metric space

Given a collection $$V$$ of $$N$$ points in a metric space $$(M, d)$$, I define a circuit as a sequence $$w = (w_1, w_2, …, w_N)$$ which visits each point in $$V$$ and has a length given by
$$|w| = sum_{i=1}^N d(w_i, w_{i+1})$$
where $$w_{N+1} = w_1$$. I am interested in
$$omega_{text{min}} = min_w |w|$$
$$omega_{text{max}} = max_w |w|$$
and how they may be related to the constants
$$C_p = sum_{v in V} d(v, p)$$
As such, I considered the smallest such constant
$$C = min_{p in M} C_p$$
and it seemed that
$$C le omega_{text{max}} le 2C$$
for all collections $$V$$. Have I missed any obvious counter examples?

So far I have only found a proof for $$omega_{text{max}} le 2C$$. For any circuit $$w$$, consider the sum of the perimeters of all triangles with vertices $$w_i$$, $$w_{i+1}$$ and $$p$$. This should evaluate to $$|w| + 2C_p$$ and by the triangle inequality this is at least $$2|w|$$.

Intuition tells me that $$omega_{text{max}} = 2C$$ iff the points in $$V$$ are colinear, since this is when we have equality in the triangle inequality. Is this correct?

Finally, I know examples where $$omega_{text{min}} le C$$ and other examples where $$C le omega_{text{min}}$$ but for large $$N$$ it seems that the former is more likely. Is there a condition on $$V$$ which requires $$omega_{text{min}} le C$$ regardless of the metric space?

Any help towards answering these questions would be greatly appreciated.

## summation – Confuse about joining and totaling sets with different lengths

Here is my code:

``````Timeval = 1;
Rval = 8;
Flap(s_) := Exp(-2 Sqrt(s));
Tfunexact(t_) := Exp(-1/t)/Sqrt(Pi*t*t*t);
Valexact = N(Tfunexact(Timeval), 20)
math(F_, t_, M_) :=
Module({np, r, S, theta, sigma},
np = Max(M, \$MachinePrecision);
r = SetPrecision(2 M/(5 t), np);
S = r theta (Cot(theta) + I);
sigma = theta + (theta Cot(theta) - 1) Cot(theta);
(r/(3 M)) Total(Join @@  {Exp(r t) F(r),
2 Table(Re(Exp(t S) (1 + I sigma) F(S)),
{theta, 2 Pi/M, (M/2 - 1) Pi/M, 2 Pi/M})
})
)
{Timeval, Approxval} = Timing(N(math(Flap, Timeval, 20)))
RelError = Abs(Approxval - Valexact)/Valexact
``````

The output is showing the set not the total of joining set. The result should be a numeric. Pleas help me! Also have tried to use `Plus @@` but still failed since the length of the sets are not the same. Thanks in advance.

## Understanding paths of given lengths in tournaments

I was reading the paper: paths of given lengths in tournaments (https://arxiv.org/pdf/2012.00262.pdf).

I could not understand how Theorem 1 and 2 are equivalent by a "standard graph limit argument".

Any explanation (with external links) would be appreciated.

## mathematical optimization – Optimizing the edge lengths of a graph(again)

This is a follow up to my previous question posted here

The code below is from the answer provided here

``````Clear(solution3d);
solution3d(uedges_, edgeweight_) :=
Module({ew, graph, dmat, newcoords, vcoords3, newLayout, vars,
weights, objective, min, vals, newercoords, xyz,
DistanceMatrixDimensionReduce},
ew = KeyMap(UndirectedEdge @@ # &, edgeweight);
graph =
Graph3D(Keys(ew), EdgeWeight -> Normal(ew),
VertexLabels -> Placed("Name", Center),
EdgeLabels -> {e_ :> Placed("EdgeWeight", Center)},
VertexSize -> .3, VertexStyle -> Red);
dmat = GraphDistanceMatrix(graph);
DistanceMatrixDimensionReduce((dmat_)?MatrixQ, dim_ : 3) :=
With({len = Length(dmat)},
Module({diffs, dist2mat, onevec, hmat, bmat, uu, ww, vv},
onevec = ConstantArray({1}, len);
hmat = IdentityMatrix(len) - onevec.Transpose(onevec)/len;
dist2mat = -dmat/2;
bmat = hmat.dist2mat.hmat; {uu, ww, vv} =
SingularValueDecomposition(bmat, dim); uu.Sqrt(ww)) /;
dim <= Length(dmat((1))) && MatchQ(Flatten(dmat), {_Real ..}));
newcoords = DistanceMatrixDimensionReduce(dmat);
newLayout =
Graph(Keys(ew), VertexCoordinates -> newcoords, EdgeWeight -> ew,
VertexLabels -> Placed("Name", Center),
EdgeLabels -> {e_ :> Placed("EdgeWeight", Center)},
VertexSize -> .3, VertexStyle -> Red);
vars = Array(xyz, {VertexCount(graph), 3});
objective =
Sum(If(weights((i, j)) >
0, ((vars((i)) - vars((j))).(vars((i)) - vars((j))) -
weights((i, j))^2)^2, 0), {i, Length(weights) - 1}, {j, i + 1,
Length(weights)});
{min, vals} =
Quiet@FindMinimum(objective,
vcoords3 = MapIndexed(#2((1)) -> # &, newercoords);
newLayout =
Graph3D(Keys(ew), VertexCoordinates -> vcoords3, EdgeWeight -> ew,
VertexLabels -> Placed("Name", Center),
EdgeLabels -> {e_ :> Placed("EdgeWeight", Center)},
VertexSize -> .3, VertexStyle -> Red);
Return(<|"newcoords" -> newcoords, "error" -> min|>))
``````

For the `edges` and `ew` specified below the code works well for repositioning the nodes of the network
to meet the distance requirements provided as edge weights.To create a layout that meets the distance requirements, an inital layout, which created using multidimensional scaling, is used for optimization via FindMinimum.

``````edges = {{1, 2}, {1, 3}, {1, 4}, {2, 5}, {2, 6}, {5, 6}, {3, 4}, {3,
7}, {6, 7}, {7, 8}, {2, 9}};
ew = <|{1, 2} -> 49.6, {1, 3} -> 74.4, {1, 4} -> 49.6, {2, 5} ->
37.2, {2, 6} -> 74.4, {5, 6} -> 49.6, {3, 4} -> 37.2, {3, 7} ->
24.8, {6, 7} -> 62, {7, 8} -> 37.2, {2, 9} -> 24.8|>;
result = solution3d(edges, ew)
Print(result);
``````

But the error for the following input (added externally due to the limitation in characters that can be added here) is really large. I’d like to know if there are other methods to create better initial layouts that can be supplied to FindMinimum.

Error returned from the code for the below edges and ew is error->4.53978*10^11.

edges, ew (also shared here)

## python 3.x – Combining two pandas dataframes/tables of unequal lengths

I have two dataframes of different lengths.
df1: df2:

``````  Column1  Column2             ColumnA ColumnG ColumnSG
0    ab1       bc1                ab1      A      AA
1    ab2       ab5                bc1      B      BB
2    ab3       bc4                ab3      C      CC
3    ab4       ab5                ab1      D      DD
4    ab5       ab1                ab5      E      EE
bc4      F      FF
ab2      G      GG
ab4      H      HH
``````

I would like an output that looks something like this:

df1:

OUTPUT

What I tried so far?

``````for row in df1, df2:
if df1[Column1] == df2[ColumnA]:
df1[ColumnG1] = df2[ColumnG]
df1[ColumnSG1] = df2[ColumnSG]
``````

But, this gave me an error saying,
ValueError: Can only compare identically-labeled Series objects

How can I solve this?