If a creature uses Shocking Grasp on another creature that uses its reaction to cast Absorb Elements, will Shocking Grasp, which stops a creature from using reactions, prevent the casting of Absorb Elements since Shocking Grasp should happen first before Absorb Elements does?

# Tag: elements

## Does the Order of Scribes Feature Awakened Spellbook also change the damage type of Absorb Elements?

The Order of Scribes from Tasha’s Cauldron of Everything has the "Awakened Spellbook" feature. Part of the feature reads as follows:

When you cast a wizard spell with a spell slot, you can temporarily replace its damage type with a type that appears in another spell in your spellbook, which magically alters the spellâ€™s formula for this casting only. The latter spell must be of the same level as the spell slot you expend.

Can i change the absorbing damage type of the spell "Absorb Elements"?

Absorb Elements is a spell with casting time of Reaction and an asterisk when the Reaction can take place as follows:

which you take when you take acid, cold, fire, lightning, or thunder damage

Can you replace the damage type of the trigger with that feature? That way you could absorb every type of damage with this spell. Absorbing poison, psychic, force or physical damage types.

## Simplifying elements of a matrix

These elements of the matrices can be simplified by hand much further{roots can be cancelled and all}, yet the Fullsimplify in Mathematica doesn’t simply it completely.

The matrix is:

