Message Boards Message Boards

GROUPS:

[✓] Include x in the DE returned by the EulerEquations?

Posted 6 months ago
518 Views
|
4 Replies
|
2 Total Likes
|

So, I need to find an extremal of a given functional

J=Integrate[12*x*y+(y')^2,{x,1,3}]

To do that I write the Euler's equation and get the DE: 12xy-2*y"=0. My calculations

Then I try to do the same thing using Mathematica and EulerEquations[] function. And it returns just -2y"=0, ignoring 12x. Mathematica's calculations

What am I doing wrong? How to make Mathematica consider the independent variable?

4 Replies

Syntax !!!

   Needs["VariationalMethods`"];
   sol = EulerEquations[12*x*y[x] + y'[x]^2, y[x], x]
   (* 12 x - 2 (y^′′)[x] == 0 *)

   First@DSolve[sol, y[x], x]
   (* {y[x] -> x^3 + C[1] + x C[2]} *)

   First@DSolve[{sol, y[1] == 0, y[3] == 26}, y[x], x]
   (*  {y[x] -> -1 + x^3} *)

Oh my god, thank you so much! That solved my problem. But what does "First@" do? I couldn't find it in the documentation...

Delete **First@** you will see the differences. @ is Map function and First is equivalent to Flatten

Execute:

 ?First

or

 ??First

Thanks! I gained a lot of knowledge:)

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract