Computer algebra system and term-rewriting functional programming language from Wolfram Research. Not to be confused with "mathematics". New dedicated Mathematica SE site: http://mathematica.stackexchange.com/

learn more… | top users | synonyms

2
votes
5answers
206 views

Performance: Divide group of numbers into two groups of which the sums are equal

I have a piece of code that divides a group of numbers into two groups of numbers of which the sums are equal. I created this because of a StackOverflow question: ...
0
votes
1answer
63 views

Math Calculus in ruby

I have several calculus to do in my ruby app. My code is currently working but I find it very ugly. @guestreviews = GuestReview.where(:reviewed_id => @user.id) @hostreviews = ...
2
votes
1answer
412 views

Fill upper triangular matrix from a list

I am looking a good way to fill up the elements of a lower triangular matrix from a list, in Mathematica. Currently I have the very ugly PadRight[#, s] & /@ Prepend[Take[elems, # + {1, 0}] ...
2
votes
0answers
115 views

nested if conditional in Mathematica

Do you know If and how can I rewrite the code below in a better form for different values of m,k,l? It is a nested if contitional construct that I want to to check b for all m,k,l, but the code below ...
1
vote
1answer
313 views

Fastest way to find all neighbours of a vertex in a graph

I'm looking for the fastest way to find all neighbours of a vertex in an undirected Graph. Please improve on the code if possible. neighbours[g_Graph, v_] := Module[ {vl = VertexList[g], pos}, ...
5
votes
1answer
293 views

Directed graph similarity calculation — optimizing Mathematica code

I am looking to optimize the following computation. First, some explanations: Explanation I have a directed graph whose adjacency matrix may only contain 1s and 0s. The similarity of nodes i and j ...
1
vote
1answer
162 views

List of integer factorization into n terms

I want the fastest way in Mathematica 7 to generate a list of the factors (not prime factors) of an integer into a specified number of terms, with each factor greater than one. For example, 240 into ...
4
votes
3answers
307 views

Simplier/shorter implementation of lists' intersection keeping elements' order

I could use function Intersection, but it returns sorted list. That's why I have to do my own, but it looks too big. I hope it could be done shorter. lists = {{1, 2, 3, 4, 5}, {1, 2, 3, 4}, {2, 3, 4, ...