Going between assignment rules and functions

I am trying to develop a model using Mathematica, and continuously run into difficulties going between the outputs of various functions (Solve, Differentiate, etc.) and back to functions (in the colloquial sense). Often in my application the results of one function are the inputs to another.

I’ve read the relevant documentation pages, and looked for previous questions. I was able to solve some of my issues this way, mostly by defining additional variables and using ReplaceAll (/.) to replace these additional variables with the assignment rules from previous steps.

Now I’ve run into an issue that I can’t seem to ‘replace’ my out of. I’ve tried to simplify the question to get at the core of my misunderstanding. I define the following function:

Rh[a_] = Ch + Z*(A - a) Pih = x*Rh[a] - \[Gamma]*0.5*Q*x^2 + P 

I now want to differentiate Pih w.r.t. x:

RESULT = Solve[D[Pih, x] == 0, x] // Simplify 

The result is an assignment x-> (Ch+Z(A-a))/(Q\[Gamma])

Now in order to use this result I would normally do something like:

RESULT2 = Solve[x==a/.RESULT,Q] 

Where often I’d have to use multiple replacements (if, for example, a was also the result of some previous calculation.) I would play around with the location and ordering of the /., sometimes with Flatten[] until it worked.

Questions 1 – is this the correct method, or am I missing something much simpler? If there are any resources that deal with this explicitly I would highly appreciate it (I’ve read the documentation for assignment and functions, and this is the best I came up with)

Question 2 – more specifically, I have not been able to solve the following. Based on the same example as above: Suppose I want to redefine a function h[a] like this:


