## When playing on a grid, can I pour a flask of oil on any adjacent square or just on the one I am standing on?

The description of a flask of oil says:

You can also pour a flask of oil on the ground to cover a 5-foot-square area, provided that the surface is level.

When playing on a grid, can I pour a flask of oil on any adjacent square or just on the one I am standing on?

Posted on Categories Best Proxies

## Divide first n square numbers 1^2, 2^2, ……. n^2 into two groups such that absolute difference of the sum of the two groups is minimum [closed]

lets say Given input is n = 6 (n is as large as 100000) My task is to divide {1, 4, 9, 16, 25, 36} into two groups and PRINT these two groups

Possible Solution 1: dividing groups as {1, 9, 36} and {4, 16, 25} which gives abs diff as abs(46 – 45) = 1. So the minimum difference is 1 and the two groups are {1, 9, 36} and {4, 16, 25}

Possible Solution 2: Another Possible Solution is dividing groups as {9, 36} and {1, 4, 16, 25} which gives abs diff as abs(45 – 46) = 1. So the minimum difference is 1 and the two groups are {9, 36} and {1, 4, 16, 25}.

If there are multiple solutions we can print any one. Iam trying to solve it using https://www.geeksforgeeks.org/divide-1-n-two-groups-minimum-sum-difference/ but its not working.

I know that min difference is always 0 or 1 for n >= 6 but how to divide them into two groups.

And can we extend this problem to cubes, fourth powers, so on. if so what is the strategy used

Posted on Categories proxies

## Divide first n square numbers 1^3, 2^3, … n^3 into two groups such that absolute difference of the sum of the two groups is minimum

lets say Given input is n = 3 (n is as large as 100000) My task is to divide {1, 8, 27} into two groups and PRINT these two groups

Possible Solution : dividing groups as {1, 8} and {27} how to print these two groups?

Posted on Categories proxies

## To “rescue” a fallen ally, do you have to enter their 5′ square? [duplicate]

Apologies if this has been answered elsewhere, but I did spend a couple of hours researching this online and didn’t find anything definitve. I DM a campaign in which a party member has fallen unconscious and is about to start making death save rolls the following turn. A character (with flying in this particular example) wants to drag the ally out of the fray and then up to the roof for safety (they are fighting in a small open courtyard). I have seen a lot of opinion on the use of grappling for ally extraction as well as the action and movement economies to answer those related questions. However, right now I need to determine whether the rescuer will provoke an attack of opportunity when they extract the ally. Really, to me, it has come down to whether you are dragging an ally from your own square (and not within 5 feet of an enemy) or whether you have to enter their square in order to drag them.

Posted on Categories Best Proxies

## What is Big O of a loop with square root inside?

Knowing that O(n^2) > O(nlogn) > O(n) > O(sqrt(n)) > O(logn) > O(1) and having below python code:

import math  def f1(n=9):     return math.sqrt(n)  def f2(n=10):     return [math.sqrt(i) for i in range(n)] 
• Am I correct to infer that O(f1(n)) = O(1)
• Am I correct to infer that O(f1(n)) = O(n)

## Expression involving square roots not simplifying

I have a relatively simple expression here that is not simplifying:

$$\frac{2 s_0 \left(\sqrt{\gamma ^5 s_0}+\sqrt{\gamma ^9 s_0}\right)+\sqrt{\gamma ^3 s_0}+2 \sqrt{\gamma ^7 s_0}+\sqrt{\gamma ^{11} s_0}+\sqrt{\gamma ^7 s_0^5}}{\gamma \left(\gamma ^2+\gamma s_0+1\right){}^2}$$

\$  Assumptions = {(s0 | \[Gamma]) \[Element] Reals, \[Gamma] > 0,     s0 > 0}; (Sqrt[s0 \[Gamma]^3] + 2 Sqrt[s0 \[Gamma]^7] + Sqrt[s0^5 \[Gamma]^7] +    Sqrt[s0 \[Gamma]^11] +    2 s0 (Sqrt[s0 \[Gamma]^5] + Sqrt[s0 \[Gamma]^9]))/(\[Gamma] (1 +      s0 \[Gamma] + \[Gamma]^2)^2) // Simplify (Sqrt[s0 \[Gamma]^3] + 2 Sqrt[s0 \[Gamma]^7] + Sqrt[s0^5 \[Gamma]^7] +     Sqrt[s0 \[Gamma]^11] +     2 s0 (Sqrt[s0 \[Gamma]^5] + Sqrt[s0 \[Gamma]^9]))/(\[Gamma] (1 +       s0 \[Gamma] + \[Gamma]^2)^2) == Sqrt[s0 \[Gamma]] // Simplify 

The output is:

(Sqrt[s0 \[Gamma]^3] + 2 Sqrt[s0 \[Gamma]^7] + Sqrt[  s0^5 \[Gamma]^7] + Sqrt[s0 \[Gamma]^11] +   2 s0 (Sqrt[s0 \[Gamma]^5] + Sqrt[s0 \[Gamma]^9]))/(\[Gamma] (1 +     s0 \[Gamma] + \[Gamma]^2)^2) True 

