Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [sow-reap]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
3answers
1k views

How to Sow[] until I've Reap[]'d enough?

I have a process that returns an unpredictable number of data points, and I'd like to run it repeatedly until I have a certain number of points. My actual code is too complicated to use an ...
1
vote
2answers
95 views

How to assign output of `Last@Reap` to a variable? [closed]

I would like to define a variable that equals the solution of a numerical equation. Usually something like smax=zmax/.FindRoot[Exp[-zmax/2]==2,{zmax,0}] would work. ...
0
votes
1answer
65 views

I need an alternative to AppendTo using Reap and Sow

c = Table[RandomVariate[BernoulliDistribution[1/2], 3], 3] d = Total[c, {2}] list = {}; For[k = 0, k <= Length[d], k++, If[d[[k]] == 2, AppendTo[list, c[[k]]]]] ...
1
vote
1answer
81 views

Reap and sow for BreadthFirstSearch

The following Code highlights the breadth-first scan tree ...
2
votes
2answers
85 views

How to control which list Sow puts elements in

I'm trying to Reap/Sow elements of a list into separate sub-lists. In this toy example, I want evens in one list, odds in the other. But whichever sub-list d[[1]] happened to belong in, that sub-...
4
votes
2answers
101 views

Reap and Sow Tags. How to retrieve part of list belonging to specific tag? [closed]

I'm trying to improve my code's performance by using reap and sow instead of appendto and it works, but I hit a small obstacle. Since my code is building two lists simultaneously, I need to use sow ...
6
votes
1answer
555 views

How to use Reap and Sow instead of Append to

I have matrix and and i want to do increment in a do loop and and i want to store in list using append to. It works fine for less values, But when i want to do it for values around 1 million the ...
17
votes
1answer
917 views

Understanding Sow and Reap documentation

Both in Sow and in Reap documentation there is the example: ...
1
vote
1answer
112 views

WhenEvent, Storing Sow data, Loops

My problem is essentially to do with manipulating and storing Sow data in a nested loop structure. I have a set of differential equations describing time-evolution of a bunch of variables. ...
4
votes
1answer
188 views

Better definitions of Reap and Sow

I am having tremendous difficulty understanding Reap and Sow in Mathematica. The definitions are pretty circular. When I look at the definition of Sow, I get, "specifies that e should be collected by ...
3
votes
1answer
83 views

Poor performance from Manipulate and Sow-Reap

I am not a mathematician, and I barely know how to use Mathematica. But, over the course of many months and with help from this site awhile back, I managed to generate dynamic output that does exactly ...
3
votes
2answers
168 views

Sow in WhenEvent can't extract parameter value of ParametricNDSolve

This is a problem I noticed when trying to answer this question. Just consider the following toy example: ...
6
votes
3answers
270 views

How to keep building list until manually stopped?

I would like to run a numerical experiment for as much as it can run in a reasonable time. This is a sketch of how I currently do it: ...
2
votes
1answer
112 views

Timing functions with Sow / Reap and AbsoluteTiming

I have a main function f[x] that calls three sub-functions: ...
1
vote
1answer
103 views

Reap unpacks packed arrays

I noticed that Reap unpacks packed arrays. I've looked at previous answers but am still an unsure whether this a serious issue. E.g. consider Ex 47.3 from EIWL: ...
4
votes
1answer
608 views

Writing Faster Mathematica Code - Sow and Reap?

I am applying Select function to a large list called xyCoordinateCentreCircle. The dimensions of the list are: ...
8
votes
1answer
933 views

Reap, Sow with Parallelize: bad performance, why?

I have a question about the performance of Reap and Sow with Parallelize. I am aware of the following questions How to collect result continuously (interruptible calculation) when running parallel ...
4
votes
1answer
330 views

Elements in `Reap` and `Sow`

Can someone help explain it to me: How does here e come out? Why b disappears? ...
13
votes
1answer
625 views

Defining Tags in Reap

I am trying to use Sow/Reap to replace Append in my code. The problem is that I need to ...