5

When I run the code

DSolve[y*D[f[x, y, z], z] - z*D[f[x, y, z], y] == 0, 
 f[x, y, z], {x, y, z}]

I get the following output.

output

I don't understand this syntax. I know c_1 is a function name, but the [x][1/2(y^2+z^2)] throws me off. Does it mean c_1 is a function of two arguments? Is it indicating some sort of product? How am I to understand output of the form f[a][b] in general?

Just Some Old Man
  • 1,607
  • 1
  • 9
  • 12
  • 2
    For whatever reason, Mathematica separates parameters like x from the independent variables of the PDE, that is, those with respect to which the dependent variables are differentiated. In the way in mathematics $f_a(x)$ represents a family of functions of $x$ depending on a parameter $a$, so does the Mathematica expression f[a][x]. – Michael E2 Nov 02 '21 at 01:44

1 Answers1

6

$c_1$ is a function that takes $x$ and $\frac{1}{2}(y^2+z^2)$ as its arguments. I do not know why it shows it this way. In Maple, same solution is shown as $f \left(x , y , z\right) = F1 \left(x , y^{2}+z^{2}\right)$ where $F1$ is same as Mathematica's $c_1$

One can define a function like this

foo[x_][y_] := Module[{}, x + y]

And call it as

foo[x][y]

So the answer is just using the above definition for $c_1$. Not the standard one:

 foo[x_,y_] := Module[{}, x + y]

but both ofcourse work. The second definition is called using foo[x,y] and the first definition using foo[x][y]. It is probably a style choice why one is used vs. the other by DSolve.

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • Is there a difference in use between foo[x_][y_] and foo[x_,y_]? The second is more common and the one I stick to. The former could conflict with indexed functions of the form foo[x_][k] and it seems wiser to stick to that convention. But is there any way they act differently in code? – Just Some Old Man Nov 02 '21 at 14:37
  • 1
    @Just The first defines a subvalue of f, the second defines a downvalue of f. The differences in function definitions are discussion several Q&As, such as (96), (544), (7999). It's not clear to me that this applies to the expression returned by DSolve, which is not a function definition. It seems sufficient to observe that the Head of C[1][x][y z] is C[1][x], and its Head is C[1], and finally its head is C; and C has no definitions. – Michael E2 Nov 02 '21 at 15:03
  • 1
    One implication is that if you want to substitute a function for C[1] in the DSolve solution, such as foo, it should defined via a subvalue foo[x_][u_], not a downvalue foo[x_, u_]. I sometimes define foo[x_][u_] := foo[x_, u_]; foo[x_, u_] := <whatever> to take care of both forms. – Michael E2 Nov 02 '21 at 15:07