probability or statistics – CDF of a learned distribution doesn’t evaluate

In this simple example

z={0., 0.0512821, 0.0909091, 0.0952381, 0.191489, 0.242424,0.276596, 0.27907, 0.347826, 0.465116, 0.487179, 0.5, 0.555556}

pdf=LearnDistribution[z]
Plot[PDF[pdf, z], {z, -.5, 1}]

enter image description here

the distribution is learnded quickly.

But the cumulative distribution CDF[...]

CDF[pdf, .5]

doesn’t evaluate!

What’s wrong here?

Thanks!

dnd 5e – Can the superiority die from ‘Superior Technique’ be used for newly learned combat maneuvers?

A fighter receives a superiority die for choosing Superior Technique fighting style, then reaches level 3 and chooses Martial Archetype; Battle Master.

Can the superiority die from superior technique be used to perform the maneuvers learned through the Battle Master’s Combat Superiority feature?

The trouble I’m running into is with the wording that the dice are added. Yet a player choosing this fighting style at level 1 would not have any superiority dice, then when you gain combat superiority it declares you have 4 dice, could be interpreted to mean the die you would already have is overwritten ‘You have four superiority dice’ (and not 5 dice).

Relevant Rules info:

SUPERIOR TECHNIQUE You learn one maneuver of your choice from among
those available to the Battle Master archetype… You gain one superiority
die, which is a d6 (this die is added to any superiority dice you have
from another source). This die is used to fuel your maneu­vers.
(Tashas p.41)

And

COMBAT SUPERIORITY When you choose this archetype at 3rd level, you
learn maneuvers that are fueled by special dice called superiority
dice…

Superiority Dice. You have four superiority dice, which are d8s. A
superiority die is expended when you use it. You regain all of your
expended superiority dice when you finish a short or long rest. (PHB p.73)

dnd 5e – If you change your Wizard subclass from Chronurgy Magic to something else, do you retain the subclass-specific dunamancy spells you’ve learned?

You know what you know.

The intent of the sidebar, taken as a whole, is “dunamancy is rare and protected, and it requires DM permission to learn if you aren’t a trained dunamancer”, but since dunamancer subclasses can use any of these spells as much as they like, this doesn’t seem to be for balance reasons. It’s just the flavor of the setting.

From a rules perspective, your spellbook is what it is. The sidebar says any wizard can add dunamancy to their spellbook if they’re specifically allowed to, and you had permission by dint of your subclass, so you’re fine there.

From a flavor standpoint, when you learned those spells, you were in fact a dunamancer, and then later you changed your subclass for whatever reason. You probably won’t be able to add new dunamancy spells to your book without the DM providing them to you, but the existing knowledge doesn’t evaporate.

But ask your DM.

Changing your subclass is always “with DM approval”, and always a conversation to determine why and how it’s going to happen. It doesn’t actually matter what the sidebar and the “changing subclasses” rules say; it’s between the two of you at the table to come up with a story and determine the answer to questions like how it impacts your known dunamancy spells. There is no set of rules that can override your personal discussion with your DM.

If you talk it over with the DM and decide that you’re just changing your focus for character reasons, but you’ll be allowed to keep your dunamancy spells, then you have the necessary DM permission to keep them. It doesn’t matter whether or not that’s strictly according-to-sidebar; the DM says that’s how it’ll work.

If you and the DM mutually decide that you’ve somehow lost your magical connection to dunamis, then maybe all dunamancy is now out of your reach, and the spells are still there in your book, but useless to you. The DM should probably take into account that you’ve lost a bunch of spells off your list and make an effort to let you replace them with non-dunamancy spells. Maybe later you’ll regain your connection and re-acquire all those lost spells, again with the DM’s permission.

If you and your DM decide that your character is intentionally turning their back on dunamancy, believing it to be dangerous or unethical, maybe you rip those pages out of your spellbook and burn them, swearing never again to use that power. In that case, then you have your answer (and the DM should again give you the opportunity to replace them).

