Tag Info

New answers tagged

2

Simple: use Table Sum[i^2, {i, 3}] (* 14 *) Table[i, {i, 3}] (* {1, 4, 9} *) If you want the output to be displayed like a sum, use Row: Row[%, "+"] (* 1 + 4 + 9 *) And when you want to evaluate, simply use Total: Total[%%] (* 14 *) There is another solution (see David's comment): Sum[(HoldForm[#] &)[i^2], {i, 3}] (* 1 + 4 + 9 *) To explain ...


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


4

Could use GroebnerBasis as below. rels = {a^2 - a, b^2 - b, c^2 - c}; gb = GroebnerBasis[Join[{a + b - (1 + 2 c)}, rels], {a, b, c}]; Thread[Complement[gb, rels] == 0] (* Out[337]= {-1 + a + b == 0, c == 0} *) Here it is packaged into a function: binarySimplify[eq_, vars_] := Module[{rels, gb}, rels = (#^2 - # &) /@ vars; gb = ...


1

The following should do what you want eqnToBool={Times->And,Plus->Xor,i_Integer:>OddQ[i]}; boolToEqn={And->Times,Xor->Plus,True->1,False->0}; eqToRules={Equal->Rule}; reduceBool[eq_]:=Resolve[Exists[{},eq/.eqnToBool],Booleans] simplifyBool[eq_]:=Module[{newEqns={}}, ...


0

Try this: MyFunc[y__] := (D[f[x], {x, Length[{y}]}]/(Length[{y}])!) /. x -> First[{y}] Example: f[x_] := Sin[x] MyFunc[3, 5] (*-(Sin[3]/2)*)


1

Have you tried these substitution? ReplaceAll[ ReplaceAll[ a + b == 1 + 2*c, {Times -> And, Plus -> Xor, i_Integer :> OddQ[i]} ], {And -> Times, Xor -> Plus, True -> 1, False -> 0} ] Or something along these lines? I also think your second example is wrong, because when you're performing a computation mod ...


1

Reduce[Join[{a + b == 1 + 2 c, {a, b, c} \[Element] Integers}, 0 <= # <= 1 & /@ {a, b, c}]] (*(a == 0 && b == 1 && c == 0) || (a == 1 && b == 0 && c == 0)*) Reduce[Join[{a + 2 b a + 2 c == 2 d, {a, b, c, d} \[Element] Integers}, 0 <= # <= 1 & /@ {a, b, c, d}]] (*(a == 0 && b == 0 ...



Top 50 recent answers are included