Practical numerical methods with C#

link:http://www.drxudotnet.com/numerical_introduction.html

Overview

Welcome to Practical Numerical Methods with C#. This book is intended for scientists, engineers, and .NET developers who want to create scientific and engineering applications using C# and .NET Framework. For many years, FORTRAN has been the dominant language of scientific and engineering computation. As Microsoft’s C# and .NET Framework gain popularity, you may find them also suitable for technical computing. This book presents C#-based procedures that perform fundamental mathematical and numerical computations critical to scientists and engineers.

The power of C# programming language, combined with the simplicity of implementing Windows Form, WPF desktop applications, and Silverlight Web applications based on the Visual Studio .NET framework, makes real-world .NET program development faster and easier than ever before. Visual C# is a versatile and flexible tool that allows users with even the most elementary programming abilities to not only perform complicated computations, but also display the calculated results in a variety of graphical representations. In this regard, C# is more powerful than FORTRAN, because it is hard to show results graphically using FORTRAN.

The main advantage of using FORTRAN in scientific and engineering computing is its rich math libraries. These libraries implement a complete collection of mathematical, statistical, and numerical algorithms, which have been evolving steadily for several decades. Each subroutine and algorithm in these libraries has undergone rigorous testing and quality assurance, providing users with more time to focus on their applications. On the other hand, the C# programming language is relatively new to the scientific and engineering community. The lack of C# math libraries prevents many researchers from using the C# programming language in their applications. In this book, I will show you that it’s fairly easy to develop math libraries in C#, and that it is worth developing scientific and engineering applications using C# due to its computing power and graphical representations capability.

This book is aimed to provide scientists and engineers with a comprehensive explanation of scientific computing using C#. Much of the work in this book is original, based on my own programming experience in developing commercial Computer Aided Design (CAD) packages, which involve intensive scientific computations and sophisticated graphical representations. With FORTRAN, developing advanced graphics and chart applications is a difficult and time-consuming task. To add even simple charts or graphs to your applications, you have to waste effort in creating a chart program, or money in buying commercial graphics and chart add-on packages. Visual C# and its rich graphics features make it possible to easily implement both powerful math libraries and professional graphics using entirely managed C# codes.

Practical Numerical Methods with C# provides an in-depth introduction to performing complicated scientific computations using C# applications. In this book, I will begins with an overview of the C# and .NET Framework, and then present procedural descriptions of linear algebra, numerical solution of nonlinear and ordinary differential equations, optimization, parameter estimation, and special functions of mathematical physics. I will show you how to create useful C# mathematical and numerical libraries that you can use in real-world scientific and engineering problems. I will try my best to introduce the C# program to scientists and engineers in a simple way – simple enough for C# beginners to easily follow. From this book, you can learn how to perform complicated scientific computations and create your own math libraries based on C# and .NET Framework.

Practical Numerical Methods with C# is not simply a book, but a powerful C# math library. You may find that you can immediately use some of the examples in this book in your real-world problems, and that you can use others to give you inspiration on adding more advanced math libraries to your applications.

What this Book Includes

This book and its sample code listings, which are available for download from our website at www.drxudotnet.com, provide you with:

  • A complete, in-depth instruction on practical scientific computing and programming using C#. After reading this book and running the example programs within, you will be able to create various math and numerical libraries in your own C# applications.
  • Ready-to-run example programs that allow scientists and engineers to explore the numerical methods described in the book. You can use these examples to better understand how the mathematical model and algorithms work. You can also modify the code or add new features to them to form the basis of your own programs. Some of the example code listings provided in this book are already sophisticated math libraries; these can be used directly in your own real-world applications.
  • Many C# classes in the sample code listings that you will find useful in your real-world scientific and engineering problems. These classes contain linear algebra, matrix manipulation, numerical approaches, and other useful utility classes. You can extract these classes and plug them into your own applications.

Is This Book for You

You don’t have to be an experienced C# developer or expert to use this book. I designed this book to be useful to scientists and engineers with all levels of C# programming experience. In fact, I believe that if you have some experience with programming languages other than C#, you will be able to sit down in front of your computer, start up Microsoft .NET Framework SDK or Visual Studio .NET, follow the examples that are provided with this book, and quickly become familiar with C# programming in scientific computing. For those of you who are already experienced C# developers, I believe this book has plenty to offer you as well. The information in this book about creating C# math libraries is not available in any other C# tutorial and reference book. In addition, most of the example programs provided with this book can be used directly in your real-world application development. This book will provide you with a level of detail, explanation, instruction, and sample program code that will enable you to do just about anything scientific and engineering computing related with visual C#.

