wolfram-mathematica

Shuffling a list with a constraint

删除回忆录丶 提交于 2019-12-10 13:54:42
问题 Preparing a new psychophysical experiment, I have 48 original stimuli displayed 4 times (4 conditions), resulting in 192 trials. Trying to randomize the order of presentation during the experiment, I need to maximize the distance between the 4 display of the same original stimuli. Please consider : Table[{j, i}, {j, Range[48]}, {i, Range[4]}] Where j is the original stimuli number and i the condition Output Sample : {{1, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, ... {47, 1},

Modifying a Graphics3D object generated by ParametricPlot3D

泄露秘密 提交于 2019-12-10 13:53:23
问题 Here is a set of structured 3D points. Now we can form a BSpline using these points as knots. dat=Import["3DFoil.mat", "Data"] fu=BSplineFunction[dat] Here we can do a ParametricPlot3D with these points. pic=ParametricPlot3D[fu[u,v],{u, 0, 1}, {v, 0, 1}, Mesh -> All, AspectRatio -> Automatic,PlotPoints->10,Boxed-> False,Axes-> False] Question If we carefully look at the 3D geometry coming out of the spline we can see that it is a hollow structure. This hole appears in both side of the

Integration in Mathematica

人盡茶涼 提交于 2019-12-10 13:24:12
问题 I would like to get a different solution to a problem I have solved "symbolically" and through a little simulation. Now, I would like to know how could I have got the integration directly using Mathematica. Please consider a target represented by a disk with r = 1, centered at (0,0).I want to do a simulation of my probability to hit this target throwing darts. Now, I have no biases throwing them, that is on average I shall hit the center mu = 0 but my variance is 1. Considering the coordinate

Histogram plots in LevelScheme

南笙酒味 提交于 2019-12-10 13:18:08
问题 I've just started using LevelScheme, and have issues with getting the histogram to fit correctly within the figure. A minimal non-working example: <<"LevelScheme`" Figure[{FigurePanel[{{0, 1}, {0, 1}}, LabB -> textit["x"], BufferB -> 2.5, LabL -> textit["p(x)"], BufferL -> 2.5, FrameTicks -> {LinTicks[-4, 4], LinTicks[0, 1]}, PlotRange -> {{-3, 3}, {0, 0.5}}], RawGraphics[ Histogram[RandomReal[NormalDistribution[], 1000], Automatic, "ProbabilityDensity"]]}, Frame -> False, PlotRange -> {{-0

Complex Error Function in Mathematica

让人想犯罪 __ 提交于 2019-12-10 13:15:58
问题 The complex error function w(z) is defined as e^(-x^2) erfc(-ix) . The problem with using w(z) as defined above is that the erfc tends to explode out for larger x (complemented by the exponential going to 0 so everything stays small), so that Mathematica reverts to arbitrary precision calculations that make life VERY slow. The function is used in implementing the voigt profile - a line shape commonly used in spectroscopy and other related areas. Right now I'm reverting to calculating the

i need to find the upper bound of this: or the tight bound:

人走茶凉 提交于 2019-12-10 11:56:05
问题 lets say i have an expression: (n)+((n-1)*2)+((n-2)*3)+((n-3)*4)+...+(3*(n-2))+(2*(n-1))+(1*(n)) what is the tight bound of this? or the upper bound? is this n^3? is this n^4? the maximum amount of number i can get out of this? thanks EDIT: so: for i=1 then: the ans is 1. i=2: (1*2 + 2*1) 1=3: (1*3 + 2*2 + 3*1) i=4: (1*4 + 2*3 + 3*2 + 4*1 ) and so on 回答1: Try Wolfram Alpha ... Sum[(i + 1) (n - i), {i, 0, n - 1}] 来源: https://stackoverflow.com/questions/4382014/i-need-to-find-the-upper-bound-of

Automatically generating sums in Mathematica

雨燕双飞 提交于 2019-12-10 11:09:12
问题 This is a design issue I came across while working on implementation of Generalized Distributive Law. Suppose you need to automatically generate expressions of the following form (source: yaroslavvb.com) Terms inside the sum, fixed variables and "summed over" variables are automatically generated for each such expression, and "f" functions are defined separately. To generate expression above, I may need to call sumProduct(factors,fixedVariables,fixedValues,freeVariables,freeRanges) where

Mathematica 2D Heat Equation Animation

空扰寡人 提交于 2019-12-10 11:06:47
问题 I'm working on mapping a temperature gradient in two dimensions and having a lot of trouble. My current approach is to define an Interpolating Function and then try to graph it a lot of times, then animate that table of graphs. Here's what I have so far: RT = 388.726919 R = 1 FUNC == NDSolve[{D[T[x, y, t], t] == RT*(D[T[x, y, t], x, x] + D[T[x, y, t], y, y]), T[x, y, 0] == 0, T[0, y, t] == R*t, T[9, y, t] == R*t, T[x, 0, t] == R*t, T[x, 9, t] == R*t}, T, {x, 0, 9}, {y, 0, 9}, {t, 0, 6}] So

how to output the data set when using histogram in mathematica

百般思念 提交于 2019-12-10 10:32:20
问题 In Mma, the Histogram function only generates graphics. I am wondering how I can to get the data set; is there any convenient built-in function for this? Many thanks. 回答1: HistogramList was added to Mathematica V8 to expose the binning and height calculations. HistogramList[a] For V7 you can hack the third argument to get the bins and counts. Histogram[a, Automatic, (Print[{##}]; #2) &] 回答2: Perhaps a bit of internet searching would help as well. This was my answer (of June 18, 2010) to a

Optimizing a “Manipulate” in Mathematica

强颜欢笑 提交于 2019-12-10 10:08:19
问题 I am looking to make a nice demo of the problem I mentioned in Integration in Mathematica but it is very slow yet and the Manipulate is not smooth at all. Considering the below, is there means by which I could improve the situation. That is see a more continuous dynamic. Also I can't get to have the Manipulator open using Control->Manipulator[Appearance->Open] arrows = ParallelTable[{ RandomVariate[NormalDistribution[0, Sqrt[1]]], RandomVariate[NormalDistribution[0, Sqrt[1]]]}, {20000}];