# Tag Info

10

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

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

5

one idea.. Needs["ErrorBarPlots"] Show[{ErrorListPlot[ Table[ {{x, Sin[x]}, ErrorBar[RandomVariate[NormalDistribution[.3, .1]], RandomVariate[NormalDistribution[.1, .1]]]} , {x, 0, 2 Pi, .2}], ErrorBarFunction -> Function[{coords, errs}, {Opacity[0.2], Rectangle[coords + {errs[[1, 1]], errs[[2, 1]]}, coords + ...

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

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}]]

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

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$

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}]

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

2

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

You can use Surd instead of Sqrt. f[{v1_, v2_}, {x_, y_}] := StreamPlot[Evaluate[{v1/(1 + x^2 + y^2)^(3/2), v2/(1 + x^2 + y^2)^(3/2)} /. {x -> u/Surd[1 - u^2 - v^2, 2], y -> v/Surd[1 - u^2 - v^2, 2]}], {u, -1, 1}, {v, -1, 1}] f[{2 x y, 1 + y - x^2 + y^2}, {x, y}] // Quiet

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

1

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

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}

1

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

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