This book is specifically designed for scientists and engineers. In fact, my own background is in theoretical physics, a field involving extensive numerical calculations as well as graphical representations of calculated data. I have been dedicated to this field for many years. My first computer experience was also with FORTRAN. Later on, I gained programming experience in Basic, C, C++, and MATLAB. I still remember how hard it was in those early days to present computational results graphically. I often spent hours creating a publication-quality chart by hand, using a ruler, graph paper, and rub-off lettering. During that time, I started to pay attention to various development tools that could be used to create integrated applications. I tried to find an ideal development tool that would allow me not only to easily generate data (computation capability) but also to easily represent data graphically (graphics and chart power). The C# and Microsoft Visual Studio .NET development environment made it possible to develop such integrated applications. Ever since Microsoft .NET 1.0 came out, I have been in love with the C# language, and have used this tool to successfully create powerful scientific and plotting applications, including commercial CAD packages.

The majority of the example programs in this book can be used routinely by scientists and engineers. Throughout this book, I will emphasize the usefulness of C# programming in real-world scientific and engineering problems. If you follow this book closely, you will be able to easily develop various math and numerical libraries. At the same time, I will not spend too much time discussing program style, execution speed, and code optimization, because there is a plethora of books out there that already deal with those topics. Most of the example programs in this book omit error handlings. This makes the code easier to understand by focusing on the key concepts.

Note that this book focuses on numerical computing methods and math library development using C#. It will not address the graphical representations of your calculation results. In fact, the real power of the .NET Framework is its ability to create graphics and user interfaces. If you are interested in graphics and user interface programming in C#, you can read my other books:

Practical C# Charts and Graphics – This book is a perfect guide to learning all the basics for creating advanced chart and graphics applications in C#, GDI+, and Windows Form. It clearly explains practical chart and graphics methods and their underlying algorithms. The 2D and 3D chart packages contained in the book can be directly used in your C# applications.

Practical WPF Programming – This book provides all the information you need to add advanced graphics to your .NET applications using C# and Windows Presentation Foundation (WPF), which comes with the new version (3.0 or later) of .NET framework. From 2D shapes and charts to complex interactive 3D models, this book uses code examples to explain every step it takes to build a variety of WPF graphics applications.

Practical Silverlight Programming – This book shows you how to develop rich interactive applications (RIAs) for Web using C# and Silverlight. Silverlight is a subset of WPF and enables you to create advanced graphics and user interfaces for Web applications. You will learn from this book how to display your computation results graphically and interactively over the internet.

What Do You Need to Use This Book

You’ll need no special equipment to make the best use of this book and understand the algorithms. To run and modify the sample programs, you need a computer capable of running either the Windows Vista or XP operating systems. The software installed on your computer should include .NET Framwork SDK 2.0 or later, which is available at Microsoft Website for free download. It will be better if you have Visual Studio 2005 or 2008 standard edition or higher. Please note that all of the example programs and math libraries were created and tested on Visual Studio 2008. However, the example code should be independent of which platform you use.

How This Book Is Organized

This book is organized into fifteen chapters, each of which covers a different topic of numerical computating. The following summaries of each chapter should give you an overview of the book’s contents:

Chapter 1, Overview of C# Programming 
This chapter introduces the basics of C# programming, including the basic types, properties, methods, mathematical operations, and how to create branches and loops.

Chapter 2, Complex Numbers and Functions 
This chapter demonstrates how to implement a complex structure, which contains the definition of complex numbers, complex operators, and commonly used complex functions. This structure allows you to perform various computations using complex numbers and functions.

Chapter 3, Vectors and Matrices 
This chapter introduces a more general n-dimensional vector class and a general matrix class with n×m dimension, which can be used in many scientific and engineering computations involving the solution of linear equations with multiple variables. Matrix analysis is a basic theory of these linear operations.

Chapter 4, LinearAlgebraic Equations 
This chapter introduces various numerical methods for solving linear equations with an arbitrary number of unknowns. Solving linear equations is one of the most commonly used operations in numerical analysis and scientific and engineering applications.

Chapter 5, Nonlinear Equations 
This chapter describes several numerical methods for solving nonlinear equations. These numerical methods are all iterative in nature, and may be used for equations that contain one or several variables.

