codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  A X = B help  heartbeatnumber at 06:15 on Friday, September 15, 2006
 

Hi,

can you help me writing the following programm in C++, please?

The problem is quite simple:
1) the programm asks user to enter numbers N1 , N2 (integers)

2) then it defines constants h1 = pi/(N1 - 1), h2 = pi/(N2 - 1)

3) then it iniciates square matrix "A", where number of rows is equal to number of columns = (N1 - 2)(N2 - 2):

D A B 0 0 0 0 0 0 . . . 0
A D A B 0 0 0 0 0 . . . 0
B A D A B 0 0 0 0 . . . 0
0 B A D A B 0 0 0 . . . 0
0 0 B A D A B 0 0 . . . 0
.
.
. ETC,

where

D = -2(1/h_{1}^2 + 1/h_{2}^2) + 12

A = 1/h_{1}^2

B = 1/h_{2}^2

4) solves A X = B (want to get X), where

X denotes the vector:
X = [u(1,1), u(2,1), ... ,u(N1-1,1),u(1,2),u(2,2), ... , u(N1 - 1,2), ... , u(1,N2-1), u(2,N2-1), ... , u(N1-1,N2-1)]
by the way: u(i,j) is function approximated at (i,j)-th cell of its domain, i.e. u(i,j) := u(ih1,jh2) :-)

B denotes the vector:

B = [f(1,1), f(2,1), ... ,f(N1-1,1),f(1,2),f(2,2), ... , f(N1 - 1,2), ... , f(1,N2-1), f(2,N2-1), ... , f(N1-1,N2-1)],

where f(i,j) := 12 - sin(2ih1)sin(3ih2)

5) writes the solution (vector X) in a file "output.dat"









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007