Question
Exercise 13: Functions with multiple return arguments Let's write a function to do Exercise 1. Use the nchoosek function inside your function to make your
Exercise 13: Functions with multiple return arguments
Let's write a function to do Exercise 1. Use the nchoosek function inside your function to
make your code as general as possible.
Write a function
[indreac, r] = ind sets(V)
in which V is a stoichiometric matrix, r is its rank r , and indreac is a matrix containing
the set of all linearly independent reactions, with each row containing a set of r integers
corresponding to a set of reactions that are linearly independent. A function can return
more than one argument, by placing the list of return arguments inside square brackets as
above.
(a) Pass in the stoichiometric matrix from Exercise 1 to check your function. Print out
the returned matrix indreac for this problem.
(b) Find your own favorite chemical reaction set with 7 or more reactions and species
whose rank is at least 2 less than the number of reactions. Apply your function to
this stoichiometric matrix and print out the list of all linearly independent reactions.
Notice that when you have a calculation that you need to repeat many times on dif-
ferent data, it's convenient to write and store a function to perform the calculation.
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