Tag Info

New answers tagged

4

The local i does not evaluate in the first table of functions; e.g. Table[# f[i] &, {i, 1, 10}] gives... {#1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &, #1 f[i] &} Use With to force the evaluation of i... Table[With[{i = i}, # f[i] &], {i, 1, 10}] to ...


0

This problem can easily appear with elements that are not heads, therefore Heads -> False is not a complete solution: Position[{{a, b}, {a, c}, {a, b}, d}, _?(#[[2]] == b &), {1}, Heads -> False] Part::partd: Part specification d[[2]] is longer than depth of object. >> {{1}, {3}} So long as the unevaluated form e.g. d[[2]] will not result ...


2

Since kirma has pointed out the main trouble, which is also found in the potential duplicate Trouble with Position[], I thought I would add another alternative like Bob Brooks. Comment: Using Association here instead of lists to manage your data might be more convenient. We can convert the data* either with pa = Association[Rule @@@ price]; da = ...


0

Zoff, Try this Table[Cases[price, {div[[i, 1]], __}], {i, 1, Length[div]}] This will give you the price on the dividend date instead of the position.


2

As suggested by @ilian , this is now better using a Nest instead of the recursive approach. Block[ {a, primes, tot}, primes = Select[Range[10^9, 10^9 + 10^3], PrimeQ]; tot = 0; Do[ tot += Nest[Mod[6 #^2 + 10 # + 3, primes[[i]]] &, 1, 10^(15) - 1]; , {i, Length@primes} ]; tot ] // AbsoluteTiming Here is an even ...


0

This is not an answer -- I just can't refrain from commenting on your coding style. Your expression Table[Plot[f[d, x], {x, -85, 60}, PlotLabel -> f], {f, {CDF}}] is valid, but it amazes me. I would never have thought of it. Because I am extremely simple-minded, I would have written {Plot[CDF[d, x], {x, -85, 60}, PlotLabel -> CDF]}


1

The problem is due to current limitations in the type system implemented by Dataset (v10.2). Specifically, the type system: cannot determine the type that results from applying Merge[Identity] to a list of associations, and does not support #a syntax when applied to an unknown type. These limitations could be considered bugs. Work-around #1 - Turn Off ...


5

I believe what you experience should not happen because when you use the alternative notation for named slots, it works as expected: data = Dataset[{<|"a" -> 1, "b" -> "x"|>, <|"a" -> 2, "b" -> "y"|>}]; data[Merge[Identity] /* (Max[#["a"]] + Total[#["b"]] &)] (* 2 + "x" + "y" *) Additionally, you could split your original ...


11

This is almost certainly an out-of-memory crash. The underlying issue is that the OS X front-end is a 32-bit program, so has a process memory limit of around 2 GB. It is normal for an attempted allocation beyond that limit to lead to a crash. A similar size ArrayPlot example I tried on my Windows machine (where the front-end is 64-bit) used more than 3 GB ...


19

Presumably your Notebooks are not being saved in a Trusted Path. Start by reading the tutorial Notebook Security, and note: If the notebook's directory is trusted, the notebook will be allowed to automatically perform dynamic evaluations without alerting the user. If the notebook's directory is untrusted, the user will be alerted upon any attempt by the ...


2

Earlier invalid assertion redacted. Some spelunking reveals that the innermost (accessible) plot function called is: Visualization`Core`Plot And using this function directly also produces the message: Visualization`Core`Plot[Sinc[x], {x, 0, 10}, Method -> {"MaxBend" -> 1}] MaxBend::deprec: MaxBend->7 is deprecated and will not be supported in ...


4

A small remark on the error: CoefficientArrays::poly: -(1 + 3.27432/(1 + 0.092 Ccu)^2) Ccu11498 - (3 Ccu11499)/200 + 1.38465 Ccu$11500 is not a polynomial. >> First note that Ccu is your dependent variable in your PDE. The expression being complained about has several variables, Ccu and ones like Ccu$11498.. (The ones like Ccu$11498 are internal, ...


3

Mathematica's finite element PDE methods only work for linear PDEs as of v10.1. See here or here for some other tips on how to deal with this. Given the form of your equation (some kind of non-linear reaction-diffusion equation?), I would suspect that you're better off using Mathematica's default "Method of Lines" algorithm than trying to use finite ...


2

First, a test case: sol = NDSolve[{x'[t] == -1/x[t], x[0] == -1}, x, {t, 0, 2}] NDSolve::ndsz: At t == 0.499999735845871`, step size is effectively zero; singularity or stiff system suspected. >> Consult What's inside InterpolatingFunction[{{1., 4.}}, <>]? or InterpolatingFunctionAnatomy and you will discover that InterpolatingFunction ...



Top 50 recent answers are included