# Tag Info

1

While the behavior has already been confirmed a bug -- an uncaught Throw from an internal function must always be one, right? -- here are a couple more workarounds. How I analyze the problem of finding a workaround: From the context NIntegrateLevinRuleDump in the error message, one might infer that NIntegrate is trying to determine whether to use (or even ...

0

This is not an answer but an extension onto the previous question with hopefully more detail. I am in the same class as the OP, and I believe that the error is dependent on something besides the recursion that you see explicitly in the code. That is because we are tasked with solving for the future coefficients of the differential equation since we are ...

2

Your mistake has nothing to do with Mathematica. For solving a differential equation numerically, you need to provide inital- (or boundary-) conditions. Here is your code that runs. Please adapt it to your needs: www[x_] := Sin[x^2] NDSolve[{x'[t] == -3 www[x[t]] (x[t] - y[t]), y'[t] == -x[t] z[t] + 27 x[t] - y[t], z'[t] == x[t] y[t] - z[t], x[0] ...

1

You could use the built-in function IntegerExponent as follows. EvenOddFactorsOf[n_?OddQ] := {{0, n}, Apply[CenterDot, {Superscript[2, 0], n}]} EvenOddFactorsOf[n_] := With[{e = IntegerExponent[n, 2]}, {{e, n/2^e}, Apply[CenterDot, {Superscript[2, e], n/2^e}]}] The function returns two formats. The first is a list of the exponent of 2 and the ...

1

Personally I think the neatest way is: powerOf2[x_Integer] := powerOf2[x/2] + {1, 0} powerOf2[x_] := {-1, 2 x} powerOf2[528]

3

CenterDot @@ (Superscript @@@ FactorInteger[528]) $2^4\cdot 3^1\cdot 11^1$ Or... if you don't like exponents of "1": CenterDot @@ (If[#[[2]] != 1, Superscript[#[[1]], #[[2]]], #[[1]]] & ) /@ FactorInteger[528] $2^4\cdot 3\cdot 11$

9

There are several problems with your code. The first one is that you are missing a couple of semicolons to suppress output and delineate substatements in a compound function. The second problem is that you are trying to assign a new value to x within the function definition. This doesn't work. x already has the value of whatever number you give. You need ...

5

Try this, just to get you started. Function arguments can't be modified in the module so I've used x0 to allow your code to run. prime[x0_] := Module[{a, i, y, x}, x = x0; a = x/2; i = 0 ; If[IntegerQ[x] == False, Print["Input integer."]; Return[]]; While[IntegerQ[x] == True, x = x/2; i = i + 1; ]; y = x/2^i; Return[{i, y}]]

1

Personally, whenever I do piecewise functions I like for them to be just one function. What I mean by that is that I use HeavisideTheta[] functions to multiply the piecewise portions by either one or zero depending on the t value. If you aren't familiar with Heaviside functions, HeavisideTheta[t] would be zero before 0 and 1 for all values after it. ...

1

In this case using Set, so that the integrals are evaluated at the time that v and x are defined, instead of SetDelayed helps with the speed, assumming t has no value. If t has a value, one can use Block as shown below to temporarily block the value while a, v, and x are defined. The increase in speed is due to the ability of Mathematica to evaluate the ...

1

You have assign (=) instead of == in the: {a x^2 + b x + c = y} Just change this into and this will be fixed. {a x^2 + b x + c == y}

5

I've noticed before that when importing text files into Mathematica, depending on how the text file encodes numbers, you might get odd results, such as expressions like -5 - 9.18301 e due to the file encoding the number as "-9.18301e-5", which is generally fine, but doesn't read correctly with ReadList[]. Instead, try Import[filename, "Table"]. Edit: I ...

9

What you have there is in the form of a rational function: Simplify[(α + β Subscript[x, 1] + γ Subscript[x, 1]^2) (D[Subscript[x, 1], x]^-1)] If you Expand and then Simplify, you get a polynomial. Subscript[x, 1] = (a x + b)/(c x + d); CoefficientList[ Simplify@Expand[(α + β Subscript[x, 1] + γ Subscript[x, 1]^2) (D[Subscript[x, 1], x]^-1)] /. a d ...

1

Use forward slashes, not backslashes. That is, replace \\ with //.

4

This is a bug in RegionPlot. For a possible workaround, try the following undocumented option RegionPlot[NIntegrate[PDF[NormalDistribution[0, 1], a], {a, 0, y}] >= 0.2, {x, -1, 1}, {y, 0.1, 0.7}, "NumericalFunction" -> False]

3

EDIT : Changed for your edited question \$Version (* "10.2.0 for Mac OS X x86 (64-bit) (July 7, 2015)" *) Define a helper function that is defined only for numeric arguments f[y_?NumericQ] := NIntegrate[ PDF[NormalDistribution[0, 1], a], {a, 0, y}]; rgn = ImplicitRegion[ f[y] >= 0.2 && -1 <= x <= 1 && 0.1 <= y ...

2

Try this small variation over your original request RegionPlot[ Integrate[PDF[NormalDistribution[0, 1], a], {a, 0, x}] > 0.3 // Evaluate, {x, -10, 10}, {y, -1, 1}]

3

If you rearrange the problem as follows (using R(x-y) == c instead of x-y == c/R): FindRoot[{Cos[x]/x == 9.59079, Cos[y]/y == 7.62064, R (x - y) == 0.154122}, {{x, 0.01}, {y, 0.01}, {R, 0.1}}, AccuracyGoal -> Infinity] Mathematica tells you there is a singular Jacobian at the point given. Essentially, Mathematica finds roots by constructing a ...

0

There are several things to change. First, having AccuracyGoal bigger than the working precision does not make sense so also change WorkingPrecision -> 100 and also you may need MaxIterations -> 100. Second, your coefficients has a limited precision. You should do coeff = SetPrecision[coeff,100] And finally change all approximate numbers 0.01 and ...

1

Rewriting your code with & corrected to && and with parameters given in a more consistent manner B0 = Exp[-I*fi] (a01 - a00*Exp[-I*x]); B1 = Exp[-2 I*fi] (a11 - a10*Exp[-I*x]); B2 = a21 + Exp[-I*x]*a20; C0 = Cos[Theta] (a20 - a10); C2 = Cos[Theta] (a10 - a20); C1 = Cos[Theta] (a00 - a20); AA = Exp[-I*x] - Exp[-I*fi] Exp[I*x]; DD = Exp[-2 I*fi] ...

0

The below explanation is fairly plausible, but either way the answer is to build up the data in a table and ListStreamPlot it I had a similar problem with StreamPlot[{1, Sqrt[1 - x^2] Cos[y + 1]}, {x, -1, 1}, {y, 0, 1}]. My conjecture is that since streamlines require numerically integrating the field, fields that are hard to integrate (require small step ...

5

You are likely using = (Set) instead of == (Equal) in the equations you are feeding to DSolve. You need to use ==, which is an equality test. Instead, you're trying to assign the right-hand side (presumably zero) to the linear combinations of As reported by Set::write. These linear combinations have the overall head Plus, which means that you're ultimately ...

Top 50 recent answers are included