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

learn more… | top users | synonyms

2
votes
1answer
20 views

TabView Alignment problem for content larger than a view area

When content is larger than ImageSize of TabView then the top edge is cut off even with ...
8
votes
1answer
264 views

Is everything in Mathematica ultimately stored as a rule?

My current understanding about Mathematica is that everything, at the lowest level, ends up as replacement rules. First question: is this true? Second question: does Mathematica "gloss over" these ...
6
votes
3answers
192 views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...
2
votes
2answers
125 views

Plotting difference between a function and its inverse function

I would like to plot the difference a function and its inverse function. (1/27)*(x^4-6x^3+12x^2+19x) (* where 0<x<5 *) I tried the following: ...
82
votes
8answers
7k views

List of compilable functions

Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found? I'd be glad ...
1
vote
1answer
30 views

Function taking arbitrary number of arguments

I have a very similar function to that which a solution was provided by kguler, but am unsure as to how to adapt the solution that was given there. That post can be seen here. The adaptation is only ...
3
votes
1answer
89 views

Listable on first level [duplicate]

I have some function which take List as input. f[l_List]:=someActions[l] I need apply this function to a list of lists. Now I ...
0
votes
3answers
84 views

How to define a function

How can I define a function which depends on a function of x? Something like this f[u[x]_,u[x]']= u[x]' + a [x] u[x] +b[x] I think I wasn't enaugh clear. If I ...
1
vote
1answer
78 views

How to find and verify relationships between functions?

MMa gave me a complicated result involving Hypergeometric0F1's. It was much less complicated after I discovered this identity: ...
0
votes
1answer
33 views

Calling a function on a variable with parameters [duplicate]

I have an equation that contains parameters. I want to use it in a function like NDSolve, but I can't seem to figure out how to do so. Here's an example: I define ...
1
vote
0answers
76 views

Incorrect output from InverseFourierTransform

Bug introduced in 8.0.4 or earlier and fixed in 9.0.1 or earlier I am trying to compute the inverse Fourier transform of this expression ...
0
votes
1answer
41 views

Permanently fixing a variable in the function

I need to define a function let's say f[x_, y_] := x^2 + y^2 such that I need to fix one variable (let's take y = a) and to ...
0
votes
2answers
51 views

Supply a function as an argument to another, and find its minimum

I would like to minimize a function, which is supplied as an argument to another function, and report back the estimates of the values of the variables that result in its minimum. In specific, I would ...
6
votes
1answer
153 views

Prevent Export from overwriting files

Export["filepath1",Expression1] works for me, but if filepath1 already exists, it will be overwritten. I'd like ...
18
votes
3answers
716 views

