assumptions – Why a complementary inequality for function values does not simplify to False?

I have a general assumption of a function to be positive. The direct inequality (f(x)>0) does simplify to True, but a complementary one (f(x) < 0) does not simplify at all despite the fact that I explcitly assumed that funciton is not zero.

$Assumptions = K(_) > 0 && K(_) != 0

FullSimplify(K(15) > 0)
True
FullSimplify(K(12) == 0)
False
FullSimplify(K(15) < 0)
K(15) < 0

Thansk in advance,

dnd 5e – Can Touch Range Spells/Effects Function Through Armor?

This is a trickier question than I thought it would be, and there is no definite answer laid out in the rules. To give the conclusion in advance…

You may be able to protect allies from your skin while using Touch-range spells on them.

But you’ll need to ask your DM.

Here’s the complication

On the one hand, Touch Spells are blocked by the armor of your target. A spell like Inflict Wounds makes a Melee Spell Attack against a target’s AC. There’s no rule in there that this attack bypasses the AC bonus from armor, so clearly a Touch Attack spell has to get around their armor. However, there is also no rule in place that says you have to contact skin–otherwise something like winter clothing would also provide protection from Touch spells.

Complicating the issue a bit, there are a lot of spellcasters who can wear armor–and to provide the description of Chain Mail:

Made of interlocking metal rings, chain mail includes a layer of quilted fabric worn underneath the mail to prevent chafing and to cushion the impact of blows. The suit includes gauntlets.

In the absence of any rules that say you have to take your gauntlets off to cast a Touch spell, it can be assumed that a Touch spell can work through them. Given that clothing doesn’t seem to stop a Touch attack, this makes a sort of sense–the palm of a gauntlet is often made from soft leather…more like clothing than armor.

This leaves us in a rather odd place, from a realism standpoint. Heavy winter clothing may be just as thick (or thicker than) padded armor, but padded armor provides protection from a Touch spell that winter clothing does not. Ultimately, this appears to be a piece of unrealism in the mechanics that is ignored in the name of simplicity–just like how a thick winter outfit doesn’t provide protection like padded armor.

So, here’s what we know:

  • Armor blocks Touch Attacks
  • Clothing does not block Touch Attacks
  • You can (apparently) use Touch Attacks through the ‘glove’ interior of a gauntlet.

Based on that, it’s probably safe to assume that your character does not actually need to come into skin to skin contact in order to use Touch-range spells.

That leads to the last problem, which is the big one…what is “direct contact?” Well, grappling only requires one free hand, so you can ‘grapple’ by grabbing someone with a gauntleted hand. The fact that a grapple always causes a save against a Grung’s poison means that their poison can apparently affect you straight through the glove of your gauntlet.

Based solely on this…anything that lets you communicate a Touch spell would also potentially transmit your poison. But the phrasing of “comes into direct contact with your skin” leaves the possibility of things like shoving a Grung into a burlap sack and not getting poisoned through the sack. So–if the Grung is wearing clothing, does it protect you from their skin? Is the special case with grappling because you have to grab and squeeze to hold them in place, so their poison is pressed through your glove?

All-in-all, the fact that it calls out a requirement to either grapple or come into direct contact with a Grung’s skin leads me to believe that if a Grung wore clothing and was not handled roughly, the clothing would be able to contain their poison. This would allow you to physically contact party members in a way that would allow Touch-range spellcasting, without poisoning them. At the cost of preventing you from just touching enemies to poison them unless you took your gloves off first.

If you want to be absolutely certain/safe…then grab the Ritual Caster or Magic Initiate (Wizard) feats to get access to Find Familiar, and let your familiar do all the touch-range spellcasting for you.

This is far from a concrete ruling–you will absolutely need to ask your DM about this–but hopefully, this post gives you some discussion points you can bring up with them.

computability – How to show a function is primitive recursive by induction?

I know, loosely speaking, if we can define a function $f$ in term of
begin{align}
&f(0,vec{x})=g(vec{x})\
&f(n+1,vec{x})=h(f(n),n,vec{x})
end{align}

where functions $g,h$ are primitive recursive. Then $f$ is primitive recursive.

However, what it means to show a function is primitive recursive by induction?

I had read above explaination on page 93 on book $textit{Computability}$ by Epstein and Carnielli, but still I’m not sure if I got the idea. Could someone provide some examples about how a inductive definition shows a function is primitive recursive?

Unit Testing Private Function Through Public Interface

Am new to unit testing, and I have been struggling with the right approach to test private functions. I have done my research, and am going with testing through the public interface.

My problem is the following, if I have a private function used by two public functions, I encounter test case duplicates, which I don’t know how to overcome. Extracting the private function into another class doesn’t seem appropriate in the case am facing, as the function is sufficient only for the class am using it from.

Example:

// This function is called only once, once the view is loaded
override func handleViewDidLoad() {
    super.handleViewDidLoad()
    loadData()
    // I have extra setup code in here
}

 // This function is called when user double taps on the screen
 override func handleReloadData() {
    super.handleReloadData()
    loadData()
}

