Tag Info

New answers tagged

0

If you want the two solutions for each i: r = {}; eqns = {Table[y[i]'[t] == 15 - (Exp[i]*10*Exp[-2*t] + 3)*y[i][t], {i, 0, 3}], Table[With[{ii = i}, {y[i][0] == 5, WhenEvent[y[ii][t] == 3, AppendTo[r, {ii, t}]]}], {i, 0, 3}]}; sol = NDSolve[eqns, ...


0

Flatten[Table[NSolve[(y[i][t] /. sol) == 3, t], {i, 0, 3}], 2] (* {t -> 1.00734, t -> 1.5086, t -> 2.0086, t -> 668.12} *)


0

result = ReplacePart[first, Thread[Rule[Position[first, a], t]]] ListPlot[Transpose[{t, result}]]


3

first = {1 + a, 2 + a, 3 + a, 4 + a}; t = {0, 1, 2, 3}; MapThread[#1 /. a -> #2 &, {first, t}] (* {1, 3, 5, 7}*) or #[[1]] /. a -> #[[2]] & /@ Transpose@{first, t} (* {1, 3, 5, 7}*)


6

The r.h.s of the assignments are evaluated sequentially. However, the symbols don't actually assume these OwnValues until the the evaluation of the body of Block begins. Example: In[8]:= Block[{a = (Print[{a, b, c}]; 1), b = (Print[{a, b, c}]; 2), c = (Print[{a, b, c}]; 3)}, {a, b, c}] During evaluation of In[8]:= {a,b,c} During evaluation of In[8]:= ...


0

In retrospect, all the clues were there… In order to run evolve on the parallel kernels Mathematica must first distribute the necessary definitions to those kernels, and recursively distribute the definitions involved in those definitions, all the way back. Which in my case turned out to involve way too much data (mostly a bunch of InterpolatingFunctions) ...


1

Did you try DistributeDefinitions[evolve] before running ParallelTable ?


6

You need to set the CellLabelAutoDelete option to False. You can do that in the Option Inspector in the Format menu.


2

Perhaps you can adapt something like this partial = Reap[CheckAbort[full=Table[Sow[expr]; expr, {i,1,1000}], Null]][[2,1]]


2

Solution to Question Part 1 Option 1: "Which one is the largest function within the range?" ClearAll["question*"]; questions = {{question1, 9.9-10\[Beta]}, {question2, 4.9-4.9\[Beta]}, {question3, -9.9+10\[Beta]}, {question4, -4.9+4.9\[Beta]}}; questions[[pos=Extract[ Position[#, Max@#]& @ ( Maximize[{#, ...


3

In addition to Jens comment: This is how you can find the cellproperties: EDIT(1): I've got an idea on how to improve the variable based method. You could create a wrapper function call it: code wich holds additional code, that can be turned on/off like this: evaluationRoutines = {1 -> True, 2 -> False, 3 -> True}; ClearAll[code] ...


1

step and injector pattern First method, load my step function and use the injector pattern: z2 := {{a, {1, 2, 3}}, {b, Complement[{1, 2, 3}, {a}]}, {c, Complement[{1, 2, 3}, {a, b}]}} step[z2] /. _[{x__}] :> Table[{a, b}, x] {{{{1, 2}}, {{1, 3}}}, {{{2, 1}}, {{2, 3}}}, {{{3, 1}}, {{3, 2}}}} UpValues definition Second method, use ...


4

You say that func[{1,2,3}] doesn't work, but in Mathematica we can actually define such functions. We just have to write func[{a_, b_, c_}] := a^2 + b^2 + c^2; and boom, now it works. Now you can do func /@ list or func@Transpose@list The latter works because of something called "listability". You can also use that with your original definition of ...


2

Use Apply. The following will work: func @@@ list Example: In[1]:= f @@ {1, 2, 3} Out[1]= f[1, 2, 3] In[2]:= f @@@ {{1, 2, 3}, {4, 5, 6}} Out[2]= {f[1, 2, 3], f[4, 5, 6]}


2

Maybe you can use the following two constructs to your advantage, which will keep the Conjugate, but evaluate and simplify the derivative inside. Using ReleaseHold, you can then evaluate even the Conjugate. Note that I left out the divisor in the Conjugate-case for clarity, but you can easily add that into the second function's definition. d[g_] := ...


1

The official list of defined Symbols is here: http://reference.wolfram.com/language/guide/AlphabeticalListing.html You can find the usage message for all System` Symbols that have one with: msg = MakeExpression@# /. _[x_] :> MessageName[x, "usage"] &; Cases[msg /@ Names["System`*"], _String] Warning: it is slow.


1

If you want a list of all built-in commands, just type: Names["System`*"] If you want all the information of them: Information/@Names["System`*"]


0

Flatten @ Names[#] & /@ (StringJoin[#, "*"] & /@ CharacterRange["A", "Z"])


1

Perhaps you are installing the wrong notebook as your palette. Installing a palette involves two notebooks and the palette installation dialog. First, the source notebook which contains the code that generates the palette notebook. Note that I have given the palette window a name. This is important when come to install it. -nb Second, the palette ...


0

As stated in comments: This means that you have interrupted the calculation. Most likely you did not do this through using the Dialog function but by using the Evaluation -> Interrupt Evaluation item or accidentally pressing the corresponding shortcut key. You can resume by evaluating Return[].


3

hIters = Hold[{{a, {1, 2, 3}}, {b, Complement[{1, 2, 3}, {a}]}, {c, Complement[{1, 2, 3}, {a, b}]}}] hIters2 = Hold[{a, {1, 2, 3}}, {b, Complement[{1, 2, 3}, {a}]}, {c, Complement[{1, 2, 3}, {a, b}]}] Delete[Hold[Table][{a, b}, hIters], {{0, 0}, {2, 0}, {2, 1, 0}}] ReleaseHold[Hold[Table][{a, b}, hIters2]] Function[Null, Table[{a, b}, ##], ...


9

General I think that one can achieve the goal much easier if we reformulate the request. A variable is IMO not a proper object to store an iterator in the form of expression. What you really need is an environment, which would use certain iterator in code. Simple lexical / dynamic environment Here is how it may look: ClearAll[withIterator]; ...


5

For version 10, another way to use the Inactive/Activate combination with @Kuba's set-delayed trick for defining z2: z20:={{a, {1, 2, 3}}, {b, Complement[{1, 2, 3}, {a}]}, {c, Complement[{1, 2, 3}, {a, b}]}}; Activate@Block[{Complement=Inactive[Complement], Table=Inactive[Table]},Table[{a,b,c}, ##&@@z20]] (* {{{{1, 2, 3}}, {{1, 3, 2}}}, {{{2, 1, 3}}, ...


5

How aboutInactivate? m = Sequence @@ MapThread[{#1, Inactive[Complement][#2, #3]} &, {vars, cr, varsx}]; res = Inactive[Table][vars, m] // Activate (* {{{{{2, 1, 0, 3}}, {{2, 1, 3, 0}}}, {{{2, 3, 0, 1}}, {{2, 3, 1, 0}}}}, {{{{3, 1, 0, 2}}, {{3, 1, 2, 0}}}, {{{3, 2, 0, 1}}, {{3, 2, 1, 0}}}}} *) Another approach, two variations: ClearAll[tab]; ...


7

Would this work for you? m = Sequence @@ MapThread[{#1, comp[#2, #3]} &, {vars, cr, varsx}]; tab[vars, m] /. {tab -> Table, comp -> Complement} (* {{{{{2, 1, 0, 3}}, {{2, 1, 3, 0}}}, {{{2, 3, 0, 1}}, {{2, 3, 1, 0}}}}, {{{{3, 1, 0, 2}}, {{3, 1, 2, 0}}}, {{{3, 2, 0, 1}}, {{3, 2, 1, 0}}}}} *)


2

Crucial, for answer to this question, is: why parts of our expression should "stay unevaluated". = in Mathematica is Set function. If we want to express assignment, but just don't want to evaluate it, then we can use = and HoldForm like in rasher's answer, or, if we just want to suppress Set evaluation, we can Inactivate it: Inactivate[Subscript[W, f[a, ...


8

Not sure if this fits your needs: z2 := Sequence[{a, {1, 2, 3}}, {b, Complement[{1, 2, 3}, {a}]}, {c, Complement[{1, 2, 3}, {a, b}]}] Unevaluated @ Table[{a, b}, z2] /. OwnValues @ z2 {{{{1, 2}}, {{1, 3}}}, {{{2, 1}}, {{2, 3}}}, {{{3, 1}}, {{3, 2}}}} You can use z2 with Set here too: z2 = Unevaluated @ Sequence[{a, {1, 2, 3}}, {b, ...


3

This is not as general as Nasser's answer but in case of output being there you can use: SetOptions[$FrontEndSession, EvaluationCompletionAction -> "ScrollToOutput"]


4

You can use Evaluate to "force evaluation of the right-hand side of a delayed definition" (as stated in its documentation). For example f[x_] := Simplify[Sqrt[x^2], x > 0] Definition@f f[x_] := Simplify[Sqrt[x^2], x > 0] g[x_] := Evaluate@Simplify[Sqrt[x^2], x > 0] Definition@g g[x_] := x


5

I just tried this, and it seems to work. See if it works for you. Type this in first cell (thanks to Kuba suggestion, changed it to use SelectionMove[EvaluationCell[]) SetOptions[EvaluationNotebook[], CellProlog :> SelectionMove[EvaluationCell[], All, Cell]] You can make the above an initialization cell. Then Evaluation->Evaluate notebook. now it ...


2

res = TraditionalForm[ HoldForm[Subscript[W, f[a, b]][ c] == \[Rho]^f[a, b] \[Omega][c] \[Rho]^-f[a, b]]]; res /. {c -> 7, f[a, b] -> 5}; For your second question you can try this: g[a_,b_]:=a Sin[b]; res /. {c -> 7, f[a, b] -> g[2 , 3]}


2

ls = HoldForm[Subscript[W, f[a, b]][c] = ρ^f[a, b] ω[c] ρ^-f[a, b]] ReplaceRepeated[ls, {f[a, b] -> 5, c -> 7}] Then just TraditionalForm that...


3

Pulling the Linksnooper out of your pocket was the right call and I guess you would have found this yourself soon. Please don't ask me about the why, because I don't know it. Additionally, I have only tested this on Linux. Let's create a small test using the "EvaluatorAbort" FE token Button["Abort", FrontEndExecute[FrontEndToken["EvaluatorAbort"]]] You ...


1

First of all correcting the sign in the exponential we get f2 = Integrate[ Exp[r^2/(2 M^2)] (b^2 - 3 r^2)^2 (Abs[b^2 + r^2] - (b^2 - r^2))/( r (r^2 - b^2)), {r, 0, I \[Infinity]}, Assumptions -> {M > 0, b > 0] (* Out[278]= 18 b^2 M^2 + 4 b^4 E^(b^2/(2 M^2)) ExpIntegralEi[-(b^2/(2 M^2))] *) Taking the pricipal value has no influence as ...



Top 50 recent answers are included