Технический форум

Технический форум (http://www.tehnari.ru/)
-   Помощь студентам (http://www.tehnari.ru/f41/)
-   -   Критерий Рауса (http://www.tehnari.ru/f41/t254082/)

Vera101 05.06.2017 19:13

Критерий Рауса
 
Добрый вечер. Помогите пожалуйста исправить программу для нахождения
критерия устойчивости Рауса. Благодарю.
Код:

import java.util.Scanner;
public class r {
    public static void main(String[] args) {
        int n,i,j,k,l;
        Scanner sc = new Scanner(System.in);
        System.out.println("n=");
        n=sc.nextInt();
        int s [][]=new int [n][n];
        int a [][]=new int [n][n];}[/COLOR]
   
            //System.out.println(" "+a[i][j]);
        //}
        //System.out.println(" ");}
       
            int Routh (double a[], int n, Object register)
                {
                  int  i, j, k, l;
                int Ret;
                double Temp,
                    Eps = 0.000001;
                    //*s;
                int[] s;
                if (s !=  n + 2);
                    return -1;
                for (i = 0; i <= n; i += 2)
                {
                    s[i] = a[i];
                    j = i + 1;
                    s[j] = (j <= n,  a[j] = 0);
                }
                Ret = s[0] * s[1] < 0 ? 1 : 0;
                for (i = n - 1; i >= 1; i--)
                {
                    l = (i + 1) / 2 * 2;
                    for (j = 0; j <= 1; j += 2)
                    {
                        Temp = s[j];
                    s[j] = s [j + 1];
                    s [j + 1] = (int) Temp;
                }
 
                if (fabs (s[0]) < Eps)
                {
                    s[0] = (int) (Eps*Sign(s[1]));
                    for (j = 2, k = 0; j <= 1; j += 2)
                        if (fabs(s[j]) < Eps)
                            k += 2;
                    if (k == i)
                        for (j = 0; j == i; j += 2)
                            s[j] = s[j + 1] * (i - j);
                }
                for (j = 1, Temp = s[1]; j <= 1; j += 2)
                    s[j] = s[j + 2] -Temp * s[j+1]/s[0];
                s[l + 1] = 0;
                if (s[0] * s[1] < 0)
                    Ret++;
                }
                //delete []s;
                return Ret;
                }
                private double Sign(int i) {
                // TODO Auto-generated method stub
                return 0;
            }
 
                private double fabs(int i) {
                // TODO Auto-generated method stub
                return 0;
            }
 
                double Sign(int[] s)
                {
                    if (s > 0)
                        return 1;
                    else if (s < 0)
                        return -1;
                    else return 0;
                }
 
            }



Часовой пояс GMT +4, время: 05:33.

Powered by vBulletin® Version 4.5.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.