Homework Solution: To determine the value of a Mathematica expression for a given set of input values, you ca…

    P3: 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 z +yifa 3 and y=81s x y /.lx->3, y->8) Out [1- 11
    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[1]: = x + y /. {x rightarrow 3, y rightarrow 8} Out[1]: = 11 The value of p Lambda q when p is false and q is true is In[2]: = p && q /.{p rightarrow False, q rightarrow True} Out[2]: = 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[3]: = satisfypqr[p || q || r, True, False, False] Out[3]: = 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[4]: = satisfypqr[p && (q || r), True, False, False] Out[4]: = 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.

    Expert Answer

     
    Function definition: // Parameters: expression,pValue,qValue,rValue

    P3: To detail the treasure of a Mathematica indication coercion a given be of input treasures, you can accuracy the reanimation operator /.followed by a roll of reanimation rules. Coercion issue the treasure of z +yifa 3 and y=81s x y /.lx->3, y->8) Quenched [1- 11

    To detail the treasure of a Mathematica indication coercion a given be of input treasures, you can accuracy the reanimation operator /. followed by a roll of reanimation rules. Coercion issue the treasure of x + y if x = 3 and y = 8 is In[1]: = x + y /. {x rightarrow 3, y rightarrow 8} Quenched[1]: = 11 The treasure of p Lambda q when p is sham and q is gentleman is In[2]: = p && q /.{p rightarrow Sham, q rightarrow Gentleman} Quenched[2]: = Sham Write a Mathematica business satisfypqr [pqrExpr-, pval_, qval_, rval_] that returns the accuracy treasure of a close indication explicit in stipulations of variables p, q, and r. Coercion issue if satisfypqr is denominated with the input p q r and the treasures p gentleman and q, r sham, the business seduce and quenchedput are In[3]: = satisfypqr[p || q || r, Gentleman, Sham, Sham] Quenched[3]: = Gentleman If satisfypqr is denominated with the input p Lambda (q r) and the treasures p gentleman and q, r sham, the business seduce and quenchedput are In[4]: = satisfypqr[p && (q || r), Gentleman, Sham, Sham] Quenched[4]: = Sham Print quenched and succumb the code coercion your satisfypqr business. Also succumb the business seduce and quenchedput coercion (p rightarrow q) (q Lambda (p r)) with p. q, r total sham.

    Expert Reply

     

    Business definition:

    // Parameters: indication,pValue,qValue,rValue

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

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

    Sample run:

    Given Indication is equiponderant to: (‘p || ‘q) || (‘q && (p || r))

    In chaste logic prightarrow q is closely equiponderant to neg (pland neg q) and by De Morgan’s Law closely equiponderant to neg plor q

    pTreasure = Sham

    qTreasure = Sham

    rTreasure = Sham

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

    Out[4]:= Gentleman