Question
Create a function num_intersections(expressions) that takes a list of expressions as an argument will return a list of the number of times each expression in
Create a function num_intersections(expressions) that takes a list of expressions as an argument will return a list of the number of times each expression in this list intersects with every other expression. Each expression should be written as a string and should contain only one symbol (eg 'x').
You can assume there will always be more than one expression within the list of expressions and that no expressions will be the same.
Note: As with the questions above,parse_expr() is available for you to use in this function and sympy has been imported into this question as sp.
For example:
Test | Result |
---|---|
print(num_intersections(["x ** 2 - 1", "0.25 * x - 1"])) | [2, 2] |
print(num_intersections(["x ** 2 - 1", "0.25 * x - 1", "x + 1"])) | [4, 3, 3] |
Answer:(penalty regime: 0, 10, ... %)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started