Solving an algebraic-integral equation in Mathematica

  • Mathematica
  • Thread starter nickthequick
  • Start date
  • Tags
    Mathematica
In summary: Furthermore, the code for this problem is very memory intensive, which can be an issue when trying to test the accuracy of the results.
  • #1
nickthequick
53
0
Hi,

I'm trying to solve an algebraic-integral equation (I don't know if this is the proper description of this class of equations, it just seems like the least wrong way to describe them) and have run into several issues that I'll describe below, but first I'll outline the problem.

I'm trying to solve for [itex]k[/itex] dependent variables where the governing equation for the [itex]k-th[/itex] mode takes the form

[tex] \alpha_{k} +\frac{1}{\lambda}\gamma \int_0^{\lambda} \frac{(1+\mathcal{X})\cos k\xi +\mathcal{Y}\sin k\xi }{\sqrt{(1+\mathcal{X})^2+\mathcal{Y}^2} } d\xi =0 [/tex]

where

[tex] \mathcal{X}=2\sum_{n=1}^N n(\alpha_n \cos n\xi);\quad \& \quad \quad \mathcal{Y} = 2\sum_{n=1}^N n(-\alpha_n \sin n\xi ).
[/tex]

and the parameters [itex]\lambda, \gamma [/itex] and N are prescribed, where N is a parameter that will be be increased to meet convergence criterion. The independent variable of the system is [itex]\gamma[/itex] and we would like to solve for the [itex]\alpha_k[/itex].

Now, I don't really know how to deal with the integral term and have no reason to suspect there's a better way to rewrite it, so I am doing the most naive thing that comes to mind, namely, taking the so called trapezoidal approximation of the integral over even spacing. That is, given a function [itex]f[/itex] on an interval [itex](a,b)[/itex], we have

[tex]\int_a^b f(x) dx =\frac{b-a}{2M} \left(f(x_1)+2\sum_{i=2}^Mf(x_i) +f(x_{M+1})\right) +R_M[/tex]

where [itex]x_i=a+\frac{b-a}{M}*i [/itex].

My goal is to increase the resolution of the integral until the remainder [itex] R_M[/itex] is sufficiently small.

I'm having a few problems. My main question is, is this the proper way to go about problems of this nature? Something is wrong with either my physics (which I understand you cannot help with without more details, which I can provide if interested) or my code as I get very strange non-convergent behavior as M is increase. Secondly, I am finding that for M<N, the gross majority of the energy tends to congregate in the M-th mode. I'm not completely sure why the system would bias this mode so I've just been considering cases where M>N. Last, but certainly not least, this code ends up being very memory intensive for test examples that I'm playing with, so I'm looking at ways of getting around this.

Any suggestions for my code, or even on how to approach these types of problems, would be much appreciated.


My mathematica code is included below.
M = 20;
\[Kappa] = 10^6;
\[Lambda] = 2 \[Pi]/\[Kappa];
\[Gamma] = 1.0126;
f1a[k_, x_] := ((1 +
2 Sum[n*(\[Alpha][n]*Cos[2 \[Pi]*n*x]), {n, 1, M}]) Cos[
2 \[Pi]*k*x] +
2*Sin[2 \[Pi]*k*x]*
Sum[n*(-\[Alpha][n]*Sin[2 \[Pi]*n*x]), {n, 1, M}])/
Sqrt[(1 + 2 Sum[n*(\[Alpha][n]*Cos[2 \[Pi]*n*x]), {n, 1, M}])^2 +
Sum[2 n*(-\[Alpha][n]*Sin[2 \[Pi]*n*x]), {n, 1, M}]^2];
MMax = 22;
I1a[j_] := 1/(MMax) (Sum[f1a[j, (i - 1)/(MMax)], {i, 1, MMax}]);
Governing[j_] := \[Alpha][j] - \[Gamma]*I1a[j];
IC = Join[Table[{\[Alpha][1], .4}, {i, 1}],
Table[{\[Alpha], 0}, {i, 2, M}]];
S =
FindRoot[Table[With[{i = i}, Governing == 0], {i, 1, M}],IC];
Y[x_] := Evaluate[
Sum[-2*(\[Alpha][k]^2)/\[Kappa] +
2*Cos[2 \[Pi]*x*k]*\[Alpha][k]/\[Kappa], {k, 1, M}] /.
S];
X2[x_] :=
x*\[Lambda] +
Evaluate[
Sum[Sin[2 \[Pi]*x*k]*\[Alpha][k]/\[Kappa], {k, 1, M}] /. S];
ParametricPlot[{X2[x], Y[x]}, {x, 0, 1}, AspectRatio -> 1/4]


Nick
 
Physics news on Phys.org
  • #2
Integral equations can be tricky to solve, and the numerical methods which can solve them involve using a lot of complicated mathematics to figure out the solutions.

Because of the nature of the integral expression, the use of the trapezoidal method to calculate the integral may not provide accurate results. There are numerical integration methods which are specially adapted to give accurate results when trigonometric or other periodic functions are involved.
 

Related to Solving an algebraic-integral equation in Mathematica

1. How do I input an algebraic-integral equation in Mathematica?

To input an algebraic-integral equation in Mathematica, use the command "Integrate" followed by the function or expression to be integrated, and then specify the variable of integration using the syntax "variableName -> lowerLimit, upperLimit". For example, to solve the equation ∫(x^2 + 3x + 5)dx with limits from 0 to 2, you would type "Integrate[x^2 + 3x + 5, {x, 0, 2}]".

2. How do I solve an algebraic-integral equation in Mathematica?

To solve an algebraic-integral equation in Mathematica, use the command "Solve" followed by the integrated function and the variable of integration. For example, to solve the equation ∫(x^2 + 3x + 5)dx with limits from 0 to 2, you would type "Solve[Integrate[x^2 + 3x + 5, {x, 0, 2}], x]". This will give you the solution in terms of the variable of integration, in this case, x.

3. Can I solve algebraic-integral equations with multiple variables in Mathematica?

Yes, you can solve algebraic-integral equations with multiple variables in Mathematica. Simply specify all the variables of integration in the "Integrate" and "Solve" commands. For example, to solve the equation ∫(x^2 + y^2)dx dy with limits from 0 to 2 for both x and y, you would type "Solve[Integrate[x^2 + y^2, {x, 0, 2}, {y, 0, 2}], {x, y}]".

4. How do I plot the solution of an algebraic-integral equation in Mathematica?

To plot the solution of an algebraic-integral equation in Mathematica, first solve the equation using the "Solve" command as mentioned above. Then, use the "Plot" command followed by the solution and the limits of integration. For example, if the solution is stored as "sol" and the limits are from 0 to 2, you would type "Plot[sol, {x, 0, 2}]".

5. Can I solve algebraic-integral equations numerically in Mathematica?

Yes, you can solve algebraic-integral equations numerically in Mathematica using the "NIntegrate" and "NSolve" commands instead of "Integrate" and "Solve". These commands will give you a numerical solution instead of a symbolic one. Make sure to specify the appropriate options for accuracy and precision in these commands.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
289
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
123
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
392
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
Back
Top