Can someone explain this snippet: (#[#] &)[#[#][#] &]

A friend showed me this snippet of code today: (#[#] &)[#[#][#] &] I can sort of see that we're constructing an anonymous function that takes a function ...
0
votes
0answers
18 views

handling the logistics function [closed]

I have the problem, I have to handle the logistics function at two points. That is my initial and final cordenas cordenas. But do not know how to apply that formula. As would be the formula for this ...
1
vote
1answer
129 views

General function taking general number of arguments

The following is an edit of this post, for which a working solution was provided by John McGee. I have a different function and am not sure how to adapt the solution for it: I want to construct a ...
6
votes
1answer
176 views

How trustworthy is NMaximize?

Suppose I solve a constrained optimisation problem using NMaximize. How confident can I be of the accuracy of the result? For concreteness, suppose that F,G are ...
0
votes
2answers
58 views

Function that creates a table from two lists

I have two lists shown below: list1 = {(0,0,0,0),(0,0,0,1),(0,0,1,0),...,(1,1,1,1)} list2 = {1,5,5,5,...,5} How can I construct a function that outputs a table similar to this: $$\begin{array}{c|c} ...
0
votes
1answer
89 views

Help with functions in Mathematica

Still learning how to do things in Mathematica. I want to make a function that has many parts. Doing this in something such as Java, which I am familiar with, would be simple. In Mathematica I have ...
-1
votes
1answer
170 views

Find minimum function value in data and give coordinates of minimum

I create with Table an array containing the function value of some function and the n1and ...
0
votes
1answer
54 views

Defining Solutions to FindRoot a functions of parameters-Part II

Here's a similar question as the the preceding question with the same title, but this time with vectors, which I need to use. I followed the suggestion in the answer the the previous question, but it ...
0
votes
2answers
47 views

Fitting data in form $f = f_0 + c A^x$

The Fit[] function in Mathematica can fit data in form of $f = f_0+c_1x+c_2x^2+...$ ($f_0$ and $c_i$ are unknown constants), is there a function can fit date in ...
5
votes
2answers
142 views

What does IndexBy do and how exactly does it work?

I just saw the function IndexBy in the autocomplete suggestions and I was curious to know exactly how it works. Unfortunately, there's no trace of it in the ...
0
votes
2answers
73 views

Is there a function that filter positive values x = f(x), and return zero for all negative values? [closed]

I'm searching for f that will comply this definition : x = f(x) where x is natural >= 0 0 = f(x) where x is natural < 0
0
votes
1answer
70 views

How to create a line due to requiriements?

Considering we have three lines, and know the intersection points (How to find intersection points of lines?) How can I draw a line that will cross the intersection point of the two lines and will be ...
1
vote
3answers
313 views

How to find intersection points of lines?

Considering I have three functions f1 = -x + 1; f2 = x - 1; f3 = x + 3; How can I find the intersection points of this functions? Thanks. This didn't work ...
0
votes
0answers
63 views

What is the product of 1+1/p^2 over all primes p? [duplicate]

Can Mathematica Sum or Multiply over the set of all primes? I can get an estimate of my question in the title with: ...
4
votes
3answers
212 views

Problem about an ant walking up a hill

An ant is walking up a hill given by $f(x)$. At what point can it see a blade of grass. I've been working on this problem with Mathematica and by hand. Help with either would be fantastic. The ...
0
votes
1answer
75 views

How to fill a Marshal buffer with whitespace using NETLink

Further to Todd Gayley's answer on string handling in a DLL function, I have the following code: ...
3
votes
0answers
65 views

Using an external Pattern breaks Format

I noted while writing this answer that using an external Pattern on Format doesn't work: ...
1
vote
1answer
47 views

Using Inner to calculate a log likelihood

I am trying to use the function Inner to calculate the sum of log likelihoods of a custom probability distribution 'custom' applied to a vector of data 'vData'. The custom distribution changes ...
20
votes
3answers
740 views

DeleteDuplicatesBy is not performing as I'd hoped. Am I missing something?

Déjà vu: a new-in-v10 function should provide a better solution to an old problem, but my enthusiasm is curbed when I run timings. This time the function is ...
21
votes
1answer
373 views

Why does list assignment with a packed array result in unpacked values?

This is another question on the design choices in Mathematica. I understand that without direct reply from the developers it may not be possible to give a definitive and exhaustive answer to "why" ...
1
vote
1answer
114 views

Manipulate - Evaluating Value of Function

I would like to visualize the properties of a threshold, which is a value of a function. Unfortunately, the value is expressed as scientific value (an approximation with 3-5 decimals would be fine) ...
-2
votes
2answers
78 views

Plotting self-made functions [closed]

EDITED AS SUGGESTED I have defined a function, which takes two values and returns a function n(x), like so ...
5
votes
2answers
119 views

Using MovingMap to calculate percentage changes

MovingMap (new in version 10) applies a function to discrete data over a moving window. This is very convenient for calculating the percentage change of a series. ...
0
votes
1answer
39 views

Summation of functions

I want to define a function that is a sum of other functions. For this, I define functions of the form ...
2
votes
1answer
80 views

Dirichlet convolution of two lists [closed]

The Dirichlet convolution of two arithmetic functions f,g is defined by $f*g(n) = Sum_{d|n} f(d)*g(n/d)$ How can I get the Dirichlet convolution of two lists? For example: Input: ...
0
votes
1answer
40 views

How to set a shared variable Power (a modified one)?

Unprotect[Power]; Power[0|0., 0|0.] = 1 ; Protect[Power]; Table[0^0, {i, 5}] No problem at all. ParallelTable[0^0, {i, 5}] ...
0
votes
0answers
44 views

subtlety of self-defined function and its evaluation [duplicate]

I wrote a simple code as follows f[x_,y_]:=NIntegrate[x+z,{z,0,1}]; g[x_,y_]:=NIntegrate[y+z,{z,0,1}]; VectorPlot[{f[x,y],g[x,y]},{x,0,1},{y,0,1}] then ...
0
votes
1answer
54 views

Mathematica function to generate a different 4 digit number [closed]

I m looking for a function that permit me to generate a different 4 digit number (>0) each time (to 4^10 possibilities) corresponding to a parameter that will never be the same (like current ...
15
votes
7answers
575 views

Enumerating tuples from a larger space such that all pairs of values are present at least once

I am trying to write a function that will accept a list of N lists and returns a list of N-tuples that represent all pairs of values from the original N lists at least once. To illustrate with an ...
3
votes
2answers
96 views

How to define a list of symbols as a list of functions?

I have a list in Mathematica for example P={1+t,1+t+t^2,1+t+t^3}; My question is, how I can define each element of this list be a function of ...
1
vote
1answer
32 views

Cannot use Part in Pure Function [duplicate]

I need to select some lists in the nested list of form of {{1,2,3},{2,3,4}}. I have used Select to complete my work. But when I tried Position, it doesn't work. For example, ...
1
vote
1answer
48 views

Mathematica defines a function as list

This might be a very silly question but i'm defining a function as: \[Chi][AR_] := ((AR^(2) - 1)/(AR^(2) + 1)); which is clearly a scalar function of AR; however ...
3
votes
1answer
87 views

Creating an autokey cipher function

Can someone help me with putting what I can say in words into code. I want to create autokey encrypt and decrypt functions (just wanting help encrypting and then can figure out decrypting). Everything ...
2
votes
0answers
62 views

Is there a documentation generator for Mathematica?

I'm looking for a way to document the functions of my packages inline, preferably inside comments. There should be a Doxygen type tool for this that takes comments and that generates html from markup ...
5
votes
4answers
172 views

Sort two lists at the same time, based on another

I am new to using Mathematica and I can not find a solution to what I am wanting to do. I want to take a list such as: x = {1,2,3,4,5,6,7,8} and a second list ...
1
vote
1answer
57 views

Creating the Nabla operator as a operator

How can I define the nabla-operator as a an operator, acting on everything to the right of the operator! Also taking \[Del]^2 would give the second derivivates. I wish to be able to write ...