Chapter 6, Special Functions 
This chapter discusses a special function class, which contains popular special functions such as the gamma function, beta function, error function, elliptic intergral, Laguerre function, Hermit function, Chebyshev function, Legendre function, and Bessel function, etc.

Chapter 7, Random Numbers and Distribution Functions 
This chapter covers a variety of random number generators and different probability distribution functions, which can be used to simulate the different chaotic circumstances that can be found in the real world.

Chapter 8, Interpolation 
This chapter explains the implementation of several interpolation methods, which can be used to construct new data points within the range of a discrete set of known data points. The interpolation is usually called curve fitting or regression analysis, and can be regarded as a special case of curve fitting, in which the function must go exactly through the data points.

Chapter 9, Curve Fitting 
This chapter explains a variety of curve fitting approaches that can be applied to data containing noise, usually due to measurement errors. Curve fitting tries to find the best fit to a set of given data. Thus, the curve does not necessarily pass through all of the given data points.

Chapter 10, Optimization 
This chapter covers several popular methods for optimizing functions with multiple variable, including the golden search, Newton, simplex, simulated annealing, and differential evolution techniques. In particular, simulated annealing and differential evolution can deal with highly nonlinear models, chaotic, noisy data, and constraints.

Chapter 11, Numerical Differentiation 
This chapter discusses several methods of numerical differentiation, such as forward and backward difference, central difference, extended central difference, Richardson extrapolation, and derivatives by interpolation. These methods provide you with different tools for estimating the derivative of a function.

Chapter 12, Numerical Intergration 
This chapter covers a variety of methods for numerical integration, including methods based on Newton-Cotes formulas, Romberg integration, and Gaussian quadrature methods. These methods can be used to estimate the finite and infinite integrals of functions.

Chapter 13, Ordinary Differential Equations 
This chapter focuses on solving ordinary differential equations numerically. It presents several popular methods including the Euler method, second- and fourth-order Runge-Kutta methods, Adaptive Runge-Kutta method, and the Runge-Kutta methods that can be used for solving a system of ordinary differential equations.

Chapter 14, Boundary Value Problems 
This chapter discusses two methods for solving boundary value problems: solution by the shooting method and by finite differences. The shooting method involves guessing the missing values and the resulting solution is very unlikely to satisfy boundary conditions at the other end. The finite difference method involves approximating the differential equations by finite differences at evenly spaced mesh points.

Chapter 15, Eigenvalue Problems 
This chapter presents several popular methods for solving eigenvalue problems, including the Jacobi method, power iteration, Rayleigh method, Rayleigh-quotient method, and matrix tridiagonalization method. These methods offer you nontrivial tools for calculating eigenvalues and eigenvectors of a real symmetric matrix system.

Using Code Examples

You may use the code in this book in your applications and documentations. You don’t need to contact the author for permission unless you are reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book doesn’t require permission. Selling or distributing the example code listings does require permission. Incorporating a significant amount of example code from this book into your applications and documentation also requires permission. Integrating the example code from this book into commercial products isn’t allowed except with the author’s written permission.

Customer Support

I am always interested in hearing from readers, and would like to know your thoughts on this book. You can send me comments by e-mail to jxu@drxudotnet.com. I also provide updates, bug fixes, and ongoing support via my website: www.drxudotnet.com.

You can also obtain the complete source code for all of examples in this book from the above website.

Note that this website was developed using Silverlight. In order to view the site, you'll be prompted to install Silverlight runtime to your browser.

 

