I want to define an abstract function.

For example,$a=a[x]$, whose expression is unknown. It can be used for calculation and deduction later. Assume that there are sufficient conditions, so I can get the specific expression of $a=a[x]$ finally.

My question is that which Code is needed to build $a=a[x]$?

  • 3
    $\begingroup$ This post is not clear. You never want t write and expression like a = a[x] in Mathematica; evaluating it would give infinite recursion. $\endgroup$ – m_goldberg Jul 15 '17 at 7:10
  • 1
    $\begingroup$ "It can be used for calculation and deduction later" In what kind of calculation and deduction? You should be more specific in this point, or I'm afraid your question is at least too board, if it's not unclear. $\endgroup$ – xzczd Jul 15 '17 at 8:03
  • $\begingroup$ I have revised the statement, so maybe the question raised is clear.@m_goldberg $\endgroup$ – Robin_Lyn Jul 15 '17 at 8:04
  • $\begingroup$ The calculation and deduciton procedure is a little bit complicated, so in the statement no specific expression is stated. And my point of this question is on "which code is needed to build a = a[x]"@xzczd $\endgroup$ – Robin_Lyn Jul 15 '17 at 8:08
  • 2
    $\begingroup$ Just type a[x] and it is a function. For example, if you want to know its derivative, take D[a[x],x] and you get a representation of the derivative of a[x] with respect to x. On the other hand, if you asked for D[a[x],y], the derivative of a[x] with respect to y, then you get 0, as you might expect. $\endgroup$ – bill s Jul 15 '17 at 12:46

You can delay as long as you want before deciding what you want a[x] to be.

ClearAll[a, b, c, x]
a[x]  (*  a[x] *)
b[x_] := a[x] (*  a[x] *)
b[25]  (*  a[25] *)
c[x_] = D[a[x], x]  (*  (a^\[Prime])[x] *)
c[25] (*  (a^\[Prime])[25] *)
a[x_] := x*x  (* finally we decide to define it! *)
b[25]  (*  625 *)
c[25]  (*  50 *)

To understand this better, read about DownValues.


Not the answer you're looking for? Browse other questions tagged or ask your own question.