CH-01 (523167), страница 3

Файл №523167 CH-01 (Pao - Engineering Analysis) 3 страницаCH-01 (523167) страница 32013-09-15СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 3)

The true, or, falsecondition of the expression inside the outer pair of parentheses directs the computerto execute the statement following the parentheses or the next statement immediatelybelow the current IF statement. Reader may want to practice on deriving indicialformulas and then write a short program for calculating the elements of the matrix:1234[M] = 5678© 2001 by CRC Press LLC01200100000000000034567234561234501234001230001200000001 (10)As another example of writing a computer program based on indicial notation,consider the case of calculating ex based on the infinite series:ex = 1 +∞=x1 x 2 x 2xi+++…+ +…1! 2! 3!i!∑i=0xii!(11)With the understanding that 0! = 1, we have expressed the series as a summationinvolving the index i which ranges from zero to infinity.

A FUNCTION ExpoFunccan be developed for calculating ex based on Equation 11 and taking only a finitenumber of terms for a partial sum of the series when the contribution of additionalterm is less than certain percentage of the sum in magnitude, say 0.001%. ThisFUNCTION may be arranged as:To further show the advantage of adopting vector and matrix notation, here letus apply FUNCTION ExpoFunc to examine the surface z(x,y) = ex + y above therectangular area 0≤x≤2.0 and 0≤y≤1.5.

The following program, ExpTest, will enableus to compare the values of ex + y generated by the FUNCTION ExpoFunc and bythe function EXP available in the FORTRAN library (hence called library function).© 2001 by CRC Press LLCThe resulting printout is:It is apparent that two approaches produce almost identical results, so the 0.001%accuracy appears quite adequate for the x and y ranges studied. Also, arranging theresults in vector and matrix forms make the presentation much easy to comprehend.We have experienced how the summation process for an indicial formula involving a Σ should be programmed.

Another operation symbol of importance is Π whichis for multiplication of many factors. That is:N∏ a = a a …ai1 2N(12)i =1An obvious application of Equation 12 is for the calculation of factorials. Forexample, 5! = Πi for i ranges from 1 to 5. As an exercise, we display the values of1! through 50! with the following program involving a subroutine IFACTO whichcalculates I! for a specified I value:© 2001 by CRC Press LLCThe resulting print out is (listed in three columns for saving space)Another application of Equation 12 is for calculation of the binomial coefficientsfor a real number r and an integer k defined as: r  r( r − 1)( r − 2)…( r − k + 1)= = kk!k∏i =1r − i +1i(13)We shall have the occasion of applying Equations 12 and 13 when the finitedifferences and Lagrangian interpolation are discussed.Sample ApplicationsProgram MatxAlgb has been tested interactively, the following are the resultingdisplays of four test cases:© 2001 by CRC Press LLC© 2001 by CRC Press LLCQUICKBASIC VERSIONThe QuickBASIC language has the advantage over the FORTRAN languagefor making quick changes and then running the revised program without compilation.Furthermore, it offers simple plotting statements.

Let us have a QuickBASIC versionof the program MatxAlgb and then discuss its basic features.© 2001 by CRC Press LLC© 2001 by CRC Press LLCNotice that the order limit of 25 needed in the FORTRAN version is removedin the QuickBASIC version which allows the dim statement to be adjustable. ' isreplacing C in FORTRAN to indicate a comment statement in QuickBASIC. READand WRITE in FORTRAN are replaced by INPUT and PRINT in QuickBASIC,respectively. The DO loop in FORTRAN is replaced by the FOR and NEXT pairin QuickBASIC.Sample ApplicationsWhen the four cases previously run by the FORTRAN version are executed bythe QuickBASIC version, the screen prompting messages, the interactively entereddata, and the computed results are:© 2001 by CRC Press LLC© 2001 by CRC Press LLCMatrix [P]Row 10.1400E+02Row 20.3200E+020.2000E+020.4700E+02MATLAB APPLICATIONSMATLAB developed by the Mathworks, Inc. offers a quick tool for matrixmanipulations.

To load MATLAB after it has been set-up and stored in a subdirectoryof a hard drive, say C, we first switch to this subdirectory by entering (followed bypressing ENTER)C:\cd MATLABand then switch to its own subdirectory BIN by entering (followed by pressing ENTER)C:\MATLAB>cd BINNext, we type MATLAB to obtain a display of:C:\MATLAB>BIB>MATLABPressing the ENTER key results in a display of:>>which indicates MATLAB is ready to begin.

