# All Questions

29 questions
Filter by
Sorted by
Tagged with
36 views

### Construction of symmetric function / matching function argument patterns

[Edited for clarification after comment] Suppose that the function f is defined as the linear combination of several translated/reflected functions starting from the primitive f0[x,y,z] ...
31 views

### Applying pure function to rotate the label in a BoxWhiskerChart

Data is available from here https://www.ocr.org.uk/Images/400305-large-data-set-lds_1-h630-2018-h640-2018-2019-pre-release-data-mei.xlsx ...
233 views

### Outputting expressions in the order in which they're entered

Background For display purposes, I sometimes find it desirable to defeat Mathematica's canonical ordering of variables, and instead have it output terms in the order in which I type them. E.g., ...
182 views

### Pure function as a variable of another function

In a notebook, I have a function that basically needs to do something like calling a pure function within a function. I would say that what best describes would be an example like: ...
81 views

### Reproducing Nest-function with recursive nesting does not work

In general, when I am learning a new programming language, it helps me to understand how builtin functions works. I am trying to reproduce the builtin Nest[f,exp,n] ...
47 views

### Mapping over array/matrix the efficient(compact) way

Update In short, I have myCAans[[1 ;; 5]] like this: {{0, 0, 0, True, 0, 0, 0, 0, True, 0, "T0", 39}, {0, 0, 0, True, 0, 0, 0, 1, True, 1, "B", 101500}, {...
648 views

### Writing lambda expressions in terms of pure functions

I am trying to create some functions that I want to comfortably compose together using the pure functions. The functions were originally written in $\lambda$-expressions so I would like to keep the ...
461 views

### Combining pure functions

Is there an easy way to combine pure functions into a single pure function? For example, say I have f = #1^2 &; g = #1 - 2 &; and I want to define a new ...
542 views

### Creating a pure function that does operations with pure functions

Suppose I have two functions defined as follows: a = #+3& b = #^2 + 3& So when I call a[2] and ...
530 views

### Using predefined expressions as free variables in a pure function [duplicate]

I want to have a function value of an expression where some variables are solutions to some set of equations, with some values of parameters. I had an idea to use pure functions for that. However, ...
37 views

### How to use OptionValue inside a pure function [duplicate]

I want to define a function with OptionsPattern as argument which returns a pure function using OptionValue: ...
160 views

### Select with test function that depends on # [duplicate]

I'm trying to teach myself to use pure functions and slots as much as possible. Here is my problem. I have a list: ...
474 views

### How can I create currying functions using pure function syntax?

For example how can I write In: pureFunctionSyntax[myF] /@ {7, 3} Out: {myF[7, Log[7]], myF[3, Log[3]]}
173 views

### Working with functionals [closed]

I am trying to work with functionals in Mathematica, this means that I want to define a function of a function. I defined my function of a function as: ...
242 views

### Substitute a function's definition for its name

I'm having trouble with a function which is supposed to work on another function. Simplified version: ...
633 views

### How to write an operator that acts on pure function (to give another pure function)

I would like to write an operator oper that acts on a pure function f with an undetermined number of arguments, with the syntax <...
102 views

### How to Fold (FoldList) this in a more compact (efficient) way?

Example code: x = Table[something[i], {i, 5}] Table[Fold[f1[#1, f2[#2, a], a] &, x[[i]], {c1, c2, c3}], {i, Length[x]}] This above is just an example. I ...
961 views

### Why is either Listable or HoldFirst not working?

Starting with a fresh kernel, I evaluate the following: ...
377 views

### Requiring NumericQ in Pure Function

Potential duplicate, but doesn't seem to solve my problem: Using patterns in pure functions I have a function that returns an InterpolatingFunction, and it works ...
133 views

### Define a function that returns a function with a variable number of arguments

Previously, I've defined a function with a variable number of arguments with the following method. ...
141 views

### How to input pure function to package?

I would like to input a pure function into a custom written package, but am running into a variety of errors. The package I have created is as follows: ...
88 views

### Need to run evaluation 2 times

Why does this only work after running the evaluation 2 times? ...
141 views

### How to make InverseFunction work on function defined with restriction on arguments

This example works to define InverseFunction on the first argument of a function ...
2k views

### Is there any way to define pure functions with optional arguments?

For example consider the following function: Function[{u,v},u^2+v^4] Is there anyway to define default values for the variables ...
649 views

### How to define a pure function with a Module?

I was not able to use a self defined (using Module and For loops) piecewise function to fit data. It seems that the problem is that I have to define a pure function. I would like to learn how to ...
2k views

### Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs

Using global variables the following turns an "expression" into a Function: expr = 2 x; Function[x, Evaluate[expr]] Of course ...
3k views

### Second level depth pure function?

I have the following working construction: Select[ln125, # == Nearest[ln125, 551.748][[1]] &] Here, ln125 is a one ...
Pure functions may be handy if you don't want to assign your function a name. For example I would calculate $x(x-1)$ for some numbers $x$ by ...