Questions about the use of built-in Mathematica functions, including pure functions.

learn more… | top users | synonyms

2
votes
1answer
324 views

Cournot Equilibrium

I'm trying to determine reaction functions of a Cournot equilibrium for $n$ firms using the same optimal condition, using the fixed point method. This is the method I'm using: ...
0
votes
1answer
242 views

How do I numerically solve a custom function?

Whenever I use functions like FindRoot or NDSolve, it sends x through the function and deals ...
6
votes
1answer
249 views

GeneralMiniMaxApproximation - Dividing out the zero

MiniMaxApproximation is used to generate minimax approximations. I'm interested in the "dividing out the zero" trick. The documentation discusses a nice example. Suppose we want to construct a ...
1
vote
2answers
761 views

Interpolating a function of two variables

I am trying to create the interpolating function for a function of two variables, over a finite area. Just for consistency we can think of a function: ...
4
votes
3answers
2k views

Passing a function as an argument of another function [duplicate]

Possible Duplicate: Pass function or formula as function parameter I am trying to implement a simple Plot[]-like function, with the same synopsis; my first (and unique so far) try would be ...
2
votes
5answers
382 views

How to leave function unevaluated programmatically?

Is it possible to write a function in such manner, that it can be either evaluated or left unevaluated? This is a general question. Sample below is just a sample. No need to find solution for this ...
6
votes
2answers
297 views

A command for outputting a list of parameter values in a Manipulate interface

I am looking for a command that will output a list of values that correspond to the current parameter values manually set on a particular Manipulate interface. For ...
4
votes
2answers
580 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: ...
2
votes
1answer
384 views

Plugging values into functions

I am very new to Mathematica, and need to know how to plug values into existing functions. For example, Math World supplies the following code for building a truth table of ...
2
votes
1answer
272 views

About high dimensional integrals

I want to be able to do high dimensional integrals like, (..naively I wrote it as this..) ...
4
votes
3answers
370 views

Generate a Combination of letters by a number

I'm trying to write a function f. example: ...
2
votes
1answer
265 views

Creating a matrix from the output of a variable inside a for loop

I would like to enter the results of the following loop inside a matrix as its elements: ...
1
vote
2answers
146 views

How to mix Unevaluated property of function arguments with expression assignments?

This is a follow-up to my (solved) question How to distribute a generic function of two arguments (without evaluating the arguments) Say, I have a binary function ...
11
votes
1answer
308 views

Better Autocompelete for the Front-End

I wonder if it is possible to improve the front-end's autocomplete capability. Compared with some other more sophisticated editors/IDEs, such as eclipse, Mathematica's front-end does not provide a ...
9
votes
3answers
372 views

Why does Hash return different values in Version 7?

This function does not work correctly for me. The generated Gravatars do not match the ones actually produced by using the corresponding address. The problem was traced to differing output from the ...
3
votes
2answers
2k views

Plot Even Piecewise function

Is it possible in Mathematica to plot an even piecewise function like: $ f(x) = \begin{cases} 3t , 0 \le t \le \frac{\pi}{2} \\ 3t + 6 , \frac{\pi}{2} \le t \le \pi \end{cases}$ which has ...
4
votes
3answers
175 views

How to distribute a generic function of two arguments (without evaluating the arguments)

I guess there is an easy way to do this, but I can't seem to figure it out. What I would like to do is to distribute a generic (i.e. without specifying what this function really does) binary function. ...
0
votes
1answer
339 views

How to create function that classifies sample data

I want to create expression, that classifies samples ( 4 weather features -> decision). Example training data: For the values that i have data for, I can use rules: ...
4
votes
2answers
247 views

How can I use Max[] in a function that is passed a list not find the max of the list

For most functions in Mathematica, passing them a list will call the function on each element of the list. For example: ...
1
vote
2answers
84 views

Using non-Graphics primitives when exporting to .cdf

I'm trying to embed a "Manipulate" applet I've created into a webpage by embedding a .cdf. I'm running into a problem with displaying outputs from functions I've written. Here is a simpler example ...
4
votes
3answers
865 views

How to prove an expression by method of mathematical induction?

I want to prove the expression $$1^2 + 2^2 + 3^2 + \cdots + n^2 = \dfrac{n(n+1)(2n+1)}{6}$$ by method of mathematical induction with Mathematica, but I do not know how to start. How do I tell ...
3
votes
3answers
313 views

How to pull scalars out of a function that should act on lists?

Suppose I have A = a vecA B = b vecB where a and b are supposed to be arbitrary scalars ...
3
votes
3answers
195 views

How to set a function as a parameter?

In case I want to know whether a given function $f(t)$ have some property, I tried to write something like this: ...
7
votes
1answer
447 views

Demonstrating Ackermann's Function

The Ackermann function is an extremely fast growing function. There are some slightly different versions of the function, but the one that I am looking for can be defined as: $$ A_0(x)=x+1 \\ ...
29
votes
3answers
635 views

