Chapter 19 Fredholm Equations


MPD78
08-03-2010, 12:58 PM
Hello all,

I have been using the book entitled, "Radiative Heat Transfer" by Michael F. Modest 2nd Edition to study the solutions of certain, maybe, more advanced radiation problems. Some of the problems involving solving integral equations of various types.

I have the fred_singular.h routine working correctly. A good example of how to use it and some help from davekw7x got that one going. However, does anyone have an example of using fred2.h?

I have read how to call this function in the NR3 book but I haven't been able to find a "good" equation to try it out on.

Any help would be greatly appreciated.

EDIT:

I have found an example, now I just need some help in coding it correctly.

EDIT:

I have found an example, now I just need some help with coding it correctly.

See attachment.

END EDIT:

Thanks
Matt

davekw7x
08-04-2010, 01:02 PM
I have found an example...
See attachment.
Ummm---The term in the denominator (inside the integral) has two left parentheses and three right parentheses.

I can't get the listed answer no matter what I do with parentheses.

Can you check the source and see if you can tell us what is missing?

I mean, I know how to feed the Fred2 constructor and I can show how to get answers from the equation in the NR Version 2 examples books, but...

Regards,

Dave

MPD78
08-05-2010, 07:11 AM
Here is the source document.

ftp://ftp.cs.uiowa.edu/pub/comp_math_rep/report-170.pdf

That example is located on page 7. It states that "this example in " is from this book. Approximate Methods for Solution of Differential and Integral Equations by S.G. Mikhlin and K.L. Smolitskiy.

Perhaps would should try problem 4, located on page 7 ...

Thanks
Matt

davekw7x
08-05-2010, 12:36 PM
Well, let's try this one.


Look at equation 25 in the paper at http://www.new.dli.ernet.in/rawdataupload/upload/insa/INSA_1/20005b92_773.pdf

y(x) + \int_{-1}^{1}K(x,s)y(s)\,ds = 1

With
K(x,s) = \frac{1}{\pi}\ \left [\frac{d}{d^2 + (x - s)^2} \right ]

And we want to solve for y, given a particular value of d.


Now, compare this with equation 19.1.1 in the NR text:

f(t) = \lambda \int_{-1}^{1}K(t,s)f(s)\,ds + g(t)
Where, given functions K and g, we want to solve for f.

To use fred2 we need two functions:

We need a function that returns lambda times the kernel value for a given t and s.


We need a function that returns g(t) for a given t


In this case, taking the sign and the value of lambda into account:
The kernel-related function to feed to fred2 will be

ak(t,s) = -\frac{1}{\pi} \ \left[\frac{d}{d^2 + (t - s)^2}\right ]

and

g(t) = 1


Here's program that uses fred2 for this problem and compares results with known values for t equal to 0 and 1

// Driver for routine fred2
// See
//http://www.new.dli.ernet.in/rawdataupload/upload/insa/INSA_1/20005b92_773.pdf
//
// davekw7x
#include "../code/nr3.h"
#include "../code/gamma.h"
#include "../code/ludcmp.h"
#include "../code/gauss_wgts.h"
#include "../code/fred2.h"

const Doub PI = 3.14159265358979323846;

// This one happens to be constant, but this
// is the generic form
Doub g(Doub t)
{
return 1.0;
}

//
// By making a functor for the kernel function,
// we can use different values of d without hard-coding
// or using a global variable for d.
//
struct Akftor {
Doub d;

Akftor(Doub dd):d(dd){}

Doub operator() (const Doub & t, const Doub & s) const
{
return (-d/PI) / ((d*d) + (t-s)*(t-s));
}
};



int main()
{
// Limits on the integral
Doub a = -1.0;
Doub b = 1.0;

// The kernel parameter
Doub d = 1.0;

// The constructor for this value of d
Akftor ak(d);


//
// Repeat for different numbers of points and
// use fredin to show the solution at two known points
//
cout << "d = " << d << endl << endl;
cout << " n Abscissa Approx Actual" << endl
<< " -----------------------------------" << endl;

cout << fixed << setprecision(5);

for (int n = 2; n <= 8; n *= 2) {

// Here's the constructor for this value of n
Fred2 < Doub(Doub), Akftor > fred2(a, b, n, g, ak);

Doub abscissa = 0.0;
double approx = fred2.fredin(abscissa);
double actual = 0.65741;
cout << " " << setw(3) << n
<< setw(10) << abscissa << setw(11) << fred2.fredin(abscissa)
<< setw(11) << actual
<< endl;

abscissa = 1.0;
approx = fred2.fredin(abscissa);
actual = 0.75572;
cout << setw(15) << abscissa << setw(11) << fred2.fredin(abscissa)
<< setw(11) << actual
<< endl;

cout << endl;
}

return 0;
}


Output:

d = 1

n Abscissa Approx Actual
-----------------------------------
2 0.00000 0.67178 0.65741
1.00000 0.75162 0.75572

4 0.00000 0.65785 0.65741
1.00000 0.75583 0.75572

8 0.00000 0.65741 0.65741
1.00000 0.75572 0.75572


Regards,

Dave