2
votes
1answer
94 views

How to explain the behavior of Rule inside these functions [duplicate]

I'm trying to define a function that takes an expression and spits out a pure function involving a replacement rule of that function's variable. An example would be a function ...
10
votes
2answers
203 views

Why doesn't a Composition[] hold its arguments and what can be done about it?

Now that Composition (also RightComposition) has shorthand syntax I am more inclined to use it, however what I feel should be ...
8
votes
3answers
599 views

Why are functions called first-class objects in Mathematica?

I've heard lots of people say a function is a first-class object in Mathematica. "Everything is an expression, including function." "There is no distinction between functions and data." Having read ...
1
vote
0answers
61 views

Expression for evaluating multiple functions?

I am constructing 3D data points for a plot and corresponding to specific conditions "manually". I define the values of five parameters [these I always have to define myself]. From those, I evaluate ...
1
vote
2answers
138 views

How to evaluate Modules in a notebook from another notebook?

I would like to create a notebook populated with several modules and be able to evaluate these modules by running a separate notebook. I have attempted several uses of the ...
0
votes
1answer
95 views

Evaluate integral of a series

I want to evaluate this integral, but it won't work. Does anyone knows why? ...
8
votes
1answer
169 views

Why does Plot[Hold[x], {x,0,1}] work?

It appears that, counter to my expectation, all of these (and probably many others) seem to work fine: ...
0
votes
1answer
199 views

Pass unevaluated function with evaluated arguments

I am almost sure that this question has been asked somewhere. I found similar ones, but I cannot find exactly what I need, which might mean that I am on the wrong track. I search a method to pass an ...
6
votes
2answers
177 views

Evaluation in lambda function

If I have a function, that returns a function, for example: f[a_] := a^2 * # & then f[3] == 3^2 # & Is there a way ...
0
votes
2answers
228 views

Defining a function in terms of matrix elements

Currently trying to use elements from a matrix in defining a function however having some trouble. This is a somewhat simplified version of the problem. Say I have the matrix ...
15
votes
2answers
735 views

Why do certain values in ArcSin not fully evaluate?

This is a continuation of: Why do certain fractional values in TriangleWave not evaluate? The analysis by R.M and rasher revealed that problem to reduce to the behavior of: ...
2
votes
1answer
109 views

Piecewise function with user-input interval

I would like define a function g[data,bins,x] which is a piecewise constant function taking value data[[i]] in the range ...
6
votes
2answers
112 views

Partial result of aborted evaluation of FullSimplify

When FullSimplify invoked on a large expression, it can run for hours. If I do not have time to wait, and abort the evaluation, I get no result, although, ...
8
votes
3answers
192 views
1
vote
1answer
134 views

Passing a joined list of symbols for Module or Block to treat as its own local symbols

The Question I'd like to write a function which itself takes a list of symbols, e.g. Foo[{x, y, z}] to pass to Module ...
5
votes
1answer
120 views

Strange Behavior when making Equal Listable in Pick

While trying to make this problem more efficient I tried different methods and dabbled with making Greater and Equal ...
11
votes
4answers
299 views

Using With to scope over pure functions

Consider this example: given an option for a function func as "x" :> (a&), how can one assign different values to ...
6
votes
2answers
324 views

Obtaining the name of a variable as a string [duplicate]

Suppose that I have an arbitrary variable myVariable. Is there some function fun -- either built-in or one that I can define -- ...
15
votes
8answers
384 views

Is it possible to use RandomChoice to choose without other choices being evaluated?

I'm trying to do this: i1 = 1; i2 = 1; RandomChoice[{ (i1 = i1 + 1), (i1 = i1 - 1), (i2 = i1 + 1), (i2 = i2 - 1)}] In order to chose randomly which ...
17
votes
1answer
182 views

How to get Cases to wrap results in an arbitrary head?

A number of functions provide for results to be wrapped in an arbitrary head. This is very important in cases where the results should not be evaluated. Take ...
0
votes
1answer
123 views

Understanding output of multivariable integration

I'm new to Mathematica and I'm trying to integrate this function: ...
11
votes
2answers
292 views

Clever use of DownValues, or failure to understand the “Mathematica Way.”

I needed to look at the changes in the values of about 4000 items from one year to the next. I have a table with identifiers and values for each year. Not all of the items are in each list. The ...
4
votes
1answer
482 views

What do the hashtags represent in the result of Solve, and how should I use them? [duplicate]

There is a function that I'm trying to get the inverse of. My function is a simple polynomial: Tn[T_] := 4/9 T^3/Tc^2 + 5/9 T Now I tried to find ...
0
votes
1answer
108 views

Can I force a function to quit and return some value after a certain amount of time has passed during its evaluation?

Imagine I provide some random input to function like FindInstance[], and I observe that, despite the existence of good solutions, the function will, with some ...
3
votes
3answers
189 views

Alternative to using global variables in functions?

Often times I find myself using unevaluated variables (i.e. they show up blue) as dummy variables in whatever I'm returning such that I can evaluate them as needed later on. A simple example is as ...
0
votes
0answers
35 views

Define a Plot3D function with custom options [duplicate]

I am trying to define a Plot3D function with custom options, following (this previous SE question), but I'm running into a brick wall. I've narrowed the problem to the following 'toy' code: ...
1
vote
0answers
52 views

Confusing efficiency and evaluation when returning pure functions? [duplicate]

I have a function that takes some time to evaluate, that's meant to be a polynomial approximation to a function. The polynomial is defined by a list of coefficients, so I have the function ...
1
vote
1answer
323 views

Forcing evaluation of ArgMax

How to force evaluation of ArgMax before its output gets used in Solve? Background: I'm trying to solve for the Nash ...
2
votes
1answer
250 views

Evaluate Numerator and Denominator Separately

I have this function. ...
9
votes
1answer
233 views

Get the name of a symbol passed to a function

I'm trying to get the name of a symbol passed to a function with this: f[x_] := {SymbolName[x], x} SetAttributes[f, HoldFirst] x = 5; f[x] But ...
5
votes
5answers
532 views

Prevent Part[] from trying to extract parts of symbolic expressions

If you have a list, e.g. {1, 2, 3} then you can extract the $k$th part using Part (...
4
votes
2answers
541 views

How to make a function that evaluates an expression?

I'm trying to make a function where the input is an expression, but somehow it just won't be evaluated. For example, this little function doesn't work: ...
1
vote
2answers
135 views

How can define a set of nested parameters

I would like to know how I to define a function with a nested set of parameters (or whatever you would like to call it). For example, how would I get the following function ...
5
votes
3answers
244 views

First evaluation fails

I am fairly new to Mathematica (version 7), so please bear with me... I have duplicated, in Mathematica, a program that I originally wrote in C (it generates OEIS sequence A191837). The problem is ...
3
votes
1answer
248 views

FunctionInterpolation Errors / Question re Evaluation Order and Options

I have using Mathematica functions that takes a Cartesian coordinate relative to the Earth (xyz) and converts it to a latitude, longitude, and altitude (lla). And here it is: ...
23
votes
2answers
759 views

Block attributes of Equal

I answered “Equating matrices (or higher order tensors) element-wise” with: ...