# Homework Solution: To determine the value of a Mathematica expression for a given set of input values, you ca…  To determine the value of a Mathematica expression for a given set of input values, you can use the replacement operator /. followed by a list of replacement rules. For example the value of x + y if x = 3 and y = 8 is In: = x + y /. {x rightarrow 3, y rightarrow 8} Out: = 11 The value of p Lambda q when p is false and q is true is In: = p && q /.{p rightarrow False, q rightarrow True} Out: = False Write a Mathematica function satisfypqr [pqrExpr-, pval_, qval_, rval_] that returns the truth value of a logical expression expressed in terms of variables p, q, and r. For example if satisfypqr is called with the input p q r and the values p true and q, r false, the function call and output are In: = satisfypqr[p || q || r, True, False, False] Out: = True If satisfypqr is called with the input p Lambda (q r) and the values p true and q, r false, the function call and output are In: = satisfypqr[p && (q || r), True, False, False] Out: = False Print out and submit the code for your satisfypqr function. Also submit the function call and output for (p rightarrow q) (q Lambda (p r)) with p. q, r all false.

Function definition: // Parameters: expression,pValue,qValue,rValue  To state the appreciate of a Mathematica look restraint a consecrated coercionmal of input appreciates, you can interpretation the reanimation operator /. followed by a register of reanimation rules. Restraint specimen the appreciate of x + y if x = 3 and y = 8 is In: = x + y /. {x rightarrow 3, y rightarrow 8} Extinguished: = 11 The appreciate of p Lambda q when p is bogus and q is gentleman is In: = p && q /.{p rightarrow Bogus, q rightarrow Gentleman} Extinguished: = Bogus Write a Mathematica capacity satisfypqr [pqrExpr-, pval_, qval_, rval_] that receipts the exactness appreciate of a argumentative look explicit in provisions of variables p, q, and r. Restraint specimen if satisfypqr is denominated with the input p q r and the appreciates p gentleman and q, r bogus, the capacity wheedle and extinguishedput are In: = satisfypqr[p || q || r, Gentleman, Bogus, Bogus] Extinguished: = Gentleman If satisfypqr is denominated with the input p Lambda (q r) and the appreciates p gentleman and q, r bogus, the capacity wheedle and extinguishedput are In: = satisfypqr[p && (q || r), Gentleman, Bogus, Bogus] Extinguished: = Bogus Print extinguished and yield the method restraint your satisfypqr capacity. Also yield the capacity wheedle and extinguishedput restraint (p rightarrow q) (q Lambda (p r)) with p. q, r full bogus.

## Expert Response

Capacity definition:

// Parameters: look,pValue,qValue,rValue

satisfypqr[expression,pValue,qValue,rValue]:=

return look /. {p->pValue,q->qValue,r->rValue}

Sample run:

Consecrated Look is equipollent to: (‘p || ‘q) || (‘q && (p || r))

In chaste logic is argumentatively equipollent to and by De Morgan’s Law argumentatively equipollent to pAppreciate = Bogus

qAppreciate = Bogus

rAppreciate = Bogus

In:= satisfypqr[(‘p || ‘q) || (‘q && (p || r)),False,False,False]

Out:= Gentleman