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:

```
D[f[x] g[x],x]
(*
==> g[x] f'[x] + f[x] g'[x]
*)
```

As you can see, I didn't define `f`

or `g`

, and yet Mathematica has no problems calculating with them.

Note that you can also make definitions using those functions. For example:

```
modify[a[x_,y_]]:=a[y,x+y]
modify[a[2,3]]
(*
==> a[3, 5]
*)
```

You can even define arithmetic operations on them. For example, you could define a function `exp`

to symbolically calculate with exponentials (note the lower case, because `Exp`

is already the built-in exponential function), and then define

```
exp/: exp[a_] exp[b_] := exp[a+b]
exp/: exp[a_]^n_Integer := exp[n a]
```

and then write

```
expression = 3 exp[x] exp[y+z]^3
(*
==> 3 exp[x + 3 (y + z)]
*)
```

Similar Questions

When I run this java code, i am able to get the values of variables define outside the function, but i am unable to get the values of variable define inside the function. how to access these variable

I want to do something like this (define a lambda function based on some condition): auto update; if(condition) { update = [this]() {this->someField += 1;}; } else { update = [this]() {this->som

I'm sure this is very simple, but I ask Mathematica for the characteristic polynomial of an equation, as follows: m={ {0, n, 0, c1}, {R, 0, 4, c2}, {0, R, 0, 0}, {0, 0, R, c4} } CharacteristicPolynomi

I want to define a macro function which support at the same time: 1) No input parameter 2) Input parameters some thing like that: #define MACRO_TEST(X)\ printf(this is a test\n);\ printf(%d\n,x) /

In the appendix of the book http://www.math.upenn.edu/~wilf/DownldGF.html, page 194, the author mentioned that in Mma 2.0 (very old. :P), there is the function which can get the generating functions d

How to call a Mathematica function inside Matlab? There are certain symbolic equation manipulation/simiplification that's particularly easy to do in Mathematica, at least to me, and I'd like to use Ma

