โ“ โŒ Eliminate or โœ… Evaluate: Surviving the Sympy ๐Ÿฆ‘ Challenge!

# You must make sure to run all cells in sequence using shift + enter or you might encounter errors
from pykubegrader.initialize import initialize_assignment

responses = initialize_assignment("15_sympy_q", "week_3", "readings", assignment_points = 23.0, assignment_tag = 'week3-readings')

# Initialize Otter
import otter
grader = otter.Notebook("15_sympy_q.ipynb")

โ“ โŒ Eliminate or โœ… Evaluate: Surviving the Sympy ๐Ÿฆ‘ Challenge!#

# Run this block of code by pressing Shift + Enter to display the question
from questions._15_sympy_q import Question1
Question1().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._15_sympy_q import Question2
Question2().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._15_sympy_q import Question3
Question3().show()

Ddakji Flip Card System Analysis#

Instructions:#

In Ddakji the โ€œFlip Cardโ€ game, a nonlinear system of equations models the flipping dynamics:

\[[ xy = 1, \ x - 2 = 0 ]\]

Use SymPy to:

  1. Solve the nonlinear system of equations.

  2. Return the symbolic solution.

Your solution must include:

  1. A function analyze_flip_card() that:

    • Define the needed symbols for the variables x and y.

    • Defines the system of equations to the variable equations. To do this, you should solve each expression such that it equals zero. equations should be a list of the two equations.

    • Solves it using nonlinsolve. If you need help use the help() function. Assign the solution to the variable solution. You can pass a list of symbols as the second argument to nonlinsolve.

    • Returns the solution. We have provided the return statement for you.

# Import SymPy
...

def analyze_flip_card():
    # Define the SymPy symbols
    ...
    
    # Define the equations for the Flip Card System
    ...
    
    # Solve the equations using non-linear solver nonlinsolve
    ...
    return solution


# Example test case
solution = analyze_flip_card()
print(f"Flip Card System Solution: {solution}")
grader.check("Ddakji-Flip-Card-System-Analysis")

Submitting Assignment#

Please run the following block of code using shift + enter to submit your assignment, you should see your score.

from pykubegrader.submit.submit_assignment import submit_assignment

submit_assignment("week3-readings", "15_sympy_q")