Parentheses in pure functions: # & vs. ( # &)

I've been using Mathematica for years, and over time I have developed the habit of using: Select[data, (# == 1 &)] instead of ...
4
votes
1answer
1k views

How can I save and recall my own function?

In MATLAB, I can save and recall my own function using an M-File(function or script) How can I do something similar in Mathematica? I already searched and know how to define functions and modules ...
3
votes
3answers
2k views

Map w/ multiple arguments [duplicate]

Possible Duplicate: How do I use Map for a function with two arguments? If I have a function: F[x_,y_,z_]:=x*y*z and I want to call it with several ...
3
votes
2answers
288 views

Plotting two functions with dependent input function

I have defined a function: myJ2[n_] := 1/n* Total[RandomVariate[NormalDistribution[0, 1], n]^2] This is basically an approximation to the gaussian integral. I ...
10
votes
2answers
695 views

NestList on a function of several arguments

I'd like to know if it is possible to use NestList on a regular function of several arguments, such as: ...
3
votes
1answer
2k views

Nested If statements

When I do this: Apply[(If[#2 == what, "yay", If[#2 == whoops, "nay"]]) &, {-5, what}] I get: yay But when I do this: ...
3
votes
2answers
311 views

Handling Indeterminate Forms

I'm running a sum, the elements of which are calculated by calling functions that I wrote. The only issue is, I've implemented this pretty stupid solution where I have 4 or 5 (nested!) if statements ...
4
votes
1answer
248 views

How to organize and run functions?

I am very new to Mathematica. I thought I would try it out for my first assignment in my computer science class. Until now I have only used C-base languages including C#, Java, Objective-C, and ...
8
votes
1answer
302 views

ReplaceAll[] and Limit[] don't give correct results for this expression under extreme variables [duplicate]

Possible Duplicate: Funny behaviour when plotting a polynomial of high degree and large coefficients 1/x^2 + (3 + x)/(6 (1 - Exp[x] + x)) ——This is a ...
1
vote
1answer
166 views

Computing a logarithmic function

Possibly this is a very lame question for this site. There is a function $f(n)=-\ln(a*n); \space \Bbb Z \to \Bbb R$, and I want to define $a$ for pairs of values. For example: $f_1(n_1)=15; ...
4
votes
4answers
575 views

How to define and use a linear function

I have the following equation $T = -800n + 12000$. I know that this is a linear function and that the two points $(0, 12000)$ and $(15,0)$ lie on the line. When I have 2 other values of n between 0 ...
1
vote
2answers
346 views

Piecewise function with a function as argument

I want to define a piecewise function, which has two arguments, one of which is a function of the other's piecewise argument. I am giving an example ...
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 ...
1
vote
3answers
779 views

Variables Inside Functions Not Evaluating

x = 5*y function1[y_] := x function1[5] Am I wrong in thinking that function1[5] should equal 25? Instead this comes out. ...
1
vote
1answer
152 views

Using an InputField to define a function to compose with a sequence

I am still trying to figure out Mathematica (started early August). I am trying to write a program that will accept an arbitrary function and an arbitrary sequence that can start at an arbitrary ...
5
votes
3answers
246 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 ...
17
votes
8answers
559 views

Applying And to lists of Booleans

I'd like to take {True,True,False} and {True,False,False} and apply And to get ...
13
votes
7answers
369 views

Get the first element after the first sequence of length N of consecutively increasing values

I'm looking for an efficient way of extracting the first element after the first sequence of N consecutive elements in which the values are increasing. If these are the data of a toy example: ...
8
votes
2answers
697 views

Determine whether some expression contains a given symbol

Given a symbol t and an expression expr, how can I determine whether or not the symbol t ...
1
vote
1answer
115 views

How to explain the results of the following integrals?

Why does the following program lead to different results of a21 and a211? ...
2
votes
3answers
348 views

How can `SquareWave` be used as the input in `OutputResponse`?

I'd like to compute the response of a TransferFunctionModel when driven by a SquareWave. Here's a simple example, ...
13
votes
6answers
2k views

Counting negative values in list

I would like to count the negative values of a list. My approach was Count[data, -_] which doesn't work. How can I tell Mathematica to count all numbers with ...
4
votes
2answers
291 views

Implementation of builtin function Fold

In the documentation for fold, it says Fold[f,x,list] gives the last element of FoldList[f,x,list]. But this is surely not the way it is implemented, right? ...
7
votes
1answer
283 views

RootSum result manipulation/simplification

Consider the sum sum1 = Sum[ k/( k^7 - 2 k + 3), {k, Infinity}] ...
3
votes
1answer
198 views

Evaluation of self-defined functions

I defined a function that I call disc which I want to minimize later. The function is defined as ...
-1
votes
1answer
255 views

Why is the CTRL + / not working?

I've learned how to use this shortcut to input fractions in the 2D form, it worked nice on my notebook but I can't make it on my desktop. Any tip on what could be happening?