Пример #1
0
        private void calcula_Clicked(object sender, EventArgs e)
        {
            var x0   = xXAML.Text;
            var y0   = yXAML.Text;
            var h    = hXAML.Text;
            var n    = nXAML.Text;
            var func = funXAML.Text;

            if (func != null && func.Length != 0 && n != null && n.Length != 0 &&
                h != null && h.Length != 0 && y0 != null && y0.Length != 0 && x0 != null && x0.Length != 0)
            {
//                GridProgress.IsVisible = true;
                RungeKuta RK  = new RungeKuta(float.Parse(x0), float.Parse(y0), float.Parse(h), int.Parse(n), func);
                string    kas = "";
                kas += "\n K1: " + RK.k1 + "    K2: " + RK.k2 + "   \n K3: " + RK.k3 + "    K4: " + RK.k4;
                //Console.WriteLine("f(res)={0}", kas);
                kXAML.Text = kas;
                Resultado.HeightRequest = (int.Parse(n) * 8.3) + 8.5;
                Resultado.Text          = RK.Rec();
                List <Datachart> datachartlist = new List <Datachart>();
                datachartlist = genInst(RK.grafica);
                Grafica.Chart = new Microcharts.LineChart
                {
                    Entries = datachartlist
                };
                ///               GridProgress.IsVisible = false;
            }
            else
            {
                DisplayAlert("Advertencia", "Campos incompletos", "Volver");
            }
        }
Пример #2
0
        public string Rec()
        {
            string aux = "Y0= " + this.y0 + "    " + "Y1= " + this.res() + "\n";
            float  xn  = Calx(this.x0);
            float  yn  = res();

            //POrdenado par2 = new POrdenado(xn, yn);
            this.grafica.Add(yn);
            for (int i = 2; i < n; i++)
            {
                RungeKuta rp = new RungeKuta(xn, yn, this.h, 0, this.cadena);
                if (i % 2 != 0)
                {
                    aux = aux + "Y" + i + "= " + rp.res().ToString() + "\n";
                }
                else
                {
                    aux = aux + "Y" + i + "= " + rp.res().ToString() + "    ";
                }
                xn = Calx(rp.x0);
                yn = rp.res();
                //POrdenado par = new POrdenado(xn, yn);
                this.grafica.Add(yn);
            }
            return(aux);
        }