Questions about the use of built-in Mathematica functions, including pure functions.
0
votes
1answer
33 views
Errors in evalauting an expression
I have the following:
Constants:
b3b = 2;
G = (1/eps^2);
a1 = 3;
a3 = 4;
xc = 0.3;
Functions:
...
0
votes
0answers
35 views
Are local variables possible in Mathematica? [duplicate]
Does Mathematica support local variables? (local - in the sense of general programming)
To be more precise, I would like to have a variable which exists only within a given block of code (possibly, ...
7
votes
3answers
101 views
How can I break through Function's HoldAll attribute to force evaluation of a body element?
The question concerns creating a function. Let consider the following code
With[{f = Function[t, Cos[t]]},
{First[#], f'[#]} &
]
which returns
...
2
votes
4answers
155 views
How to generalize and speed up this prorgam?
There is a vector whose length is $n*m$, we can part it into $n$ sections in order. I want to define a function to compare the $i$-th and $i+1$-th section and find the minimum. The program for $n=m=3$ ...
1
vote
1answer
71 views
BSplinefunction and its derivative
Hi I am trying to use curve fit some data using the BSplinefunction. I havent been using Mathematica long, so my questions might be quite basic.
...
2
votes
1answer
49 views
How to compute a discrete histogram of a list [duplicate]
I'm trying to compute the discrete histogram of a set of values.
By histogram I mean the absolute frequency a value appears on the dataset, by discrete I mean the values are from a discrete set, e.g. ...
0
votes
1answer
67 views
Understanding output of multivariable integration
I'm new to Mathematica and I'm trying to integrate this function:
...
0
votes
2answers
58 views
Scope of expression in a user-defined function
I have the following code:
fbasic = A + R + Z*Z *Z*Z;
f[A_, Z_, R_] := fbasic + R;
f[0, 2, 3]
The answer I am getting is
...
0
votes
1answer
54 views
Defining functions with changing number of variables [duplicate]
I am working with a bunch of functions of the form
fn[x1_,x2_,x3_,...,xn_] := x1x2+x2x3+...+xnx1
where $n$ changes. Is there a way to create these functions ...
4
votes
4answers
195 views
How to avoid writing $K$ loops?
I want to evaluate a mathematical function of $K$ variables each of variables varying between 1:N. One way to do this is writing $K$ loops and varying variables accordingly, as shown below:
...
0
votes
1answer
40 views
How can I provide description for functions [duplicate]
I am sorry,might be it's simple question but I want to know.
I wrote the following function
...
1
vote
4answers
159 views
Find time since last 0 in list
When I have a list of data (measured per day), is it possible to define a function that gives the nr of days since the data has been 0? I tried working with...
2
votes
1answer
77 views
Create continuous function from list
I have a list of data (measured per day) that I want to use as imput for another equation (say f). The problem is that the input I need for f needs to be a continuous function of time. Is it possible ...
2
votes
2answers
100 views
Writing a function that returns a (usable) function
I am trying to create a function that returns Arnold's Cat Map of size n iterated k times. I can get something out of the Function command, but I can't figure out ...
2
votes
4answers
141 views
How to use If to select arguments min & max in Range?
I want to call Range[] with its arguments depending on a condition. Say we have
...