Ultimately, it’s not about what the book says, because every relevant rule in the book is explicitly prefaced with “if the DM wants to allow it”.

dnd 5e – Can a multiclass Artificer use Alchemical Savant on spell learned through the other class(es)?

The description for Alchemical Savant say:

You’ve developed masterful command of magical chemicals, enhancing the healing and damage you create through them. Whenever you cast a spell using your alchemist’s supplies as the spellcasting focus, you gain a bonus to one roll of the spell. That roll must restore hit points or be a damage roll that deals acid, fire, necrotic, or poison damage, and the bonus equals your Intelligence modifier (minimum of +1).

Now, say I have multiclassed with a Wizard and learn Infestation and Chromatic Orb via that class. Both can do poison damage so they qualify on that part.

Can I take advantage of Alchemical Savant with either spell?

Unlike a lot of other class features, it doesn’t say, “When you cast an (insert class name) spell…”, just cast a spell and use tools as the focus.

Initially I would just say no, but, while not laid out in the PHB, in XGE it says that the Alchemist’s Supplies kit contains:

Alchemist’s supplies include two glass beakers, a metal frame to hold a beaker in place over an open flame, a glass stirring rod, a small mortar and pestle, and a pouch of common alchemical ingredients, including salt, powdered iron, and purified water.

And in the PHB, the (Wizard’s Arcane) focuses are described as:

An arcane focus is a special item–an orb, a crystal, a rod, a specially constructed staff, a wand-like length of wood, or some similar item–designed to channel the power of arcane spells. A sorcerer, warlock, or wizard can use such an item as a spellcasting focus.

So it may be possible to have an arcane focus built-in to the character’s alchemist’s supplies and do double duty…


The is a related question about spells with no material components, but this is about spells that have material components, but learned through a different class.

dnd 5e – Can you cast a spell learned from the Magic Initiate feat using spell slots?

No, you can’t use spell slots, unless you choose the class associated with your Spellcasting feature.

Without loss of generality, suppose you are a Wizard who takes the Magic Initiate feat (PHB, p. 168), and pick the cleric class for the feat. The relevant part of the description of the feat says:

Choose a class: bard, cleric, druid, sorcerer, warlock, or wizard. You learn two cantrips of your choice from that class’s spell list.

In addition, choose one 1st-level spell to learn from that same list. Using this feat, you can cast the spell once at its lowest level, and you must finish a long rest before you can cast it in this way again.

So the 1st-level spell you choose for the feat is a cleric spell (as are the cantrips). Even if the 1st-level spell you choose for the feat is on both the cleric and wizard spell lists, it still counts as a cleric spell for you.

Unfortunately, as of the 2018 PHB errata, the wizard’s Spellcasting feature says, (emphasis mine):

The Wizard table shows how many spell slots you have to cast your wizard spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell’s level or higher.

A wizard may only cast wizard spells with their wizard spell slots. This is confirmed in the official ruling on Magic Initiative in the Sage Advice Compendium:

If you have spell slots, can you use them to cast the 1st-level spell you learn with the Magic Initiate feat?

Yes, but only if the class you pick for the feat is one of your classes. (…)

If the cleric spell chosen counted as a wizard spell for you, you would be able to cast it using your spell slots, but the SAC confirms that the class you choose for Magic Initiate must be one of your classes for this to be the case.

On the other hand, if the wizard took the Magic Initiate feat and picked the wizard class for the feat, the chosen spell would be a wizard spell for you, and would be eligible for casting with your wizard spell slots. This is confirmed in the Sage Advice Compendium ruling, which continues:

(…) Similarly, if you are a wizard and pick that class for the feat, you learn a 1st-level wizard spell, which you could add to your spellbook and subsequently prepare.

In short, you must follow your character’s normal spellcasting rules, which determine whether you can expend spell slots on the 1st-level spell you learn from Magic Initiate.

Eldritch Knight and Arcane Trickster

In particular, casting a spell with your spell slots as an Eldritch Knight fighter or Arcane Trickster rogue requires two things: that you know the spell, and that it is a wizard spell. The spell gained from Magic Initiate satisfies both of these conditions if you choose the wizard class for the feat.

The Eldritch Knight’s Spellcasting feature says (PHB, p. 75; emphasis mine):

The Eldritch Knight Spellcasting table shows how many spell slots you have to cast your wizard spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell’s level or higher. You regain all expended spell slots when you finish a long rest.

Similarly, the Arcane Trickster’s Spellcasting feature says (PHB, p. 98; emphasis mine):

The Arcane Trickster Spellcasting table shows how many spell slots you have to cast your wizard spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell’s level or higher. You regain all expended spell slots when you finish a long rest.

If you pick the wizard class for the Magic Initiate feat, and therefore the 1st-level spell you learn from the feat is a wizard spell for you, it meets all the conditions for being able to expend spell slots to cast it as an Eldritch Knight or an Arcane Trickster.

This ruling is confirmed by the same Sage Advice Compendium ruling quoted earlier (emphasis mine):

In short, you must follow your character’s normal spellcasting rules, which determine whether you can expend spell slots on the 1st-level spell you learn from Magic Initiate.

Since your Spellcasting feature says you can use your spell slots to cast wizard spells, then if you take Magic Initiate and pick the wizard class, you can cast that 1st-level wizard spell using your spell slots.

c++ – I’m done with my first year of college as a software engineer and I feel like I haven’t learned intermediates programming!

I am a freshman and today was my last day of freshman year so a sophomore next semester, I yoo intro to programming in C++ and intermediate programming in C++, when I did intro it was a different teacher and I enjoyed doing it, it was fun but when I got to intermediate it started falling apart, first assignment I knew I didn’t know how to make a linked list, and I still don’t, I knew I wasn’t learning because I was asking friends for the assignments or looking them up, but even when I tried it was impossible, I just didn’t know what he wanted since he would use slides to teach us and google didn’t help either, I feel useless and stupid, I want to be a software engineer badly but it’s killing me mentally, I feel like I will not succeed in further since I “cheated” (I didn’t learn so cheated) through the class, now I am even more scared since I have to take Digital Design: Theory and Practice next which the Professor is even worse than the intermediate one, am I fit to be a programmer? I always carry the feeling that I haven’t learned anything and I am bound to fail, how will I do a job if I can’t learn it in college. I know one thing I’d rather die than change majors. Why is programming so annoying and why are professors so shitty! I wish they would just teach the code instead of power point slides. Would you say I will fail when I do a job? I don’t want to be that guy that can’t do something so simple.

satisfiability – How often can a learned clause cause this solver to backtrack?

The is an improvement to the X3SAT solver I described in What is wrong with this simple proof of P=NP? I have fixed the flaw found in that solver. Now, I want to know how often the solver described below will backtrack because of a particular learned clause.

Exactly 1 in 3 SAT ($X3SAT$) is a variation of the Boolean Satisfiability problem. Given an instance of clauses where each clause has three literals, is there a set of literals such that each clause contains exactly one literal from the set. $X3SAT$ is NP-Complete even when the instance is monotone and linear. Monotone means all literals are positive. Linear means no two clauses share more than one variable in common.

The algorithm I describe is a clause based lexicographical satisfiability ($LexSAT$) solver. A $LexSAT$ solver finds the lowest or highest “numbered” satisfying assignment based on a given ordering of the variables or clauses.

Davis, Putnam, Logeman, Loveland ($DPLL$) with fixed variable order is an example of a LexSAT solver. If we agree 0 means a variable is false and 1 means a variable is true then any satisfying assignment of an $N$ variable instance can be represented by an $N$-bit binary number.

Assume all variables are unset. Choose the highest order unset variable and set it to 0 (false). If there is no conflict then repeat. If there is a conflict then backtrack and set the variable to 1 (true). If this also causes a conflict then backtrack to the lowest order variable that is set to 0. Set this variable to 1, unset all lower order variables, and repeat. This procedure will find the smallest binary number that represents a satisfying assignment.

