wolfram-mathematica

What does // mean in Mathematica?

对着背影说爱祢 提交于 2019-12-24 14:39:40
问题 Examples: In CT = Table[Prepend[10^4*x[range2] /. NDSolve[{...series of equations here...}, {t, range1, range2}, MaxSteps -> 10000, PrecisionGoal -> 11], delay], {delay, delaymin, delaymax, 0.1}]; // Timing what does it mean this // Timing after the semicolon? In Dρ = -I*((H0 + V).ρ - ρ.(H0 + V)) - Γ*ρ // Simplify; And this // Simplify here? I can't find this explanation anywhere! Thanks in advance, Thiago 回答1: This is Mathematica's postfix notation. Basically x//f is the same as f[x] 回答2:

Is there an R equivalent to Mathematica's Sow and Reap functions for building lists?

半腔热情 提交于 2019-12-24 12:24:08
问题 Mathematica has an interesting way of incrementally building a list (or more than one list) of results that you calculate at various points of a complicated computation. I'd like to do something similar in R. In Mathematica, you can collect the list of each argument to each invocation of the Sow function during a computation by wrapping the entire calculation in call to the Reap function. Does R have any equivalent to these functions? Could you perhaps emulate it with environments and the <<-

What is the difference between Mathematica Rules and the objects returned by GraphEdit?

会有一股神秘感。 提交于 2019-12-24 12:00:34
问题 This is actually a two-fold question. First: as someone coming from an OO programming background, I find Mathematica's use of lists as the basis of everything a bit annoying. So here is how a mathematica programmer (as far as I can tell) might define a graph: graph={{1, 2, 3, 4, 5}, {1->2, 2->4, 4->4, 4->5}}; and then the programmer would just have to remember that graph[[1]] refers to the list of vertices and graph[[2]] refers to the list of edges (in this case defined as a set of rules.) So

The basic input form for floating-point numbers?

随声附和 提交于 2019-12-24 10:00:24
问题 I just have discovered the fundamental difference between two input forms for floating-point numbers: In[8]:= 1.5*^-334355//Hold//FullForm 1.5*10^-334355//Hold//FullForm Out[8]//FullForm= Hold[1.5000000000000000000000000000000001`15.954589770191005*^-334355] Out[9]//FullForm= Hold[Times[1.5`,Power[10,-334355]]] These two forms differ very much in memory and time consumption: In[7]:= start = MaxMemoryUsed[]; 1.5*^-33432242 // Timing start = MaxMemoryUsed[] - start 1.5*10^-33432242 // Timing

Compute the arithmetic functions for large integer in Mathematica faster?

寵の児 提交于 2019-12-24 08:26:18
问题 Let f be an arithmetic function and A={k1,k2,...,kn} are integers in increasing order. Now I want to start with k1 and compare f(ki) with f(k1) . If f(ki)>f(k1) , put ki as k1 . Now start with ki , and compare f(kj) with f(ki) , for j>i . If f(kj)>f(ki) , put kj as ki , and repeat this procedure. At the end we will have a sub sequence B={L1,...,Lm} of A by this property: L1=k1 L2=ki L3=kj ... where f(L(i+1))>f(L(i)) , for any 1<=i<=m-1 For example, let f be the divisor function of integers. I

Unable to use link between Netlogo 6.0.1 and Mathematica 11.1 on a 64 bit processor pc running Windows 10

一个人想着一个人 提交于 2019-12-24 07:40:02
问题 I am unable to run the mathematica-netlogo link on my PC with a 64 bit processor running window 10. The versions of Netlogo and Mathematica are 6.0.1 and 11.1 Student Edition respectively. The error arises when the function "NLStart[]" is run with the path of the Netlogo directory provided as an input to this function. The error message is as follows: NLStart::netlogonotfound: NetLogo could not be found in: C:\Program Files\NetLogo 6.0.1\ Prior to this step, I successfully loaded the NetLogo

Recommended hotpatch for Mathematica Link to NetLogo 6 didn't work

人走茶凉 提交于 2019-12-24 07:39:33
问题 I have the same problem as the user who posted in "Unable to use Mathematica Link in NetLogo 6.0" (Unable to use Mathematica Link in NetLogo 6.0). For me, the Mathematica Link seems to work fine with Netlogo version 5.3.1. Even after I attempted the recommended hotpatch (which was the answer to the original posted question on this topic), still no luck (I get the same error message posted in the original comment cited above). I tried extracting the hotpatch in the NetLogo 6.0 directory and in

Mathematica: Non-intersecting line segments

随声附和 提交于 2019-12-24 07:07:53
问题 How can we tell Mathematica to gives us a set of non-intersecting lines? In this case two lines intersect if they have a point (not an endpoint) in common. Consider this simple case: l1 = {{-1, 0}, {1, 0}}; l2 = {{0, -1}, {0, 1}}; lines = {l1, l2}; The idea is to create a function which, given a set a lines, returns a set of non-intersecting lines. If such function exists say split then the output of split[lines] would be { {{-1, 0}, {0,0}}, {{ 0, 0}, {1,0}}, {{ 0,-1}, {0,0}}, {{ 0, 0}, {0,1}

Is there something like generalized Piecewise in Mathematica?

房东的猫 提交于 2019-12-24 03:50:41
问题 I'm trying to define a cubic spline as a function in Mathematica 8 as I've got every P_{i} (which, of course, are polynomials of degree 3) for each interval [x_{i}, x_{i + 1}], i = 0, ..., n . What I want to do is to define s in the interval [x_{0}, x_{n + 1}] as s(x) = P_{i}(x) if x is in [x_{i}, x_{i+1}] . How can I do that as n varies? I was thinking of Piecewise but that didn't work. 回答1: This does precisely what you ask, if I'm not mistaken. It's a bit ugly though. There are better

Conditional list values replacement in Mathematica

冷暖自知 提交于 2019-12-24 03:14:08
问题 Please consider : dalist = Transpose@{{"Noise1",1,1,1,1,1},{"Blah", 1, 2, 3, 4, 5}, {"Noise2",2,2,2,2,2}, {"COGCondition", 1, 2, 1, 2, 1}} COGCondition1 = 10 COGCondition2 = 20 I would like to replace the values in column "Blah" given the value taken in column "COGCondition" such that: If, for a given row, the value in column "COGCondition" = 1 the value in column "Blah" should be equal to COGCondition1 (And 2 -> COGCondition2) Desired output: I need this for a large data set and my attempts