Numerical Recipes in C

In: Computers and Technology

Submitted By luyngu99
Words 24819
Pages 100
Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website or call 1-800-872-7423 (North America only), or send email to (outside North America).

Numerical Recipes in C
The Art of Scientific Computing

Cambridge New York Port Chester Melbourne Sydney EXXON Research and Engineering Company Harvard-Smithsonian Center for Astrophysics Department of Physics, Cornell University


William T. Vetterling Saul A. Teukolsky

Brian P. Flannery

Second Edition

William H. Press

Polaroid Corporation

Published by the Press Syndicate of the University of Cambridge The Pitt Building, Trumpington Street, Cambridge CB2 1RP 40 West 20th Street, New York, NY 10011-4211, USA 477 Williamstown Road, Port Melbourne, VIC, 3207, Australia Copyright c Cambridge University Press 1988, 1992 except for §13.10 and Appendix B, which are placed into the public domain, and except for all other computer programs and procedures, which are Copyright c Numerical Recipes Software 1987, 1988, 1992, 1997, 2002 All Rights Reserved. Some sections of this book were originally published, in different form, in Computers in Physics magazine, Copyright c American Institute of Physics, 1988–1992. First Edition originally published 1988; Second Edition originally published 1992. Reprinted with corrections, 1993, 1994, 1995, 1997, 2002. This reprinting is corrected to software version 2.10…...

Similar Documents