The solver I describe below orders the $M$ clauses and represents a satisfying assignments with an $M$-trit ternary number.

Order the literals in each clause lexicographically, highest to lowest. Let $2$ represent the highest order literal, $0$ represent the lowest, and $1$ the middle literal. Then, order the clauses lexicographically, highest to lowest.

$quad(t,r,h)(t,p,o)(t,n,l)(s,o,a)(s,m,l)(s,j,c)(r,q,j)(q,l,g)(o,j,e)(n,m,e)(l,k,e)(i,h,c)(g,f,e)(e,d,c)(c,b,a)$

This linear, monotone instance has two satisfying assignments:

a,d,g,i,j,k,m,t are true and all other variables are false.

b,e,i,q,s,t are true and all other variables are false.

Algorithm description:

  1. Choose the highest order unsatisfied X3SAT clause.

  2. Choose the lowest order unassigned variable in this clause and set it true.

  3. Process all X3SAT clauses with this newly set true variable and set all other variables in these clauses to false.

  4. Reduce learned clauses. Set to false all variables that appear in a unit learned clause.

  5. If no conflict go to step 1.

  6. Create a learned clause from the true variables that caused the conflict. Do not create a learned clause if one or more of the variables in the conflict clause wasn’t set false in an assigned X3SAT clause.

  7. Increment the lowest order satisfied clause that can be incremented.

  8. Unset all variables set by clause assignments below the newly incremented clause.

  9. Go to step 3.

Example (variables set to true are capitalized):

set clause-processed clauses / true / false

$quad(t,r,H)-(i,H,c) / H / t,r,i,c$

$quad(t,p,O)-(s,O,a)(O,j,e) / O,H / t,s,r,p,j,i,e,c,a$

$(s,j,c)$ is a conflict

There can never be more than three true variables involved in a conflict:

$s$ was set false when $O$ was set true in $(s,O,a)$

$j$ was set false when $O$ was set true in $(O,j,e)$

$c$ was set false when H was set true in $(i,H,c)$

$quad(s,j,c)-(s,O,a)(O,j,e)(i,H,c)$

$H$ and $O$ cause the conflict. Add $(bar o lor bar h)$ to the learned clauses.

Increment $(t,p,o)$, setting $P$ true, and go to step 3.

Repeating this process eventually creates the following learned clauses;

$quad(bar o lor bar h), (bar l), (bar n lor bar a), (bar s lor bar n), (bar o lor bar n)$

It is possible for more than one clause to cause a conflict. There can also be more than one true variable that forces a variable to be set false in the conflict clause. When these things happen simply create multiple learned clauses. There will still never be more than three literals in a learned clause.

The lowest numbered satisfying assignment is $t, m, k, j, i, g, d, a$ true and all other variables false:
$quad(T,r,h)(T,p,o)(T,n,l)(s,o,A)(s,M,l)(s,J,c)(r,q,J)(q,l,G)(o,J,e)(n,M,e)(l,K,e)(I,h,c)(G,f,e)(e,D,c)(c,b,A)$

This corresponds to the base 3 number $222011001112210$.

The other satisfying assignment would correspond to $222222120002021$.

$quad(T,r,h)(T,p,o)(T,n,l)(S,o,a)(S,m,l)(S,j,c)(r,Q,j)(Q,l,g)(o,j,E)(n,m,E)(l,k,E)(I,h,c)(g,f,E)(E,d,c)(c,B,a)$

Since there can’t be more than $O(n^3)$ learned clauses it is tempting to claim this proves $P=NP$. It appears this solver will only backtrack a polynomial number of times before finding a satisfying assignment or proving the instance unsatisfiable.

Unfortunately, a given learned clause can cause the solver to backtrack multiple times. For example, $(bar l)$ prevents $l$ from being set true in $(t,n,l)$ when $(t,r,h)$ gets incremented.

My question is how often can a learned clause cause this solver to backtrack?

