Jater

finite difference method

May 1st, 2013
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             double[] dy = { 12.4, 45.6, 10, 45.1, 76.1 };
  13.             int l = dy.Length;
  14.             double[,] dyy = new double[l,l];
  15.  
  16.             for (int i = 0; i < l; i++)
  17.                 dyy[0, i] = dy[i];
  18.  
  19.             for (int i = 1; i < l; i++)
  20.             {
  21.                 for (int j = 1; j < l - i + 1; j++)
  22.                     dyy[i, j - 1] = dyy[i - 1, j] - dyy[i - 1, j - 1];
  23.             }
  24.  
  25.             for (int i = 0; i < l; i++)
  26.             {
  27.                 for (int j = 0; j < l-i; j++)
  28.                 {
  29.                     Console.Write(dyy[i, j] + "; ");
  30.                 }
  31.                 Console.Write("\n");
  32.             }
  33.             Console.ReadLine();
  34.         }
  35.     }
  36. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×