How can I define a general function without the exact expression in Mathematica? For example, I don’t need this:
a[x_, y_]:= 2x + 3y,
I need to work with a general parameter a(x,y) instead:
a[x_, y_]:= a[x, y].
Of course, this line doesn’t work too well.
Edit1:
Well, I am using the parameter in another unknown function (unknown because it is defined only in the package), which works basically as a derivative, i.e. it’s a very complicated mix of first and second derivatives.
This line
a[x_, y_]:= a[x, y],
actually works (kind of), because the parameter ‘survives’ the package as a function, except in the output I get the annoying “Hold[a[x,y]]” instead of just a[x,y], and I can’t use the result as a function anymore.
The way to “define” a function without specifying an expression is to not define it. Just use it.
Example:
As you can see, I didn’t define
forg, and yet Mathematica has no problems calculating with them.Note that you can also make definitions using those functions. For example:
You can even define arithmetic operations on them. For example, you could define a function
expto symbolically calculate with exponentials (note the lower case, becauseExpis already the built-in exponential function), and then defineand then write