## Total convergence of a function series

Let us consider the following function series:

$$\sum_{n=1}^{\infty} \frac{1}{n^x + n^{-x}}.$$

It seems that there is total convergence in $$(- \infty, -1-\delta] \cup [1+ \delta, + \infty)$$ for $$\delta > 0$$. Thank-you in advance for any help!

## Visualizing convergence/divergence series

I was trying to visualize the idea of convergence/divergence of series using complex plane. I got this idea from “A First Course in Complex Analysis with Applications by Dennis Zill, Patrick Shanahan”. I used the command:

ComplexListPlot[Table[(0.9 I)^(n + 1)/n, {n, 1, 70, 0.01}],Joined -> True, PlotRange -> All,  PlotStyle -> {Blue, Thick}] 

to generate a plot as shown below:

Alternatively, one can use the command

ListLinePlot[Table[ReIm[(1.1 I)^(n + 1)/n], {n, 1, 70, 0.01}],   PlotRange -> All] 

to generate the same. This series is convergent as it kind of spirals down. If we change 0.9i to 1.1i, the plot changes to

which signifies that the series is divergent. What is want is that some sort direction as to which way the sequence goes, like these:

How can this be achieved in mathematica?

## For a single party, how can I make Dead in Thay a “fast-paced assault” and not a drawn-out series of skirmishes?

I having been running adventure modules from Tales from the Yawning Portal for a single group of 3-6 players (i.e. I have 6 players, but sometimes as few as 3 can attend a session). Part of the reason for me running modules is to minimise necessary preparation time.

We recently finished playing the first adventure, Sunless Citadel, when I asked the players which adventure in the book they would like to do next. Upon seeing the massive awesome-looking map for the Doomvault in Dead in Thay (with 107 rooms, all containing encounters, divided into 9 mini-dungeons), they unanimously voted for that one. I warned them that it would take many sessions to complete, and they were fine with that. So I got all the characters to advance to Level 9, threw them some bonus loot, and dropped them into the Doomvault.

We are now three sessions in, and I have identified a few potential issues.

The lengthy preamble to the adventure says:

The incursion into the Doomvault is intended to be a fast-paced assault in which the characters have little time for typical rests. A few areas of the dungeon offer access to special magic that allows characters to gain the benefit of a rest.

However, our experience so far has been contrary to this. I provide a transcript of the game so far below:

• In the first session, with 5 players, they fought through 3 rooms occupied by ordinary enemies, then one room occupied by a big (CR 10) boss monster. This took 40 minutes of in-game time.

• In the second session, with 3 players (all casters), they took a long rest, had one encounter with two-and-a-half rooms’ worth of enemies (although a well-placed conjure woodland beings tipped the balance in their favour), then killed another big (CR 10) boss monster. After the rest, this took 1 hour of in-game time.

• In the third session, with 3 players (2 casters), they took a short rest, killed a relatively strong monster, found a source of healing, fought two gorgons, returned to the gatehouse, twiddled their thumbs and restocked for what I declared to be 9 hours, took a long rest, returned to the dungeon, and fought a small room’s worth of enemies.

• In the fourth session, with 4 players (2.5 casters), they had 3 combat encounters.

• In the fifth session, with 3 players (2.5 casters), they dealt with a minor trap, had one combat encounter, took a long rest, had one large combat encounter, then took a short rest.

(For those unfamiliar with Dead in Thay, the gatehouse is an unmapped area through which the players entered the Doomvault and is under control of allies to the party. The module assumes that no encounters will happen in the gatehouse. I have thus assumed that it can function as a safe-room.)

So far, we have had 14 encounters, 3 long rests and 2 short rests. Over an in-game time of 49:20, the party has only spent 3:55 inside the dungeon, with the rest of the time sheltering in the gatehouse – far from a fast-paced assault! Typically, the call to take a long rest was done because the casters were out of spell slots, and with small party sizes the casters needed their spell slots for the party to deal enough damage to push through the encounters. While the players have found ways to recover hit-points within the Doomvault, nothing they have lets them recover spell slots besides a long rest.

