public ActionResult DeleteConfirmed(int id) { Taylor taylor = db.Taylors.Find(id); db.Taylors.Remove(taylor); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,CustomerName,CellNo,KamezLenght,Tera,Galla,Kandha,Baghal,Bazoo,Kohni,Chest,Kamar,Ghera,ShalwaarLenght,Aasan,Ponchha,Palla,Kundha,Kundhi,Saali,Kaff,Button,Pocket,Sticker,TotalSuit,Gheras")] Taylor taylor) { if (ModelState.IsValid) { db.Entry(taylor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(taylor)); }
// GET: Taylors/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Taylor taylor = db.Taylors.Find(id); if (taylor == null) { return(HttpNotFound()); } return(View(taylor)); }
static void Main(string[] args) { var x = SymbolicExpression.Variable("x"); Console.WriteLine(Taylor.GetTaylor(6, x, 0, SymbolicExpression.E.Pow(x).Multiply(x.Sin()) )); //--------- // 2. Užrašykite liekamąjį narį. // Rn = M * (x-a)^(n+1) / (n+1)! // M = f(n+1)(x) // 3. Įvertinkite liekamąjį narį. Lagrange.GetError(-0.5, 0.5, 5); Lagrange.GetError(-0.1, 0.1, 5); Lagrange.GetError(-0.001, 0.001, 5); }
private void Button_Click_Calc(object sender, RoutedEventArgs e) { string inputNum_string = Input_TextBox.Text; Number inputNum = new Number(inputNum_string, false, 0, 0); string inputAccuracy_string = Accuracy_TextBox.Text; int accuracy = Convert.ToInt32(inputAccuracy_string); System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //进行计算 RangeAssist rangeAssist = new RangeAssist(inputNum, accuracy); //泰勒展开法进行计算 stopwatch.Start(); Taylor TaylorCal = new Taylor(rangeAssist.numConverted, accuracy); Number resultTaylor = rangeAssist.NumRecover(TaylorCal.TaylorCalculate()); stopwatch.Stop(); float taylorTime = (float)stopwatch.ElapsedMilliseconds / 1000; //外推加速法进行计算 stopwatch.Start(); Romberg RombergCal = new Romberg(rangeAssist.numConverted, accuracy); Number resultRomberg = rangeAssist.NumRecover(RombergCal.RombergCalculate()); stopwatch.Stop(); float rombergTime = (float)stopwatch.ElapsedMilliseconds / 1000; //牛顿法进行计算 stopwatch.Start(); Newton NewtonCal = new Newton(rangeAssist.numConverted, accuracy); Number resultNewton = rangeAssist.NumRecover(NewtonCal.NewtonCalculate()); stopwatch.Stop(); float newtonTime = (float)stopwatch.ElapsedMilliseconds / 1000; //显示字符串 //泰勒法 string resultTaylor_string = ""; if (resultTaylor.sign == -1) { resultTaylor_string += "-"; } for (int i = 0; i < resultTaylor.intLength; i++) { resultTaylor_string += resultTaylor.intPart[i].ToString(); } resultTaylor_string += "."; for (int i = 0; i < resultTaylor.decLength; i++) { resultTaylor_string += resultTaylor.decPart[i].ToString(); } Taylor_TextBox.Text = resultTaylor_string; TaylorTime_TextBox.Text = taylorTime.ToString() + "秒"; //外推加速法 string resultRomberg_string = ""; if (resultRomberg.sign == -1) { resultRomberg_string += "-"; } for (int i = 0; i < resultRomberg.intLength; i++) { resultRomberg_string += resultRomberg.intPart[i].ToString(); } resultRomberg_string += "."; for (int i = 0; i < resultRomberg.decLength; i++) { resultRomberg_string += resultRomberg.decPart[i].ToString(); } Romberg_TextBox.Text = resultRomberg_string; RombergTime_TextBox.Text = rombergTime.ToString() + "秒"; //牛顿法 string resultNewton_string = ""; if (resultNewton.sign == -1) { resultNewton_string += "-"; } for (int i = 0; i < resultNewton.intLength; i++) { resultNewton_string += resultNewton.intPart[i].ToString(); } resultNewton_string += "."; for (int i = 0; i < resultNewton.decLength; i++) { resultNewton_string += resultNewton.decPart[i].ToString(); } Newton_TextBox.Text = resultNewton_string; NewtonTime_TextBox.Text = newtonTime.ToString() + "秒"; }
private void Button_Click_Calc(object sender, RoutedEventArgs e) { string inputNum_string = Input_TextBox.Text; Number inputNum = new Number(inputNum_string, false, 0, 0); string inputAccuracy_string = Accuracy_TextBox.Text; int accuracy = Convert.ToInt32(inputAccuracy_string); System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //进行计算 RangeAssist rangeAssist = new RangeAssist(inputNum, accuracy); //泰勒展开法进行计算 stopwatch.Start(); Taylor TaylorCal = new Taylor(rangeAssist.numConverted, accuracy); Number resultTaylor = rangeAssist.NumRecover(TaylorCal.TaylorCalculate()); stopwatch.Stop(); float taylorTime = (float)stopwatch.ElapsedMilliseconds / 1000; //外推加速法进行计算 stopwatch.Start(); Romberg RombergCal = new Romberg(rangeAssist.numConverted, accuracy); Number resultRomberg = rangeAssist.NumRecover(RombergCal.RombergCalculate()); stopwatch.Stop(); float rombergTime = (float)stopwatch.ElapsedMilliseconds / 1000; //牛顿法进行计算 stopwatch.Start(); Newton NewtonCal = new Newton(rangeAssist.numConverted, accuracy); Number resultNewton = rangeAssist.NumRecover(NewtonCal.NewtonCalculate()); stopwatch.Stop(); float newtonTime = (float)stopwatch.ElapsedMilliseconds / 1000; //显示字符串 //泰勒法 string resultTaylor_string = ""; if (resultTaylor.sign == -1) { resultTaylor_string += "-"; } for (int i = 0; i < resultTaylor.intLength; i++) { resultTaylor_string += resultTaylor.intPart[i].ToString(); } resultTaylor_string += "."; for (int i = 0; i < resultTaylor.decLength; i++) { resultTaylor_string += resultTaylor.decPart[i].ToString(); } Taylor_TextBox.Text = resultTaylor_string; TaylorTime_TextBox.Text = taylorTime.ToString() + "秒"; //外推加速法 string resultRomberg_string = ""; if (resultRomberg.sign == -1) { resultRomberg_string += "-"; } for (int i = 0; i < resultRomberg.intLength; i++) { resultRomberg_string += resultRomberg.intPart[i].ToString(); } resultRomberg_string += "."; for (int i = 0; i < resultRomberg.decLength; i++) { resultRomberg_string += resultRomberg.decPart[i].ToString(); } Romberg_TextBox.Text = resultRomberg_string; RombergTime_TextBox.Text = rombergTime.ToString() + "秒"; //牛顿法 string resultNewton_string = ""; if (resultNewton.sign == -1) { resultNewton_string += "-"; } for (int i = 0; i < resultNewton.intLength; i++) { resultNewton_string += resultNewton.intPart[i].ToString(); } resultNewton_string += "."; for (int i = 0; i < resultNewton.decLength; i++) { resultNewton_string += resultNewton.decPart[i].ToString(); } Newton_TextBox.Text = resultNewton_string; NewtonTime_TextBox.Text = newtonTime.ToString() + "秒"; }
private void InitializeComponent() { this.BackColor = Color.White; this.components = new Container(); this.AutoScaleMode = AutoScaleMode.Font; this.ClientSize = new Size(800, 450); this.Text = "Form1"; this.plot0 = new PlotView(); InitializePlotProps(plot0, "a) y=(e^x) sin x", 0); InitializePlotModel(plot0, Constants.Function); this.Controls.Add(this.plot0); this.plot1 = new PlotView(); InitializePlotProps(plot1, "b) kai imamas narys tik su x0", 1); Func <double, double> taylorWithX0 = (double x) => Taylor.GetNthTaylorFormulaCoefficient(0); // will result in a constant 0 InitializePlotModel(plot1, taylorWithX0); this.Controls.Add(this.plot1); this.plot2 = new PlotView(); InitializePlotProps(plot2, "c) kai imami nariai su x0 ir x1", 2); Func <double, double> taylorWithX1 = (double x) => Taylor.GetNthTaylorFormulaCoefficient(0) + Taylor.GetNthTaylorFormulaCoefficient(1) * x; InitializePlotModel(plot2, taylorWithX1); this.Controls.Add(this.plot2); this.plot3 = new PlotView(); InitializePlotProps(plot3, "d) kai imami nariai su x0, x1 ir x2", 3); Func <double, double> taylorWithX2 = (double x) => Taylor.GetNthTaylorFormulaCoefficient(0) + Taylor.GetNthTaylorFormulaCoefficient(1) * x + Taylor.GetNthTaylorFormulaCoefficient(2) * Math.Pow(x, 2); InitializePlotModel(plot3, taylorWithX2); this.Controls.Add(this.plot3); this.plot4 = new PlotView(); InitializePlotProps(plot4, "d) kai imami nariai su x0, x1, x2 ir x3", 4); Func <double, double> taylorWithX3 = (double x) => Taylor.GetNthTaylorFormulaCoefficient(0) + Taylor.GetNthTaylorFormulaCoefficient(1) * x + Taylor.GetNthTaylorFormulaCoefficient(2) * Math.Pow(x, 2) + Taylor.GetNthTaylorFormulaCoefficient(3) * Math.Pow(x, 3); InitializePlotModel(plot4, taylorWithX3); this.Controls.Add(this.plot4); this.plot5 = new PlotView(); InitializePlotProps(plot5, "d) kai imami nariai su x0, x1, x2, x3 ir x4", 5); Func <double, double> taylorWithX4 = (double x) => Taylor.GetNthTaylorFormulaCoefficient(0) + Taylor.GetNthTaylorFormulaCoefficient(1) * x + Taylor.GetNthTaylorFormulaCoefficient(2) * Math.Pow(x, 2) + Taylor.GetNthTaylorFormulaCoefficient(3) * Math.Pow(x, 3) + Taylor.GetNthTaylorFormulaCoefficient(4) * Math.Pow(x, 4); InitializePlotModel(plot5, taylorWithX4); this.Controls.Add(this.plot5); this.plot6 = new PlotView(); InitializePlotProps(plot6, "d) kai imami nariai su x0, x1, x2, x3, x4 ir x5", 6); Func <double, double> taylorWithX5 = (double x) => Taylor.GetNthTaylorFormulaCoefficient(0) + Taylor.GetNthTaylorFormulaCoefficient(1) * x + Taylor.GetNthTaylorFormulaCoefficient(2) * Math.Pow(x, 2) + Taylor.GetNthTaylorFormulaCoefficient(3) * Math.Pow(x, 3) + Taylor.GetNthTaylorFormulaCoefficient(4) * Math.Pow(x, 4) + Taylor.GetNthTaylorFormulaCoefficient(5) * Math.Pow(x, 5); InitializePlotModel(plot6, taylorWithX5); this.Controls.Add(this.plot6); }
public void factTest() { Assert.AreEqual(6, Taylor.fact(3)); Assert.AreEqual(1, Taylor.fact(0)); }
public void SinTaylorTest() { Assert.AreEqual(0, Taylor.SinTaylor(0, 4)); Assert.AreEqual(1, Math.Ceiling(Taylor.SinTaylor(2, 3))); }
public void CosTaylorTest() { Assert.AreEqual(1, Taylor.CosTaylor(0, 4)); Assert.AreEqual(0, Math.Ceiling(Taylor.CosTaylor(2, 3))); }
public void ETaylorTest() { Assert.AreEqual(5, Taylor.ETaylor(2, 3)); Assert.AreEqual(1, Taylor.ETaylor(0, 4)); }