6

My Mathematica code is this:

Simplify[D[Sqrt[1 + (u')^2 + (-60 x - 20 u u')^2], u]]

It returns this:

(1200 u x (0&) + (1200 x + (0&) + 400 u^2 (0&)) u^′+ 400 u (u')^2) / Sqrt[1 + (u^′)^2 + 400 (3 x + u u^′)^2]

What does the (0&) term mean?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
oldlab
  • 191
  • 1
  • 4
  • 5
    It's the zero function, equivalent to f[x_] := 0. – Michael E2 Nov 16 '15 at 00:08
  • When you wrote u and u', did you mean them to be two distinct variables? In Mathematica, they are not. ' denotes the derivative. (u') is assumed to be a function. In Mathematica, (u')^2 makes no sense and leads to the sorts of weird results you see here. – Szabolcs Nov 16 '15 at 12:26
  • 1
    Yes, I meant them as two distinct variables. Perhaps that's why Mathematica responded as such. Evaluating the Euler-Lagrange equation for a given functional integrand f(x,u,u') requires computation of its partials wrt u and u'. It seems that I should have been more careful in setting this up than I was. In any case I can see the concern raised by @Szabolcs. And I appreciate the gentle treatment in this forum. I'll give the formulation another shot with commenters' observations in mind. – oldlab Nov 17 '15 at 01:23

2 Answers2

9

Simpler example:

D[u', u]
(*  0 &  *)

Usually it helps to inspect the FullForm of an expression to understand how Mathematica works.

u' // FullForm

enter image description here

But comparing the two similar forms, Derivative[1][u] and x[1][u], it's hard to understand what is happening.

D[Derivative[1][u], u] // Trace

enter image description here

D[x[1][u], u] // Trace

enter image description here

D[x[1][u], u] /. x -> Derivative
(*  u''  *)

D[x[1][u] /. x -> Derivative, u]
(*  0 &  *)

The difference between these last two examples is hard for me to explain. The first is probably because Derivative[1]' evaluates to Derivative[2]. It may be a bug, I suppose. If $u$ is a function of some variable $t$, then $${d \over du}\,u' = {dt \over du}\,{d \over dt}\,u' = {u'' \over u'}\,.$$ But it's more like this: $${d \over du}\,u'={d \over du}\,{du \over dt} \mathrel{\buildrel ? \over =} {d \over dt}\,{du \over du} = {d \over dt}\,1\,,$$ because of the following:

D[u', u] // Trace

enter image description here

Michael E2
  • 235,386
  • 17
  • 334
  • 747
6

Although Mathematica has an interpretation for D[u', u] as discussed by Micheal E2, I have an hard time conceiving (i.e., have no clue) of a situation where using that form would apply. So I wonder if the following is what you really wanted is

D[Sqrt[1 + (u'[x])^2 + (-60 x - 20 u[x] u'[x])^2], x]

which gives

form

which is at least something that appears sensible to me.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257