Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python Score: 0 / 1 0 ( 0 % ) Output Initial fraction of plutonium: 0 . 2 5 Final ingredient composition: [ 0 .
python
Score:
Output
Initial fraction of plutonium:
Final ingredient composition:
Test Results
Checking initialfrac
Max points:
Earned points:
Message
'initialfrac' is inaccurate
Checking finalcomp
Max points:
Earned points:
Message
'finalcomp' is inaccurate
Kelly has a magic pot which can slowly cook one ingredient into others. She already
mastered the cooking techniques and concludes that the process can be modeled using
markov chain represented by a transition matrix
You are given the ingredient list materiallist snake oil", "silver",
"caviar", "bones", "uranium", "plutonium" which corresponds to the rows and
columns order of A Each entry of A represents the fraction of the ingredient of
materiallist that will turn into the ingredient per minute without losing any mass.
One day Kelly started making some of her magical soup and after a few minutes she
realized she forgot to start the timer. She could not remember the time she started
cooking, or even the ingredient composition of her initial soup. She can only recall that
at the beginning of the cooking, of the mass of all materials is snake oil.
In fear of ruining her precious ingredients, she immediately casts a spell to determine
the current composition of the soup and stores it in the vector comp, where each entry
is the fraction in terms of mass of each ingredient, following the order in
materiallist.
Write a code snippet to help Kelly with the following:
Use the current ingredient composition given in comp to determine the initial
ingredient composition. Store in the variable initialfrac the initial fraction of
the ingredient plutonium.
Suppose Kelly decides to leave the soup cooking for a very long time, until the
ingredient composition in the pot is no longer changing. Help her determine this
final ingredient composition and store it in the vector finalcomp, where each
entry is the fraction in terms of mass of each ingredient, following the order in
materiallist.
The setup code will provide the following variables:
Your code snippet should define the following variables:
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