I do not believe this to be a fault in the party (besides being too small half the time), but rather a characteristic of Dead in Thay. Page 84 of the DMG talks of the Adventuring Day, which is how many encounters a party can have between two long rests. For three level 9 PCs, an adventuring day contains 22,500 XP worth of encounters. Between the first two long rests, my three level 9 PCs had 31,900 XP worth of encounters, so it is hardly surprising that the party’s resources are so taxed. Between the second two long rests, we had 29,050 XP of encounters, mostly for 4 PCs, 2 lvl 9 and 2 lvl 10, which is around the right amount for an adventuring day.

If I had all 6 of my players, they could probably get further, but their adventuring day would still be much, much shorter than a full day. And because of this, and how a character can only benefit from a long rest once every 24 hours (PHB 186) (a rule I have already stretched a little), I anticipate that this will result in many more periods of inactivity in the gatehouse.

I am aware that the Thayans of the Doomvault can and will run some degree of preparations and repairs while the party is resting. However, the highly segregated nature of the Doomvault leads me to think that damage dealt to one section won’t draw that much attention from another section unless it is utterly catastrophic. And since access into and out of the Doomvault is being tightly controlled against the Thayans, their ability to replenish lost monsters is limited. The modifications the Thayans could make to the Doomvault during rests would be highly situational and rather limited, as far as I can tell, although maybe I’m just unimaginative.

Further reading about Dead in Thay online indicates that the adventure was originally designed for many groups of players to tackle simultaneously. This makes me fear that the Doomvault will become a long grind rather than a fast-paced assault for a single party.

On a related point, Dead in Thay includes a feature called ‘Alert Level’ which increases the difficulty of random encounters the longer players spend in the Doomvault; a feature intended to add to the feeling of a ‘fast-paced assault’. However, if the players only spend 2 hours a day inside the Doomvault, then the Alert Level never goes up by the rules as written, which is boring. I am considering having time spent in the gatehouse not decrease the Alert Level (but not increase it either), or possibly make Alert Level increase faster (1 per hour rather than 1 per 4 hours).

My question is this:
For a single party, how can I make Dead in Thay a “fast-paced assault” and not a drawn-out series of skirmishes?

Specifically, I would like to know how to

• avoid the “15-minute working day” in a module densely packed with encounters (I am aware of several questions which handle this question generically; advice specific to Dead in Thay is thus preferable),
• avoid burn-out in this mega-dungeon, and
• make the Alert Level meaningful (although this is a minor point compared to the above two),

preferably without having to re-write the module.

An answer should preferably include your own experience in running Dead in Thay and how you tackled these issues (or if they are issues at all), although experience from other adventure modules of similar scale and density is acceptable.

## Finding series coefficients

Given

b[0]:= 1; Sum[Binomial[n, k]*((2*n-2*k-1)!!)^2*b[k+1], {k,0,n}] = ((2*n+1)!!)^2; 

is there a way to find the coefficients b[n] using InverseSeries, SeriesCoefficient, or some other method?

## Trouble with the numerical evaluation of a series

The series is $$\;S=\displaystyle{\sum_{n=0}^\infty 2^{-n+\sin(n\pi/5)}}$$.

Mathematica doesn’t find a closed form for Sum[2^(-n + Sin[n Pi/5]), {n, 0, Infinity}], so I tried both:

N[Sum[2^(-n + Sin[n Pi/5]), {n, 0, Infinity}], 100] NSum[2^(-n + Sin[n Pi/5]), {n, 0, Infinity}, WorkingPrecision -> 100] 

They return the same result:

2.621953360503001622580428627210775515701951638633391919349668089988053230383633286891962065806603221 

However, as I discovered later, this result is wrong. Indeed, the series is not difficult to evaluate, thanks to the periodicity of $$\sin(n\pi/5)$$:

$$S=\left(\sum_{n=0}^\infty2^{-10n}\right)\left(\sum_{n=0}^92^{-n+\sin(n\pi/5)}\right)=\frac{1}{1-2^{-10}}\sum_{n=0}^92^{-n+\sin(n\pi/5)}$$

And N[1/(1 - 2^-10) Sum[2^(-n + Sin[n Pi/5]), {n, 0, 9}], 100] yields:

2.621953365022156800044269458734842788555304465923212022625632939238430813027293562013936284925892294 

So the initial sum only had 9 correct digits. It’s so bad that I am almost certain I am missing an important option, but I have no idea which (I tried playing with AccuracyGoal and PrecisionGoal, but it led me nowhere so far).

Any idea to get the numerical answer directly?

