Tag Info

Hot answers tagged

9

You could try something like the following. bounded[Indeterminate] := $MaxMachineNumber; bounded[x_?NumericQ] := x This gives a very large number instead of Indeterminate so NMinimize keeps searching. NMinimize[bounded[J[{θ0, θ1, θ2}, X1, y1]], {θ0, θ1, θ2}] (* {0.203498, {θ0 -> -25.1613, θ1 -> 0.206231, θ2 -> 0.201471}} *) Incidentally, ...


5

As it stands the integral does not converge! To see that note that Series[Log[1 + y^2]/Cos[Pi y], {y, 1/2, 0}] returns $$-\frac{\log \left(\frac{5}{4}\right)}{\pi \left(y-\frac{1}{2}\right)}-\frac{4}{5 \pi }+O\left(y-\frac{1}{2}\right)$$ and a simple pole is not integrable. What you maybe want to know is Cauchy's principle value of the integral ...


5

There are two problems with your code: 1. Incorrect Usage of WhenEvent As the name indicates WhenEvent is meant to be used when you want to e.g. switch at certain events, what I think you try to do is to set a'[t] to zero for a whole period (0<=t<=0.1), but that's AFAIK not what WhenEvent can be used for directly. Of course you can reformulate your ...


3

You may try something like: raw = FinancialData["GE", All]; fraw = Flatten[raw]; data = Table[fraw[[4*i]], {i, 1, Length[raw]}];(*extracting just the prices*) model = A + B*Abs[c - x]^z; fit = FindFit[data, {model}, {A, B, c, z}, x]; modelf = Function[{t}, Evaluate[model /. fit]] Show[Plot[modelf[x], {x, 0, 12000}], ListPlot@data]



Only top voted, non community-wiki answers of a minimum length are eligible