Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pythonKelly has a magic pot which can slowly cook one ingredient into others. She already mastered the cooking techniques and concludes that the process can

pythonKelly 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 A.
You are given the ingredient list material_list =["snake oil", "silver",
"caviar", "bones", "uranium", "plutonium"] which corresponds to the rows and
columns order of A. Each entry Aij of A represents the fraction of the jth ingredient of
material_list that will turn into the ith 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, (25+-0.1)% 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
material_list.
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 initial_frac 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 final_comp, where each
entry is the fraction in terms of mass of each ingredient, following the order in
material_list.
The setup code will provide the following variables:
Your code snippet should define the following variables:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

Students also viewed these Databases questions