`{{-((p^2 + Sqrt[m^2 + p^2] p3 - p0 (Sqrt[m^2 + p^2] + p3))/ m), -(((p^2 + (m + Sqrt[m^2 + p^2]) (m - p0)) (-I p2 + Sqrt[ p^2 - p2^2 - p3^2]))/(m (m + Sqrt[m^2 + p^2]))), (1/( m (m + Sqrt[m^2 + p^2])))(-p^2 p2 + Sqrt[m^2 + p^2] p0 p2 + m (-Sqrt[m^2 + p^2] + p0) p2 - I p0 p3 Sqrt[p^2 - p2^2 - p3^2] + I p3 Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)] + I m^2 (I p2 + Sqrt[p^2 - p2^2 - p3^2]) + I m (p3 Sqrt[p^2 - p2^2 - p3^2] + Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)])), (1/( m (m + Sqrt[m^2 + p^2])))(-I (Sqrt[m^2 + p^2] - p0) p2^2 + I m^2 (p0 - p3) - I p3 (p^2 + Sqrt[m^2 + p^2] p3 - p0 (Sqrt[m^2 + p^2] + p3)) + p2 (-p0 Sqrt[p^2 - p2^2 - p3^2] + Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)]) + m (I (p0 - p3) (Sqrt[m^2 + p^2] + p3) + p2 (-I p2 + Sqrt[p^2 - p2^2 - p3^2])))}, {-(((p^2 + (m + Sqrt[ m^2 + p^2]) (m - p0)) (I p2 + Sqrt[p^2 - p2^2 - p3^2]))/( m (m + Sqrt[m^2 + p^2]))), (-p^2 + p0 (Sqrt[m^2 + p^2] - p3) + Sqrt[m^2 + p^2] p3)/m, (1/( m (m + Sqrt[m^2 + p^2])))(-I (Sqrt[m^2 + p^2] - p0) p2^2 + I m^2 (p0 + p3) + I m (Sqrt[m^2 + p^2] - p3) (p0 + p3) + I p3 (p^2 - Sqrt[m^2 + p^2] p0 - Sqrt[m^2 + p^2] p3 + p0 p3) + p0 p2 Sqrt[p^2 - p2^2 - p3^2] - p2 Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)] - m p2 (I p2 + Sqrt[p^2 - p2^2 - p3^2])), (1/( m (m + Sqrt[m^2 + p^2])))(p^2 p2 + m (Sqrt[m^2 + p^2] - p0) p2 - Sqrt[m^2 + p^2] p0 p2 + I p0 p3 Sqrt[p^2 - p2^2 - p3^2] - I p3 Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)] + m^2 (p2 + I Sqrt[p^2 - p2^2 - p3^2]) + I m (-p3 Sqrt[p^2 - p2^2 - p3^2] + Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)]))}, {(1/( m (m + Sqrt[m^2 + p^2])))(-p^2 p2 + Sqrt[m^2 + p^2] p0 p2 + m (-Sqrt[m^2 + p^2] + p0) p2 + I p0 p3 Sqrt[p^2 - p2^2 - p3^2] - I p3 Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)] + I m^2 (I p2 + Sqrt[p^2 - p2^2 - p3^2]) + I m (-p3 Sqrt[p^2 - p2^2 - p3^2] + Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)])), (1/( m (m + Sqrt[m^2 + p^2])))(I (Sqrt[m^2 + p^2] - p0) p2^2 - I m^2 (p0 + p3) + I p3 (-p^2 + Sqrt[m^2 + p^2] p0 + Sqrt[m^2 + p^2] p3 - p0 p3) + p0 p2 Sqrt[p^2 - p2^2 - p3^2] - p2 Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)] - I m ((Sqrt[m^2 + p^2] - p3) (p0 + p3) + p2 (-p2 - I Sqrt[p^2 - p2^2 - p3^2]))), (-p^2 + p0 (Sqrt[m^2 + p^2] - p3) + Sqrt[m^2 + p^2] p3)/ m, ((p^2 + (m + Sqrt[m^2 + p^2]) (m - p0)) (-I p2 + Sqrt[ p^2 - p2^2 - p3^2]))/(m (m + Sqrt[m^2 + p^2]))}, {(1/( m (m + Sqrt[m^2 + p^2])))(I (Sqrt[m^2 + p^2] - p0) p2^2 - I m^2 (p0 - p3) + I p3 (p^2 + Sqrt[m^2 + p^2] p3 - p0 (Sqrt[m^2 + p^2] + p3)) + p2 (-p0 Sqrt[p^2 - p2^2 - p3^2] + Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)]) + m (-I (p0 - p3) (Sqrt[m^2 + p^2] + p3) + p2 (I p2 + Sqrt[p^2 - p2^2 - p3^2]))), (1/( m (m + Sqrt[m^2 + p^2])))(p^2 p2 + m (Sqrt[m^2 + p^2] - p0) p2 - Sqrt[m^2 + p^2] p0 p2 - I p0 p3 Sqrt[p^2 - p2^2 - p3^2] + I p3 Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)] + m^2 (p2 + I Sqrt[p^2 - p2^2 - p3^2]) + I m (p3 Sqrt[p^2 - p2^2 - p3^2] + Sqrt[-(m^2 + p^2) (-p^2 + p2^2 + p3^2)])), ((p^2 + (m + Sqrt[ m^2 + p^2]) (m - p0)) (I p2 + Sqrt[p^2 - p2^2 - p3^2]))/( m (m + Sqrt[m^2 + p^2])), -(( p^2 + Sqrt[m^2 + p^2] p3 - p0 (Sqrt[m^2 + p^2] + p3))/m)}} `

some of the substitution we can make are (already taken),

`{p1 -> Sqrt[p^2 - p2^2 - p3^2], e -> Sqrt[p^2 + m^2]} Assuming[{Element[{p0, p, p2, p3}, Reals], m > 0}, sat2 = sat // FullSimplify] `

What more could be done to simplify the elements of the matrix?

## How do I manipulate a list so the elements within the sublist are sorted from greatest to largest?

Imagine I have this sublist. [1]: https://i.stack.imgur.com/SqsDJ.png I want to sort it in an order so that [{Larger Number, Smaller Number}, {Larger Number, Smaller Number}, et cetera]. Any help would be appreciated Thanks

## Is there any specific order to Elements?

In Dungeons and Dragons, the four elements are Air, Earth, Fire, and Water (like the planes and the elementals). In the lore, is there any specific order to these elements? Or is the order just usually alphabetical and has no lore?

## Can absorb elements be triggered on attacks that require a saving throw or be paralyzed, incapacitated… and elemental damage on a failed save?

Say an enemy is casting a spell or using an ability that forces the player to make a saving throw or be "conditioned and take X elemental damage".

Does absorb elements go off if the save is failed? Or because of the condition effect, does that mean the reaction can’t be used if you fail the save, take damage, and conditioned? Or even can it be cast before the save (and wasted if the save passes)?

