# Tag Info

1

In the CUDALink user guide, there is a section describing the time out error. This can be found here about 2/3 of the way down the page under Common Errors. Essentially, under Windows, if the same GPU that is used for CUDA computation is also used for the display, the Windows Display Driver Model (WDDM) enforces a time limit on GPU computations so that the ...

2

First, some slight changes to orbita: orbita[a_?NumberQ, b_?NumberQ, c_?NumberQ, d_?NumberQ, e_?NumberQ] := (orbita[a, b, c, d, e] = {X[t], Y[t]} /. First@NDSolve[{Vx'[t] == (-e*G*X[t]*Msun)/(X[t]^2 + Y[t]^2)^(3/2), Vy'[t] == (-e*G*Y[t]*Msun)/(X[t]^2 + Y[t]^2)^(3/2), X'[t] == Vx[t], Y'[t] == Vy[t], Vx[0] == a, Vy[0] == b, ...

0

Perhaps list = {{1, 2, 3, 4}}; While[list =!= {} && Length[list[[1]]] > 3, If[RandomReal[{0, 1}] < 0.2, list = {};, list = {{1, 2, 3}, {}};];]; list (* {{1,2,3},{}} *) or ClearAll[list]; list = {{1, 2, 3, 4}}; While[Length[list[[1]]] > 3, If[RandomReal[{0, 1}] < 0.2, Break[], list = {{1, 2, 3}, {}};];]; list (* {{1,2,3},{}} *) ...

1

You are most likely hitting this problem because choose is not defined to be a numerical quantity. NSum requires a summation where each part evaluates to something numerical, not algebraic. Deleting the choose gives a result: In[1]:= NSum[((50000 - x) x)*(1/3^15)^ x*((3^15 - x)/3^15)^(50000 - x), {x, 1, 4}] Out[1]= 0.0034724 EDIT Based on the ...

7

You can specify a general error message that only consists of a placeholder General::error = "1"; and then use foo[x_] := Module[{}, If[x < 0, Message[foo::error, "x<0 detected"], x]]; r = foo[-1] foo::error: x<0 detected

2

Since you haven't provided some code I can run, I will use the example of the documentation. As you can read in the details section of the documentation of WhenEvent, what you want can probably be implemented using something like the following: Reap@ NDSolve[{(2 - f[x]) f'[x] == f[x], f[0] == 1, WhenEvent[Abs[f'[x]] > 10^6, Sow[x]; ...

2

It seems ProgressIndicator can't interpret irrational numbers (I guess because they can be evaluated with any accuracy, while indicator needs some precise number). So just use floats explicitly: Monitor[ For[x = 1., x < 10, ++x, Pause[.1]], ProgressIndicator[Log[x], {Log[1], Log[10.]}]] or Monitor[ For[x = 1, x < 10, ++x, Pause[.1]], ...

3

Leaving your first part unchanged Remove["Global`*"] firstline = {1, 2, 3, 2, 7}; secondline = {4, 3, 2, 5, 7}; typeOfEndCondition = 0; cc = {3, 2}; In the second part of your code there is only a ; missing after the Print function: avald1 = Table[{}, {i, 5}]; For[i = 1, i <= Length[cc], i++, If[typeOfEndCondition == 0, conline = ...

Top 50 recent answers are included