Where Y is the derivative of RESULT from the previous calculation -Z/(Q\[Gamma]). However, when I apply D[RESULT,a], the result is 0->-Z/(Q\[Gamma]. I successfully used

h[a_]=h0+0*a/.D[RESULT, a] 

Which works but is terrible and I cannot believe is the right way to do this. I understand why Mathematica is doing this, but I’m lost as to what would be a better, more general alternative.

I tried using := in various places, to no avail (I usually just get the whole Solve[…] function as RESULT…)

Thanks for any help

Applying replacement rules to products doesn’t work as expected

I have the following issue: I’d like to apply some replacement rules, for example

rules:={f[x]/t :> ff[x], g[x]/t :> gg[x]} 

to an expression, e.g. like this:

(f[x]*g[x]/(t^2))/. rules 

Surprisingly, this doesn’t give the expected result


How do I fix this? Sorry if it’s an easy question, I’m still a beginner with Mathematica.

Are there any rules pertaining to using extremely heavy weapons, either standard or improvised?

I haven’t found any rules related to this subject. Nothing about weight changing the damage of any weapon was seen anywhere, and neither was there anything on the improvised weapon.

Have anyone seen house rules that modified the damage of standard weapons that happen to be extremely heavy by design? Like instead of using a Warhammer weighing 2lbs someone wants to use one that is 20lbs.

Using everyday items that are not included in the official list of weapons are generally counted as attacking with an improvised weapon, like a chair or a wine bottle. But the problem is, what if the improvised weapon in question is so ridiculously heavy that it no longer makes logical sense for it to only inflict 1d4 damage?

Consider The Bag of Holding, which will always be 15lbs. (For reference, a battleax is weighed at 8lbs and heavy crossbow weighs 18lbs) Even if the texture of the bag in question is soft leather, when you swing that bag to hit someone or someone, the weight and momentum itself should be plenty enough to crush things.

PS: Not that I would want to swing that thing around! Damaging the bag could be disastrous.

Swinging around a sack with a rock is definitely an improvised weapon with 1d4 damage. But if someone swings a regular sack filled with a lot of rocks (or with tons of loot and gold),filled the bag with more than 50lbs worth of stuff and swung it around? Or 100lbs? (Assuming the sack doesn’t rip or fall apart before the smashing hit connects).

Speaking of which, would using a gigantic heavy table that is capable of seating twenty people as an improvised weapon during the bar fight in the tavern really only do 1d4 damage?

Casting Somatic Spells while handless (rules as intended) [duplicate]

This question hasn’t popped up in any of my games, whether as DM or player, but I thought of it while coming up with character concepts and wondered how it should be ruled.

If a caster does not have hands, can they perform the somatic components of their spells?

For example, if a player has the idea to have a caster born without arms who uses somatic components using their "ghost limbs" should they be able to since the restriction that they’re not wielding weapons or a shield isn’t being infringed?

Alternatively, if the above is true, does that mean players couldn’t disable an enemy caster they captured by Skywalker-ing their hands so they don’t have a free hand to cast the spell with?

The Player’s handbook describes somatic components as:

Spellcasting gestures might include a forceful gesticulation or an intricate set of gestures. If a spell requires a somatic component, the caster must have free use of at least one hand to perform these gestures.

But I don’t know how I’d interpret this.

I guess the main question is do somatic component rules emphasize having a (free) hand or do they emphasize not wielding an item/weapon? Are there any official rules for these edge cases or is there a way to interpret the rules on somatic components that answers these questions?

New DM on House Rules, concerning Nat20 & Rule of Cool

As a DM making a house rule, am I allowed to grant "Rule of Cool" to Natural 20 rolls in exchange of giving "Rule of Uncool" effects for Natural One rolls? (but all within the boundaries of RAW as well).

  • In battle, a small PC rolling Nat20 successfully maneuvers himself and climb on the back of the big bad creature (Legolas Style), only to roll Natural 1 in his attack and accidentally hit his allies.

  • Failing Deception on guard with Nat1 roll additional 2 arrives and a High Ranking Knight, only to roll Nat20 and convinced the High Ranking Knight instead literally allowing you to pass the area with no consequence at all.

I just want to encourage imagination by introducing some Matrix dodges and Epic fails in the game that is somewhat lighthearted and funny especially to noobs like me.

Am I being a bad example of being a DM? Should I discontinue this approach?

How do I handle players that don’t care for the rules I put in place as the DM and question everything I do?

I am DMing a game of dnd 5e or close to it. It’s a homebrew campaign. We are mostly new to D&D with the exception of 2 players that play with other groups.

I have 2 players that seem to question everything I do as a DM and make the game hard to DM. One of the things they question is cantrips.

I had one of my players call my ruling stupid and log out. To put it into context I make my players roll to see if they can land the cantrip. 2 of my players have recently questioned why they have to roll at all and why it just doesn’t do what they believe it should do. But there is nothing in the rules about rolling and cantrips.

It was a cantrip called "mend" and he was trying to use it to repair his armor which had been broken. I made him roll to see how well he repaired it and he got a 2 so it didn’t repair much. He went behind my back and spoke to another player about how it was stupid and "that’s not how cantrips work" even though he was able to cast the spell, just not well.

I don’t want to just put my foot down and say "I’m the DM, what I say goes" but they won’t listen to my reasoning and just keep saying I’m wrong. How do I handle this situation? It’s getting to the point where I am considering stopping DMing all together.

What are the rules for the size of weapons?

According to Items and Sizes Small and Medium creatures seem to be able to use Small and Medium weapons interchangeably without any penalty, and they can use Large weapons but they gain the Clumsy 1 condition.

The Bulk rules in this chapter are for Small and Medium creatures, as the items are made for creatures of those sizes.

In most cases, Small or Medium creatures can wield a Large weapon, though it’s unwieldy, giving them the clumsy 1 condition, and the larger size is canceled by the difficulty of swinging the weapon, so it grants no special benefit.

Items of Different Sizes also specifies:

Creatures of sizes other than Small or Medium need items appropriate to their size.

I’ve got several questions related to inappropriately sized weapons:

  • What happens if a Large creature tries to use a Medium weapon?
  • What happens if a Small/Medium creature tries to use a Tiny weapon?
  • What happens if a Small/Medium creature tries to use a Huge or bigger weapon?

And all other possible permutations of these questions.

Then, there is no mention about damage at all, is it the same for all sizes? It seems absurd that a Tiny hammer does the same damage as a Gargantuan hammer.

Where are the rules for the Gondola mentioned in A&EG?

My players are chomping at the bit to get an airship and since I’ve allowed the Arms and Equipment Guide in our campaign, they’ve naturally set their sights on the Soarwhale.

The problem is, to ride the soarwhale, you need a howdah or gondola. The rules for the howdah are earlier in the book, but I can’t find any further mention of any rules for the gondola. Are these printed in another book somewhere? If not, is there an equivalent somewhere? I don’t think the howdah is going to suit them as it’s fairly small.

Super Index list of all DnD published rules? [closed]

has anyone produced a combined index, taking all the separate indexes of all DnD published books and combining it into one resource. For instance today I was looking for trap info, it is present in the DMG, Xanthers Guide etc so I have to go to each book tthat has info and physically check the book index to check for the page I am looking for. I physically have now 10 books so it would be good to be able to have one combined index I can refer to when looking things up, especially if something comes up at the table mid game.