## Randomly assign n elements to n agents such that each agent only knows its own element

### Problem

I’m working on an app that involves shuffling and distributing playing cards to players. As a challenge, I tried to solve this problem in a way that doesn’t require a trusted intermediary.

In other terms, the task is to find a distributed algorithm that

- uniquely assigns $ n$ agents numbers $ 1..n$
- allows each agent to know nothing about the assignment but its own
- when revealing the assignment, allows other players to verify the assignment

We also assume that knowing other’s assignment is an advantage for each agent, and revealing its own prematurely a disadvantage. Agents are also assumed to be able to talk with each other in a way hidden from all other agents.

## Partial solution

The solution I came up with works only under the assumption that adversaries do not collaborate.

The idea is to create a set of $ n$ nonces, and assign each agent exactly one nonce. The set is then passed from agent to agent in an agreed upon order, hidden from all others, until each agent received the set exactly once. Each time an agent receives the set, it swaps its nonce with a new one, memorizes the new nonce, and confirms receival of the set to the others. This entire procedure is done twice, at which point, all agents have received the set at least once after all other agents swapped their nonces, making it impossible to recognize and hence map the nonces to the other agents.

When the last agent receives the set the second time, it shares it with everyone, and all agents confirm to the others that their nonce is contained in the set. The agents then assign a number to each nonce in the set based on an agreed upon random seed, giving us the required unique assignment.

To allow ownership verification, instead of the nonces, agents put the hash value of their nonce on the set, revealing the actual nonce only when verification is required.

The problem with this solution is that if adversaries are allowed to collaborate, each time an adversary receives the set, they can compare their versions, identify changes and potentially derive which nonce belongs to other agents, allowing them to know what number got assigned to them.

All ideas are appreciated!

## Recursively plotting specific elements in a list of lists

I am trying to build band structures and am looking to generate a general code that will work regardless of my list size. Here is what I am trying to do: say I have a list like

`list = {{0.0, 1, 2, 3}, {0.1, 4, 5, 6}, {0.2, 7, 8, 9}, {0.3, 10, 11, 12}}; `

and I want to plot the nth element of each list against the first element of each list. How can I tell Mathematica to automatically produce a set of lists to plot like shown below

`k = {0.0, 0.1, 0.2, 0.3}; band1 = {1, 4, 7, 10}; band2 = {2, 5, 8, 11}; band3 = {3, 6, 9, 12}; Show[ListLinePlot[k, band1], ListLinePlot[k, band2], ListLinePlot[k, band3]] `

Doing it manually one band at a time is possible but a waste of time when I have n=36+ bands. Any help would be much appreciated!

## GroupBy and Rule to select the first and third elements based on the second

Let’s say I have a matrix like

`m={{1,a,2},{4,b,3},{6,a,8},{7,c,10},{2,c,5}} `

How can I use GroupBy to pick the first and third elements using the second one? I tried

`GroupBy[m, #[[2]]&->#[[{1,3}]]&] `

which is apparently wrong.

## How to remove sublists whose difference of two elements is either 1 or 11?

I want to create a list of 3-element subsets of $ \{1,2,\cdots,12\}$ where no two elements in each subset can have difference of 1 or 11.

The following attempt fails because it returns just a list of all subsets without restriction.

`Select[Subsets[Range[12], {3}] , (Abs[#[[1]] - #[[2]]] != 1 || Abs[#[[1]] - #[[2]]] != 11) && (Abs[#[[1]] - #[[3]]] != 1 || Abs[#[[1]] - #[[3]]] != 11) && (Abs[#[[3]] - #[[2]]] != 1 || Abs[#[[3]] - #[[2]]] != 11) &] `

# Edit

I just got the solution as follows, but can it be simplified?

`Select[Subsets[Range[12], {3}] , ! MemberQ[{1, 11}, Abs[#[[1]] - #[[2]]]] && ! MemberQ[{1, 11}, Abs[#[[1]] - #[[3]]]] && ! MemberQ[{1, 11}, Abs[#[[3]] - #[[2]]]] &] // Length `