The same method as above can be used to evaluate $$\displaystyle{\sum_{n=0}^\infty 2^{-n+(-1)^n}}$$, and the sum is $$3$$, however, Mathematica fails with a message that starts with NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections. So again I must be missing somthing important. The failure occurs with:

N[Sum[2^(-n + (-1)^n), {n, 0, Infinity}], 100] 

My guess would be that it fails for this one because the correct answer is an integer, and thus it’s impossible to give even a single correct digit since the sum could be 2.99999… or 3, but I’m not sure what really happens here, nor how to deal with this.

I’m not entirely new to Mathematica, but I have always found that numerical computations are difficult to handle with it. If someone can point to a good tutorial on this kind of problem or similar ones with NIntegrate, it would be really helpful!

## Defining a function as a truncated taylors series

I am trying to numerically find the error of a truncated series. To do so I want to first define a function that is the truncated sum, I cannot seem to do that. All I am tried is not working.

f[x_]:=Normal[Series[ArcTan[x], {x, 0, 100}]] 

Does not work as f[1] evaluates $$x$$ inside $$\arctan$$. I also tried

Normal[Series[ArcTan[x], {x, 0, 100}]] f[x_]:=% 

But that did not work. When I copy and paste the result of

Normal[Series[ArcTan[x], {x, 0, 100}]] 

It works fine. What am I doing wrong?

## SQL – Sparse data in time series

[I wasn’t sure if this is the proper place to post SQL questions.] I have a public dataset of pharmaceutical prices. Any given drug gets a new price on some unpredictable day, and then the price remains that price until the next price change.

E.g.

drug            date          new_price acetaminophen   2020-01-09    0.25 oxycontin       2020-01-10    1.40 valaxirin       2020-02-10    2.34 oranicin        2020-02-11    1.54 acetaminophen   2020-02-12    1.47 

I have to do a variety of analytics e.g. "what was the price of acetaminophen on 2020-02-01?" Well that would of course be 0.25, but I need a way to figure that out in SQL. I have a variety of more complex queries, e.g. "list the ten cheapest drugs on a given date". So a solution I think needs to be generalized.

I realize that one possible solution would be to run a job that populates the database with prices for every day of the year, but I prefer not to solve the problem that way.

## 2-D Fourier series components from image

Suppose I draw a black/white image where the color black represents 1.0 and the color white represents 0. Is there a way to extract numerical estimates for the coefficients of a (real) 2-D Fourier series which approximates this image?

Here is a simple example:

What about for more complex images such as:

or

## Why has the Final Fantasy series largely changed for the worst (or JRPs/RPGs in general)?

From what many remembered as open-world, explorable, side-quest, challenging battles and tactics of many similar RPGS/JPRGs of the 90s to the 2000s even, it now largely seems like the genre — especially referencing to FF series since they are among the "top dogs" of it — have diminished. I get the impression that lots of what made the old games good is lost:

1. What was once more explorable of a main navigation element seems to have become more centered, linear, and/or restrictive. You can have nicer walking animations and prettier backgrounds, but the same "tunnel" like forward direction — or more aimless all-way walking potential in huge open areas replaces that special emphasis on simple old rooms (often smaller) with less to give graphically but more to give in a travel, explorative or more sensible approach than just "hunting" or "running around and grinding." If you make a large area you should at least give different elements to it than just "lots of space." If you scale up you need more of that "something" to scale up too — otherwise it’s more empty.

2. The old free-to-explore open-worlds/world maps, airship/flying ship/etc. mechanics (even re-visit mechanics) are almost always chopped down or implemented much less attractively (think how it started with FFX and then onwards — i.e. you can "explore" fast but it’s really largely watered down stuff/processes in doing such). The whole "open world" aspect to the classics is largely reduced to large areas/fields but no longer a blend of different terrains, sub-areas, sections or just the general nature/element of traveling/entering/exiting different areas rather than storyline/linear rules imposed on all areas/paths.

