# Tagged Questions

For questions on writing functions (pure or using Set/SetDelayed) for any purpose, including the features that may be incorporated in those functions, such as options, patterns and conditions.

55 views

### Problems with Tooltip

I an getting strange behavior with functions built using Tooltip. I create a function to display the position of data in a list ...
123 views

81 views

### Finding zero of nonlinear simultaneous equations [closed]

I'm trying to find the zero of nonlinear simultaneous equations defined in myfun1 and myfun2: ...
31 views

### Applying a function to the second element of a list [duplicate]

I'm trying to apply a simple function to the second element of a list: {#1, #2/5} &@{1, 2} But this returns an error message. ...
30 views

### Using the Function construct in a table with parameters [duplicate]

I'd like to define a table of functions like so Table[Function[{x,y},{x + k y,x - k y}] , {k,1,10}] My intention is to have the first function defined with k=1, ...
48 views

### Is there a way to make the Function construct accept a list as argument? [duplicate]

Is there a way to make the Function construct accept a list as argument ? Writing Function[{x,y},{x+y,x-y}] does not work, ...
113 views

### Obtaining a Previously Constructed Function as Desired Output

I was playing around with some Generalized Trigonometric Functions defined as follows; ...
55 views

### Importing data, then plotting ListPlot. What's the most efficient way to write a code?

It should be a boring question to ask for someone, but this is very basic need which I haven't resolved by myself. I know I can use MapThread and pure function to make it short and beautiful, but even ...
53 views

### Using the Nest function — Confusion on my output

I have the following code and output where the original function is $f(x,a) = a^2 - x^2$. ...
50 views

### Convert string to function with an argument

I am trying to build an expression by first writing it out as a string and then using ToExpression to convert it to an expression. However, I cannot figure out how to make expression recognize x as an ...
50 views

### First position of incremental series

I am still a beginner and maybe I want to do something too complicate! After 29 cycles I obtained the following events list: ...
41 views

...
77 views

### Problems using a function as an argument

I made a function: f[x_]:=x^2+1 and when i use it on, for example f[5], i get the answer 26. . But when i use it on: PollardRho[a_, f_] := Module[ {}, Return[f[a]] ] And when i write ...
244 views

### How to create a version of FixedPointList for asymptotically periodic functions?

I need to efficiently generate a bunch of bifurcation diagrams. A simple familiar example illustrates the efficiency problems I'm running into: ...
49 views

### NonLinearModelFit to a Function [closed]

I have a multiple dimension function that is fairly complicated. Instead of simply using Series to get a taylor series of the function, I would rather specify my ...
78 views

### Pattern for a function of say 2 variables [closed]

How can I specify a pattern for an expression f for which say f[x,y] returns a value, ie is defined as a function taking two ...
175 views

### How can I implement a moving standard deviation for a time series?

I imported the following dataset and converted it into a time series. ...
46 views

### Call user defined function from many notebooks [duplicate]

I wanted to ask a simple question. I am new to Mathematica, and I don`t find a way to call user defined functions just as I call Mathematica functions. I want to use my own defined functions, but ...
85 views

### Double arguments and place of the underscore

Could someone explain me of this bit of code below is correct: Is it possible to define a function with a second bracket, see below, i.e. f[x_][y_]? And what does ...
257 views

### Handling options in my function [duplicate]

It seems this should be easy, by I just can not figure out how. I'm making many very similar style plots, so I want to make a function with all the default options specified. Sometimes I need to tweak ...
153 views

### How to define a complicated function inside the body of Compile?

I want to compile a function in a way to keep its memory footprint down. In the example below, I am trying to compile a function f that makes three calls to ...
85 views

### What's the easiest way to remove overall factors from polynomials?

I have code that outputs polynomials (in #1) such as the ones below (note that the trailing Function character ...
279 views

### Combinations of multiple matching patterns

I wonder if there is any nice way to combine DownValues (or any other suitable rule-/pattern-/function -based Mathematica construct) when multiple patterns match an expression. Let me explain what I ...
148 views

### Maximizing a recursive functional equation

I would like to maximize a recursive functional equation but I am struggling with setting up the problem correctly. The equation I am interested in captures the nature of a decision process over time ...
51 views

### Simple grouping equations [closed]

I'm new in the Mathematica world. A very basic question. I have been using the command Eliminate on a set of equations as follow: ...
137 views

### Are these two functions equivalent?

I checked several cases and saw that two functions are equivalent in these samples. However, are the two equivalent in all cases? Is there a way to check that? Explicit function: ...
90 views

### Evaluating While Loops inside Modules [duplicate]

I am trying to compute some objects inside while loops within modules, but I keep getting the following error: ...
52 views

### Construct all possible sets of pairs [duplicate]

I am looking for a nice way of constructing all possible pairings of a given list. Currently I am using the brute force approach of sieving the 2-partitions of all permutations. ...
124 views

### The basic primitive recursive functions

How can the basic primitive recursive functions be expressed in the Wolfram Language? Apparently here's an example for primitive recursion: ...
48 views

### How to define InterpolatingFunction on a variable set of points?

I would like to define an InterpolatingFunction to which data points are transferred as a parameter, e.g.: ...
57 views

### Is it possible to match a sequence with multiple heads without using Condition

Suppose I have: expr = Times[2, a[x,r], a[y,1], c[z,0,0], d[w,m]]; If I want to match a sequence of expressions with the same head ...
162 views

### Subset-type function construction

This is probably a very straightforward thing I am missing, and probably also a duplicate(!), but I can't for the life of me think how to do this cleaner. I want to achieve what ...
92 views

### Pertubation series of given equations

I would like to define a function that does the following. If I have an equation, for example: $$f(x)+[1-f^2(x)]+f^{\prime\prime}(x)+f(x)\ f^\prime(x)=0$$ and I am given a value for $f$ to expand ...
77 views

### How to change the built-in function? [duplicate]

As you can see,the original Differences will get {} when your parameter is a list with one element just. Differences /@ {{1, 2, ...
108 views

### Finding the smallest starting number producing a Collatz sequence of length 125 which ends with a value > 4

I'm supposed to do a Mathematica function that selects the smallest number not less or equal to 4 after 125 iterations. I am not good at coding, so some help/advice would be awesome. My code so far. ...
51 views

### How to add Optional Sequence

Note: This question could be duplicate but I couldn't find any so far. It is know that Optional (:) can be use to represent expression if omitted. ...
52 views

### Cumulative function definition and plotting [closed]

I'm quite new to Mathematica. I have an issue defining cumulatively a function. Let's say I have a waveform f[t] , and I want to create a function with many copies ...
63 views

### Should I define a function or not?

I was trying to execute the following code: ...
103 views

### Gradient of interpolated 3D data in mathematica 9

tt = Flatten[Table[{x, y, z, btot[x, y, z]}, {x, -1, 1, 0.1}, {y, -1, 1,0.1}, {z, -1, 1, 0.1}], 2]; ff = Interpolation[tt] Till here it is working fine as it is ...
I am finding myself having to code functions like this: \text{answer} = \sum_{k_0 = 0}^{\color{Blue}n_0} \sum_{k_1=0}^{\color{Blue}n_1}\cdots\sum_{k_{N-1}=0}^{\color{Blue}n_{N-1}} \frac{P_{k_0,k_1,\...