You are working on quadratic function
 
search
 


Contents:


swap function:
Swapping two values to change their addresses.
a

max function:

The largest number among two.
a

absolute value function:

The positive value of a number.
a

sorting function:

How to sort an array.
a

bisection function:

Bissection method used to solve equations by computing, example of cable strung ..
a

Newton-Raphson function:

To solve equations numerically, example of free fall motion ..
a

Secant function:

To solve equations numerically, example of free fall motion ..
a

isPrime function:

This function tests whether an integer is prime..
a

abundant function:

This function tests whether an integer is abundant..
a

factorial function:

Factorial of an integer..
a

quadratic function:

solving a quadratic equation ..
a

even_odd function:

To know if an integer is even or odd ..
a

mean value function:

To calculate the arithmetic mean of some values..
a

reverse function:

To reverse an integer and to know whether a string is palindrome..
a

least squares function :

To calculate the slope and the y_intercept of a linear equation ..
a

Monte Carlo method:

To calculate integrales or probabilities using Monte Carlo technique ..
a

2 and 3 equations systems solving :

To solve the 2 and 3 equations systems with 2 and 3 variables ..
a

Interpolation and Extrapolation :

To solve for lacking values in graphs or tables ..
a

Integer divisors :

Gives the divisors fo an integer and tests whether it is prime ..
a

Amicable pair :

Gives, if it exists, the amicable number of a given integer ..
a

Perfect numbers :

Tests whether a positive integer is perfect, and more ..
a

Periodic table of elements:

Periodic table of elements in C language, and more ..
a

Playing TicTacToe

Using some Fortran90 language funtionalities, and more ..
a


a
home

   Quadratic function

	

Quadratic function

1. Definition: The quadratic function ax2 + bx + c is a polynomial of degree 2 (second order). The related equation ax2 + bx + c = 0 has two solutions. We are interested in calculating the roots of this equation. If a is null, we have a linear equation and the solution is -c/b. If the discriminant is negative, we have imaginary roots: x1,2= (-b -,+ (b*b - 4*a*c)i/(2*a), and if the discriminant is positive, we have real roots: x1,2= (- b +,- sqrt(b*b - 4*a*c)/(2*a). 2. The method in Fortran90 language: PROGRAM quadratic_equation IMPLICIT NONE REAL :: a,b,c, disc, x1, x2 PRINT*,"Enter the values of the coefficients a, b, c : --> n" READ*, a,b,c disc=b*b-4*a*c IF (a == 0) THEN PRINT*,"The equation is linear and the related solution is:" PRINT*,"x0 = ", -c/b ELSE IF(disc <0) THEN x1 = -b/2*a x2 = SQRT(- disc)/2*a PRINT*,"n The roots are complexe: " PRINT*,"x1 = ",x1," + ",x2,"i" PRINT*,"x2 = ",x1," - ",x2,"i" ELSE x1 = (-b + SQRT(disc))/2*a x2 = (-b - SQRT(disc))/2*a PRINT*,"n The roots are real:" PRINT*,"x1 = ",x1 PRINT*,"x2 = ",x2 ENDIF END PROGRAM quadratic_equation


Custom Search


© 2007. The scientificsentence . All rights reserved.