Tag Info

New answers tagged

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


0

f1[x_] = ((Zl \[Rho]) Exp[-x]); f2[x_] = (\[Alpha] k e^2/x^2); Zl = 2.05*10^-15 // Rationalize[#, 0] &; \[Alpha] = 1.6381 // Rationalize[#, 0] &; \[Rho] = 0.326*10^-10 // Rationalize[#, 0] &; k = 8.9875517873681764*10^9 // Rationalize[#, 0] &; e = 1.602176565*10^\[Minus]19 // Rationalize[#, 0] &; sol = NSolve[f1[x] == f2[x], x, ...


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


5

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


4

You mean like this? Reduce[x^4 == 1 - I, x] // N x==-1.06955+0.212748 I||x==-0.212748-1.06955 I||x==0.212748+1.06955 I||x==1.06955-0.212748 I


2

f1 = RegionDistance[#, #2] < #3]& f1[Line[{{0, 0}, {1, 10.^-7}}], {.5, 0}, 10^-6] (* True *) f2 = Chop[RegionDistance[#, #2] ,#3] == 0& f2[Line[{{0, 0}, {1, 10.^-7}}], {.5, 0}, 10^-6] (* True *)


0

Following gpap's answer: Options[regionMember] = {Tolerance -> 0}; regionMember[reg_Line, p : {_?NumberQ, _?NumberQ}, OptionsPattern[]] := With[{e = OptionValue[Tolerance]}, If[e == 0, RegionMember[reg, p], RegionDistance[reg, p] < e]] line = Line[{{0, 0}, {1, 0}}]; ps = {.5, #} & /@ {0, 10^-100, 10.^-16, 10.^-5}; regionMember[line, #] ...


1

There's Internal`$EqualTolerance. See How to make the computer consider two numbers equal up to a certain precision and its reference. Block[{Internal`$EqualTolerance = 9.}, RegionMember[Line[{{0, 0}, {1, 10.^-7}}], {.5, 0}] ] (* True *) It's a relative tolerance, whereas gpap's & kguler's answers give absolute ones. The setting above, which is ...


6

This (or an appropriately written variant) works: myRegionMember[a_, b_] := With[{threshold = 10^-6}, If[ RegionDistance[a, b] < threshold, True, False ] ]


2

There were a couple issues. First, your definitions of tPx were done using :=, and they contained an integral. Ordinarily this is not a problem, but if tPx is used in NIntegrate (or any other function which calls it repeatedly!), then the kernel will symbolically evaluate the integral tPx at every datapoint in the integration, which is a recipe for ...


14

When you work with machine numbers the precision depends on the order of summation. The built-in functions Plus and Total are more intelligent then straightforward summation. It can be shown by the following example x = RandomInteger[{-100, 100}, {10000}]/RandomInteger[{1, 100}, {10000}]; res = Accumulate[x]; nx = N[x]; s[n_] := Sum[nx[[k]], {k, 1, n}]; ...


1

Here is my first pass at implementing what you describe. If you find that it deviates from your intended behavior let me know and I shall attempt to refine it. MakeBoxes[foo_, form_] /; format`hex =!= True := Block[{format`hex = True}, ToBoxes[foo, form] /. s_String?DigitQ :> With[{n = FromDigits@s}, InterpretationBox[StyleBox[#, RGBColor[1, ...


0

Currently you must call d@Sum[x^100, {x, 0, 10}] to get it to display in HEX form. To input custom HEX numbers simply call use the 16^^ff. In addition I have included a custom base16 function because I prefer a generalized solution that works for bases larger then 36 and support capital letters in stead of lowercase letters. t[x_] := Module[{l, r, h}, l ...


4

The magical words are Singular Value Decomposition. The singular vectors corresponding to small singular values form the kernel. Of course, Singular Value Decomposition is available in Mathematica as SingularValueDecomposition[]. As confirmed by Daniel Lichtblau, the built-in Tolerance option to NullSpace[] does it this exact way.


1

This is the most efficient I can think of: With[{vars = (δA | δB | δC)}, expr /. {x: vars * y: vars -> 0, vars^n_ /; n>1 -> 0}]


3

These sums are conditionally convergent, so you have to specify a summation order that suits your purpose. See Wikipedia. Since the question seems to be focused on the issue of dropping a term in a sum, here is one way of doing it, without making any claim that the resulting sum is of any use: Chop[NSum[ If[i == j == k == 0, 0, (-1)^(i + j + ...



Top 50 recent answers are included