private func loadData() {
    delegate.showLoading()
    fetchData { (weak self) in
        self?.delegate?.hideLoading()
    }
}

// I have another function that uses this one. But it's not included in the sample
private func fetchData(then completion: @escaping (() -> Void)) {
    service.start() { (weak self) (_, error) in
        if error == nil {
            if self?.shouldTrackScreen == false {
                self?.shouldTrackScreen = true
                self?.delegate?.trackScreen()
            }
        }
        completion()
    }
}

So when I think about handleViewDidLoad function’s test cases. I will have the following:

  1. Check that showLoading is called.
  2. Check that hideLoading is called in case of service success.
  3. Check that hideLoading is called in case of service failure.
  4. Check that service.start() is called.

Same applies to handleReloadData test cases. This way I will end up with a duplicate of each test case of the above.
And if I have another function that uses fetchData function, I will also have to repeat the 4th test case.

Is there a way to overcome those duplicates?

python – How to store the value of the calculated variable within a function to another variable outside it?

I am new to Python programming, and trying to calculate the heat of an enclosure with the user-fed values (Height, depth and width) in entries (Tkinter GUI interface). I have defined a function to calculate the area for every different type of the enclosure. However, I am not able to to fetch the value of final result and store it outside the function (I tried using global variable too. But it didn’t work). Below is my code:

def AreaofEnclosuretype (AreaResult, Height, Depth, Width):
    H = (Height.get())
    D = (Depth.get())
    W = (Width.get())
    selection = v.get()
    if  selection == 1:
        result1 = 1.8*float(H)*(float(W) + float(D)) + 1.4*float(W)*float(D)
    elif selection == 2:
        result1 = 1.4*float(W)*(float(H) + float(D)) + 1.8*float(H)*float(D)
    AreaResult.config(text="Area of enclosure is %f" % result1)
    return

Furthermore, I can display the value of calculated Area within the master window. How do I fetch/extract the value of the the calculated variable result1 and store it as another variable ?

lambda calculus – PCF encoding and denotational semantics of simple recursive function

Let $f$ be the function:

$f(n: mathbb{N}) = text{if }(n > 0) text{ then } 0 text{ else } f(n-1)$

I encode it in PCF following the notations in a standard text in denotational semantics:

$f = Y_{sigma}(lambda f: nat to nat. lambda n: nat. text{ifz}(n,0,pred(n))$

Then I try to compute its semantics:

$((vdash f ))5 = mu(((lambda f. lambda n. text{ifz}(n,0,pred(n))))) = mu(Lambda (f vdash ((lambda n. text{ifz}(n,0,pred(n))))5))$

However, from here the computation seems confusing. For instance, what value should $f$ have according to the annotated environment (in this case $5$).

Denotational semantics rules:

enter image description here

enter image description here

Passing python data types as function argument

I’ve a few python data types

edges = ((1,2), (1,3), (1,4), (2,5), (2,6), (5,6), (3,4), (3,7), (6,7), (7,8), (2,9));
vl = (1,2,3,4,5,6,7,8,9)
ew = {(1, 2) : 49.6, (1,3): 74.4, (1, 4) : 49.6, (2,5): 37.2, (2, 6) : 74.4, (5, 6): 49.6, 
     (3, 4) : 37.2, (3, 7):24.8, (6, 7) : 62, (7, 8) : 37.2, (2, 9) : 24.8}
vd = {1:(75., 25., 0), 2:(115., 45., 0), 3:(10., 5., 0), 4:(45., 0, 0), 
      5:(90., 60., 0), 6:(45., 55., 0), 7:(0, 25., 0), 8:(10., 50., 0), 9:(115.,  25.,0)};

I want to pass these variables to a function that will convert these to MMA expression.
I want to do something like below,

solutiond(edges_, vd_, vl_, ew_) := (
{edges,vl,ew,vd}=ImportString(#,"PythonExpression")&/@{"edges","vl","ew","vd"};
)

solutiond(edges,vd,vl,ew)

But I am not sure how to pass these input arguments here
{"edges","vl","ew","vd"};

in python I use .format.

Suggestions will be helpful

An otherwise linear matrix equation with the presence of a signum function : reference request

Consider the equation $$pmb{c}+text{sign}(Gpmb{c}) = L$$

$pmb{c}$ is a $ntimes1$ matrix.

$G$ is a $ntimes n$ matrix which is also positive definite.

matrices $G$ and $c$ are real.

$L$ is a $ntimes 1$ matrix whose entries are from the set ${-1,1}$.

Can this equation be solved for the matrix $pmb{c}$?
Suppose there is no signum function there, then the solution is $$pmb{c} = (G+I_n)^{-1}L$$
and as $G$ is positive definite, there exists a unique solution. But with the presence of the $text{sign}$ function, the problem doesn’t seem to belong to linear algebra. I request for a reference to any subject or book for this type of equations. Does this belong to linear programming?(I don’t know anything about it, so I am hoping it is related).

PS: please tag appropriately.

PS 2: $text{sign}((a_{i,j})_{mtimes n}) = (text{sign}(a_{i,j}))_{mtimes n}$.