Behaviour of Coefficient[] for negative exponents in rational expressions

I’ve observed a puzzling behaviour of Coefficient[] for negative exponents and I’m wondering if I was always just relying on undefined behaviour or if there is a bug in recent versions of Mathematica.

So far, if I had an expression of the form

expr = a/x + b/(1+x) + c 

and ran

Coefficient[expr,x,-1] 

I’ve always gotten

a 

as the answer, which made a lot of sense to me. I’ve tried this with a number of different versions of Mathematica (all on Linux if that matters) that I had access to and the behaviour described above is true for 8.0.0, 8.0.1, 8.0.4, 9.0.0, 9.0.1, 10.0.0, 10.0.1, 10.4.0, 10.4.1, 11.0.0 and 11.0.1.

With 11.1.0, 11.1.1, 11.3.0 and 12.0.0 I got the answer

a + b/(1+x) 

which I find a bit weird, but maybe I can come up with a rationale behind this.

Finally, with 12.1.1 I get

a/(1+x) + b/(1+x) + c/(1+x) 

which makes absolutely no sense at all to me.

My question is: Is this a bug in the newer versions of Mathematica or was the answer of 8.0.0 to 11.0.1 always just undefined behaviour? And is there a workaround, which would allow me to extract the coefficient a from expressions like the one above (i.e. after partial fractioning a rational function, take only the term that is multiplied by x^k with k a negative integer)? If this is indeed undefined behaviour, shouldn’t Mathematica issue a warning or something like that in this case?

ReplaceAll doesn’t replace all, factor out negative sign first

I have this matrix:$ $ \left( \begin{array}{ccccc} \{\{0\},\{0,0,0\}\} & \{\{1\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} \ \{\{-1\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,z,-y\}\} & \{\{0\},\{-z,0,x\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,-z,y\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{y,-x,0\}\} \ \{\{0\},\{0,0,0\}\} & \{\{0\},\{0,0,0\}\} & \{\{0\},\{z,0,-x\}\} & \{\{0\},\{-y,x,0\}\} & \{\{0\},\{0,0,0\}\} \ \end{array} \right)$ $

When I run ReplaceAll (/.) on it using this$ $ \left\{\{\{1\},\{0,0,0\}\}\to X_1,\left\{\{t\},\left\{\frac{2 x}{3},\frac{2 y}{3},\frac{2 z}{3}\right\}\right\}\to X_2,\{\{0\},\{y,-x,0\}\}\to X_3,\{\{0\},\{z,0,-x\}\}\to X_4,\{\{0\},\{0,z,-y\}\}\to X_5,\{\{0\},\{0,0,0\}\}\to 0\right\}$ $

it doesn’t replace everything:

$ $ \left( \begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ \{\{-1\},\{0,0,0\}\} & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & \{\{0\},\{-z,0,x\}\} \ 0 & 0 & \{\{0\},\{0,-z,y\}\} & 0 & X_3 \ 0 & 0 & X_4 & \{\{0\},\{-y,x,0\}\} & 0 \ \end{array} \right)$ $

I expect:$ $ \left( \begin{array}{ccccc} 0 & X_1 & 0 & 0 & 0 \ -X_1 & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & X_5 & -X_4 \ 0 & 0 & -X_5 & 0 & X_3 \ 0 & 0 & X_4 & -X_3 & 0 \ \end{array} \right)$ $

Is there an automated way of doing these replacements?

How to decompose a 4×4 TRS transformation matrix with negative scale?

As the title says I need to decompose 4×4 TRS transformation matrices and extract the proper scale vectors and the proper rotation vectors (or rotation quaternions).

I know how to extract those information when the upper 3×3 matrix determinant is not negative. The problem is that those matrices can have that negative determinant and as far as I could understand, this negative determinant indicates a flip or mirrored transformation.

What do I have to do to extract the proper values for scale and rotation in those cases?

Are there any magical items that would have an adverse effect if you had a negative Con?

I was just reviewing my Q&A about the effect of a negative Constitution modifier, and that is limited to the effects on the PC stats and abilities (specifically HP, fatigue, etc).

I remembered that Barbarians also use Con for the their Unarmored Defense ability, and (while it is a UA, so probably not as important, but still note-worthy in this regard) The Giant Soul Sorcerous Origin relies on Con as well.

Are there any Magic Items that would be affected by a negative Constitution Modifier?

Can the half-dragon template have a negative impact on fly speed?

First example: A half-dragon astral deva. Astral devas normally have wings, but they’re Medium, and the Half-Dragon template states that Medium half-dragons don’t have wings. Does the Astral deva lose its wings due to the template?

Second example: A half-dragon solar. Solars have a land speed of 50 ft., and a fly speed of 150 ft. The Half-Dragon template states that a creature of this size can fly at twice its base land speed, with a maximum of 120 ft. Does the solar have its fly speed reduced to double its land speed (100 ft.), or to the Half-Dragon template’s maximum fly speed (120 ft.), or does it keep its base fly speed (150 ft.)? Similarly, what (if anything) happens to its maneuverability?

Third example, based on the maneuverability part of the previous point: a half-dragon great wyrm (or any creature with a fly speed greater than 120 ft. but worse than the average maneuverability given by the Half-Dragon template). Does it keep the best aspects of its flight sources, or the worst aspects, or does it take one source for its wings in its entirety?

Isometric tiles on wrong positions if the mouse points at a negative world coordinate

I am using this approach:

http://clintbellanger.net/articles/isometric_math/

Basically, you can calculate the iso coordinates based on the screen coordinates. What I am doing is, getting the actual world position the mouse is pointing at using get_mouse_global_position() and convert this position to isometric values.

Then I translate those coordinates back to world space coordinates to actually display the sprite.

Problem is, that when the world coordinates come from a negative position, the tiles get offset by almost an entire tile amount. Here is the relevant code.

The get_coord() function returns the actual world position of the tile used to display the Sprite

func get_coord(pos : Vector2):     var t = Vector2()     var e = screen_to_iso(pos)     t = iso_to_screen(e)     print(pos)     print(e)     print(t)     return t     pass var buildings  func screen_to_iso(pos :Vector2):     var flipx = 0     var flipy = 0     var t = Vector2()     var x_size = size/2     var y_size = size/4     t.x = int((pos.x/x_size) + (pos.y/y_size))/2     t.y = int((pos.y/y_size) - (pos.x/x_size))/2     return t     pass  func iso_to_screen(pos : Vector2):     var t = Vector2()     var x_size = size/2     var y_size = size/4     t = Vector2((pos.x-pos.y)*x_size, (pos.x+pos.y)*y_size)     return t     pass 

I can’t seem to figure out a way

What’s behind the widespread negative response to Wild Sorcerers, and how can I ensure they’re fun at my table?

I’m just starting to get into D&D 5e. Magic classes in particular fascinate me, and the one that caught my eye the most is the wild sorcerer. Or, rather, the concept did. The mechanics of the design itself seem particularly lackluster when compared to every other magic class I’ve looked at.

After quite a bit of searching, it seems I’m not alone in this observation. All over the place, people insist that wild sorcerers are unbalanced/underwhelming/generally unwanted. But I haven’t really seen any explanations of what exactly makes them this way, compared to other classes.

I’m now looking at attempting to DM a game with a bunch of other newbies, and trying to figure the game out as a group. One of my players will likely want to play a wild sorcerer. I’m interested in seeing how that plays out in RAW, but more importantly, I want the players to have fun.

I’m new and inexperienced. What should I look out for in the Wild Sorcerer when considering balance, or fun? Are there any gaping flaws in practice for the wild sorcerer’s design?

Right now I’m considering using the existing mechanics, but supplementing them with a secondary system of character progression that slowly takes the sorcerer from fearing their magic that’s unpredictable, to having some, but not total, control over it. Basically there’s a chaos level that increases and decreases based on player ability/spell usage. High chaos means more wild surges, low means less. To get the most out of the design, you have to balance the chaos level (in theory).

Note, I’m well-aware that I should probably stick to RAW during the learning phase. But as someone that works in gaming, I’m also aware that mechanics typically function differently in practice than in theory, and so I want to be prepared for any known “in-practice” shortcomings.

It sounds like the main ones are how often a surge happens (GM overhead, chance of anything happening at all), and exactly what happens (more flavor vs more functionality, which is up to what you want from the game). Both answers were solid, but I’m going with Icy’s, since it approached the question more specifically targeting the Wild Sorcerer’s in-practice functionality with examples and edge cases.

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?

Do negative modifiers change a critical hit? [duplicate]

I want to play a champion fighter and am considering whether or not to get the Great Weapon Master Feat which states:

Before you make a melee attack with a heavy weapon that you are proficient with, you can choose to take a – 5 penalty to the attack roll. If the attack hits, you add +10 to the attackā€™s damage.

If I take the -5 to attack roll and roll a critical hit, will that crit still be in effect, or will the -5 counteract that? Also, in the event that I do crit with a -5, would I add the +10 damage before, or after I double damage, like with other modifiers. It doesn’t say that the +10 is a modifier specifically, so I was a bit confused (note: for critical hits, my group usually has house-rule to double the damage and then add modifiers instead of the normal double dice.)