Tag Info

Hot answers tagged

27

Other answers have already suggested ways of querying options. There's no way of systematically generating a list of all string values, but it's not too difficult to put together a list of all of the values which are used by Wolfram Research in Mathematica itself. If you look in the various files in these locations: ...


17

Have you tried adding AppendTo[$Path, FileNameJoin[{$UserBaseDirectory, "ExtraPackges"}]] to the file FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}] ? init.m is described here, under "more information".


14

I believe I would use: expr = Q1 a1 + Q2 a2 + Q3 a3 + Q4 a4 + Q5 a5 + Q6 a6 + Q7 a7 + Q8 a8 + Q9 a9 + Q10 a10 + Q11 a11 + Q12 a12 + Q13 a13 + Q14 a14 + Q15 a15 + Q16 a16 + Q17 a17 + Q18 a18 + Q19 a19 + Q20 a20 + Q21 a21 + Q22 a22 + Q23 a23 + Q24 a24 + Q25 a25 + Q26 a26 + Q27 a27 + Q28 a28 + Q29 a29 + Q30 a30 + Q31 a31 + Q32 a32 + Q33 a33 ...


13

These String items were directly read from the 10.0.2 Front End, including quite a few not listed elsewhere in this Q&A: {"AltKey", "ByteCount", "CellChangeTimesList", "CellCount", "CellStyleName", "CodeContext", "CommandKey", "ConnectedControllers", "ControlKey", "ControllerData", "ControllerState", "ControlsFontFamily", "ControlsFontSize", ...


13

The only method I am aware of is to attempt an operation that requires administrator-level permissions and look for a General::privv message: Check[ (CreateDirectory @ #; DeleteDirectory @ #) & @ FileNameJoin[{$InstallationDirectory, "test"}]; True, False, General::privv ] // Quiet This should return True if it is run with administrator ...


12

Perhaps: using systemnames = Names["System`*"]; Select[systemnames, CurrentValue[#] =!= $Failed &]; CurrentValue /@ % // Short (* ==> {False, {FrontEnd`FileName[{$UserBaseDirectory, "Autoload"}], ... } *) for the System` context, and replacing System with the appropriate context name for other members of the list Contexts[]?


9

To prevent your second invocation of SetOptions from resetting the value of sub-option "SymbolContextStyles", you need to set both "System" and "Global" sub-sub-option values at once: SetOptions[EvaluationNotebook[], "AutoStyleOptions" -> {"SymbolContextStyles" -> {"System`" -> RGBColor[211./255, 54./255, ...


9

To my understanding CurrentValue adds an alternative syntax to what Options and SetOptions provide for the frontend and notebooks. So in addition to what's documented I think Options[$FrontEnd] and Options[Notebook] would be a good starting point. These are what I usually consult when searching for something.


8

xQ = Q1 a1 + Q2 a2 + Q3 a3 + Q4 a4 + Q5 a5 + Q6 a6 + Q7 a7 + Q8 a8 + Q9 a9 + Q10 a10 + Q11 a11 + Q12 a12 + Q13 a13 + Q14 a14 + Q15 a15 + Q16 a16 + Q17 a17 + Q18 a18 + Q19 a19 + Q20 a20 + Q21 a21 + Q22 a22 + Q23 a23 + Q24 a24 + Q25 a25 + Q26 a26 + Q27 a27 + Q28 a28 + Q29 a29 + Q30 a30 + Q31 a31 + Q32 a32 + Q33 a33 + Q34 a34 + Q35 a35 + Q36 ...


7

Basing on Sjoerds self answer, you were missing the subdirectories. I added that and the tr files (don't know if it was worth something). Probably I'm missing some others because this doesn't check box structures, but it does get a few extras fnames = FileNames[ "*.nb" | "*.tr", {FileNameJoin[{$InstallationDirectory, "SystemFiles", ...


7

Replacement rules make this much easier, as Ymareth indicated. Make a list of rules like: r2 = {"x" -> Checkbox[True], "o" -> Checkbox[False], "u" -> Checkbox[3, {1, 2, 3}]}; Then apply these to the matrix m as: m/.r2 Note that this code is idiomatic Mathematica and imminently readable by anyone familiar with it. Nested For loops and ...


6

You can use the Find and Replace command: ⌘+F on the Mac or Ctrl+F on a PC.


6

Not an answer but I just wanted to observe that the $RecursionLimit info box (whatever that is called) has a formatting error on my Mac: Update halirutan: When I set $RecursionLimit to say 30, then hover the symbol and click on the information $i$, I sometimes get more than only wrong formatting:


6

Just to get an answer on record. As bobknight stated in the comments $InputFileName is bound to a string giving the full path name of the file being read when code loading operations initiated by Get, (<<), or Needs are in the process of loading. The file being loaded can make use this information, but the notebook requesting the load cannot (think of ...


6

It may suit your purpose to use the Windows API function IsUserAnAdmin. It can be accessed through NETLink like this: Needs["NETLink`"] isUserAnAdmin = DefineDLLFunction["IsUserAnAdmin", "shell32.dll", "bool", {}]; isUserAnAdmin[] (* True if Mathematica was launched elevated, False otherwise *) It is also possible to to use the shell command whoami to ...


5

Using Nasser's expression code as an example: expr = Sin[x] + Cos[y] + z^3 + Exp[d] + h + 3 h^2 + 4 h^3 + Integrate[Exp[p], p] + D[Sin[m]^Exp[f], m]*Series[Sin[g], {g, 0, 3}] + 2 (E^a BesselK[0, 2 Sqrt[E^a]]) C[2]/D[Gamma[w], {w, 2}]; You might use: Variables @ Level[expr, {-1}] {a, d, f, g, h, m, p, w, x, y, z} To extract indexed ...


5

Note that while the accepted answer obviously answers the question it is also possible to set values of System` and Global` individually. CurrentValue[EvaluationNotebook[], {"AutoStyleOptions", "SymbolContextStyles"}] (* {"System`" -> {}, "Global`" -> {}, Automatic -> {}} *) So to set only System`: CurrentValue[EvaluationNotebook[], ...


5

In addition to the other very useful answers, I'd like to start a collection of links to posts mentioning interesting CurrentValue items: The CurrentValue doc page Accessing the current style in a Graphics expression (e.g. CurrentValue["Color"])


5

You can do this programmatically by converting the expression to strings, replacing Qs with Rs and then converting it back to an expression. For example: expr := Q1 a1 + Q2 a2 + Q3 a3 + Q4 a4 + Q5 a5 + Q6 a6 + Q7 a7 + Q8 a8 + Q9 a9 + Q10 a10 + Q11 a11 + Q12 a12 + Q13 a13 + Q14 a14 + Q15 a15 + Q16 a16 + Q17 a17 + Q18 a18 + Q19 a19 + Q20 a20 + Q21 ...


4

ClearAll[x, y, z, d, h, p, m, f, g, a, w]; expr = Sin[x] + Cos[y] + z^3 + Exp[d] + h + 3 h^2 + 4 h^3 + Integrate[Exp[p], p] + D[Sin[m]^Exp[f], m]*Series[Sin[g], {g, 0, 3}] + 2 (E^a BesselK[0, 2 Sqrt[E^a]]) C[2]/D[Gamma[w], {w, 2}]; Cases[Variables[Level[expr, -1]], x_ /; AtomQ[x] :> x] (* {a, d, f, g, h, m, p, w, x, y, z} *)


4

Perhaps there's a better way than using Reduce three times, but it seems to me that the computations to figure out the range of each variable will have to be done somehow. Reduce does that. This will work on such simple inequalities as in the OP's example: And @@ (First@Reduce[a == b + c && a >= 2 && b <= 10 && c == 5, #] ...


4

{time, mean, std} = Transpose[Import["C:\\Users\\...\\Downloads\\MEANSDVALUES.xlsx"][[1]]] (* use the appropriate directory for your file *)


4

I don't know about temporary values, but if you want to monitor the progression of Nest you could use the following: intensiveCalculation[x_] := (Pause[0.5]; x + 1) Nest[(PrintTemporary[#]; #) &@ intensiveCalculation[#] &, 1, 5]


3

Clear[GetVariables] SetAttributes[GetVariables, HoldFirst]; GetVariables[expr_, f_:Identity, excludedContexts:{__String}:{"System`"}]:= Cases[Unevaluated[expr], a_Symbol/;!Or[ MemberQ[excludedContexts, Context[a]], MemberQ[Attributes[a], Locked | ReadProtected] ] :> f[a], {0, Infinity} ]//DeleteDuplicates It is used like ...


3

sr = {Exp[v_] :> v, v1_^v2_ :> {v1, v2}}; variables[expr_] := FixedPoint[Replace[Variables[# /. sr], _[x_] :> x, {1}] &, expr] variables[Sin[Subscript[x, 1]] + Cos[Subscript[x, 2]]] (* {Subscript[x, 1], Subscript[x, 2]} *) variables[Sin[x] + Cos[y] + z^3 + Exp[d] + h + 3 h^2 + 4 h^3 + Integrate[Exp[p], p] + D[Sin[m]^Exp[f], m]] (* {d, f, h, ...


3

This constitutes only a beginning (if that) of an answer, maybe more an extended comment. You seem to have some problems with your code. First, I don't think you need to define any of the following as functions (i.e., defined using := ): a, b, c, \[HBar], H0, G, \[CapitalOmega]M, \[CapitalOmega]\[Gamma], \ \[CapitalOmega]\[CapitalLambda], \[Lambda], f, y ...


3

the dK[2] just means the integral is with respect to K[2], $\int f(t) dt$ is exactly the same as $\int f(K[2]) dK[2]$ In this case, it appears in the solution because X1[x] is an unknown, so the only way for the differential equation to be formally solved is to include how it would affect the solution via the integrals. However, you can solve for x1 at ...


3

As the Locale & Internalization guide page says $TimeZone is resettable. If the developers would foresee adverse effects I guess they wouldn't have documented it in this way. The only problem that I can see is that you have to take care that your system time is also set to GMT, otherwise real-time calculations (e.g., elevation of the sun as seen in ...


3

The reason that MakeExpression has any FormatValues at all is because there's one defined in GetFEKernelInit.tr for some experimental functionality (which we probably ought to clean up in a future release). The fact that it's experimental also led to our not fully implementing the error-handling cases of typesetting, which is the source cause of the pink ...


3

a = {{1, 1, 1}, {1, 0, 1}}; b = {6, 4}; Reduce[{a.{x, y, z} == b, x > 0, y > 0, z > 0}, {x, y, z}, Reals] (* 0<x<4 && y == 2 && z == 4-x *) Find one instance: FindInstance[{a.{x, y, z} == {6, 4}, x > 0, y > 0, z > 0}, {x, y, z}, Reals] (* {{x -> 2,y -> 2,z -> 2}} *) Find three instances: ...



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