Is there a general function or way in Java to calculate an equation of the form (a+b+…+n)^2 with a,b,n >= 0? [closed]What is an efficient way to implement a singleton pattern in Java?Is there a destructor for Java?Fastest way to determine if an integer's square root is an integerHow do I generate random integers within a specific range in Java?What's the simplest way to print a Java array?How to create a generic array in Java?How does C compute sin() and other math functions?Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missingJava tree data-structure?Ways to iterate over a list in Java

How do solar inverter systems easily add AC power sources together?

Is it true that different variants of the same model aircraft don't require pilot retraining?

Book featuring a child learning from a crowdsourced AI book

What is the sound/audio equivalent of "unsightly"?

What's the simplest way to calibrate a thermistor?

Is this password scheme legit?

Could the UK amend the European Withdrawal Act and revoke the Article 50 invocation?

Grep contents before a colon

Did anybody find out it was Anakin who blew up the command center?

Why did James Cameron decide to give Alita big eyes?

Time difference between banns and marriage

Notice period 60 days but I need to join in 45 days

Are there any to-scale diagrams of the TRAPPIST-1 system?

Is there a word or phrase that means "use other people's wifi or Internet service without consent"?

Talk interpreter

Are (c#) dictionaries an Anti Pattern?

How could a self contained organic body propel itself in space

What is Soda Fountain Etiquette?

How many petaflops does it take to land on the moon? What does Artemis need with an Aitken?

Did ancient peoples ever hide their treasure behind puzzles?

Is the internet in Madagascar faster than in UK?

If I said I had $100 when asked, but I actually had $200, would I be lying by omission?

Is a memoized pure function itself considered pure?

What's the point of fighting monsters in Zelda BoTW?



Is there a general function or way in Java to calculate an equation of the form (a+b+…+n)^2 with a,b,n >= 0? [closed]


What is an efficient way to implement a singleton pattern in Java?Is there a destructor for Java?Fastest way to determine if an integer's square root is an integerHow do I generate random integers within a specific range in Java?What's the simplest way to print a Java array?How to create a generic array in Java?How does C compute sin() and other math functions?Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missingJava tree data-structure?Ways to iterate over a list in Java






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-3















I need to find a way to implement an algorithm in Java that can calculate (a+b+...+n)^2 with a,b,n >= 0. The purpose is to use it afterwards in order to calculate Jain's Fairness index for my algorithm in networks. Is there any standard way to do that or any specific library for advanced math that i might have missed?










share|improve this question














closed as too broad by EJoshuaS, Max Vollmer, meowgoesthedog, thewaywewere, gdlmx Mar 28 at 5:49


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • what do you mean by ... ?

    – battlmonstr
    Mar 27 at 21:03






  • 1





    You mean like sum = a + b + … + n; return sum * sum?

    – Nico Schertler
    Mar 27 at 21:14






  • 1





    Your question is unclear. Is the sequence (a, b, ..., n) an arithmetic progression (e.g. 5, 10, 15, 20). If so, it's important that you say so.

    – Leo Aso
    Mar 27 at 21:15


















-3















I need to find a way to implement an algorithm in Java that can calculate (a+b+...+n)^2 with a,b,n >= 0. The purpose is to use it afterwards in order to calculate Jain's Fairness index for my algorithm in networks. Is there any standard way to do that or any specific library for advanced math that i might have missed?










share|improve this question














closed as too broad by EJoshuaS, Max Vollmer, meowgoesthedog, thewaywewere, gdlmx Mar 28 at 5:49


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



















  • what do you mean by ... ?

    – battlmonstr
    Mar 27 at 21:03






  • 1





    You mean like sum = a + b + … + n; return sum * sum?

    – Nico Schertler
    Mar 27 at 21:14






  • 1





    Your question is unclear. Is the sequence (a, b, ..., n) an arithmetic progression (e.g. 5, 10, 15, 20). If so, it's important that you say so.

    – Leo Aso
    Mar 27 at 21:15














-3












-3








-3








I need to find a way to implement an algorithm in Java that can calculate (a+b+...+n)^2 with a,b,n >= 0. The purpose is to use it afterwards in order to calculate Jain's Fairness index for my algorithm in networks. Is there any standard way to do that or any specific library for advanced math that i might have missed?










share|improve this question














I need to find a way to implement an algorithm in Java that can calculate (a+b+...+n)^2 with a,b,n >= 0. The purpose is to use it afterwards in order to calculate Jain's Fairness index for my algorithm in networks. Is there any standard way to do that or any specific library for advanced math that i might have missed?







java math equation






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 20:42









Σωκράτης ΚαλαμόπουλοςΣωκράτης Καλαμόπουλος

21 bronze badge




21 bronze badge





closed as too broad by EJoshuaS, Max Vollmer, meowgoesthedog, thewaywewere, gdlmx Mar 28 at 5:49


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











closed as too broad by EJoshuaS, Max Vollmer, meowgoesthedog, thewaywewere, gdlmx Mar 28 at 5:49


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by EJoshuaS, Max Vollmer, meowgoesthedog, thewaywewere, gdlmx Mar 28 at 5:49


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • what do you mean by ... ?

    – battlmonstr
    Mar 27 at 21:03






  • 1





    You mean like sum = a + b + … + n; return sum * sum?

    – Nico Schertler
    Mar 27 at 21:14






  • 1





    Your question is unclear. Is the sequence (a, b, ..., n) an arithmetic progression (e.g. 5, 10, 15, 20). If so, it's important that you say so.

    – Leo Aso
    Mar 27 at 21:15


















  • what do you mean by ... ?

    – battlmonstr
    Mar 27 at 21:03






  • 1





    You mean like sum = a + b + … + n; return sum * sum?

    – Nico Schertler
    Mar 27 at 21:14






  • 1





    Your question is unclear. Is the sequence (a, b, ..., n) an arithmetic progression (e.g. 5, 10, 15, 20). If so, it's important that you say so.

    – Leo Aso
    Mar 27 at 21:15

















what do you mean by ... ?

– battlmonstr
Mar 27 at 21:03





what do you mean by ... ?

– battlmonstr
Mar 27 at 21:03




1




1





You mean like sum = a + b + … + n; return sum * sum?

– Nico Schertler
Mar 27 at 21:14





You mean like sum = a + b + … + n; return sum * sum?

– Nico Schertler
Mar 27 at 21:14




1




1





Your question is unclear. Is the sequence (a, b, ..., n) an arithmetic progression (e.g. 5, 10, 15, 20). If so, it's important that you say so.

– Leo Aso
Mar 27 at 21:15






Your question is unclear. Is the sequence (a, b, ..., n) an arithmetic progression (e.g. 5, 10, 15, 20). If so, it's important that you say so.

– Leo Aso
Mar 27 at 21:15













2 Answers
2






active

oldest

votes


















1















Just sum those n values in for loop and then multiply it by itself. Or am i missing something?






share|improve this answer
































    0















    The number of possible problems you may encounter is infinite, so you should not be surprised if you often get into a situation where there is no method to help you. Let's suppose that you have an array of numbers, let's suppose it has double elements and the name of the array is input, then:



    double sum = 0;
    for (int index = 0; index < input.length; index++)
    sum += input[index];
    double result = Math.pow(sum, 2);
    //output holds the result


    If there is a possibility of overflow, then you will need to handle it. Also, you will need to handle the validation that your items are positive.






    share|improve this answer



























    • @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

      – Lajos Arpad
      Mar 27 at 22:37



















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    Just sum those n values in for loop and then multiply it by itself. Or am i missing something?






    share|improve this answer





























      1















      Just sum those n values in for loop and then multiply it by itself. Or am i missing something?






      share|improve this answer



























        1














        1










        1









        Just sum those n values in for loop and then multiply it by itself. Or am i missing something?






        share|improve this answer













        Just sum those n values in for loop and then multiply it by itself. Or am i missing something?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 21:15









        tomietomie

        1018 bronze badges




        1018 bronze badges


























            0















            The number of possible problems you may encounter is infinite, so you should not be surprised if you often get into a situation where there is no method to help you. Let's suppose that you have an array of numbers, let's suppose it has double elements and the name of the array is input, then:



            double sum = 0;
            for (int index = 0; index < input.length; index++)
            sum += input[index];
            double result = Math.pow(sum, 2);
            //output holds the result


            If there is a possibility of overflow, then you will need to handle it. Also, you will need to handle the validation that your items are positive.






            share|improve this answer



























            • @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

              – Lajos Arpad
              Mar 27 at 22:37















            0















            The number of possible problems you may encounter is infinite, so you should not be surprised if you often get into a situation where there is no method to help you. Let's suppose that you have an array of numbers, let's suppose it has double elements and the name of the array is input, then:



            double sum = 0;
            for (int index = 0; index < input.length; index++)
            sum += input[index];
            double result = Math.pow(sum, 2);
            //output holds the result


            If there is a possibility of overflow, then you will need to handle it. Also, you will need to handle the validation that your items are positive.






            share|improve this answer



























            • @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

              – Lajos Arpad
              Mar 27 at 22:37













            0














            0










            0









            The number of possible problems you may encounter is infinite, so you should not be surprised if you often get into a situation where there is no method to help you. Let's suppose that you have an array of numbers, let's suppose it has double elements and the name of the array is input, then:



            double sum = 0;
            for (int index = 0; index < input.length; index++)
            sum += input[index];
            double result = Math.pow(sum, 2);
            //output holds the result


            If there is a possibility of overflow, then you will need to handle it. Also, you will need to handle the validation that your items are positive.






            share|improve this answer















            The number of possible problems you may encounter is infinite, so you should not be surprised if you often get into a situation where there is no method to help you. Let's suppose that you have an array of numbers, let's suppose it has double elements and the name of the array is input, then:



            double sum = 0;
            for (int index = 0; index < input.length; index++)
            sum += input[index];
            double result = Math.pow(sum, 2);
            //output holds the result


            If there is a possibility of overflow, then you will need to handle it. Also, you will need to handle the validation that your items are positive.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 27 at 22:36

























            answered Mar 27 at 22:15









            Lajos ArpadLajos Arpad

            30.6k19 gold badges65 silver badges123 bronze badges




            30.6k19 gold badges65 silver badges123 bronze badges















            • @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

              – Lajos Arpad
              Mar 27 at 22:37

















            • @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

              – Lajos Arpad
              Mar 27 at 22:37
















            @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

            – Lajos Arpad
            Mar 27 at 22:37





            @meowgoesthedog Oups, I thought the op wants the latter, sorry. Please see my edit.

            – Lajos Arpad
            Mar 27 at 22:37



            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현