Breadth-first traversal: difference between generation and expansion

Romanian map

The question here is to find a path from A(rad) to B(ucharest). I’ll be using the initials of the cities in the picture instead of their full names.

Some ground-rules: we’re traversing in alphabetical order. And traversal must stop once the goal node has been generated, not expanded. This last part is where I feel like I’m not completely understanding what is being asked.

So the solution given is: Arad, Sibiu, Timisoara, Zerind, Fagaras, Bucharest.

What I think the solution is as follows: we’re at A so A has been “generated”. And then we expand A, giving us: A, S, T, Z. Since the goal node hasn’t been generated we start with S. Expanding S gives us F and R (no goal node yet) and then we expand T giving us L following which Z is expanded giving us O. So far we have A, S, T, Z, F, R, L, O. Now, going alphabetically, we go to F for expansion. This gives us B and this is where the traversal should stop.

So my solution is A, S, T, Z, F, R, L, O, B.

Can you tell me where I’m going wrong and why the given solution (as opposed to my solution) is correct?

Coefficient of power $p$ in polynomial expansion : mathematica doesn’t answer me

I would like to access the coefficient in front of $ n^p$ for a polynomial expansion.

I wrote the following code:

f[n_, q1_, q2_] := (n^q1 + (n + 1)^q1)* (n^q2 + (n + 1)^q2)  SeriesCoefficient[f[n, q1, q2], {n, 0, p},   Assumptions -> {Element[q1, Integers] && q1 >= 0,     Element[q2, Integers] && q2 >= 0 }] 

However, mathematica doesn’t compute anything. Why ?

I would expect an expression that would make appear the binomial coefficient (I can do it by hand it is not very complicated thus I wonder why mathematica cannot).

Global Taylor Expansion of a Function on a Manifold with Boundary

Let $ (M,g)$ be a compact Riemannian manifold with boundary and let $ f:M\rightarrow \mathbb{R}$ be a smooth function. Let $ r:M\rightarrow \mathbb{R}$ denote the distance to the boundary $ d(\cdot, \partial M)$ .Let $ N\varepsilon = \{ x\in M : r(x)<\varepsilon\}$ . It is well known that for small enough $ \varepsilon$ we can form boundary normal coordinates.

I was interested in Taylor expanding an integral operator of $ f$ near the boundary in terms of $ r$ . We can write $ f$ in boundary geodesic coordinates $ (x^1,…x^n)$ on a neighborhood $ U$ . Where $ x^1$ is equal to the distance from the boundary and $ (x^2,…,x^n)$ are normal coordinates in a neighborhood $ U_\partial$ of $ \partial M$ . We then have: $ $ \int_{U} f(x^1,…,x^n) \sqrt{|g|}dx^1,…,dx^n = \int_{U} f(0,x^2,…,x^n) + \frac{\partial f}{\partial x^1}\Big|_{(0,x^2,…x^n)}x^1 +\frac{\partial^2 f}{\partial (x^1 )^2}\Big|_{(0,\zeta)}(x^1)^2\sqrt{|g|}dx^1,…,dx^n. $ $

We then can separate out the terms involving $ x^1$ to obtain: $ $ \int_{U} f(x^1,…,x^n) \sqrt{|g|}dx^1,…,dx^n = \int_{0}^\varepsilon dx^1 \int_{U_\partial} f(0,x^2,…,x^n) \sqrt{|g|_\partial}dx^2…dx^n + \int_{0}^\varepsilon x^1 dx^1 \int_{U_\partial}\frac{\partial f}{\partial x^1}\Big|_{(0,x^2,…x^n)}\sqrt{|g|_\partial}dx^2,…,dx^n + \mathcal{O}(\varepsilon^3) $ $

I am trying to “patch together” this local argument into a global result. The first term (up to constant) is really just the integral of $ f$ over the boundary. The second term seems like it is $ df(\partial_1)$ where $ \partial_1$ is the gradient of $ r$ .

I suspect that I am mistaken. If $ \partial M$ is not orientable, then this suggests that grad $ r$ is an outward facing globally-defined vector field near the boundary.

