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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!