# Tag Info

5

Use AbsoluteTime :- DateObject[Min[Map[AbsoluteTime, DateRange[DateObject[{2000, 1, 1}], DateObject[{2014, 10, 1}], "Month"]]]]

4

Here is a plot of your function $\frac{\epsilon r}{\epsilon^2 + (\omega-z^2 + r^2)^2}$ (code for ComplexPlotR2 at end of answer): ComplexPlotR2[ CCompileR2[(1/10)/((1/10 - x^2 + y^2)^2 + 1/100) y], {-10, 10, 0.02}, {0, 10, 0.02}] As you can see, it is nonzero on a pair of lines that extend to infinity, so it is not unexpected that the integral might ...

4

The requirement that la + lc == 100 is simple to implement, just pass 100 - la to Fc, or use ModelP/.{lc->100-la} in the call to FindFit. For the other trouble, remember that N is a special function in Mathematica, so avoid ever using this as a variable. Using n instead, I tried ModelP = (2/q^4)*Re[((1 - Fc[q, lc, sc])*(1 - Fa[q, la, sa]))/ (1 - ...

4

You can get a glimpse into the workings of NMinimize by turning on the debug-printing: Block[{OptimizationNMinimizeDumpdbPrint = Print}, NMinimize[{x + y, x >= 0 && Abs[x + 10 y + 100] <= 1}, {x, y}] ] It seems at a cursory glance that it decided to search for points in the rectangle: {{x,0.,2.},{y,-1,1}} In this region it found zero ...

3

myround is undefined. I assume that you mean Round. ToString[Round[4.811, 0.01]] "4.81" ToString[Round[4.811, .01 // Rationalize] // N, InputForm] "4.81"

3

In Mathematica, to take a derivative, grinding through Do loops, producing arrays, and defining finite-difference differentials are all completely unnecessary; instead, just use D: Plot[Evaluate@Table[D[f[x, n], {x, 2}], {n, 1, 5}], {x, 0, 2 Pi}, PlotLegends -> "Expressions"] which produces the graph that you are trying to make:

3

Documentation states: "This error can typically be avoided by providing starting values for the variable". Lets try to find these values: FindInstance[{x >= 0, Abs[100 + x + 10 y] <= 2}, {x, y}, Reals] {{x -> 0, y -> -(49/5)}} FindInstance[{x >= 1, Abs[100 + x + 10 y] <= 1}, {x, y}, Reals] {{x -> 1, y -> -10}} Lets try: ...

2

You are invoking ForAll with vacuous conditions. Compare: ForAll[{x}, x == x + 1, Element[Abs[x], Reals]] (* output: True *) I think that is really all that's going on here. There is no x in the ForAll for which x==Infinity actually returns true, so it spits out true because the "all" in "for all" is the empty set. It's vacuous. Likewise in the limit, ...

2

Here is a case where you should take a close look at the magniture of your quantities and do some manipulation to normalize things before throwing the system at the computer: Zl = 2.05*10^-15 \[Alpha] = 1.6381 \[Rho] = 0.326*10^-10 k = 8.9875517873681764*10^9 e = 1.602176565*10^\[Minus]19 divide both of your expressions by ( \[Rho] e ) : ...

2

The code NSolve[Rationalize[f1[x] == f2[x], 0], x, Reals], 100] yields three solutions (with or without N), which is the minimum number of solutions if Zl ρ is positive. The following, which sets the precision of the input to match the working precision, NSolve[SetPrecision[f1[x] == f2[x], 100], x, Reals, WorkingPrecision -> 100] also yields three ...

2

Using Method->"ExplicitRungeKutta" with a larger value of the option "DifferenceOrder" allows recovering more terms of the series expansion.

1

According to my tests, your function (where only even powers of omega occur) have symmetric solutions. Depending on the initial starting value for the root search, FindRoot converges to a solution or the opposite. That's why you observe the oscillations in your plot. Solution : To prevent FindRoot from choosing "randomly" one solution or the opposite, you ...

1

Not sure why this resurfaced but it can be done symbolically by separating real and imaginary parts. This of course is no guarantee that for some regions on parameter space the solution values will actually be real valued. zz = Array[x, 6] + I Array[y, 6]; polys = Expand[ ComplexExpand[{zz[[1 ;; 3]].Conjugate[zz[[1 ;; 3]]] - a, zz[[1 ;; 3 ;; ...

1

I suggest that you should be using a number formatting function, e.g. NumberForm, for the kind of control you are apparently after. For Round and ToString only you could use OutputForm: ToString[Round[4.811, 0.01], OutputForm] "4.81" Which is the default and therefore equivalent to this on an unmodified installation: ToString @ Round[4.811, 0.01] ...

1

For the first question (re finite difference from a table): Differences will compute the differences. xlist = Range[0., 20., 0.001]; flist = Sin@xlist; ListLinePlot[{Transpose@{xlist, flist}, Transpose@{Most@xlist, Differences[flist]/0.001}, Transpose@{Rest@Most@xlist, Differences[flist, 2]/0.001^2}}] If x is a nonuniform grid, e.g., xlist = ...

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