D
dsv
I am writing a code that, among other things, iteratively solves a set
of non-linear algebraic equations. I am using Newton's method.
f1(x1,x2,...,xN)=0
f2(x1,x2,...,xN)=0
.....
fN(x1,x2,...,xN)=0
The difficulty arises because f1, f2, ..., fN are known at the time of
compilation. In fact, the number of equations N is also unknown. They
are provided by the user during run-time either via an input file, or
using the keyboard. Therefore I cannot hard-code them into the source
code.
All I know about the functions are that they are a weighted sum of
known functions. i.e. for i=1,2,...,N,
f_i(x1,x2,...,xN)=a1*g1(x1,x2,...,xN)+a2*g2(x1,x2,...,xN)+...
where the functional forms of g1, g2, ... are known.
How do I pass f1, f2, .., fN to the Newton's iteration subroutine? Is
it possible at all, and what is the syntax?
I guess this is a general programming question, but since I am using C+
+ in this case, I am posting this question here.
dsv
of non-linear algebraic equations. I am using Newton's method.
f1(x1,x2,...,xN)=0
f2(x1,x2,...,xN)=0
.....
fN(x1,x2,...,xN)=0
The difficulty arises because f1, f2, ..., fN are known at the time of
compilation. In fact, the number of equations N is also unknown. They
are provided by the user during run-time either via an input file, or
using the keyboard. Therefore I cannot hard-code them into the source
code.
All I know about the functions are that they are a weighted sum of
known functions. i.e. for i=1,2,...,N,
f_i(x1,x2,...,xN)=a1*g1(x1,x2,...,xN)+a2*g2(x1,x2,...,xN)+...
where the functional forms of g1, g2, ... are known.
How do I pass f1, f2, .., fN to the Newton's iteration subroutine? Is
it possible at all, and what is the syntax?
I guess this is a general programming question, but since I am using C+
+ in this case, I am posting this question here.
dsv