...QUICK { { Good Food Good Reason Health and Happiness ® RECIPES a principled natural food company of more than 300 authentically traditional, pure & purifying foods. Eden Foods® EDEN is... * A principled natural food company! Please know that USDA organic food does not have to be natural food. * Privately held and operated since 1968 * The best food that can be procured from growers and handlers we know and trust * Champion of organic family farms and the highest standards of organic agriculture and food handling * Thorough transparency of all ingredients and handling Eden is the oldest natural and organic food company in North America and the largest manufacturer of dry grocery, authentically organic, food. Eden Foods began in Ann Arbor in the late 1960s with friends sourcing natural food. Youth motivated in study of a social phenomenon stemming from macrobiotics: centering diet on whole grain and seasonal local plant foods that are not nutrient depleted or adulterated with toxins. 44 years following small, simple beginnings we are grateful and proud to be doing exactly what we set out to do: Get the best food possible and make it available to all. EN GLUTEE FR ~B~ Eden offers a pantry full of delicious foods that make healthy cooking and eating a joy. These foods are procured and prepared with our children and grandchildren in mind. Purity is paramount and maintained through painstaking attention to detail and long-nurtured relationships in...

Words: 14051 - Pages: 57


...CHICKEN BELLAGIO(Cheesecake Factory copycat recipe) FOR THE GARLIC BASIL PESTO: 1/2 cup fresh basil leaves, packed 2 Tbsp. freshly grated Parmesan-Reggiano or Romano cheese 2 Tbsp. extra virgin olive oil 1 Tbsp. pine nuts or walnuts (optional) 1 or 2 garlic cloves, minced or microplaned or grated 1/2 tsp. salt 1/4 tsp. black pepper FOR THE PROTEIN: 2 boneless skinless chicken breasts 4 slices Prosciutto, room temperature FOR THE BREADING: 1 large egg, beaten 1/4 cup flour 3/4 cup bread crumbs 1 tsp. salt 1/2 tsp. ground black pepper 1 tsp. dried parsley 1 tsp. oregano FOR FRYING: 4 Tbsp. olive oil or enough to coat bottom of pan with 1/4 in. of oil FOR THE PASTA: 6 oz. angel hair pasta 2 Tbsp. garlic pesto sauce FOR THE PARMESAN CREAM SAUCE: 1 cup heavy (whipping) cream 3 Tbsp. garlic pesto sauce 1/3 cup Parmsan-Reggiano 1/2 tsp. salt 1/4 tsp. white pepper FOR THE SALAD/GARNISH: 1 cup washed arugula half a cup of shredded or grated fresh parmigiana regianno To prepare the garlic basil pesto, add all of the ingredients for the pesto to a food processor and pulse until well blended; set aside. Pound out the chicken breasts one at a time in between two pieces of plastic wrap or in a ziploc bag until flattened out evenly. In a bowl, mix salt, pepper, oregano, and parsley into the bread crumbs to season. Coat the breasts in flour, and then dip in the beaten egg, and then into the seasoned bread crumbs. Coat......

Words: 566 - Pages: 3


...oil on top of the potatoes and they’ll be good to go.   
  After they’re stuffed with butter and Parmigiano-Reggiano, you want to bake them at 400ºF for about 45 minutes to an hour. I found mine were done more at the hour mark.     
  When they’re done baking, you’re still a few minutes away from cheesy gloriousness! First you have drizzle the heavy cream atop the potatoes …  
  And then add the shredded cheddar and bake for an addition 10-15 minutes.   
  They’ll come out looking all cheesy and inviting. Like this.  
  Transfer them to your plate. Of course, you can serve them just like this. They’ll be amazing.   
  But isn’t everything better with a dollop of sour cream? Yes, yes I think so.  This recipe is a total winner. It’d be perfect as a main dish accompanied with a salad, or as a side dish to, say, a roast chicken? The cheese and cream make this meal cozy and comforting, which is perfect for those chilly, brisk autumn evenings....

Words: 414 - Pages: 2


...Promote detoxification Ease digestion Who Can reboot? Rebooting is for almost everyone with a few exceptions. Please don’t attempt a Reboot if you are pregnant or nursing, under 18 or have a severe medical condition. Check with your doctor, if you are unsure. If you are currently on medication, ask your doctor before starting this or any diet program. Getting ready The cleaner your diet is going into the Reboot, the faster you will get to the feel-great phase! The week before you start your Reboot: Daily Menu We always say, “Eat a rainbow every day.” Well, here’s your chance to drink a rainbow! Follow the schedule below; selecting the orange, green, red and purple juices you want to drink. If you want more variety, there are more recipes to choose from on Calorie Counting Our 3-Day Reboot is designed to provide approximately 1,200 calories or more a day but actual calories and yields will vary depending on your juicer. We don’t focus on counting calories. In fact, drinking more vegetable juice and water, not less like your average “diet plan,” will work best for weight loss. If you do a Reboot, you will probably lose weight. If you don’t want to lose weight, you can still Reboot for the amazing health benefits. Just aim to drink more juice to support your metabolism. • • • • • • • • • • Reduce processed or “junk” foods, white flours, sugar, desserts, fried food Eliminate fast food, processed meats like bacon or deli meats, and alcohol......

Words: 1587 - Pages: 7

The Recipe for Success

...The Recipe for Success Amy Dwigans Grand Canyon University Family Centered Health Promotion NRS - 429V Marti Schagel September 8, 2013 The Recipe for Success Throughout the educational journey, students all over the world have strived to perfect the art of studying in order to achieve an optimal level of knowledge. Just as taste in clothing differs between people, each has their own preference in different learning styles and techniques. Learning styles group common ways that people learn. Wikipedia defines learning styles as an individual's natural or habitual pattern of acquiring and processing information in learning situations. A core concept is that individuals differ in how they learn. The idea of individualized learning styles originated in the 1970s, and has greatly influenced education ("Definition," 2013). Everyone has a mix of learning styles. Some people may find that they have a dominant style of learning, with far less use of the other styles. Others may find that they use different styles in different circumstances depending on the distinct behaviors of study that appeal to his/her own specific learning needs. There is no right or wrong definition or tactic. Nor is your practice unamendable. You can cultivate a better practice in a less dominant style, as well as further develop styles that you already use well. By recognizing and understanding your own learning styles, you can use techniques better suited to you. Thus improving the speed......

Words: 966 - Pages: 4


6 egg yolks

200g sugar

200ml milk

300ml clear custard apple juice

100ml single cream
 Vanilla Custard Base * 
400ml single cream

2 vanilla beans

1 whole egg

3 egg yolks

80g sugar
 Vanilla cream * 
100g vanilla custard base

100g double cream
 Guava Fool * 
400g guava puree

200g vanilla cream
 Poached Meringue : * 1. | * 
For this recipe you will need a 6cm diameter half hemisphere sili con mould sheet. * 2. | * 
Whisk the egg whites in a machine until they form soft peaks and slowly add the sugar. * 3. | * 
Once the meringue forms firm peaks and the sugar has dissolved place the meringue into 16 half hemisphere moulds. * 4. | * 
Cook the meringue in a bain marie large enough to hold the silicon mat in a pre-heated 120°C oven for approximately 15 minutes. Allow to cool then unmould the half hemispheres and store in the fridge on a silicon paper lined tray until needed. Maltose Tuilles : * 1. | * 
Heat the sugar and maltose together until it reaches hard crack stage (until it caramelises). Add the flaked almonds and immediately pour the mixture onto a silicon mat, allow to cool completely. * 2. | * 
Process the hard caramel in a food processor to form a fine powder. Next sieve the praline mixture......

Words: 1025 - Pages: 5


...leaves and switch off the fire. 11. mix well. 12. check salt before we add the tempering. if less than add more salt. 13. cover the dal with a lid. 14. begun to prepare the tempering/tadka. preparing the tempering: 1. 2. 3. 4. 5. 6. 7. 8. heat oil in a pan. add cumin and fry them. the cumin should get fried and not be raw but don’t burn them. now add red chilies, asafoetida and chopped garlic. let the garlic brown. once the garlic gets browned pour the entire tempering along with the oil into the dal. you can mix the dal or serve the dal tadka with the tempering on top it. garnish dal tadka with coriander leaves. 9. have this fantastic tadka dal with some steamed basmati rice or jeera rice. Notes few suggestions for making dal tadka recipe: 1. instead of oil you can temper the dal with ghee/clarified butter. 2. the dal tadka consistency is neither thick nor thin but medium. but if you prefer you can go for a slightly thick or thin dal consistency. 3. you can also soak the dal for 30 to 40 minutes before cooking them. 4. if you don’t have a pressure cooker than cook the dal in a pot with enough water added to the dal. in this case better to soak the dal so that the cooking is faster. Paneer Butter Masala Ingredients 200 or 250 gms paneer/cottage cheese, cubed or diced 2 tbsp cashew – soaked if you have time and then ground with some water to a smooth paste. if less time, then just grind the cashews to a smooth paste. 4-5 medium size tomatoes – pureed 1 or 2 green......

Words: 3143 - Pages: 13

Numerical Methods

...SUBJECT: NUMERICAL METHODS CODE: BUM2313 FACULTY OF INDUSTRIAL SCIENCES & TECHNOLOGY INSTRUCTION: Use MATHEMATICAL SOFTWARE such as EXCEL/ MATLAB/ MAPLE/ C to facilitate the computation. SUBMIT the solution in HARDCOPY & SOFTCOPY. Please save the solution in CD for softcopy. Do the assignment in group as allow by your lecturer. QUESTION 1 The nonlinear resistive circuit shown below is described by the nonlinear equation f ( x)  g ( x)  ( E  x) 0 R TOPIC: CHAPTER 1, 2,3 & 4 DUE/DURATION: MARKS: ASSESSMENT: ASSIGNMENT 2nd May 2014 (before 5 P.M) WEEK 11 100 The function g ( x) gives the current through the nonlinear resistor as a function of the voltage x cross its terminals as shown in the following Figure 1. Figure 1 Assuming that g ( x)  9sin( x  5)  10 and consider the three following cases: Case 1: E  5, R  1, Case 2: E  15, R  3, Case 3: E  4, R  0.5. (a) (b) (c) By using an appropriate method that you have learned in this course, find all the solutions of the nonlinear resistive circuit equation for the all cases. Select suitable starting points for xl and xu by plotting f over the interval [0,4] for the all cases, and visually selecting a good starting point. Find the lowest root over the the interval [0,4] by using (i) Bisection method and (ii) False position method. Use the starting points xl and xu in (b) and terminate the computation if  a  104. (For (a) and (b) use two decimal places, for (c) use eight decimal places)......

Words: 1140 - Pages: 5


...(low-fat is fine) Crust * 2 cups (500mL) graham cracker crumbs * 1 tsp (5 mL) finely grated lemon zest * 1/4 tsp (1 mL) salt * 1/2 cup (125 mL) unsalted butter, melted Filling * 1 recipe Yogurt cheese * 1/4 cup (60 mL) honey * 1 x large egg * 1 tsp (5 mL) finely grated lemon zest * 1 tsp (5 mL) vanilla extract Topping * 1 1/2 cups diced fresh mango   Directions: Yogurt "Cheese" 1. Prepare yogurt “cheese” a day before needed. Stir yogurt and ricotta together and place in a cheese cloth (or large paper coffee filter) in a strainer. Place strainer over a bowl, wrap loosely with plastic wrap and chill for 24 hours. Discard whey (liquid in bowl), and refrigerate yogurt cheese until ready to use. Crust 1. Preheat oven to 325 F (160 F). 2. Combine graham cracker crumbs, lemon zest, salt and melted butter and press into an ungreased 9-inch (22 cm) pie plate. Bake for 10 minutes, then cool while preparing filling. Filling 1. For filling, stir yogurt cheese with honey, egg, lemon zest and vanilla. Spoon into cooled pie shell and bake for 30 minutes. Cool to room temperature, then chill at least 4 hours before serving. Topping 1. Top with diced mango immediately before slicing. 2. Roasted Garlic Vegetable Tart   Yield:  6 Ingredients: Roasted Garlic Vegetable Tart * 1 heads garlic * 1 cup canola oil * 6 cups peeled and diced...

Words: 8891 - Pages: 36

Numerical Problem

...Ch 12 – Numerical Problem 6 Jake Goldstone is working 30 hours per week. His marginal utility of income is 2, his marginal utility of leisure is 60, and his hourly wage is $20. Assume throughout this problem that the income effect is zero. Is Mr. Goldstone maximizing his utility? Would working more or less increase his utility? If his wage rose to $30 per hour, would he be maximizing his utility by working 30 hours per week? If not, should he work more or fewer hours? At a wage of $40 per hour, would he be maximizing his utility? If not, would working more or less than 30 hours per week increase his utility? 1. He’s not maximizing his utility since 2 * $20 = 40, which is less than his marginal utility of leisure of 60. 2. He would have to work more hours in order to maximizing his utility. 3. If his wage rose to $30, the total utility of his would be 30 *2 = 60. He then maximizes his utility. 4. At wage of $40, he would have to work less because his utility is excess his utility of leisure time (60). His total utility is 40 *2 = 80 Ch 13 – Numerical Problem 4 A new health club has just opened up in your town. Struggling to bring in money now, the club is offering 10-year memberships for a one-time payment now of $800. You cannot be sure that you will still be in town for the next 10 years, but you expect that you will be. You anticipate that your benefit of belonging to the club will be $10 per month (think of this as an annual benefit of $120). Decide whether you should......

Words: 352 - Pages: 2


...Traditional Hummus Recipe by DedeMed, on 6 March , 2014  I love the smooth texture of this hummus recipe. The nutty flavor from the sesame seed paste combined with the tangy lemon flavor and a hint of garlic gives this hummus an almost three-dimensional flavor. Nutritional info  per serving Calories | 78 | Fat | 6g | Saturated fat | 1g | Carbohydrates | 5g | Sugar | 78 | Sodium | 124mg | Fiber | 1g | Protein | 2g | Cholesterol | 0mg | * ------------------------------------------------- Traditional Hummus Recipe 2 cups Servings Prep time:10 mins Total time:10 mins Ingredients * 1 (15-oz.) can chickpeas, rinsed and drained * 3 cloves garlic, peeled * [1/4] cup fresh lemon juice * [1/2] tsp. salt * [1/4] cup plain Greek yogurt * [1/2] cup tahini paste * 2 TB. extra-virgin olive oil * 3 fresh mint leaves Directions In a food processor fitted with a chopping blade, blend chickpeas, garlic, lemon juice, and salt for 2 minutes or until smooth. Scrape down the sides of the food processor bowl with a rubber spatula. Add Greek yogurt, tahini paste, and extra-virgin olive oil and blend for 1 minute or until creamy and well combined. Add mint leaves, and pulse for 30 seconds or until you see little specks of green mint throughout. Serve, or refrigerate for up to 1 week. Mediterranean Morsel Presentation is a big part of eating in the Mediterranean culture, and serving your food in appealing dishes with pretty......

Words: 287 - Pages: 2


...Individual Cheese Cupcake Ingredients for Crust: 1 cup (100 grams) graham wafer crumbs or crushed digestive biscuits 1 tablespoon (15 grams) granulated white sugar 4 - 5 tablespoons (55-65 grams) butter, melted Instructions: Preheat oven to 300 degrees F (150 degrees C) and place oven rack in the center of the oven. Line 12 muffin cups with paper liners. (Can also use silicone baking cups.) In a small bowl combine the graham cracker crumbs, sugar, and melted butter. Press a heaping tablespoon of crumbs onto the bottoms of the 12 muffin cups. Cover and refrigerate while you make the filling. Ingredients for Cheese filling: 2 - 8 ounce (454 grams) packages of full fat cream cheese, room temperature 2/3 cup (130 grams) granulated white sugar 1/8 teaspoon salt 2 large eggs, room temperature 1 teaspoon pure vanilla extract 1/2 teaspoon grated lemon zest 1/2 cup (120 ml) sour cream, room temperature Instructions: In the bowl of your electric mixer (or with a hand mixer), beat the cream cheese on low speed until creamy and smooth. Add the sugar and salt and beat until combined. Scrape down the sides of the bowl as needed. Add the eggs, one at a time, beating until incorporated. Add the vanilla extract, lemon zest, and sour cream and beat until incorporated. Remove the crusts from the refrigerator and evenly divide the filling among the 12 muffin cups.  Bake for about 18 -22 minutes or until firm but the centers of the cheesecakes still wobble a......

Words: 324 - Pages: 2


...Farmer's Market Recipes * Our Best Vegetarian Recipes * Our Best Salad Recipes directions 1.  Squeeze the lemons into a bowl of water. Working with 1 artichoke at a time, snap off the dark green outer leaves. Using a sharp paring knife, slice off all but 1 inch of the remaining leaves. Peel and trim the stems. Halve the artichokes, scrape out the hairy choke and drop them into the lemon water. 2.  In a large, nonreactive skillet, heat the olive oil. Add the garlic, carrots, onion, thyme, bay leaves, black peppercorns and coriander seeds and cook over moderately high heat until the onion begins to soften, about 2 minutes. 3.  Drain the artichokes and add them to the skillet. Cook until the onion is translucent, about 2 minutes longer. Add the wine and salt, cover and cook over moderate heat until the artichokes are just tender, about 10 minutes. Discard the bay leaves. Spoon the artichokes and their juices onto plates. Drizzle with the Fresh Tomato Coulis and serve. MAKE AHEAD: 1.  The cooked baby artichokes can be refrigerated for up to 2 days. Gently reheat before serving. ingredients   shop kitchen ▾ * 1 1/2 pounds turnips (2 large), peeled and cut into 1/2-inch cubes (5 cups) * 2 ounces reduced-fat cream cheese (Neufchatel), softened * 1/4 teaspoon garlic powder * 1/4 teaspoon black pepper * 1/8 teaspoon kosher salt * Fresh chives complete your meal * Farmer's Market Recipes * Our Best Vegetarian Recipes * Our......

Words: 1618 - Pages: 7


...Spanish Garlic Lemon Chicken Recipe - Pollo con Ajo y Limon Garlic Lemon Chicken is a relatively easy chicken recipe, which has two of the essential Mediterranean ingredients - garlic and citrus. Pieces of chicken are first sautéed in olive oil, then baked in a garlic chicken broth with white wine and slices of lemon. Serve with potatoes or rice. Prep Time: 5 minutes Cook Time: 1 hour Total Time: 1 hour, 5 minutes Yield: 4 Servings Ingredients: * 10 large garlic cloves * 24 oz (750 ml) chicken stock * 4 Tbsp olive oil * 8 boneless chicken pieces (approx 3 lbs) * 1 whole lemon * 2 heaping Tbsp flour * 8 oz (250 ml) white wine * salt and pepper to taste * 1 sprig flat leaf parsley or basil for optional garnish Preparation: Note: Use chicken with skin on or skinless pieces. If using skinless pieces, chicken will tend to stick to pan more easily when browning, so use lower heat and turn more often. Peel all garlic cloves. Pour chicken stock into a medium pot or sauce pan, and place garlic into brother. Cover and simmer on low for approximately 20 minutes. Peel the lemon, removing white pulp. Cut the lemon in thin slices. Set aside. Pour olive oil into a large frying pan and heat on medium. Brown chicken on both sides. Remove and place into the bottom of an ovenproof pot, and set aside. Heat oven to 375F degrees. Reduce the heat to low, and add the flour to the frying pan where the chicken was fried. Scrape the bottom of the pan......

Words: 338 - Pages: 2


...PULLED PORK Sandwiches (slow cooker) Ingredients * 1 (14 ounce) can beef broth * 3 pounds boneless pork ribs * 1 (18 ounce) bottle barbeque sauce Directions 1. Pour can of beef broth into slow cooker, and add boneless pork ribs. Cook on High heat for 4 hours, or until meat shreds easily. Remove meat, and shred with two forks. It will seem that it's not working right away, but it will. 2. Preheat oven to 350 degrees F (175 degrees C). Transfer the shredded pork to a Dutch oven or iron skillet, and stir in barbeque sauce. Bake in the preheated oven for 30 minutes, or until heated through. Shrimp and Mushroom linguini Ingredients * 1 (8 ounce) package linguini pasta * 2 tablespoons butter * 1/2 pound fresh mushrooms, sliced * 1/2 cup butter * 2 cloves garlic, minced * 1 (3 ounce) package cream cheese * 2 tablespoons chopped fresh parsley * 3/4 teaspoon dried basil * 2/3 cup boiling water * 1/2 pound cooked shrimp Directions 3. Bring a large pot of lightly salted water to a boil. Add linguini, and cook until tender, about 7 minutes. Drain. 4. Meanwhile, heat 2 tablespoons butter in a large skillet over medium-high heat. Add mushrooms; cook and stir until tender. Transfer to a plate. 5. In the same pan, melt 1/2 cup butter with the minced garlic. Stir in the cream cheese, breaking it up with a spoon as it melts. Stir in the parsley and......

Words: 814 - Pages: 4