Skip to main content

All Questions

1 vote
1 answer
81 views

Can not get OptionValue with SetDelayed variable

ClearAll[foo1]; foo1[OptionsPattern[]] := Hold[OptionValue[""]][[1, 1]] foo1[] gives function name foo1 But ...
matheorem's user avatar
  • 17.7k
1 vote
0 answers
79 views

DeleteCases/ReplaceAll and PatternSequence [closed]

I thought it must be ...
imida k's user avatar
  • 4,405
3 votes
1 answer
253 views

Test whether an expression contains a particular pattern

How to test whether an expression contains a particular pattern ? I made a function for myself that tests whether an expression contains Plus or not. ...
imida k's user avatar
  • 4,405
10 votes
3 answers
894 views

What is the best method to search pattern for 2D list?

What is the best method to search patterns for 2D list ? Let L be following 2D-list : ...
imida k's user avatar
  • 4,405
4 votes
1 answer
104 views

Replacement, PatternTest, Module related Question

Let's see how MMA handles following type of expression : Replace[L, {pattTest1->rhs1, pattTest2->rhs2, pattTest3->rhs3}, {1}] Specific example : ...
imida k's user avatar
  • 4,405
1 vote
1 answer
116 views

How to make a vector of elements the pattern of a function?

if I have an expression that contains a lot of symbolic elements and I would want to make it a function of the vector containing all the elements I've found a solution based on rule delayed: ...
PeaceEverybody's user avatar
1 vote
0 answers
262 views

How to make a function ignore an argument [closed]

Motivation I am trying to call a function f, that has either 1 or 2 (or multiple) parameters, from a function g that uses ...
IntroductionToProbability's user avatar
2 votes
1 answer
131 views

Why does this DeleteCases not work? [duplicate]

I believe this is simple but I couldn't figure out why this doesn't work. Everything looks good to me. ...
emnha's user avatar
  • 2,111
2 votes
2 answers
87 views

Construct a function like Coefficient

I'am trying to construct a function that will work like Coefficient as an exercise. ...
Mateus's user avatar
  • 1,293
3 votes
1 answer
184 views

Apply functions to a BlankNullSequence

I'd need to apply all functions in a list to a BlankNullSequence (___) But when I tried ...
Giancarlo's user avatar
  • 712
7 votes
2 answers
2k views

Skew-symmetric function

I have a simple question: 1) I defined a skew symmetric function this way M[i_,j_]/;i>j:=-M[j,i]; M[i_,i_]:=0; this is of course the most general skew ...
MaPo's user avatar
  • 899
4 votes
1 answer
446 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: ...
user76284's user avatar
  • 341
21 votes
1 answer
487 views

What is the difference between defining a function and specifying the type of argument, versus applying a test to that argument?

Say I want to create a function that evaluates differently based on what type of argument is given. I've found two ways of doing this, ...
Jason B.'s user avatar
  • 71.2k
6 votes
1 answer
161 views

Is there an elegant way of delaying evaluation of `A==B` when calling a function that uses this pattern

Suppose I wanted to define a number of functions that accepts expressions of the form: ...
AlexanderF's user avatar
5 votes
1 answer
211 views

Downvalues vs. Scoping for Functions

Regarding my recent question on using a default value for a function argument when a pattern was not met yielded some interesting answers, but the general consensus was "Yes this can be done, but ...
kale's user avatar
  • 11k

15 30 50 per page