Vous êtes sur la page 1sur 7

Problem:

The 80 lb ball is supported from the horizontal ring using three springs each having an
unstretched length of 1.5 ft and stiffness of k = 50 lb/ft. Determine the distance L from
the ring to point A for equilibrium.

Analytical Solution:
Since the three springs are equidistant with each other, the tensions of the three springs
then are equal.
Let L = stretched length
1.5
L

Fy = 0
h
3 F L =W

( )

where x = L-15
3 (50)( L15) L2(15)2
=80
L
15 ( L15 ) L ( 15 )
=8
2a
2

225 ( L23 L+ 2.25 ) ( L22.25 ) =64 L2


4

225 L 675 L 64 L + 1518. 75 L1139 . 0625=0

L = 2.22 ft
Numerical Solution:
4
3
2
225 L 675 L 64 L + 1518. 75 L1139 . 0625=0

Iteration Number 1
xu: 1 xl: 3 xr: 2 Ea: 100.00%

Iteration Number 2
xu: 2 xl: 3 xr: 2.5 Ea: 20.00%

Iteration Number 3
xu: 2 xl: 2.5 xr: 2.25 Ea: 11.11%

Iteration Number 4
xu: 2 xl: 2.25 xr: 2.125 Ea: 5.88%

Iteration Number 5
xu: 2.125 xl: 2.25 xr: 2.1875 Ea: 2.86%

Iteration Number 6
xu: 2.1875 xl: 2.25 xr: 2.2188 Ea: 1.41%

Iteration Number 7
xu: 2.2188 xl: 2.25 xr: 2.2344 Ea: 0.70%

Iteration Number 8
xu: 2.2188 xl: 2.2344 xr: 2.2266 Ea: 0.35%

Iteration Number 9
xu: 2.2188 xl: 2.2266 xr: 2.2227 Ea: 0.18%

Iteration Number 10
xu: 2.2227 xl: 2.2266 xr: 2.2246 Ea: 0.09%

Iteration Number 11
xu: 2.2227 xl: 2.2246 xr: 2.2236 Ea: 0.04%

Source Code:
package bisection;
import static java.lang.Math.E;
import static java.lang.Math.abs;
import static java.lang.Math.pow;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
*
* @author Axl Roy Cabatana
*/
public class BISECTION {

static Scanner in = new Scanner(System.in);

public static void main(String[] args) {

double xr = 0, xr_old = 0, func;

//Decimal formatter
DecimalFormat d = new DecimalFormat("##.####");
d.setRoundingMode(RoundingMode.HALF_UP);

System.out.println("BISECTION METHOD \n");


System.out.print("The Function is f(x) = 225L^4-675L^3-64L^2+1518.75L1139.0625 \n \n");
System.out.print("Enter number of Iterations: ");
int z = in.nextInt();
System.out.print("Enter xl and xu: ");
double xu = in.nextDouble();
double xl = in.nextDouble();
System.out.println("");

for (int i = 1; i <= z; i++){


System.out.print("Iteration Number " + i +"\n");

xr_old = xr;
xr = (xu+xl) / 2;

func = (225*pow(xr, 4))-(675*pow(xr,3))-(64*pow(xr,2))+(1518.75*xr)-1139.0625;

System.out.print("xu: "+ d.format(xu));


System.out.print(" xl: " + d.format(xl));

if (func >= 0) {
xl = xr;
} else {
xu = xr;
}

double EA = abs((xr-xr_old)/xr)*100;
System.out.print(" xr: " + d.format(xr) + " Ea: ");
System.out.printf("%.2f",EA);
System.out.print("%");
System.out.println("\n");
}
}

Screenshot:

Vous aimerez peut-être aussi