转载于:https://www.cnblogs.com/xiexiaokui/archive/2011/05/27/2059874.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
我想说的是这类书不多,所以必定是好书。哇靠,大家支持啊。虽然很多人有这本书但是就是不分享啊。 Features •Emphasizes the latest state-of-the-art object-oriented methods wherever possible •Covers a large spectrum of computational tools, including sorting algorithms and Monte Carlo methods •Contains working C# code and numerous practical examples that illustrate how to apply the computational tools •Provides the C# source code online Summary Comprehensive Coverage of the New, Easy-to-Learn C# Although C, C++, Java, and Fortran are well-established programming languages, the relatively new C# is much easier to use for solving complex scientific and engineering problems. Numerical Methods, Algorithms and Tools in C# presents a broad collection of practical, ready-to-use mathematical routines employing the exciting, easy-to-learn C# programming language from Microsoft. The book focuses on standard numerical methods, novel object-oriented techniques, and the latest Microsoft .NET programming environment. It covers complex number functions, data sorting and searching algorithms, bit manipulation, interpolation methods, numerical manipulation of linear algebraic equations, and numerical methods for calculating approximate solutions of non-linear equations. The author discusses alternative ways to obtain computer-generated pseudo-random numbers and real random numbers generated by naturally occurring physical phenomena. He also describes various methods for approximating integrals and special functions, routines for performing statistical analyses of data, and least squares and numerical curve fitting methods for analyzing experimental data, along with numerical methods for solving ordinary and partial differential equations. The final chapter offers optimization methods for the minimization or maximization of functions. Exploiting the useful features of C#, this book shows how to write efficient, mathematically intense object-oriented computer programs. The vast array of practical examples presented can be easily customized and implemented to solve complex engineering and scientific problems typically found in real-world computer applications.
This book is for software developers who have cursory knowledge of TDD and are looking to gain a thorough understanding of how TDD can benefit them and the applications they produce. Software developers with an intermediate understanding of C# and the .NET Framework and/or a thorough understanding of JavaScript and React will likely be able to follow along with all the code examples used throughout the book. The book covers everything from why TDD is important to setting up testing environments, and how to get started testing a green-field application. As the reader grows more comfortable, they will be exposed to more advanced TDD topics such as abstracting away third-party code, approaching a problem from a TDD perspective, and how to deal with legacy code that wasn't written with testability in mind. Chapter 1, Why TDD is Important, asks what is TDD and why should you care? In this chapter, you will learn what TDD is and why it matters. A compelling argument for TDD will be made and the benefits, and more importantly, the execution will be shown. Chapter 2, Setting Up the .NET Test Environment, explains how to set up your IDE and configure the testing framework so that you can easily run your tests in C# and .NET, with more detail and many more examples of growing complexity in the Speaker Meet API. Chapter 3, Setting Up a JavaScript Environment, configures the JavaScript testing framework so that you can easily run your tests in your IDE. It provides more detail and many more examples of growing complexity in the Speaker Meet React application. Chapter 4, What to Know Before Getting Started, dives deeper into the why and how of TDD. you will learn the importance of defining and testing boundaries and abstracting away third-party code (including the .NET Framework), and you'll discover more advanced concepts such as spies, mocks, and fakes, and how to avoid pitfalls along the way. Chapter 5, Tabula Rasa - Approaching an Application with TDD in Mind, explains how to get started with a new application. You'll apply what you've learned in the previous chapters and take the same approach with a full-sized application using Speaker Meet as an example. Chapter 6, Approaching the Problem, takes the broader problem of the overall application and breaks it into meaningful chunks that can be developed independently. You'll learn different approaches to developing an application, such as front to back, back to front, and inside out. Chapter 7, Test-Driving C# Applications, takes requirements and assembled user stories and turns them into working software using TDD. It explains how to utilize all the skills you've assembled so far to test the boundaries, testing small, individual units. Chapter 8, Abstract Away Problems, explores abstracting away third-party libraries, including the .NET Framework. It covers removing dependencies on things such as DateTime and Entity Framework. It explains how to decouple their application from specific implementations to not only allow your application to be testable but much more flexible and easy to modify in the future. Chapter 9, Testing JavaScript Applications, now that you have a working API, focuses on creating a Single Page Application in JavaScript using React. It focuses on test-driven actions and reducers and any functionality within the application. Chapter 10, Exploring Integrations, explains how to write integration tests to ensure that your application is functioning properly. Chapter 11, Changes in Requirements, focuses on what happens when the requirements change. What happens if a bug is discovered? No problem, change a test or write a new one to cover the new requirement or to defend against the discovered bug. Now, write some new code or change some existing code to make all of the new/modified tests pass. If you do everything correctly, you should feel safe to make these changes as your existing test suite will prevent you from introducing new bugs. Chapter 12, The Legacy Problem, explains that there are a lot of applications out there without sufficient (any?) test coverage, and even fewer were written testfirst. You'll discover some of the major problems with legacy applications that weren't written with testability in mind; they will be identified, and also how best to recover will be covered. Chapter 13, Unraveling a Mess, dives into how to go about safely modifying a legacy application that wasn't written with testing in mind. How can you add tests to minimize the potential for introducing new bugs when modifying the existing code? An extreme example will be used to explore these topics and more. Chapter 14, A Better Foot Forward, emphasizes that TDD is a personal choice. You don't need anyone's permission to do good work. Advice on how to continue a successful journey of TDD, how to introduce TDD to your team, and how to rejoin the world as a TDD expert will be covered in this chapter.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值