It is obvious there are upper bounds. Take $(bar l)$ as an example. $l$ appears in the third highest order clause, $(t,n,l)$. We can ignore all lower order clauses because $l$ will always be false when these clauses get processed. Since there are only two higher order clauses than $(t,n,l)$, $(bar l)$ can’t cause more than $3^2$ increments.

The learned clause $(bar o lor bar h)$ can’t cause more than one backtrack. $o$ is in the second highest order clause and $h$ must be true in the highest order clause before $(bar o lor bar h)$ can force a backtrack.

dnd 5e – Can you cast a spell learned from the Magic Initiate feat using spell slots?

No, you can’t use spell slots, unless you choose the class associated with your Spellcasting feature.

Without loss of generality, suppose you are a Wizard who takes the Magic Initiate feat (PHB, p. 168), and pick the cleric class for the feat. The relevant part of the description of the feat says:

Choose a class: bard, cleric, druid, sorcerer, warlock, or wizard. You learn two cantrips of your choice from that class’s spell list.

In addition, choose one 1st-level spell to learn from that same list. Using this feat, you can cast the spell once at its lowest level, and you must finish a long rest before you can cast it in this way again.

So the 1st-level spell you choose for the feat is a cleric spell (as are the cantrips). Even if the 1st-level spell you choose for the feat is on both the cleric and wizard spell lists, it still counts as a cleric spell for you.

Unfortunately, as of the 2018 PHB errata, the wizard’s Spellcasting feature says, (emphasis mine):

The Wizard table shows how many spell slots you have to cast your wizard spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell’s level or higher.

A wizard may only cast wizard spells with their wizard spell slots. This is confirmed in the official ruling on Magic Initiative in the Sage Advice Compendium:

If you have spell slots, can you use them to cast the 1st-level spell you learn with the Magic Initiate feat?

Yes, but only if the class you pick for the feat is one of your classes. (…)

If the cleric spell chosen counted as a wizard spell for you, you would be able to cast it using your spell slots, but the SAC confirms that the class you choose for Magic Initiate must be one of your classes for this to be the case.

On the other hand, if the wizard took the Magic Initiate feat and picked the wizard class for the feat, the chosen spell would be a wizard spell for you, and would be eligible for casting with your wizard spell slots. This is confirmed in the Sage Advice Compendium ruling, which continues:

(…) Similarly, if you are a wizard and pick that class for the feat, you learn a 1st-level wizard spell, which you could add to your spellbook and subsequently prepare.

In short, you must follow your character’s normal spellcasting rules, which determine whether you can expend spell slots on the 1st-level spell you learn from Magic Initiate.

Eldritch Knight and Arcane Trickster

In particular, casting a spell with your spell slots as an Eldritch Knight fighter or Arcane Trickster rogue requires two things: that you know the spell, and that it is a wizard spell. The spell gained from Magic Initiate satisfies both of these conditions if you choose the wizard class for the feat.

The Eldritch Knight’s Spellcasting feature says (PHB, p. 75; emphasis mine):

The Eldritch Knight Spellcasting table shows how many spell slots you have to cast your wizard spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell’s level or higher. You regain all expended spell slots when you finish a long rest.

Similarly, the Arcane Trickster’s Spellcasting feature says (PHB, p. 98; emphasis mine):

The Arcane Trickster Spellcasting table shows how many spell slots you have to cast your wizard spells of 1st level and higher. To cast one of these spells, you must expend a slot of the spell’s level or higher. You regain all expended spell slots when you finish a long rest.

If you pick the wizard class for the Magic Initiate feat, and therefore the 1st-level spell you learn from the feat is a wizard spell for you, it meets all the conditions for being able to expend spell slots to cast it as an Eldritch Knight or an Arcane Trickster.

This ruling is confirmed by the same Sage Advice Compendium ruling quoted earlier (emphasis mine):

In short, you must follow your character’s normal spellcasting rules, which determine whether you can expend spell slots on the 1st-level spell you learn from Magic Initiate.

