12.07.2015 Views

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Page 36 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 13• a = 0 ∧ b ≠ 0L<strong>in</strong>ear case, x = −c/b.• a ≠ 0Quadratic case,x 1 = 12a (−b + √ b 2 − 4ac).x 2 = 12a (−b − √ b 2 − 4ac).2.9.2.2 A Flow-Chart of the QuadSolverThe follow<strong>in</strong>g flow chart shows all the case, which we have to handle. The algorithm is given for a realarithmetic, i.e. no complex data types are used. The relevant source code will be developed with<strong>in</strong> thenext section.Startyes yes yesa = 0 b = 0 c = 0<strong>in</strong>f<strong>in</strong>itsolutionsStopnononod = b 2 − 4 · a · cx = − c bStopno solutionStopd < 0yesx 1,2 = −b±i√ −d2·aStopnox 1,2 = −b±√ d2·aStop2.9.2.3 Quadratic Equation, Solver Implementation Fortran 66 likeThe first implementation <strong>in</strong> strict Forteran 66 shows the subsequent solution of the above discussedcases. Because the if statement can only process one statement, the <strong>in</strong>verse case should be checked tojump over the succeed<strong>in</strong>g code. After the code block a further jump should be performed to the laststatement of the program.List<strong>in</strong>g 2.19: Implementation of a 66-Quad-Solver1 c quadratic equation2 c a*x**2 + b*x + c =3 c4 c a,b,c are arbitray <strong>in</strong>put parameters5 c6 c explicit declaration should be done7 c8 c2345679 implicit none10 cE. Baeck

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!