Skip to main content

All Questions

1 vote
1 answer
104 views

Attribute based pre-processing of arguments

I work with hashes that can be related to various data structures. I find it convenient to have my functions work either when a hash argument is provided or when the required data structure is ...
Kvothe's user avatar
  • 4,881
3 votes
3 answers
230 views

Function to find the most common numeric ordered pairings (value, count)

Let us say that I have a list of numeric ordered pairs where the first number represents a value to be counted and the second number represents the count of that value. The following is one way to ...
anonmous's user avatar
  • 195
3 votes
1 answer
78 views

Function with complicated argument constraint with default value

I need to define a function, say f with an argument which is integer, positive and with a default value say 2. I tried: ...
Giovanni Russo's user avatar
5 votes
3 answers
698 views

Reversing the order of function arguments by a replacement rule

I am facing an issue when I try to reverse the arguments of a function in a replacement rule. Let me give an example : ...
Adrien Martina's user avatar
3 votes
1 answer
81 views

Troubles with BlankNullSequence in the case of multiplication

I have some trouble to use the triple underscore notation to use definitions with or without a term. Consider the following toy example f[a___ x]:=1 {f[x],f[2x]} ...
Adrien Martina's user avatar
2 votes
3 answers
186 views

Simplifying 'symbol-linear combinations' of nested monomials

I'm working with a custom binary 'operation' $F$ which takes $x, y$ and produces $F[x, y]$, where the possible arguments are already given by some list $\{ \text{one}, a, b, c, d, x, y, e, f\}$ where $...
VertexVexed's user avatar
3 votes
1 answer
169 views

Pattern matching vs. condition in a function

I'm trying to learn stuff from pattern matching but I found sometimes pattern matching does not work as I expected. Could anyone explain why the below outputs are not same? Thank you. And could anyone ...
Josh's user avatar
  • 31
2 votes
1 answer
65 views

Is it possible to ask Mathematica to give/find this largest (absolute value) argument of $\cosh$ in the expression?

I have the expression exp in terms of Cosh functions: ...
MsMath's user avatar
  • 195
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
1 vote
1 answer
155 views

how to understand f[{1,2,3,4}]? [closed]

As far as my understanding of function in Mathematica, its core is pattern match, but why f[{a,b,c}] (when f is defined) can work correctly? in my understanding, <...
Aerterliusi's user avatar
2 votes
1 answer
318 views

Can you use superscripts as variable and function names?

I want to express the following function: $z^{(1)}=w^{(1)}a^{(0)}+b^{(1)}$ I have read in Mathematica documentation that Symbolize can be used to define variables ...
M.E.'s user avatar
  • 333
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

15 30 50 per page
1
2 3 4 5