Linked Questions

7
votes
3answers
1k views

Functions with both optional arguments and options [duplicate]

I have the following codes: ...
4
votes
2answers
96 views

How to prevent an Optional parameter from taking an OptionsPattern parameter without multiple function definitions? [duplicate]

I have function the needs to enable some Optional parameters and an OptionsPattern. The issue I am facing is that the options ...
2
votes
1answer
77 views

Issue using optional argument before options [duplicate]

I have a problem using optional arguments before an OptionsPattern: ...
549
votes
19answers
139k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
76
votes
4answers
5k views

Using a PatternTest versus a Condition for pattern matching

My last question to the site resulted in several answers that involve using pattern matching in Mathematica, a feature I wasn't very familiar with at the time. I am currently reading Mathematica ...
39
votes
4answers
4k views

Can a function be made to accept a variable amount of inputs?

I have a function that takes two inputs and processes them for a single output. What I need is one that can take a varying number of inputs. and process them to a single output. Is this possible in ...
29
votes
1answer
670 views

Why doesn't PatternTest work with Composition?

While playing around with the solutions to this question, I've found some very strange behaviour: ...
12
votes
4answers
347 views

Is it possible to separately call the default value of a variable which isn't at the end of the sequence?

After reading this post I recalled an old question I once met. We know that we can set default values for variables of a function: ...
8
votes
2answers
290 views

Weird behavior of conditions when using OptionsPattern and OptionValue

I'm trying to define a function that is evaluated differently depending on its options. This code ...
8
votes
1answer
695 views

define a function with optional arguments

I have defined a function as follows: ...
7
votes
2answers
1k views

How to translate and scale an image via ImageTransformation

Is there a way to translate and scale a 2D image simply by using ImageTransformation[] and TransformationFunction[]? I know how ...
8
votes
1answer
255 views

Attributes with Pattern test

Probably this question has no application but it helps understand basic issues about Attributes and functions. I was writing a piece of code where I accidently ...
7
votes
1answer
242 views

How can a function know in which function it was evaluated?

Hello my second question here might be very hard. I am asking for something "magical", if i define a function g and i call it inside a function f, how can g have information about the outer function ...
11
votes
1answer
246 views

Practice notebook for Pure Functions & Rules-Patterns

Are there practice notebooks or exercises for practising using pure functions and rule-patterns? I've completed "An Elementary Introduction to the Wolfram Language" and "Fast Introduction for ...
9
votes
1answer
106 views

Except @ OptionsPattern[] affects OptionValue

The background This example works as expected, small function with a special case rule: ...

15 30 50 per page