Tag Info

New answers tagged

2

When you call compiled functions inside another compiled function, you should consider to inline them. You can do this by wrapping a With statement around and using CompilationOptions -> {"InlineCompiledFunctions" -> True} as option to compile. I have cleaned your code, moving a lot of definitions of variable right where you declare it in Module. I ...


0

It seems that for some reason all Integer values are converted to Real in the environment in which the autoload process takes place, therefore the value of $SystemWordLength is changed to a Real which breaks the path. I have been unable to figure out the source of the Integer to Real conversion and therefore I do not know what else it may affect, but I can ...


3

Confirmed by WRI (@ilian) as bug introduced in 10.1.


4

There was a wrong bracket in F. Also do not use { as a normal bracket, and second you wrote Exp{[ which has to be either {Exp[ or (Exp[ . F[k1_, k2_, λ1_, λ2_, δ_, w1_, w2_] := (1 - Exp[-(w1/λ1)^k1]) (1 - Exp[-(w2/λ2)^k2]) (Exp[(1 - (1 - Exp[-(w1/λ1)^k1]))^(-δ) + (1 + (1 - Exp[-(w2/λ2)^k2]))^-δ]^(1/-δ))


8

I think there's a bug in the internal function NDSolve`SPRKDump`CheckSeparability that leads NDSolve to conclude that the system is not separable. I think you should report it and see if WRI can verify it (they would probably appreciate a link to this Q&A). It's a fair amount of work to track it down, and there is a lot of nearly unreadable stuff to ...


1

Go to Preferences -> Messages and choose the desired option for Kernel Messages.


2

The reason for this error is that NIntegrate uses fixed precision when computing the integration ranges, while EllipticK needs to raise the precision internally to obtain a good result. N[EllipticK[7/10], 20] (* 2.0753631352924691439 *) Block[{$MinPrecision = $MaxPrecision = 20}, N[EllipticK[7/10], 20]] (* Divide::infy: Infinite expression ...


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 ...



Top 50 recent answers are included