## WhenEvent and Energy conservation

I’m using NDSolve to do a simple Sinai billiard simulation. But the performance isn’t very good using WhenEvent to reflect the ball off the walls. Apparently the energy is not conserved. How can I use NDSolve to correctly find the solution? (Maybe there is some method it can be supplied to ensure energy conservation?)

Here is my code. The billiard table is a square with a circular pillar in the center. reflect gives the new velocity after the ball hits the pillar. However, even though I have numerically verified that the reflect function conserves energy, when NDSolve uses it in WhenEvent the energy is not conserved.

reflect[surface_, pos_, vel_, vars_ : {x, y}] :=   Block[{grad, normal},     grad = Grad[surface, vars];     normal = Normalize[grad //. Thread[Rule[vars, pos]]];   -(2 (normal . vel)*normal - vel)   ]  sinaiSolver[initialData_, duration_ : 100] :=   Block[{eqns, sol, pillar},     {{xi, yi}, {vxi, vyi}} = initialData;     eqns = {x''[t] == 0, y''[t] == 0,             x[0] == xi, y[0] == yi,             x'[0] == vxi, y'[0] == vyi,         WhenEvent[x[t]^2 + y[t]^2 - 1 == 0,          {Derivative[1][x][t] ->         reflect[-1 + \[Xi]^2 + \[Zeta]^2, {x[t],            y[t]}, {Derivative[1][x][t],            Derivative[1][y][t]}, {\[Xi], \[Zeta]}][[1]],        Derivative[1][y][t] ->         reflect[-1 + \[Xi]^2 + \[Zeta]^2, {x[t],            y[t]}, {Derivative[1][x][t],            Derivative[1][y][t]}, {\[Xi], \[Zeta]}][[2]]}         ],         WhenEvent[x[t] == -2, x'[t] -> -x'[t]],         WhenEvent[x[t] == 2, x'[t] -> -x'[t]],         WhenEvent[y[t] == -2, y'[t] -> -y'[t]],         WhenEvent[y[t] == 2, y'[t] -> -y'[t]]};   sol = NDSolve[eqns, {x, y}, {t, 0, duration}]   ] 

Here is a plot that shows energy isn’t conserved. The trajectories still look fine if you plot them, except that the particle changes speed on reflection with the pillar.

sol1 = sinaiSolver[{{1, 1}, {0.345, 0.493}}, 1000]; Block[{energy},     energy = 1/2 (x'[t]^2 + y'[t]^2);     Plot[energy /. sol1, {t, 0, 100}, PlotRange -> All,    PlotTheme -> "Scientific",     FrameLabel -> "Energy vs Time"]  ] 

## Rotational kinetic energy and derivative by velocity

I have some object with tensor of inertia $$I_{p_{3×3}}$$ and angular velocty vector $$\omega$$.

Object’s kinetic energy find as:

$$T_p=\frac{1}{2} \omega^T I_{p} \omega$$

I wand find derivative by $$\omega$$.

Is the result I am getting with this code correct?

Clear["Derivative"];  ClearAll["Global*"];  Tp = 1/2 Transpose[\[CapitalOmega]].Ip.\[CapitalOmega];  D[Tp, \[CapitalOmega]]; `

EDIT:

Is that result correct ?

$$\frac{d}{d\omega}\frac{1}{2} \omega^T I_{p} \omega=\frac{1}{2}\omega^T(I_{p}+I_{p}^T)$$

## Evasion and Vulnerability to Energy precedence?

A creature has Evasion:

‘If she makes a successful Reflex saving throw against an attack that normally deals half damage on a successful save, she instead takes no damage.’

And also has Vulnerability to Energy:

‘Some creatures have vulnerability to a certain kind of energy effect (typically either cold or fire). Such a creature takes half again as much (+50%) damage as normal from the effect, regardless of whether a saving throw is allowed, or if the save is a success or failure.’

Which rule takes precedence if a creature is attacked by an effect of that energy type and a successful Reflex saving throw is made against this energy attack that normally deals half damage on a successful save?

## What level should a shorter-duration “Mass Protection from Energy” be?

The group I DM for (7 characters – Bard, Cleric, Druid, Fighter, Ranger, Rogue, Wizard – all level 7) will soon go up against an Adult White Dragon. (They don’t know yet. Heh.)

I would like to gently introduce them to the art of researching enemies and preparing for encounters, with the help of their conveniently-high-level spellcaster mentor (class left open for flexibility). In the present case, he would suggest Protection from Energy against cold damage.

Unfortunately, this 3rd-level abjuration only targets one creature – and it requires concentration. So our three characters capable of casting the spell (the Cleric, Druid and Wizard) could, between them, only protect three characters. Conversely, the duration of one hour is really far too much if they can choose the time and place of the battle.

So I am thinking of their mentor handing them (or their finding) a scroll of Mass Protection from Energy, which functions just like Protection from Energy, but protects up to ten creatures, with a duration of up to one minute (with concentration).

Question: what would be an appropriate spell level for Mass Protection from Energy?

Is there a mass version of Protection from Energy? is related, but for dnd-3.5.

## How can I create a Viking/Saiyan that creates his own weapons with energy, ki or magic?

I’m going to play on a table with some friends and I wish to create a Viking-type warrior that is able to use energy/ki/magic to create weapons and fight like a barbarian but without being one. The character creation limitations are to be a lvl 5, using the core rulebook 2nd edition, advanced players guide and Lost omens: character guide, Gods and magic & Legends.

The concept would be a Viking/Saiyan, so it’s starting from a low lvl 5 and the campaign is estimated to end up anywhere from lvl 8 to 10. Any magic that he learns is focused on the typical saiyan powers from dragon ball (flying, ki attacks, move absurdly fast and, if possible, visual indication of powering up like going super saiyan).

## Is the negative energy plane underneath Golarion?

I had always been under the impression that Golarion and the negative energy plane were on entirely different metaphysical planes. This would mean that you couldn’t simply move from one to the other using mundane means.

The Tar-Baphon entry on Lost Omens: Legends says (pg.104):

Tar-Baphon dug a portal to the Negative Energy Plane on the Isle of Terror …

To me, this sounds like he physically dug a hole to the negative energy plane. At face value, this would only be possible if the negative energy plane were somehow underneath the earth of Golarion.

I have access to many of the PF2 books, but am weak in lore published in PF1 resources. Is it true that the negative energy plane is literally below Golarion?

## Creating a SoP Energy Wall in a straight line

Using the Spheres of Power rules, the destruction sphere has a talent called Energy Wall

You may spend a spell point to shape your destructive blast into either a wall up to 20 ft. per caster level or a hemisphere with a radius up to 5 ft. per 2 caster levels (minimum: 5 ft). This wall extends up to 20 ft. high and lasts for 1 round per caster level. The wall does not block line of effect, line of sight, projectiles, or thrown objects.

Creatures passing through your wall suffer your destructive blast’s damage and effects as normal. Creatures standing in the wall’s space when it is created are allowed a Reflex save to avoid damage.

I have the following questions:

• Does the wall have to be created in a straight line (if not using the hemisphere version)?
• If the wall is a straight line, say down a 5 foot wide corridor, would someone traveling down the corridor take damage each square of movement?

## Can a tarrasque be animated by negative energy flood? [duplicate]

The spell negative energy flood says:

"You send ribbons of negative energy at one creature you can see within range. Unless the target is undead, it must make a Constitution saving throw, taking 5d12 necrotic damage on a failed save, or half as much damage on a successful one. A target killed by this damage rises up as a zombie at the start of your next turn. The zombie pursues whatever creature it can see that is closest to it. Statistics for the zombie are in the Monster Manual. If you target an undead with this spell, the target doesn’t make a saving throw. Instead, roll 5d12. The target gains half the total as temporary hit points"

It does not specify the creature must be humanoid nor the size of the creature. However, it implies the new zombie’s stats must be in the MM. Can a tarrasque be animated by this spell’s effect?

## Is this addition to the spell Negative Energy Flood balanced?

In this question I outlined an inconsistency in the RAW interpretation of the spell Negative Energy Flood (XGtE, pg. 163): a size Large or larger creature killed by it rises as a size Medium zombie. To remedy this, I have added to the spell description to make it scale with the size of creature killed. Bold in the spell description indicates my addition to the spell.

### Negative Energy Flood

5th-level Necromancy
Casting Time: 1 Action
Range: 60 feet
Components: V, M (a broken bone and a square of black silk)
Duration: Instantaneous

You send ribbons of negative energy at one creature you can see within range. Unless the target is undead, it must make a Constitution saving throw, taking 5d12 necrotic damage on a failed save, or half as much damage on a successful one. A target killed by this damage rises up as a zombie at the start of your next turn, having the same size and shape as the target. If the zombie is of size large or larger, it deals extra dice of damage on a hit. Double the weapon dice if the zombie is Large, triple the weapon dice if it’s Huge, and quadruple the weapon dice if it’s Gargantuan. Statistics for the zombie are in the Monster Manual. The zombie pursues whatever creature it can see that is closest to it.

If you target an undead with this spell, the target doesn’t make a saving throw. Instead, roll 5d12. The target gains half the total as temporary hit points.

This solves the obvious problem of Gargantuan creatures becoming Medium zombies, and I anticipate a size change alone has little implications for balance – correct me if I am wrong.

Potential balancing issues arise in increasing the damage output for Large and larger zombies. I borrowed the language directly from DMG pg. 278 in the section on creating your own monster stat blocks, taking into account the size of the monster. Step 11 of Creating a Monster Stat Block reads:

Big monsters typically wield oversized weapons that deal extra dice of damage on a hit. Double the weapon dice if the creature is Large, triple the weapon dice if it’s Huge, and quadruple the weapon dice if it’s Gargantuan.

A zombie has a Slam attack that deals 1d6+1 damage on a hit (Monster Manual, pg. 316). So for a large zombie, the damage on a hit would be 2d6+1, Huge 3d6+1, and Gargantuan 4d6+1.

I don’t think only scaling the damage dice by size would make the spell too much more powerful than it already is, the zombie still has an AC of 8 and 22 hitpoints. What would start to tip the scales out of balance, I think, would be scaling the hit dice according to Step 8 in the same section of the DMG (pg. 276), especially for Gargantuan creatures. Scaling hitpoints in this way gives: Large – 25 (3d10+9), Huge – 28 (3d12+9), and Gargantuan – 40 (3d20+9).

Allowing the spell to scale hitpoints in this way for Gargantuan creatures gives the zombie nearly twice the staying power as the original version of the spell did. I also couldn’t think of a clear way to word it into the spell description. For this reason, I propose only scaling the damage dice for the zombie with the zombie’s size.

Is this buff to Negative Energy Flood still appropriately balanced as a 5th-level spell?

## Does a size large or larger creature killed by Negative Energy Flood rise as a medium sized zombie?

The spell Negative Energy Flood (XGtE pg. 163) states:

A target killed by this damage rises up as a zombie at the start of your next turn.

And also,

Statistics for the zombie are in the Monster Manual.

This seems to imply that the creature killed rises as a zombie with exactly the statistics stated in the Monster Manual.

If I kill a gargantuan (or anything larger than medium) creature with Negative Energy Flood, does it rise as a size medium zombie?