Skip to main content
10 votes
Accepted

Are there any better methods to solve this problem?

Function ForAll and Resolve help. ...
Jie Zhu's user avatar
  • 2,185
9 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

Use Inner Inner[Power, var, #, Times] & /@ expo (* {x[1],x[2],x[3] x[4],x[2] x[5]} *)
A. Kato's user avatar
  • 2,550
7 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

This feels like I was just following the directions in the OP: Times @@ (var^#) & /@ expo
Michael E2's user avatar
  • 241k
6 votes
Accepted

How to find the x-coordinate of the point circled(non-differentiable points) in this trigonometric function graph?

FunctionSingularities. ...
cvgmt's user avatar
  • 79.4k
5 votes

Transform a list of rules into a list of function definitions

rules = {f[x] -> a + 3 h[x], g[x] -> 2 a + c + 6 h[x]} ...
Craig Carter's user avatar
  • 4,675
5 votes

How to find the x-coordinate of the point circled(non-differentiable points) in this trigonometric function graph?

These are discontinuities caused by Abs[Sin[w x]]. ...
azerbajdzan's user avatar
  • 20.9k
5 votes
Accepted

Can this code be simplified further?

This is personal style. I never like long chained commands. I like to make variables and small functions. It makes it easier for me to read my own code one week after I write it. So I would write your ...
Nasser's user avatar
  • 149k
5 votes

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

If you like the GroupBy functionality, there are functions that work on associations "transparently". If you know how many "largest" counts you ...
lericr's user avatar
  • 31.7k
5 votes
Accepted

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

Maybe not exactly what you're asking for, but related. Your data is basically a weighted data structure, and Commonest will work on that kind of data. ...
lericr's user avatar
  • 31.7k
4 votes

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

The GroupBy function has a form that can apply Total to get your result. We group using the first element of ...
creidhne's user avatar
  • 5,370
4 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

Here is another Inner strategy: Inner[OperatorApplied[Power], expo, var, Times]
lericr's user avatar
  • 31.7k
4 votes

How to define a function for Schmitt trigger?

The Schmitt trigger is not a function because it has memory, but it is a respectable object in the sense of Object Oriented Programming. Of course, in this new context some difficulties appear : When ...
andre314's user avatar
  • 18.9k
4 votes
Accepted

How to define a function for Schmitt trigger?

Obviously, we need a function with memory. For this we may use a module with a localized variable: ...
Daniel Huber's user avatar
  • 54.6k
3 votes

Transform a list of rules into a list of function definitions

To achieve this, we need to manipulate the "DownValues" of the function names. We use "Scan" to operate on all elements of the rule list. As "DownValues" has the ...
Daniel Huber's user avatar
  • 54.6k
3 votes

Is there a technical name for functions that end in Q?

I used to think of them as question functions, but like @David, I've called them query functions for a while, having picked this up long ago from other Mathematica users. Unfortunately, we now have <...
Michael E2's user avatar
  • 241k
3 votes

Is there a technical name for functions that end in Q?

I call these "predicate functions" because they always return either True or False
Jason B.'s user avatar
  • 69.6k
3 votes

Series does not deal with the branch cut for the power function correctly [bug]

This appears to have been fixed in v13.2 ...
Bob Hanlon's user avatar
  • 161k
2 votes

How to optimize performance with DeleteDuplicates?

I build upon A. Kato's idea to use a normalization: First turn each element into a unique representative of the equivalence class. Then run vanilla DeleteDuplicates....
Henrik Schumacher's user avatar
2 votes

How to optimize performance with DeleteDuplicates?

This answer is for the case where the order does matter. While OP's question asks for case where the order does not matter at any level. First of all rules can be ...
azerbajdzan's user avatar
  • 20.9k
2 votes

How can I simplify this out put?

Resolve[ForAll[x,x>-d/c,f'[x]>0],Reals] (c!=0&&b c-a d<0)||(d!=0&&b c-a d<0)
chyanog's user avatar
  • 15.7k
2 votes

How to form a discrete function using table data

Try ...
Bill's user avatar
  • 12.3k
2 votes

Transform a list of rules into a list of function definitions

If the left-hand sides of each rule depend on the same variable, @Craig Carter's solution is sufficient, but if not, we can generalize this process using ReplaceAll ...
E. Chan-López's user avatar
2 votes

How to raise a vector to powers contained in a vector, change the list into a product, and do this for all the lines of a matrix, efficiently?

expo . Log@var // Exp (* {x[1],x[2],x[3] x[4],x[2] x[5]} *)
Karl's user avatar
  • 958
2 votes
Accepted

Making a video of dynamic output

Initialize an empty list of frames: frames = {}; Then add a new frame after each iteration: ...
Domen's user avatar
  • 30.5k
2 votes
Accepted

How do #1 and #2 work in a function defined by 2 variables?

#1 is a placeholder for the first functionargument, # 2 for the second. For example function=#1 #2^2& defines a function for two arguments ...
Ulrich Neumann's user avatar
2 votes

Issue with variable within Sum[] bounds

There is a closed-form solution for $n=1, 2, 3, 4, 5$. I've had no luck in finding a general solution. ...
JimB's user avatar
  • 42.3k
1 vote
Accepted

How to put prime before value during a substitution?

One approach to get your desired result, of course, is to just put the time dependence explicitly, ...
evanb's user avatar
  • 6,311
1 vote

How to form a discrete function using table data

Here is a version using Ordering : ...
Ulrich Neumann's user avatar
1 vote

Can this code be simplified further?

If you don't like MapThread, you can make the pure function Listable and apply it directly to the two lists: ...
att's user avatar
  • 296
1 vote
Accepted

Finding the position of a list element using functions like Max on lists that might contain 'Indeterminate' values

Here is an approach. Not sure if it integrates well with your workflow. There might be better ways to do this in your context, but just based on what you've shown, something along these lines might ...
lericr's user avatar
  • 31.7k

Only top scored, non community-wiki answers of a minimum length are eligible