# Tag Info

1

Times has the Attributes Orderless and Flat. (Among others.) a/b has the FullForm Times[a, Power[b, -1]]. That is already in the sorted order: Sort[{a, Power[b, -1]}] {a, 1/b} And as there is only one Times the Flat attribute doesn't change anything. However the first expression is interpreted as: (x^2 + y) z/w // FullForm // HoldForm ...

2

As @image_doctor notes in a comment, the problem occurs because the definition of TestPrivatefQ is not being distributed to the other kernels. DistributeDefinitions uses LanguageExtendedFullDefinition to determine which definitions to transmit. We can see this by evaluating the following expression: On[LanguageExtendedFullDefinition] ...

2

I think this is a question of organizing the definitions differently. If I understand the goal of type correctly, it seems redundant to define it based on a pattern that includes the second argument. Instead, you should just define type using TagSet by giving only the first argument pattern on which the type actually depends. Then you can reserve the pattern ...

3

If the application permits, one way might be to add a third definition to type: type[x_] := type[Evaluate@Block[{f1, f2}, x]] By temporarily blocking the definitions of f1 and f2, expressions like myf can evaluate to their constituent parts involving those symbols. We then apply type to the result, and the upvalues on f1 and f2 can once again take ...

0

This can be stated as: I want to create a list of "assignments" that do not actually assign, but have a form like {x=1,y=2,z=3}, so that I can use these temporarily with With[]. One solution is to abandon your original approach and see if you can achieve your goal in another fashion. You cannot do this in Mathematica: q={x=1,y=2,z=3} s= ...

1

As mentioned in a comment, you are trying to take the derivative of a logical equation, not of a function. f = x^2 - 2 * 3^(1/2) x y + 3 y^2 - 8 * 3^(1/2) x - 8 y; D[f, {x, 2}] (* 2 *) Correct. g = x^2 - 2 * 3^(1/2) x y + 3 y^2 - 8 * 3^(1/2) x - 8 y == 0; D[g, {x, 2}] (* False *) A "derivative" of a logical expression. If you must retain your ...

1

The problem is with numerical error in the procedure used by Integrate. Sufficiently high arbitrary precision, or exact input, is needed to ensure an accurate result from Integrate. On the other hand, MachinePrecision is sufficient for NIntegrate. There is nothing particularly numerically challenging about the integrand, so the NIntegrate result is not ...

0

Clear[delta] delta[\[Alpha]_?NumericQ, q_?NumericQ, n_?NumericQ] := Module[ {z = I 2.0` l \[Pi]/Log[q]}, Re[2 NSum[Gamma[\[Alpha] - z] n^z, {l, 1, Infinity}]]]; delta[1, 10, 10] 0.0818184

0

As stated n the comments, the problem lies with the defnition s = 0.01 which causes all calculations to be done with machine precision. Higher precision is required, say 20. Analytic solution int1 = Integrate[E^(4 n x s) (1 - x)^(-1 + 4 n mu) x^(-1 + 4 n nu), {x, 0, 1}] ConditionalExpression[ Gamma[4 mu n] Gamma[4 n nu] ...

1

Using Mathematica 10.0.2.0, I do not receive the error message you did. However, Sum returns unevaluated, which happens when Sum cannot do the summation. Since you are seeking a numerical answer, I suggest that you use a large upper bound on your Sum instead of Infinity. For instance, delta[\[Alpha]_, q_, n_] := 2 Sum[Re[Gamma[\[Alpha] - I 2 l ...

4

One more subtle variation: Sum[Defer[# - #2] & @@ (1/(2 i + {-1, 1})), {i, 6}] (1/11 - 1/13) + (1/9 - 1/11) + (1/7 - 1/9) + (1/5 - 1/7) + (1/3 - 1/5) + (1 - 1/3)

5

Another way of doing it (something similar to Kuba's great answer) is: Sum[HoldForm[#1 - #2] &[1/(2 i - 1), 1/(2 i + 1)], {i, 1, 6}] May be also something different: Sum[(1/(2 i - 1) - 1/(2 i + 1) // Trace)[[-2]], {i, 1, 6}]

5

HoldForm[# - #2] & @@@ Table[{1/(2 i - 1), 1/(2 i + 1)}, {i, 1, 6}] // Total

1

Looking again at the image I realize you are using a strange construct: p[n, 0] = p[n_, 0] := 1 p[n, 0] = p[n_, 1] := -1 p[n, k] = p[n_, k_] := (* body *) I strongly suspect that this is not what you want. Instead I believe you are attempting to set up memoization, in which case I believe you need to change these to: p[n_, 0] = 1; p[n_, 1] = -1; p[n_, ...

0

After reading the Mathematica tutorial on "Memory Management", I was enlightened. (I cannot believe that I missed that help.) I was able to carry out the calculations by being more careful and expanding only the expressions that were necessary to simplify a given expression. In this way, I only had in memory exactly what was necessary. And for my ...

6

Leaving aside the wisdom of modifying System functions this is an interesting question. I would not have been surprised to see this behavior had the input list been packed as I have already learned about low-level optimizations on packed arrays. See: Block attributes of Equal However that does not appear to be the issue here since (typed in) {1, 2, 3} ...

4

Your expression will be evaluated unless it is entered in a held form, or a form that natively does not evaluate. For example: a = Hold[1/10, 2/10, 3/10, 4/10, 5/10]; b = {{1,10}, {2,10}, {3,10}, {4,10}, {5,10}}; The second representation is a bit easier to work with as the first, which while not evaluating is nevertheless parsed differently from what ...

4

Use HoldForm HoldForm[2/10] $\frac{2}{10}$ ReleaseHold[%] (* Out[68]= 1/5 *)

10

The behaviour we see is due to the precedence of &, which is much lower than the precedence of /@. As a consequence, the expression Line /@ (Print[#]; #) is bound tightly together by the high precedence /@ infix operator, yielding the single argument to the low precedence & postfix operator. This means that the second expression is interpreted as ...

1

Actually, Map[Line, Map[(Print[#]; #) &, {{{2, 1}, {1, 1}}, {{-2, 1}, {3, 1}}}]] is equivalent to Line /@ ((Print[#]; #) & /@ {{{2, 1}, {1, 1}}, {{-2, 1}, {3, 1}}}) with both producing {{2,1},{1,1}} {{-2,1},{3,1}} {Line[{{2, 1}, {1, 1}}], Line[{{-2, 1}, {3, 1}}]} Note the extra pair of parentheses that I added. They are necessary so that ...

8

The use of Rule (->) does cause the right-hand-side to be evaluated but if a pattern Symbol (such as n) remains its left-hand-side match will still be substituted in. Observe what happens when f[n] evaluates to different expressions. No n present in evaluated form: f[n] = 7; {x, x^2, x^3, a, b} /. x^n_ -> f[n] {x, 7, 7, a, b} Note that only ...

1

I think that's because n is on both sides of ->, so it's treated like a function. So for x^2, the rules says, make it a function, with 2 as its input. {x, x^2, x^3, a, b} /. x^n_ -> f[n] {x, f[2], f[3], a, b} {x, x^2, x^3, a, b} /. x^n_ :> f[n] {x, f[2], f[3], a, b} Now we define the function f[z_] f[z_] := Sqrt[z] // N {x, x^2, x^3, ...

Top 50 recent answers are included