0

I have a somewhat convoluted problem and am not a Mathematica expert. I am trying to solve (numerically) the Euler-Lagrange equations for a complex Lagrangian. The difficulty lies in the fact that L(x(t), xdot(t), t) depends on the integral over a region that itself depends on x(t).

The issue is that when I supply the Euler-Lagrange equations to Mathematica, it tries to evaluate the ImplicitRegion before solving, which of course fails as the region depends on x(t).

Is there a way to formulate this problem so that Mathematica evaluates the region and integral dynamically? Defining the region analytically based on x(t) and defining the integral explicitly is not an option due to the dynamic complexity of the region.


Added detail:

Here's the Lagrangian:

L[q_, t_] := Module[{ R, S, \[ScriptCapitalR], \[ScriptCapitalS]},
  R = ((outerL2[q, t][[1]] <= x <= innerL2[q, t][[1]]) && (y <= 
        outerL1[q, t][[2]])) || ((innerL1[q, t][[2]] <= y <= 
        outerL1[q, t][[2]]) && (x >= innerL2[q, t][[1]]));
  S = ((-1 <= x <= 0) && (-3 <= y <= 1));
  \[ScriptCapitalR] = ImplicitRegion[R, {{x, -3, 3}, {y, -3, 3}}];
  \[ScriptCapitalS] = ImplicitRegion[S, {{x, -3, 3}, {y, -3, 3}}];
  Return[4 - 
    NIntegrate[
     1, {x, y} \[Element] 
      RegionIntersection[\[ScriptCapitalR], \[ScriptCapitalS]]]]
  ]
Luke
  • 1
  • 1
  • 1
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Feb 17 '24 at 10:23
  • It's really hard to help without seeing the actual problem. Integral equation is a big category. For now, most of the integral equations cannot be directly handled by NDSolve, but for some cases, the problem can be solved with a little extra programming (often much simpler than in other languages!); and in some cases, the equation can be transformed to eliminate the integral term. Anyway, click the [tag:integral-equations] tag and you'll see existing examples, these might help. – xzczd Feb 17 '24 at 10:29
  • 1
    An incomplete code doesn't help much. Anyway, if I have to guess: are you looking for black-box function defined with e.g. _?NumericQ? See this post for more info: https://mathematica.stackexchange.com/a/26037/1871 – xzczd Feb 17 '24 at 11:07

0 Answers0