Tag Info

Hot answers tagged

10

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


6

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


4

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

If you mean the vertical line, this is created by only one point. p = Plot[N[Im[isinh]], {e, 0, 2}, PlotRange -> Full, Exclusions -> None, WorkingPrecision -> Infinity]; list = Cases[p, Line[x_] :> x, -1]; ListPlot[list, PlotRange -> All] If you delete this point then: point = Cases[p, {x_ /; Abs[x - 1] < 0.01, y_ /; y < 0.5}, ...


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]


3

Update notice 2: Found starting initial conditions that work in V10. Update notice: bbgodfrey pointed out that the built-in shooting method does not work in V10.0.1 (nor V10.0.2). Set up the shooting method by hand, so you can control the convergence. The problem is that small changes in the initial conditions cause the solutions to blow up before r ...


2

I'm not familiar with the physics so I cannot say whether integrating over this set of 2 real dimension, in C^2, is what is wanted. I think the code below will cover the product space of the contours that are requested. ii = z1*z2/(p/z2 + (1 - p) z1 - 1)*Exp[1/z1 + z1 + 1/z2 + z2]; i1 = (ii /. {z1 -> Exp[I*t1], z2 -> Exp[I*t2]})*I*Exp[I*t1]*I* ...


2

For your first integral, NIntegrate gives warnings or messages about failing to converge when not excluding the singular points. When excluding the singular points I trust the result 13.6216 + 0. I because some alternative methods agree. Monte Carlo sampling: In[76]:= NIntegrate[ 1/Abs[tk], {kx, 0, 2 Sqrt[3] Pi/3}, {ky, 0, 4 Pi/3}, Method -> ...


2

Reversing the order of integration produces a solution: ans= Integrate[HeavisideTheta[1 - x - y]/(x 100^2 - y (1 - y) 90^2), {y, 0, 1}, {x, 0, 1}, PrincipalValue -> True] (* Log[(100*10^(38/81))/(81*19^(19/81))]/10000 *) N[ans] (* 0.000060027526501455836 *) Solutions of this sort are what I would expect based on outlining a pencil-and-paper ...


1

Results can be obtained with the following changes. First, delete the two asterisks at the end of the line ik=ik2 (* if evk>phi*)**, which confuse Mathematica. Second replace DSolve by First@NDSolve (and t by { t, 0, T} in NDSolve), because DSolve cannot solve these equations. Third, change T to .5*(1/fre) to avoid stiffness issues. Then, labeling ...


1

I think part of the issue lies with the coordinate singularity at r=0. I made the following transformations, first x1 -> x1/KO2 , x2->x2/KS . Then u1=x1/r and u2=x2/r. I also assumed that you were solving from R0>0 to R because you couldn't solve at R0=0. I set the boundary conditions u1[0]=0, u2[0]=0 . These transformations were used because Laplacian[ ...


1

One problem is using NumericQ - see What are the most common pitfalls awaiting new users? Another problem is how many times NIntegrate is being called. To do the 2D integral in FF, f4 will be called tens of thousands of times. Computing f4 in turns does three 1D integrations, which will call f1, f2, f3 several hundred times. And there's still one more ...


1

It looks to me like the data extends to the right of the singularity. Is it acceptable to simply remove that part of the data? It doesn't look like it could possibly fit the model. FindFit[data[[;; 9500]], model, {{A, 0}, {B, 10^9}, {c, 10000}, {z, -2}}, x] (* {A -> -0.0521369, B -> 1.54292*10^10, c -> 11142.5, z -> -2.71708} *) ...



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