Why is Mathematica not simplifying to this much simpler form $$\sqrt{s_0 \gamma}$$, I think my assumptions should be enough. I can do the simplification by hand

Posted on Categories cheapest proxies

## Symplifying expressions with exponentials inside square root

I have an expression $$\exp (i k x) \sqrt{y^2 \exp (-2 i k x)}$$ When I put this in Mathematica and do FullSimplift, it gives

FullSimplify[Exp[I k x] Sqrt[Exp[-2 I k x] y^2]] 

The output is $$e^{i k x} \sqrt{y^2 e^{-2 i k x}}$$ Even if I give all proper assumptions $$\{x,y, k\} \in \mathbb R$$ and $$-\pi < k \leq \pi$$ like this

FullSimplify[Exp[I k x] Sqrt[Exp[-2 I k x] y^2], {x, y, k} \[Element] Reals && -\[Pi] < k <= \[Pi]] 

The output comes as $$\left| y\right| e^{i k x} \sqrt{e^{-2 i k x}}$$ But the exponentials should not be there anymore, the result should be only $$\left| y\right|$$.

What simplification or assumptions to make, to get the desired result?

Posted on Categories cheapest proxies

## How to find the square with the highest total sum

I have an integer matrix of size 4n x 4n. I need to select a part of the matrix of size n^2 from which adds up to the most.

For example if n = 3. I have a matrix of size 12 x 12. In the below picture, you can clearly see that n^2 square (outlined in red) adds up to the most. For simplicities sake, I made all the numbers 5, expect for 9 of the boxes which are 9999 so its clear that that is the n^2 squares that add up to the most. My approach to solving this problem was to essentially create a n^2 square and brute force the entire 4n x 4n matrix. However, that runs in O(n^4) time complexity. How can I do it in O(n^2)?

## How to mathematically determine row, column, and sub-square of cell in nxn array where n is a perfect square?

Given an one dimensional array of size nxn, where n is a perfect square How can one mathematically determine the row, column, and/or sub-square the cell resides in? Additionally, is there a mathematical way to traverse the subsquare? Posted on Categories proxies

## Problem with making torus graph in Graph3D by identifying edge of a square graph

Background: I want to imply periodicity along the given edges for a graph. For example in a square lattice with identifying parallel edges, you can construct a torus. consider the following image nmax = 15;(*Length of lattice*) points = Flatten[Table[{i, j}, {i, -nmax, nmax}, {j, -nmax, nmax}],       1];(*list coordinate of the lattice*) d1 = (Sqrt + 1)/2;(*Max distance to construct linked between coordination of the lattice*) d0 = 1/2;(*Min distance to construct linked between coordination of the lattice*) nn = Nearest[points -> "Index"]; (*function which determine the nearest of a vertex. we can do this*)  (*also by for example DistanceMatrixor or NearestNeighborGraph*) ha = Select[    Flatten[ParallelTable[Module[{pp}, pp = nn[points[[i]], {10, d1}];       Select[{i + 0 pp, pp,            Norm /@ ((points[[pp]]\[Transpose] -                 points[[i]])\[Transpose])}\[Transpose],          d1 > #[] &][[All, {1, 2}]]], {i, 1, Length[points]}],      1], #[] > #[] &]; (*I use select to just consider one linke between two vortex ,*) (*This part is somehow hard to catch at a glince but it did not *) (*change following discussion. Consider this line  as a function*) (*making nearest neighbor links*) Graph3D[ha] 

where gives, now I am looking to identifying edges. I use the following, for the left and right one

vortexL =points//SortBy[Flatten[Position[#[[All, 1]], Max[#[[All, 1]]]]], points[[#, 2]] &] &; vortexR =points//SortBy[Flatten[Position[#[[All, 1]], Min[#[[All, 1]]]]],points[[#, 2]] &] &; 

and for up and down edge we have

vortexU =points//SortBy[Flatten[Position[#[[All, 2]], Max[#[[All, 2]]]]], points[[#, 1]] &] &; vortexD =points//SortBy[Flatten[Position[#[[All, 2]], Min[#[[All, 2]]]]],points[[#, 1]] &] &; 

now i define identifier as

vchanger = {Table[vortexL[[i]] -> vortexR[[i]], {i, 1, Length@vortexL}],Table[vortexU[[i]]-> vortexD[[i]], {i, 1, Length@vortexU}]}; 

By applying it on ha (the link address) sequentially you can see how periodicity along those edges established,

ha = ha /. vchanger[]; Graph3D[ha] and

ha = ha /. vchanger[]; Graph3D[ha] 

where gives, although it seems torus, by rotation it, you notify two crossings of the links Question? So I am wondering, I did a mistake to construct the lattice and implication of periodic boundary condition, or this is the problem of Mathematica? Do someone has an option for Graph3D to make it correct shape?

Update My problem is almost the visualization of correct geometry this lattice has.

Posted on Categories cheapest proxies