5 Pages

HW5_BME153_S09

Course: BME 153, Spring 2009
School: Duke
Rating:
 
 
 
 
 

Word Count: 2130

Document Preview

153L BME - Spring 2009 Homework 5: Maple Introduction 5.1 Introduction This homework focuses using Maple to find both the symbolic and the numeric solutions to the linear algebra equations involved with solving electric circuits. Specifically, this lab depends on the full set of equations generated from Ohm's law and Kirchhoff's laws. 5.2 Solving Equations Once you have found the necessary equations to solve a...

Register Now

Unformatted Document Excerpt

Coursehero >> North Carolina >> Duke >> BME 153

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
153L BME - Spring 2009 Homework 5: Maple Introduction 5.1 Introduction This homework focuses using Maple to find both the symbolic and the numeric solutions to the linear algebra equations involved with solving electric circuits. Specifically, this lab depends on the full set of equations generated from Ohm's law and Kirchhoff's laws. 5.2 Solving Equations Once you have found the necessary equations to solve a circuit, there are multiple methods for solving them. If you choose to use matrix methods, you will need to organize the equations such that all the unknowns (and their coefficients) are on one side and the known items are on the other. You can then setup up and solve a matrix equation using whatever method you like (Cramer's Rule, Gaussian Elimination, etc.). If you have access to a computer, however, you may consider using a computational tool to do the algebra for you. One such tool is Maple, produced by Maplesoft. This program is written to perform many mathematical tasks, including symbolic algebra. Solving linear algebra problems with this program can be done in several steps. 5.2.1 Starting the Program Maple is free to Duke students and resides on the OIT system in the same way that MATLAB does. To start Maple, make sure your terminal is set up to receive graphics1 and type xmaple & at the prompt. Maple will start up. It may have a window at startup containing hints or tips - go ahead and close that window. There will most likely be some initial blank document in the main window - go ahead and close it as well by selecting File-Close Document. Then, open a new blank worksheet with File-New-Worksheet Mode. 5.2.2 Documenting Your Work When Maple starts a worksheet, it expects everything to be an input. To document your work with the title of the assignment, your name and NET ID, and any kind of explanation you would like to add, you need to tell Maple to switch to paragraph mode. Go to Insert-Paragraph-Before Cursor and you will notice that a blank line opens up above the red cursor mark. You can type text in here and Maple will know not to try to process it. Go ahead and call this assignment Introductory Maple Assignment, hit return, put in your name followed by your NET ID in parenthesis, hit return, and put in today's date. 5.2.3 Clearing the Worksheet When Maple runs, it "remembers" everything that it has done in the worksheet, regardless of what order you ran lines of code. For that reason, it is good programming practice to have Maple "restart" itself at the beginning of each worksheet. To give Maple a command, first tell Maple you are ready to issue commands by selecting Insert-Execution Group-After Cursor. This will start a new bracket (black lines at the left of the worksheet) and give you a prompt (red >). At the prompt, type restart. When you hit return, if you quickly look at the bottom left of the Maple window, you will see that Maple evaluates the command then then tells you that it is Ready. The restart command clears out any variables Maple was taught and also clears out any packages that were loaded. It is a good way to make sure you have a "fresh start." 5.2.4 Defining Variables and Equations In Maple, the way you define a variable is by typing the name of the variable, followed by the symbols :=, followed by whatever items you want to store in the variable. Note the importance of the colon directly in front of the equals sign - without it, Maple will not assign a value to a variable but will merely print out 1 See the www.pundit.pratt.edu page on X-Win if you are a PC user or X11R6 if you are a Mac or Linux user. Copyright 2009, Gustafson Hwk 5 1 BME 153L - Spring 2009 the equation you typed. One benefit of this is you can define variables to hold on to equations and then use those variables later, in concert with Maple's solver, to get answers for the unknowns. Let us assume that we want to solve the following equations: ax + by + cz = j dx + ey + f z = k gx + hy + iz = l where x, y, and z are unknowns, a through i are known coefficients, and j through l are known variables. To teach Maple about these equations, you would create three variables, each holding on to one of the equations. At the prompt, type: eqn1 := a * x + b * y + c * z = j eqn2 := d * x + e * y + f * z = k eqn3 := g * x + h * y + i * z = l Note that each time you hit return to go to the next line, Maple processes your input and reports back what it has done. It will also number the outputs for you so you can refer to them later. At this point, Maple now has three variables, each of which defined as an equation. It is perfectly happy having undefined items in the equations. Also, you can put multiple equations in a single variable instead of defining each equation on its own; just separate them with commas: eqns := a * x + b * y + c * z =j , d * x + e * y + f * z =k , g * x + h * y + i * z = l Quick note on Maple variable names - use letters and numbers only. Subscripts are bad, bad ideas for Maple because the subscripted text is considered to be a new variable. Type in the following and note what happens as you try to type it and, once you figure out what is going on with that, when you get to the last line: p_abs := v_R_2 ^2/ R_2 R := 6 p_abs 5.2.5 Solving Equations With Maple To solve the equations, all you need to do is use Maple's built in solve function. One of the best ways to use the solve function is to give it a list of the equations and an array of items for which to solve. In the equations above, for example, there are three equations with a total of fifteen symbols - we need to tell Maple which ones are unknown and it will assume that the others are known. Add the line: solve ({ eqn1 , eqn2 , eqn3 } , [x , y , z ]) (or solve ({ eqns } , [x , y , z ]) if using the list of equations) and note that the equations are bracketed with curly braces while the unknowns are in a list set off with square brackets. Hit return, and you will note that Maple produces a - list set off with double brackets - containing the answers for x, y, and z in terms of the other variables. If we had not included the variable list and instead had asked solve ({ eqn1 , eqn2 , eqn3 }) Maple would have given all possible combinations of all 15 symbols that would satisfy the equations. Conversely, if we had given Maple only x to work with as an unknown by typing: Copyright 2009, Gustafson Hwk 5 2 BME 153L - Spring 2009 solve ({ eqn1 , eqn2 , eqn3 } , [ x ]) the answer would come back as empty because no value of x satisfies the three equations for arbitrary values of the other 14 variables. In order to use these solutions, you should give them a name. Click at the start of the solve line and pre-pend it with MySoln:= so it resembles: MySoln := solve ({ eqn1 , eqn2 , eqn3 } , [x , y , z ]) This will assign the solution list to a variable that we can use later. 5.2.6 Substituting Values Now that you have the symbolic answers to the variables x, y, and z, you may want to substitute the actual coefficient values to obtain a numerical solution. One way to do this is to generate a list of equations for the known values, then tell Maple to substitute in the numerical values by using the built-in subs command. Add the following lines of code: Vals := a = -1 , b =2 , c =3 , d =4 , e =5 , f =6 , g =7 , h =8 , i =9 , j =10 , k =11 , l =12 subs ( Vals , MySoln ) (note - the -1 for a is important; without it, the equations are not linearly independent). The list in MySoln will now be shown with numerical values instead of symbols. Note that you have not made any actual changes to any of the variables - you have just asked Maple to show you what they would look like given the particular substitutions presented in Vals. This is a very powerful tool, since you can substitute in a variety of values to see how one or more parameters influence a particular variable or variables. 5.2.7 Using Symbolic Representations While the subs command was useful for putting numerical values into solutions, you can also use the equations generated with solve as part of the substitution list. What makes this a bit difficult is that MySoln is given as a single-row matrix and subs just wants the equations themselves. To extract only the equations, you can write: subs ( MySoln [1][] , Vals , T h i n g T o S u b I n F o r ) Go ahead and add the line alpha := x + y + z subs ( MySoln [1][] , Vals , alpha ) to the end of your worksheet. Note that the order is important - you need to first substitute in the equations for the circuit variables, then give values to the known quantities, then substitute all that into whatever is 1 in the final argument of subs. At this stage, will be 3 . Copyright 2009, Gustafson Hwk 5 3 BME 153L - Spring 2009 5.2.8 Cleaning Things Up Many times, Maple will produce an expression that is more complicated than it needs to be. To get what it considers to be the simplest form, use the simplify(expand( )) compound function. The expand will take the expression and represent it using as many simple terms as necessary while simplify will recombine them in the most compact form. Finally, to get a decimal value, use the evalf[N]( ) function, where N represents the number of decimal digits to use. For example, s i m p l i f y( expand ( subs ( MySoln [1][] , alpha ))) will produce the most symbolically simplified version of (after substituting in the solutions found for x, y, and z) while evalf [8]( subs ( MySoln [1][] , Vals , alpha )) will produce a floating point result for . With practice, you will see how best to combine evalf, simplify, and expand to get the form of answer you want. 5.3 The Persistence of Memory2 A major issue to consider with Maple is its memory. At the end of this worksheet, there are several variables that are defined, including x, y, and z. If you go back near the beginning, click in the line where eqn1 is defined, and hit return, you will notice that where x, y, and z were before, their symbolic solutions from much further down the worksheet are being used. This is why the restart command is so helpful - if you need to to run a worksheet again, it is best to always start from scratch. A shortcut for running an entire worksheet is the !!! button at the top of the window. 2 Salvador Dal The Persistence of Memory. 1931. Oil on canvas, 9 1/2 x 13" (24.1 x 33) c 2008 Salvador Dal Gala-Salvador i. i, Dal Foundation/Artists Rights Society (ARS), New York i Copyright 2009, Gustafson Hwk 5 4 BME 153L - Spring 2009 5.4 Assignment In each case, you are going to be using Maple to solve for variables in homework problems you have already done. It is perfectly acceptable in this case to look at the solutions to get the equations and also to compare the solutions to your worksheet. (1) Write a Maple worksheet that will take the three KCL equations generated in Rizzoni 3.3 and solve for the node voltages. Call the top left node vx , the middle node vy , and the top right node vy . Show each symbolically and numerically. Then, use Maple to solve for the power delivered by the leftmost current source symbolically and numerically - this will require using subs). Be sure to simplify the symbolic forms for everything. (2) Write a Maple worksheet that will take the three KVL equations generated in Rizzoni 3.16 and solve for the mesh currents. Call the left mesh current i1 , the top right mesh i2 , and the bottom right mesh i3 . Show each symbolically and numerically. Then, use Maple to solve for the power delivered by the leftmost voltage source symbolically and numerically - this will require using subs). Be sure to simplify the symbolic forms for everything. In your Maple worksheet, be sure to include your name and the assignment name at the top. You should also clearly indicate where in your worksheet the answer for each section is by putting a comment just above it; for example, S y m b o l i c s o l u t i o n s for u n k n o w n v a r i a b l e s Copyright 2009, Gustafson Hwk 5 5
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duke - BME - 153
BME 153L - Spring 2009Homework 6: Reactive Elements and Complex NumbersIntroductionThe problems for this assignment focus on capacitors, inductors, complex numbers, and phasors.AssignmentRemember, each Part needs to be turned in separately, so
Duke - BME - 153
BME 153L - Spring 2009Homework 7: Phasors and AC Circuit AnalysisIntroductionThe problems for this assignment focus on using phasors to solve circuits.AssignmentRemember, each Part needs to be turned in separately, so when you turn in this par
Duke - BME - 153
BME 153L - Spring 2009Homework 8: Filters; Transient AnalysisIntroductionThe problems for this assignment focus on investigating the responses of reactive circuits, including the frequency response of filters and the transient response of RC and
Duke - BME - 153
BME 153L - Spring 2009Homework 9: More Transient Analysis; Introduction to AmplifiersIntroductionThe problems for this assignment focus on further investigating the responses of reactive circuits, including the transient response of RLC circuits.
Duke - BME - 153
BME 153L - Spring 2009Homework 10: Amplifiers; Active FiltersIntroductionThe problems for this assignment focus on operational amplifiers.AssignmentRemember, each Part needs to be turned in separately, so when you turn in this particular assig
Duke - BME - 153
BME 153L - Spring 2009Homework 11: Big Box of RandomIntroductionThe problems for this assignment focus on logic, transformers, and diodes.AssignmentRemember, each Part needs to be turned in separately, so when you turn in this particular assig
Duke - BME - 153
BME 153L.1 Spring 2009Test 1 Coverage(1) Basic electrical entities - be able to fill in the following chart: Name charge current work voltage power resistance conductance Variable q i w v p R G Units Coulombs (C) Amperes (A) Joules (J) Volts (V)
Duke - BME - 153
While the test is, by nature, cumulative, there will be certain aspects of Biomedical Electronic Measurements which form the core of this test. Specifically, topics from lectures 8-17. More specifically, topics including, but not limited to, 1. React
Duke - MATH - 108
Duke University MATH 108 - Sections 03 and 04 Ordinary and partial differential equationsFall 2008Professor: Benoit Charbonneau benoit@math.duke.edu Class webpage: Blackboard site.Office 108 Physics 919-660-2844Textbook: Elementary differenti
Duke - BIOLOGY - 118
From Mitchell-Olds and Schmitt, "Genetic mechanisms and evolutionary significance of natural variation in Arabidopsis", Nature, 2006, Box 1: Association studies use linkage disequilibrium to identify polymorphisms that may be responsible for complex
Duke - BIOLOGY - 118
Genomics Restriction enzymes CloningGoal: Understand how technologies work Understand what is possible Improved understanding of biological mechanisms and processes Polymerase Chain Reaction DNA sequencing Whole genome shotgun sequencing Pol
Duke - BIOLOGY - 118
Answers to Bio 118 in-class recitation problems (Sets 2-3) Set #2 Only one of the two DNA strands of the consensus sequence for the -35 box and -10 box of E.coli promoters is shown below:-35 Box: 5'-TTGACAT . -10 Box: TATAAT-3'a) By convention, w
Duke - BIOLOGY - 118
Cell Division Cycle and CancerCancer: unrestrained cell division Failure of cell cycle controls Organization of the cell cycle: phases and events The cell cycle machinery: cyclin dependent kinases Regulation of cell cycle events What ha
Duke - BIOLOGY - 118
S phase Cyclin E Cyclin A cyclin E/Cdk2 and cyclin A/Cdk2 trigger initiation of DNA replication and centrosome duplication substrates?(synthesis phase) duplication eventsS phase1. Replicate DNA 1. Duplicate CentrosomesS- phase: Control
Duke - BIOLOGY - 118
Figure 5-3 Molecular Biology of the Cell ( Garland Science 2008)Figure 5-5 Molecular Biology of the Cell ( Garland Science 2008)Figure 5-2 Molecular Biology of the Cell ( Garland Science 2008)Figure 5-4 Molecular Biology of the Cell ( Garland S
Duke - BIOLOGY - 118
Figure 7-44 Molecular Biology of the Cell ( Garland Science 2008)Figure 7-42 Molecular Biology of the Cell ( Garland Science 2008)Figure 7-62 Molecular Biology of the Cell ( Garland Science 2008)Figure 7-45a Molecular Biology of the Cell ( Garl
Duke - BIOLOGY - 118
The Duke Community StandardDuke University is a community of scholars and learners, committed to the principles of honesty, trustworthiness, fairness, and respect for others. Students share with faculty and staff the responsibility for promoting a c
Duke - BIOLOGY - 118
BIO118 ExamII3/26/2009Name_ Page 1Please Print1. [6 pts] Chromosomes are moved to opposite sides of the cell during anaphase by the action of several motor proteins and microtubules. Describe the forces that drive these chromosomes apart at the
Duke - CHEM - 152
Duke - CHEM - 152
Duke - CHEM - 152
Duke - CHEM - 152
Duke - CHEM - 152
Duke - CHEM - 152
Chem 152 Spring 2009Problem Set # 11. Predict the products from the reaction of 5-decyne with the following reagents:a. b. c. 1 equiv Br2 Li in NH3 Excess H2, Pd/C catalyst2. How would you carry out the f ollowing reactions?a. b. c. CH3CH2 C C
Duke - CHEM - 152
Chem 152 Spring 2009Problem Set # 21. Treatment of 3,4-dibromohexane with strong base leads to loss of 2 equivalents of HBr and f ormation of a product with the formula C6H10. Three products are possible. Name each of the three, and tell how you w
Duke - CHEM - 152
Duke - CHEM - 152
Duke - CHEM - 151
Name: Problem 1 (16 pts) a. Rank the following compounds in order of bond length. (1 = LONGEST, 4 = SHORTEST) H3C H HO H HS H4 2 1H 2N 3Hb. Rank the following compounds in order of boiling point. (1 = HIGHEST boiling point, 4 = LOWEST boiling
Duke - CHEM - 151
Name:CHEM151L.003-F2008 EXAM 2 October 20, 2008Name: Answer LAST Duke Unique ID No: This exam consists of 12 pages including Appendices at the end. a. Appendix A. Periodic Table b. Appendix B. Collection of Equations, Constants, and Definitions c.
Duke - CHEM - 151
Name:CHEM151L.003-F2008 EXAM 3 November 17, 2008Name: Answer LASTKeyFIRSTDuke Unique ID No: This exam consists of 13 pages including Periodic Table at the end. Please put your name at the tops of pages 212. Ambiguous answers will get no
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
EGR75L: Buckling Laboratory Report GuidelinesPlease include the following sections in your lab report. It is completely acceptable and expected that you reference the lab manual in your report. Please cover all of the topics below, but be concise in
Duke - EGR - 75
Duke University Pratt School of EngineeringEGR 75L - Mechanics of SolidsLaboratory #4 Buckling of Columns1 Introduction and ObjectivesWhen a column is subjected to a compressive force, it will fail in one of two ways. If the slenderness ratio,
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
Duke - EGR - 75
End: -*f=j b t 3 0l=Iaaton%
Duke - EGR - 75
EGR75L: Numerical Assignment #1 Area, Centroid and Second Moment of Area Due date: Tuesday, March 3rd.The following is a shape that can be thought of as the cross section of a beam. For future analysis you may need to know the area, the location of
Duke - EGR - 75
EGR75: Numerical Assignment #2Due 6 April 2009For the simple frame shown above, use the method of joints to write out equations of equilibrium for joints A,B and C. Set up a linear system, Ax = b, and solve for the forces in the members and reacti
Duke - EGR - 75
Duke - EGR - 75
4. lin-9eqjfi'=1*5/Pskas*795 kiprunw-c$t= cTs"PstPstq 5 = a .7QProblo. '=I lA) C, .,038~0U S Y 5@-cog ~ 3 .-.05Y31 in.F,A&.T andTIr f'12hid = I@ 5d ~ a L =t nI in.
Duke - EGR - 75
1) [15 points] Draw the shear force and bending moment diagrams for the beam shown below:70 kN 20 kNABCDE0.5m1m2m2.5m22) [15 points] Compute and draw the shear force and bending moment diagrams for the system shown below:w/uni
Duke - MATH - 107
MATH 107: EXAM 1No calculators allowed. Your work must be clearly written in order to receive credit. Time: 50 minutes (1) (21 points) Let 2 1 -2 1 M = -1 3 -3 b = 1 4 -2 1 1 (a) (5 points) Compute the determinant of M by cofactor expansion alo
Duke - MATH - 107
MATH 107: EXAM 2No calculators allowed. Your work must be clearly written in order to receive credit. Time: 50 minutes (1) (10 pts) Let 3 0 0 A = -9 -1 5 -1 -1 3 (a) (9 pts) Compute the eigenvalues of A and a basis for each eigenspace. Clearly la
Duke - MATH - 107
MATH 107: EXAM 3No calculators allowed. Your work must be clearly written in order to receive credit. Time: 50 minutes (1) (15 pts) Find the general real-valued solution to the differential equation x + 2x + x = 4 sin 2t (2) (5 pts) Suppose that a
Duke - MATH - 107
Ben CookeMath 107Test 1 Do not open this test booklet until you are directed to do so. You have 50 minutes to earn 100 points. This exam is closed book. You are not allowed to use a calculator. Show your work, as partial credit will be given.
Duke - MATH - 107
Ben CookeMath 107Test 2 Do not open this test booklet until you are directed to do so. You have 50 minutes to earn 100 points. This exam is closed book. You are not allowed to use a calculator. Show your work, as partial credit will be given.
Duke - MATH - 107
Ben CookeMath 107Test 3 Do not open this test booklet until you are directed to do so. You have 50 minutes to earn 100 points. This exam is closed book. You are not allowed to use a calculator. Show your work, as partial credit will be given.
Duke - MATH - 107
Ben CookeMath 107Test 4 Do not open this test booklet until you are directed to do so. You have 50 minutes to earn 100 points. This exam is closed book. You are not allowed to use a calculator. Show your work, as partial credit will be given.
Duke - MATH - 107
First Midterm February 19, 2009NAME(Please print)Question Score 1 2 3 4 5 Total (Max Possible: 100)Instructions: 1. All questions are worth 20 points. 2. No calculators, computers, notes, books are permitted. 3. Do all computations on the exa
Duke - MATH - 107
Second Midterm February 19, 2009NAME(Please print)Question Score 1 2 3 4 5 Total (Max Possible: 100)Instructions: 1. All questions are worth 20 points. 2. No calculators, computers, notes, books are permitted. 3. Do all computations on the ex
Duke - MATH - 107
Math 107 (06) Exam 1 Spring 2009Name:Problem 1 (10pts). Complete the following definitions: (a) The vectors v1 , . . . , vk are linearly independent iff:(b) W is a subspace of the vector space V iff:(c) The n n matrix B is the inverse of
Duke - MATH - 107
Math 107 (06) Exam 2 Spring 2009Name:Problem 1. A tank initially contains 600 l of salted water whose salt concentration is 0.5 kg/l. Salted water whose salt concentration is 0.25 kg/l flows into the tank at the rate of 12 l/min. The mixture f