Hi How can I define a function on button click in HTML, I tried something like that: <input type=button value=sth onclick= <script type=text/javascript> function hello()( window.print(

Is it true that Mathematica's Minimize function does not allow constraints like Mod[x,2]==0? I am trying to solve a MinuteMath puzzle with Mathematica: What is the smallest possible average of four d

I want to use the Manipulate function in Mathematica to fit an analytical function to a set of (x,y) data. I want to plot the dataset on the same axes that I use to manipulate the function (so I can g

problem with setTimeout function is not define ! What is the problem in this code ? $(document).ready(function(){ function ISS_NextImage() { //ImageSlideShow NextImage $('.ImageSlideShow').each(func

I'm a newbie in Mathematica programming and I need some help. I'm trying to write a function that gets the elements of an arbitrary array and builds a string especifically formatted to use in Math Lib

How can I save the numerous Plot options in Mathematica into a single variable

I'm having trouble with this exercise, please help ! Define a function remove that takes an integer and a list of integers as input and returns the list obtained by deleting the first occurence of the

My first function I defined that works def chainPoints(aa,DIS,SEG,H): #xtuple n=0 xterms = [] xterm = -DIS while n<=SEG: xterms.append(xterm) n+=1 xterm = -DIS + n*SEGL # #ytuple k=0 yterms = [] w

Is there a way to define a function on a specific domain in mathematica? I need this because I want to invert a function which is only monotonic on a specific domain. For example: f[x_]:=x^2 g[x_]:=I

I am trying to plot slope fields of some differential equations using mathematica but can't figure it out. Say I have the equation y' = y(t) y(t) = C * E^t How do I plot the slope field? I found an

I am not looking for a Hibernate/JPA/JDBC implementation, but for a general design pattern. Googling pagination gives me loads of information, lot of interesting articles that explain how to implem

In general, mathematica always assumes the most general case, that is, if I set a function a[s_]:={a1[s],a2[s],a3[s]} and want to compute its norm Norm[a[s]], for example, it will return: Sqrt[Abs[a

I am trying to define a function that would to that: var photoWidth = $('#photo_preview').width(); var photoHeight = $('#photo_preview').height(); if (imgHeight > imgWidth){ $('#photo_preview').css

Has anyone already thought about how to do a clickable calendar in Mathematica? There seems to be something here http://library.wolfram.com/infocenter/Demos/108/, but I quickly tested it and it doesn'

I am experimenting with syntax mods in Mathematica, using the Notation package. I am not interested in mathematical notation for a specific field, but general purpose syntax modifications and extensio

When using constraints with simple equality in Mathematica 8, minimization doesn't work. E.g. FindMinimum[{x^2 + y^2, y == 1}, {x, y}] works ok in Mathematica 6, but gives errors in version 8. Can a

I want to code a single js/jquery function for all forms submit events in my application. Currently I am hardcoding on 3 locations like that and it is working but I have to create a function for each

I have a following problem - I need to integrate such a function in Mathematica (I couldn't post an image, so I am writing it in latex form): G(r)= \int_{0}^{\infty} dq f(q)*q*sin(qr)/r To obtain fu

When doing calculations in Mathematica I often need to redefine a function by appending to it. For example if I define f[n_] := n^2 + n + 1 then after some time I'd like to add 2n^3 so from now on

I have a function which I would like to maximize over an independent variable range, say a->b. How would I do this in Mathematica? The documentation does not provide an answer.

I'm playing with Python and Google App Engine for the first time but am unable to define a string within my function (mytest2), I get an indentation error on the line after the declaration. I can defi

Not sure that my title is that descriptive, but here it goes. I am on visual c++ working on a console calculator, I am creating a way to let the user define a custom linear function. Here is where I a

I'm very new to Mathematica. I want to use it as a data source for gnuplot (I know Mathematica can plot too), it uses a file format with data in columns and a space between each column on each row. Li

How can I define a function f(x) in Mathematica that gives 1 if x is in [-5, -4] or [1, 3] and 0 otherwise? It's probably something simple but I just can't figure it out!

I need some function which among other stuff would define a new global symbol. So that I could use it like this: (define (func-prototype symbol value comment) (define symbol value) ; this should someh

Since cljs doesnt have a format function, I need to define one myself if i have a src file with following: (ns formatter (:require [goog.string :as gstring] [goog.string.format])) (defn format Format

I have a function f(x,t) and I'd like to plot the function of the solution x(t) of f(x(t),t)=0 using Mathematica. How can I do it? Mathematica is often quite different to other programming languages I

I'm trying to plot a couple of UnitStep functions, but for some reason, Mathematica won't plot the whole function - Just the top (it doesn't look like a step, more like a line). How do I tell mathemat

It is possible to define a prototype of a function or in some way indicate to Ruby that a function exists even though it may not be defined yet? I have lots of classes like this: class Program FIRST

Original question: I know Mathematica has a built in map(f, x), but what does this function look like? I know you need to look at every element in the list. Any help or suggestions? Edit (by Jefromi,

Has anyone come across a tutorial to create documentation for functions you create in Mathematica? I'm trying to organize some functions that I have written but so far I'm doing a terrible job. I woul

I need to convert this to Matlab code, and am struggling without the table function. Table[{i,1000,ability,savingsrate,0,RandomInteger[{15,30}],1,0},{i,nrhhs}]; So basically, these values are all j

I found several questions about how to declare regular JS functions within jQuery. But how to define a jQuery function within jQuery(function () ?

How do i define functions in OpenCL? I tried to build one program for each function. And it didn't worked. float AddVectors(float a, float b) { return a + b; } kernel void VectorAdd( global read_only

I want to define a custom function which can be used globally with the include function. Is there some location that I can put additional cmake sources which can be included globally?

I want to repeat a function n times on a table, For n=2 I have the following code, How can I be sure that the function had run twice since my fc is differend every time? smat = Table[{9, 8, 10}, {3}]

I've managed to write a template class to work like a callback, learned from the accepted answer of this question How to define a general member function pointer. I wish to have a map of string keys a

If a simple function factory is possible in bash? For example: function_factory func1 func2 func3 will create three functions that just have the passed names without doing anything. These birthed func

I think I am starting to understand how to link functions written in C/C++ to Mathematica. The problem I'm facing is that I don't know how to send error messages from my C wrapper to Mathematica. Afte

This question already has an answer here: Optional parameters in Python functions and their default values [duplicate] 2 answers I want to define a function to which the input parameters can be

I would like to map the elements of a Scala tuple (or triple, ...) using a single function returning type R. The result should be a tuple (or triple, ...) with elements of type R. OK, if the elements

I have created this using the mathematica bezier curves. I just want to know how could I fill these fonts with colour using some mathematica routines. Thanks

I'm currently new to javascript programming. And I have a question about function. When I tried to modify html DOM. I could either use function or no function. The function one is as below: <button

I am trying to write a curve fitting function which returns the optimal parameters a, b and c, here is a simplified example: import numpy import scipy from scipy.optimize import curve_fit def f(x, a,