Hot answers tagged

11

The variable i is a dummy one. The evaluated expression: Sum[f[i], {i, 1, 10}] f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7] + f[8] + f[9] + f[10] contains no explicit variable f[i], hence, the result is 0. Try to first Inactivate the sum, and only then to calculate the derivative: expr1 = D[Inactivate[Sum[f[i], {i, 1, 100}], Sum], f[i]] The result is ...


4

Clear["Global`*"] Use Format to format output display of variables, e.g., rm and rp Format[rm] = Subscript["r", "-"]; Format[rp] = Subscript["r", "+"]; Solve[A (r - rp) == B, r][[1]]


4

You can use Alphabet + Tuples + StringJoin: StringJoin /@ Tuples[{Alphabet[], ToString /@ Range[5]}] {"a1", "a2", "a3", "a4", "a5", "b1", "b2", "b3", "b4", "b5", "c1", "c2", "c3", "c4", "c5", "d1",...


3

Would this work? Table[char <> ToString[num], {char, CharacterRange["A", "Z"]~Join~CharacterRange["a", "z"]}, {num, 60} ]~Flatten~1 (* Out: {"A1", "A2", "A3", "A4", "A5", "A6", "A7", ..., "Z59", "Z60", "a1", &...


2

Well one can 'overload' system functions of Mathematica using UpValues for user-defined symbols like the abstract symbol array in the following: ClearAll[array]; array/:Part[a_array,i_Integer]:=arrayGetPart[a,i] array/:Part[a_array,ij_Span]:=arrayGetSpan[a,ij] which for array[{1, 2, 3}] %[[1]] %%[[1 ;; 2]] results in calls to the currently undefined ...


1

Would this work for you? RSolveValue[{f[0] == 1, f[n] == 1 + Sum[f[i + 1], {i, 0, n - 2}]}, f[n], n]


1

You could modify how Solve works with subscripts: Unprotect[Solve]; Solve /: Solve[a__] /; !FreeQ[{a}, _Subscript] := Block[{CompressedData}, With[ {z = Unevaluated[Solve[a]] /. s_Subscript :> CompressedData[Compress[s]]}, z /; !MatchQ[z, _Solve] ] ] Protect[Solve]; Then: Solve[A (r - Subscript[r, "+"]) == B, r] {{r -&...


1

FoldPairList[TakeDrop, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 3, 3, 1}, Total @ *First] {1, 9, 18, 8} Alternatively, FoldPairList[{Total @ Take @ ##, Drop @ ##} &, {1, 2, 3, 4, 5, 6, 7, 8}, {1, 3, 3, 1}] {1, 9, 18, 8}


1

Clear["Global`*"] I recommend that you avoid the use of subscripted variables and instead use indexed variables. You can display the indexed variables in any desired manner using Format. Format[c[n_]] := Subscript[c, n] n = 5; var = Array[c, n] To set variables c[3] through c[n] equal to a constant Set[c[#], k] & /@ Range[3, n]; Then var ...


1

Input variables of functions in Mathematica should have _ at the end of their names. Using Subscript in Mathematica is a little tricky and sometimes leads to unexpected results. It's recommended to not use them. Also, you can't use _ in your variables, except in inputs of functions. But for your problem, I will show some alternatives: Solution 1 c3 = 2 f[c1_,...


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