Since your Spellcasting feature says you can use your spell slots to cast wizard spells, then if you take Magic Initiate and pick the wizard class, you can cast that 1st-level wizard spell using your spell slots.

dnd 5e – Are the spells learned from the “Touched” feats considered class spells when cast using spell slots?

The Fey Touched and Shadow Touched feats published in Tasha’s Cauldron of Everything each grant the use of two spells. Among other things, they say:

  1. You learn the (spells).
  2. You can cast each of these spells without expending a spell slot (once per long rest).
  3. You can also cast these spells using spell slots you have of the appropriate level.

The spellcasting ability for these spells is specific to the feat, so it may or may not be the same as the ability of a class that grants spell slots.


Casting classes all have their own quirks regulating their spellcasting features, but these shouldn’t be relevant to how the Touched feats’ spells are cast in #2 because that casting isn’t using a spellcasting feature. This is clear because even non-casting classes can cast the spells in this way, so only the generic spellcasting rules apply there.

(This is related to why racial feat spells can’t be cast with a focus, as discussed at If a spellcaster’s racial trait grants a spell that requires material components, can they use their class’ focus to cast that spell?)

However, things get more complicated when the feats’ spells are cast as described in #3, because the spell slots referenced there do come from a class spellcasting feature. In that case, does the caster simply use the spell slot as “fuel” and otherwise cast the spell exactly as it had been cast for #2? Or is this inherently different, with the caster actually using their class spellcasting feature and therefore having to follow all of its specific rules?

Furthermore, is the answer different depending on whether the specific Touched feat spell being cast is on the caster’s class’ spell list or not?


Potentially Related:

Does Magic Initiate allow the chosen spell to effectively be “always prepared” if the spell is on their spell list?

What makes a spell being cast considered to be a {class} spell?

Are spells learned from feats considered to be associated with your class?

dnd 5e – Can you cast a spell learned from the Magic Initiate feat using spell slots?

The Sage Advice Compendium appears to be misquoting it’s own source texts (which is truly frustrating because the most indelible measure of being wrong is being wrong by your own logic) as, in the PHB, the Sorcerer Spellcasting feature makes no mention of specifically casting “Sorcerer” spells.

The above ruling is wrong, at least in the 5e rule set as written (including errata). After a careful reading of the spellcasting ability description of all classes you will find the specificity of the cleric description to be an exception in terms of wording.

Further examination of the multiclassing section of the PHB will net you the understanding that spell slots are a feature tied to Character Level, though the ability to cast spells in general using a spell slot requires having a class with the spellcasting feature, as they are the only classes with spellslots to use.

Looking through the Spellcasting chapter of the PHB will also reveal that regardless of the source of the magical knowledge, all spells follow the set out rules in the same way. In this section there is no mention of spell slots being class specific, and evidence would lead one to conclude that the function of spells being denoted as class specific pertains to the traditions in which they are learned and thus the ability modifiers applied to them.

The only difference in casting type is in the form of the distinction made between the Spellcasting and Pact Magic class features.

Add to this the fact that the only specification in the Magic Initiate feature regarding learning the spell is that it is learnt as a spell from a specific class which means the ability modifiers added to it are derived from that class’ specification for spell modifier and it is obvious to me that RAW allows the spell to be cast with any spell slot, at least before the question was answered by the Wizards Team in which they misquote their own material.

This leads me to believe that either the team misread their personal notes on the topic and substituted them for final copy materials to reference, or that they need to issue another errata, or, finally, that given that the DM is the be all and end all of rules and that all forms of common sense from the material given would lead you to deduce that you can cast a spell with any spell slot because there is absolutely no mention of spell slots being class specific, most DMs should probably ignore the above ruling.

This is the way I have been running my games since we moved to 5e at least, and its the one that makes the most sense deriving from the base texts only. Though the team may have notes that clarify this, they have not shared them, and the SAC quotes a non-existent line of text, so I’m not entirely sure this ruling will stand for long anyway.