Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: Weiszfeld’s Algorithms Help PLS

1. ## Weiszfeld’s Algorithms Help PLS

```package Sezgisel;

public class SezgiselAlgoritma1 {

public static void main(String[] args) {

double a[]={40.78,40.75,40.71,40.72,40.69,40.93,40.51,40.80,40.64, 41.07,41.03,41.05,40.51,40.69,40.88,40.40};
double b[]={30.40,30.40,30.36,30.38,30.62,30.48,30.29,30.75,30.54, 30.78,30.31,30.85,30.17,30.27,30.45,30.49};
//Rastgele değerler x=50 ve y=50 olarak verildi.
int x=50;
int y=50;
int literasyon=0;
double m,l;
double J=0;//Amaç fonksiyonu J fonksiyonudur.
do {
double Toplam=0;
for ( int i=0; i<16; i++){
m(i)=1/sqrt(((x-a[i]))^2+((y-b[i]))^2);
Toplam=Toplam+ m(i);
}// 1. for end
for (int i=0; i<16; i++){
l(i)=m(i)/Toplam ;
}//2. for end
x=0; y=0;//Formüldeki ilk x ve y değerleri sıfırdır.
for (int i=0; i<16; i++){
x= x+ (l(i)*a[i]);
y= y+ (l(i)*b[i]);
}//3. for end

for (int i=0; i<16; i++){
J=J+ sqrt(((x-a[i]))^2+((y-b[i]))^2);

literasyon=literasyon+1;
}while (literasyon!=50);
System.out.println("Tesisin enlem değeri X=" + x + "ve boylam değeri Y=" + y + "'dir." );

}
System.out.println("Amaç fonksiyonumuzun değeri Z=" + J);

}

}```

2. ## Re: Weiszfeld’s Algorithms Help PLS

If you are getting error messages. copy the full text and paste it here.

[code=java]
[/code]
to get highlighting and preserve formatting.

3. ## Re: Weiszfeld’s Algorithms Help PLS

thanx. i edited it...

4. ## Re: Weiszfeld’s Algorithms Help PLS

Where is wrong ?
Can you explain what the problem is?
Post the program's output, explain what is wrong with it and show what it should be.

5. ## Re: Weiszfeld’s Algorithms Help PLS

Here is a output errors...

gu2rx.jpg

6. ## Re: Weiszfeld’s Algorithms Help PLS

Please copy and post the error messages NOT an image.

To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

7. ## Re: Weiszfeld’s Algorithms Help PLS

Originally Posted by Norm
Please copy and post the error messages NOT an image.

To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.
like this ? sorry for misunderstood, i'm at very beginning for java programming

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The left-hand side of an assignment must be a variable
The method m(int) is undefined for the type SezgiselAlgoritma1
The left-hand side of an assignment must be a variable
The method l(int) is undefined for the type SezgiselAlgoritma1
The method l(int) is undefined for the type SezgiselAlgoritma1
The operator ^ is undefined for the argument type(s) double, double
Syntax error, insert "while ( Expression ) ;" to complete DoStatement

at SezgiselAlgoritma1.main(depo.java:19)

8. ## Re: Weiszfeld’s Algorithms Help PLS

at SezgiselAlgoritma1.main(depo.java:19)
The error messages do NOT show what lines they happened on. I don't think all those error messages are for the code at line 19. What code is on line 19?
Can you use the javac compiler to compile the program to get compiler error messages?
Your IDE's error messages don't say where the errors are.