0
$\begingroup$

Here is the modified question:

First: Define

phi[x_]:=Piecewise[{{1, 0 <= x < 1}}, 0]

psi1[x_] := (phi[2 x] - phi[2 x - 1]);

psijk[x_, j_, k_] := Piecewise[{{(Sqrt[2])^j psi1[2^j x - k],0 <= j}, {(2)^j psi1[2^j (x - k)], j < 0}}];

I am trying to solve the equation in the below picture by finding an approximation solution for u(x) using wavelets. What I did is as follows: I used wavelet functions and substitute the wavelet instead of u(x).

I multiplied both sides of the equation by psijk[x,l,s] and integrate both sides from 0 to 1, this known in wavelets as the Galerkin Method. So we have the following system,

Sum[C [j, k]* PSI[j, k, l, s], {j, -2, 2}, {k, -4, 3}, {l, -2, 2}, {s, -4, 3}] = NIntegrate[f[x]*psijk[x, l, s], {x, 0, 1}]

where

PSI[j_, k_, l_, s_] := NIntegrate[psijk[x, j, k]* psijk[x, l, s], {x, 0, 1}]- NIntegrate[psijk[x, l, s] * NIntegrate[psijk[t, j, k]*(1/(-t + x)^(1/4)), {t, 0, x}], {x, 0, 1}]-NIntegrate[psijk[x, l, s]*NIntegrate[psijk[t, j, k]*(1/(-t + x)^(1/4)), {t, 0, 1}], {x,0, 1}];

and

f[x_]:=16/165 (-1 + x)^(3/4) + 48/385 (-1 + x)^(3/4) x + x^2 + (256 (-1 +x)^(3/4) x^2)/1155 - (256 x^(11/4))/231 - x^3 - (512 (-1 + x)^(3/4) x^3)/1155 + (1024 x^(15/4))/1155, and C[j,k] to be found!

Then to find these coefficients, I defined,

ce = ArrayReshape[Table[PSI[j, k, l, s], {j, -2, 2}, {k, -4, 3}, {l, -2, 2}, {s, -4, 3}], {40, 40}];

coef=NIntegrate[f[x]*psijk[x, l, s], {x, 0, 1}]

and

ae = PseudoInverse[ce].coef;

However, I am getting error and the solution is incorrect as the exact solution is u[x]=x^2(1-x).

The errors came as some comments is from the ranges {x, 0, 1}, {t, 0, 1}, but I dont know how to fix this issue as the method I used is by integrating both sides of the equation from 0 to 1.

I hope the question is clear for everyone. enter image description here Your help is extremely appreciated!

$\endgroup$
  • 2
    $\begingroup$ Try different Methods you can find within NIntegrate. $\endgroup$ – Αλέξανδρος Ζεγγ Oct 16 '18 at 7:59
  • 2
    $\begingroup$ You should interchange the integration parameters NIntegrate[..., {t, 0, x}], {x, 0, 1}]-> NIntegrate[..., {x, 0, 1}, {t, 0, x}]] (first error!) $\endgroup$ – Ulrich Neumann Oct 16 '18 at 9:24
  • 2
    $\begingroup$ What is your reason for including the definition of f in this question? It doesn't seem to called any other function in the question. $\endgroup$ – m_goldberg Oct 16 '18 at 22:14
  • $\begingroup$ When t == 1 and x == 0, (-t + x)^(1/4) is complex. $\endgroup$ – Michael E2 Oct 16 '18 at 22:59
1
$\begingroup$

If you combine the iterated integrals into multiple integrals, apply PiecewiseExpand to the last integral, and further specify the singularity t == x in the last integral, it seems to work.

PSI[j_, k_, l_, s_] := 
  NIntegrate[psijk[x, j, k]*psijk[x, l, s], {x, 0, 1}] - 
   NIntegrate[
    psijk[x, l, s]*psijk[t, j, k]*(1/(-t + x)^(1/4)),
    {x, 0, 1}, {t, 0, x}] - 
   NIntegrate[
    psijk[x, l, s]*psijk[t, j, k]*(1/(-t + x)^(1/4)) // PiecewiseExpand,
    {x, 0, 1}, {t, 0, 1}, Exclusions -> t == x];

PSI[1, 1, 1, 1]
(*  0.767956 + 0.0606109 I  *)

You get a complex value because near t == 1, x == 0, the factor (-t + x)^(1/4) is complex.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Might want to set a finite AccuracyGoal, since the integrals may be zero. E.g. AccuracyGoal ->12. $\endgroup$ – Michael E2 Oct 16 '18 at 23:18
  • $\begingroup$ How we can avoid x-t to be a negative? I need it only positive for any value in the domain of 0<t<x<1. $\endgroup$ – Mutaz Oct 17 '18 at 6:32
  • $\begingroup$ @Mutaz The integration ranges you give in the 3rd integral are {x, 0, 1} and {t, 0, 1}. Perhaps you meant to put {t, 0, x} for the t range in the 3rd, just as you did in the 2nd integral? (If you do that, the integral is computed without any fuss. No need for PiecewiseExpand either.) $\endgroup$ – Michael E2 Oct 17 '18 at 10:13
  • $\begingroup$ But it supposed to be as it is $\endgroup$ – Mutaz Oct 17 '18 at 17:42
  • $\begingroup$ @Mutaz If (-t+x)^(1/4) and {x, 0, 1}, {t, 0, 1} are both correct, then complex numbers cannot be avoided. It is not a numerical issue, but a mathematical one. $\endgroup$ – Michael E2 Oct 17 '18 at 22:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.