3. The battle system is definitely a hot topic, as some will tell you the new mechanics add some new flesh to the table while others feel the older system worked best and it’s been "slaughtered" merely at the attempt of "spicing up" something that people already liked for the most part/settled in with over time. The thing is — if the battle system is to be made "better" so to speak — it should try and maintain the same elements of what the skeleton of original battle systems were based on. As an example old turn-based games kept the same skeleton even when becoming "active time" battles where it’s every turn to grab for themselves the quickest. The idea was that you can maintain the same "skeletal base" of the mechanics and only tweak them better — but lots of newer stuff almost always tries to go completely a new path that strays away from this with new experimentation, impositions, rules, and/or unneeded "extra steps" at times too. Basically it’s like the game’s old and functioning system has been put less concern to while trying to "splice" its old DNA under the impression that you can supposedly better an old thing by going in a completely a new "frankenstein" direction rather than just sprucing up the initial base in a more specific/oriented/targeted manner that fulfills its initial life blood/base than trying

4. Always an extreme. Nowadays it seems games of this series are either too linear or not linear at all — there’s no longer a good balance between the two. For example one game may have so much explorable, massiveness to specific areas that you would be to get lost/tired/grinding excessively/etc. in one area to then go to the next one and rinse and repeat. On the other hand you can go super linear (think FFXIII for example) where everything is just "new area -> go straight -> battle -> story -> repeat" and such. What made the classics arguably more "wow" is the fact that the game — when it needs to — switches from storyline/linearity to open/some explorableness (to pique the natural exploring instinct) while going back to restriction when danger arose (defensive mechanism/protective inhibition) — because both of these angles match human behavior/etc. it suits gameplay. But if you make it either too open or too linear you force one side too long and it doesn’t align naturally with the cycle of human operability/engagement well enough to have proper "ups" and "downs."

5. More "complex" systems or angles regarding leveling/power ups/etc. In old games it’s often fairly simple and straightforward to a large degree on how something more direct leads to a more expandable nature of said system to grow and keep delivering. What has replaced easy but expandable seems to be complex and rigid — more learning curves but less direction to go once you "have it." Slowly I think the series has gone this way, possibly starting with FFXIII/around that era. You make something simple that expands as needed become complex that really doesn’t give much over time. Something like junctioning in FF8 starts simple but can scale up to cool stuff as the game goes on, especially with the addition of GFs to character stats and so on. In a game like FFXIII for example you can liken the "powering system" to weak remnants of FFX and FFXII in ways of both combat means and stat growth.

6. Games/scenes (probably applies to others outside this genre/series/etc. though) are now largely presented as cinematics/films with bits of gameplay as the only crux to break apart that concept of whether it’s innately a movie with gameplay or gameplay with cinematics (like older games of the series where "movies" in, say, the FMV form/class were much less emphasized as part of the overall game). "Cutscenes" in old FFs were mostly seamless or passive — now they are expected to emphasize more (due to the graphics) and "fill" a part of the game/impression as such rather than just be more of a seamless flow with only particular moments having more "weight" to them. In old FFs, how much of the story is lost removing the dialogue/locked moment/cutscenes? Now compare that to how much would be lost in modern games. If there is more to "lose" from the cutscenes overall then maybe they are relied on too much to shape the impression or experience of the game.

## finding the combinatorial solutions of series and parallel nodes

I have n nodes, and I want to find the (non duplicate) number of possible ways in which these nodes can be combined in series and parallel, and also enumerate all the solutions. For example, for n=3, there are 19 possible combinations.

 0 (0, 1, 2)  1 (0, 2, 1)  2 (1, 2, 0)  3 (1, 0, 2)  4 (2, 0, 1)  5 (2, 1, 0)  6 [0, 1, 2]  7 [0, (1, 2)]  8 [0, (2, 1)]  9 (0, [1, 2]) 10 ([1, 2], 0) 11 [1, (0, 2)] 12 [1, (2, 0)] 13 (1, [0, 2]) 14 ([0, 2], 1) 15 [2, (0, 1)] 16 [2, (1, 0)] 17 (2, [0, 1]) 18 ([0, 1], 2) 

In the notation above, a series combination is denoted by (..) and a parallel combination is denoted by [..]. Duplicates are removed, for example [0,1,2] is the same as [1,2,0] since all of them are happening in parallel so the order does not matter here.

Can you give me an algorithm for this, or if any such algorithm already exists, then point me to it?

(I tried googling for a solution, but did not hit any relevant answer, maybe I was entering the wrong keywords.)

Note: for a sequential-only solution, the answer is easy, it is n!, and the enumeration of the solutions is also easy. But when parallelism (especially non duplicates) is added to the problem, it gets very complex.