Questions tagged [sampling]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4
votes
2answers
209 views

Why does plot not show where Piecewise function is not zero?

From my user point view this looks like bug. But I am not an expert. f[x_?NumericQ]:=Piecewise[{{1,x==1},{0,True}}]; Plot[f[x],{x,0,1}] Does not show ...
1
vote
1answer
73 views

Random sampling of a discrete distribution in NetGraph

Within a NetGraph I would like to use the output of a softmax layer, interpreted as a probability distribution, to sample a "next token". Since this is done inside an RNN structure, I cannot do this ...
1
vote
2answers
76 views

Multiple unique random samples?

I'm trying to produce $n$ random samples from a list, but not all samples, and I'd like the samples to not repeat in the same execution of the command. If I'm not mistaken, something like ...
2
votes
4answers
151 views

How to generate a matrix with certain conditions

I want to generate a $n \times n$ matrix. I want the diagonal entries to be all 0 I want a random choice of matrix elements with 0 or 1. The probability of having a 1 as a matrix element is $1/m$ and ...
0
votes
1answer
45 views

How do I extract data points from an audio plot at a constant spaced time interval?

AudioPlot[Audio[File["Downloads/1_mp3.wav"]]] data = Cases[AudioPlot[Audio[File["Downloads/1_mp3.wav"]]], Line[x_] :> x, Infinity] This code can extract data ...
0
votes
1answer
41 views

ProbabilityDistribution fails for square root

I would like to sampling data from a distribution Sqrt[x^2 + y^2]. I used the code as follows: ...
0
votes
1answer
70 views

Speeding up Module

I am working on the Ising 2D model in Mathematica and this is currently my Metropolis sampling function: ...
4
votes
2answers
107 views

Filtering data with timestamps

How to apply filter to data that was sampled in certain moments of time? Examples from documentation deal only with uniformly sampled data: ...
51
votes
1answer
3k views

Adaptive sampling for slow to compute functions in 2D

EDIT: Although I have posted an answer based on my current progress, this in incomplete. Please see the "open issues" section in the answer. Most plotting functions in Mathematica adjust the ...