Skip to main content
19 events
when toggle format what by license comment
Dec 27, 2017 at 17:10 comment added CAF thanks, I have done so, it is here if you are able to help on this one, mathematica.stackexchange.com/questions/162655/…
Dec 21, 2017 at 12:04 comment added SPPearce You should probably ask that as a separate question.
Dec 20, 2017 at 12:01 comment added CAF Did you catch my last comment? :)
Nov 20, 2017 at 21:09 comment added CAF Ok Thanks for your help! The last thing I would ask is how to make sure my chi square function, which I'm differentiating with respect to the parameters NN,a,b for returning the covariance matrix, is symbolic and not numeric?
Nov 20, 2017 at 13:46 comment added SPPearce Yes, I get the same 160ish value. I'd recommend you track down where that error is coming from though.
Nov 20, 2017 at 13:38 comment added CAF Yup I tried that , I’ll maybe try running the code on a desktop at the university rather than my personal computer and see what happens. Just out of interest, was the 160 chi square that my code returned in line with what you got ? I should also say when I resort to using the previous formula for alphas everything works fine.
Nov 20, 2017 at 13:25 comment added SPPearce The code in the first post works for me. Have you closed the kernel properly, and make sure you aren't defining a variable somewhere earlier. k is the likely culprit, as you posted some code earlier using k as an iterator in a For loop. So type k and see if it has a value (and if it does you can clear it with Clear[k] or k=. )
Nov 20, 2017 at 13:22 comment added SPPearce Yes, you should be worried about that, you can't just ignore those type of errors. It says that the integral was non-numeric.
Nov 20, 2017 at 12:03 comment added CAF Thanks for the check. I've tried it multiple times and I tried again just now and I got the same errors. I've edited my OP ^^ with the code I'm working with and the errors that I'm getting (commented at the end). I've also commented the (worsened) chi square it returns and a,b,NN. So it runs, but just gives me these errors in addition - should I be worried about this?
Nov 20, 2017 at 11:16 comment added SPPearce That error usually means that you are trying to integrate or differentiate with respect to a variable that you have a value assigned to. Have you tried closing the kernel and trying again? It works for me (although it is worse for the specific a,b,NN that was doing well earlier)
Nov 19, 2017 at 21:50 comment added CAF I see that the code runs with this new alphas but there are errors about integrand evaluated to non-numeric values and something about 'General: 7.0432....' is not a valid variable. I don't really understand this. Would you be able to check if you get the same errors on your machine?
Nov 19, 2017 at 20:46 comment added SPPearce That looks fine for me. Test it by going alphas[1], if that isn't a number that is your issue. Did you manage to sort out your derivatives?
Nov 18, 2017 at 15:25 vote accept CAF
Nov 18, 2017 at 15:25
Nov 18, 2017 at 15:25 comment added CAF I see, thanks +1, I also replaced alphas[k_] = 4*Pi/9/Log[k/lambda] with alphas[k_] = 4*Pi/9/Log[k/lambda] - 16*Pi*16/9/9/9*Log[Log[k/lambda]]/(Log[k/lambda])^2 (an improved functional form for alphas) - however this gives errors about non-numeric input and I don't see why they come about by simply redefining my functional form for alphas.
Nov 17, 2017 at 6:28 comment added SPPearce It is a symbolic derivative, but here you have a numerical function. That is really not Mathematica-style code though. Read mathematica.stackexchange.com/questions/134609/… and mathematica.stackexchange.com/questions/7924/….
Nov 16, 2017 at 16:27 comment added CAF Thanks! Found it, the last thing I had a quick query on was in my determination of the covariance matrix. The code is Ucovinv = IdentityMatrix[3]; vecpar = {a, b, NN}; For[i = 1, i <= 3, i++, For[k = 1, k <= 3, k++, Ucovinv[[i]][[ k]] = (1/ 2 D[chisq5[a, b, NN], vecpar[[i]], vecpar[[k]]] /. %19[[2]])]]; Ucov = Inverse[Ucovinv]; Ucov // MatrixForm, but this returns a matrix with peculiar output such as chisq5 raised to a power (0,1,1). Do you know what that means?
Nov 16, 2017 at 13:38 comment added SPPearce I switched to FindMinimum actually (once I had a reasonable value from the initial NMinimize I wanted to zoom in on it). Yes, you can change the maximum number of iterations (and various other things, such as the method used), look in the help files for how to do that.
Nov 16, 2017 at 13:13 comment added CAF Oh thanks very much! I tried the code you provided and obtained values of 54.7837, a-> -0.128017, b->-0.456918 and NN->-1.24031. However, NMinimize failed to converge after 100 iterations. I just wonder is there a way to extend the number of iterations NMinimize can do so that maybe I can obtain the same numbers that you got?
Nov 16, 2017 at 11:16 history answered SPPearce CC BY-SA 3.0