I was wondering if there was anyone who could clarify the obstruction here. Is grad $ r$ simply not smooth on the boundary? Is that the only problem?

If there is also a good reference on doing analysis on tubular neighborhoods, that would be much appreciated!

Variable expansion in substitution

I have small script and I struggle with how variables expansion works.

for repo_data_path in $  {PROJECTS_HOME}/**/.git(e:'[[ ! $  REPLY =~ ".*local-hound/data/vcs.*"  ]]':) ; do   repo_path=($  {repo_data_path:h})   cat << REPOSITEM         "$  {repo_path:t}" : {             "url" : "file://$  {repo_path:s_/Users/mailo/Projects/my_/projects_}"         }, REPOSITEM done 

The script is provided with variable PROJECTS_HOME. Let’s say this variable contains /Users/mailo/Projects/my.

I do use this variable at the beginning and it works. I just don’t know how to make it expanding in the substitution, where I currently use hardcoded path — $ {repo_path:s_/Users/mailo/Projects/my_/projects_}.

sed variable expansion not working (unterminated `s’ command)

I have a file named config.yaml that contains this line:

device_connection_string: "<ADD DEVICE CONNECTION STRING HERE>" 

I want to replace <ADD DEVICE CONNECTION STRING HERE> with the value of the following variable:

root@ubuntu1804-ko-001:/tmp# echo "$  CSTRING";DeviceId=ubuntu1804-ko-001;SharedAccessKey=xdWDu2gnzlg8X1mHgGqYU+yECBYUJ065n1AjdkYNCWI= root@ubuntu1804-ko-001:/tmp# 

When I run this sed command, I get the unterminated s error:

sed -i "s/<ADD DEVICE CONNECTION STRING HERE>/$  CSTRING/g" config.yaml sed: -e expression #1, char 38: unterminated `s' command 

Thank you for your help!

the sims 4 expansion packs

Press the "Download Now" button to download the sims 4 expansion packs installer.
The whole process will just take a few moments.



– Title: the sims 4 expansion packs
– Download type: safety (no…

the sims 4 expansion packs

bash shell script, searching for complex line in makefile (shell parameter expansion issue)

I have an annoying problem, I want a script to search through a makefile (using grep) for a particular annoying line. The problem is best illustrated concretely:

someMakefile (minimal Makefile):

#!/usr/bin/env bash echo bla bla OBJ_DIR='something' EXE_FILE='my_exe' cp $  (OBJ_DIR)/$  (EXE_FILE) ../bin/. echo 'doing something else now' (test for the existence of the difficult line):


#!/usr/bin/env bash set -x foundNumLines = $  (grep -in 'cp $  (OBJ_DIR)/$  (EXE_FILE) ../bin/.' someMakefile) echo "foundNumLines = $  foundNumLines" set +x 

From the commandline (this DOES work):

$   grep -in 'cp $  (OBJ_DIR)/$  (EXE_FILE) ../bin/.' someMakefile 5:cp $  (OBJ_DIR)/$  (EXE_FILE) ../bin/. 

From the script (this does NOT work and I cannot figure out how to make it work):

$   ./  ++ grep -in 'cp $  (OBJ_DIR)/$  (EXE_FILE) ../bin/.' someMakefile + foundNumLines = 5:cp '$  (OBJ_DIR)/$  (EXE_FILE)' ../bin/. ./ line 4: foundNumLines: command not found + echo 'foundNumLines = ' foundNumLines =  + set +x 

When “grep” works from the script, I wanted to use maybe “wc” or similar, to detect the presence of the line and then do something, based on this…

I just cannot make it work, tried many combinations of “‘” \’ etc – I hope you understand, what I’m trying to achieve, please help with ideas/suggestions, thanks!

Is a Duergar’s Expansion and Invisibility abilities spell-like or psi-like? And does it matter?

The Duergar in the Monster Manual says that their expansion and invisibility abilities are spell-like abilities. But in the Expanded Psionics Handbook they are psi-like abilities.

Which is it? And does it matter? For example, if there was an area effect spell that prevented spell-like abilities, would it effect a duergar’s abilities (assuming they were psi-like)?

RAW answers please (I can’t find the tag on my phone).