Let us rerun the cases of matrixsubtraction, addition, transposition, and multiplication previously considered in theFORTRAN and QuickBASIC versions. First, we enter the matrix [A] in the form of:>> A = [1,2;3,4]When the ENTER key is pressed, the displayed result is:© 2001 by CRC Press LLCA=1234Notice that the elements of [A] should be entered row by row. While the rowsare separated by ;, in each row elements are separated by comma. After the printout of the above results, >> sign will again appear. To eliminate the unnecessary linespace (between A = and the first row 1 2), the statement format compact can be enteredas follows (the phrase “pressing ENTER key” will be omitted from now on):>> format compact, B = [5,6;7,8]B=5678Notice that comma is used to separate the statements.

To demonstrate matrix subtraction and addition, we can have:>> A-Bans =–4–4–4–4>> A + Bans =681012To apply MATLAB for transposition and multiplication of matrices, we can have:>> C = [1,2,3;4,5,6]C=123456>> C'ans =142536© 2001 by CRC Press LLC>> D = [1,2,3;4,5,6]; E = [1,2;2,3;3,4]; P = D*EP=14203247Notice that MATLAB uses ' (single quote) in place of the superscripted symbolT for transposition. When ; (semi-colon) follows a statement such as the D statement,the results will not be displayed. As in FORTRAN and QuickBASIC, * is themultiplication operator as is used in P = D*E, here involving three matrices not threesingle variables. More examples of MATLAB applications including plotting willensue. To terminate the MATLAB operation, simply enter quit and then theRETURN key.MATHEMATICA APPLICATIONSTo commence the service of Mathematica from Windows setup, simply pointthe mouse to it and double click the left button. The Input display bar will appearon screen, applications of Mathematica can start by entering commands fromkeyboard and then press the Shift and Enter keys.

To terminate the Mathematicaapplication, enter Quit[] from keyboard and then press the Shift and Enter keys.Mathematica commands, statements, and functions are gradually introducedand applied in increasing degree of difficulty. Its graphic capabilities are also utilizedin presentation of the computed results.For matrix operations, Mathematica can compute the sum and difference oftwo matrices of same order in symbolic forms, such as in the following cases ofinvolving two matrices, A and B, both of order 2 by 2:In[1]: = A = {{1,2},{3,4}}; MatrixForm[A]Out[1]//MatrixForm =1234In[1]: = is shown on screen by Mathematica while user types in A ={{1,2},{3,4}}; MatrixForm[A]. Notice that braces are used to enclose the elementsin each row of a matrix, the elments in a same row are separated by commas, andthe rows are also separated by commas.

MatrixForm demands that the matrix beprinted in a matrix form. Out[1]//MatrixForm = and the rest are response of Mathematica.In[2]: = B = {{5,6},{7,8}}; MatrixForm[B]Out[2]//MatrixForm =5768© 2001 by CRC Press LLCIn[3]: = MatrixForm[A + B]Out[3]//MatrixForm =681012In[4]: = Dif = A-B; MatrixForm[Dif]Out[4]//MatrixForm =–4–4–4–4In[3] and In[4] illustrate how matrices are to be added and subtracted, respectively. Notice that one can either use A + B directly, or, create a variable Dif tohandle the sum and difference matrices.Also, Mathematica has a function called Transpose for transposition of amatrix. Let us reuse the matrix A to demonstrate its application:In[5]: = AT = Transpose[A]; MatrixForm[AT]Out[5]//MatrixForm =13241.3 SOLUTION OF MATRIX EQUATIONMatrix notation offers the convenience of organizing mathematical expression in anorderly manner and in a form which can be directly followed in coding it intoprogramming languages, particularly in the case of repetitive computation involvingthe looping process.

The most notable situation is in the case of solving a systemof linear algebraic equation. For example, if we need to determine a linear equationy = a1 + a2x which geometrically represents a straight line and it is required to passthrough two specified points (x1,y1) and (x2,y2). To find the values of the coefficientsa1 and a2 in the y equation, two equations can be obtained by substituting the twogiven points as:(1)a1 + (x1 )a 2 = y1(1)(1)a1 + (x 2 )a 2 = y2(2)and© 2001 by CRC Press LLCTo facilitate programming, it is advantageous to write the above equations inmatrix form as:[C]{A} = {Y}(3)where:1[C] = 1x1  a1  y1 , {A} =  , and {Y} =  x2 a 2 y 2 (4)The matrix equation 3 in this case is of small order, that is an order of 2.

Характеристики

Тип файла
PDF-файл
Размер
821,54 Kb
Тип материала
Учебное заведение
Неизвестно

Список файлов книги

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6360
Авторов
на СтудИзбе
310
Средний доход
с одного платного файла
Обучение Подробнее