c# - Find the min and max for quadratic equation -


How to find the minimum and maximum for quadratic equation using C #?

  f (x, y) = x ^ 2 + y ^ 2 + 25 * (sin (x) ^ 2 + sin (y) ^ 2), where (x , y) from (-2p, 2p)) ?? Manually solve   

I've found = 0, max = 8p = 2 = 78.957.

I tried to write code based on the liner class but something goes completely wrong give this code minimum = -4. ?? And maximum = 96 can you know where my fault is?

I uploaded the code to Dropbox, if anyone can see:

  double [] X, Y, results; // Range array and result array set any range for Private Zero BtnRun_Click (Object Sender, EventArgs E) {// Function X = setRange (-2 * Math.PI, 2 * Math.PI, 10000); Y = Setrange (-2 * Math.PI, 2 * Math, PI, 10000); Results = getOutput_twoVariablesFunction (X, Y); Int max index = getMaxIndex (results); Int Min Induct = Millindex (results); TxtMin.Text = result [min indax]. Ostring (); TxtMax.Text = Result [Max Indexes] .Ostring (); } Private Double Double Variables Function (Double X, Double Y) {Double F; // Any two variable function F set = Math.Pau (X, 2) + Math Pov (y, 2) + 25 * (Math.p. (Math sign (X), 2) + Math. Sin (Y), 2)); Return; } Private Double [] Setrange (Double Start, Double End, At Sample) {Double Phase = (End - Start) / Sample; Double CurrentVaue = Start; Double [] array = new double [sample]; {Array [index] = current VAU for (int index = 0; index  index ++); Current VA + step; } Come back; } Private double [] getOutput_twoVariablesFunction (double [] x, double [] y) {int Step = X.Length; Double [] array = new double [phase]; (Index index = 0; index & lt; x.length; index ++) {array [index] = denominators (x [index], y [index]); } Come back; } Private Ent MXandX (Double [] ValuesArray) {Double M = ValuesArray.Max (); Int index = value addition Toolist () Indexoff (m); Return index; } Private int Minne index (double [] value addition) {double M = valuerre.min (); Int index = value addition Toolist () Indexoff (m); Return index; }    

Do you want to count (sin (x)) or sin (X ^ 2)? In your F (x, y) formula it looks like (sin) (x) ^ 2, but in your method two works like verb sin (x ^ 2).

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -