Tag Info

Hot answers tagged

24

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


15

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


11

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[]?


8

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


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


6

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.


6

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


6

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


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


5

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:


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

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

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"])


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

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]


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

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[], ...


4

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


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

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


2

Go to Notebooks->Notebook's Default Context and select Unique to this notebook: Now, could you possibly use more reasonable capitalization and punctuation in your questions?


2

I didn't put much effort into it but at least it works. Xsps[x_, r_] := 0.659*0.696*0.716*Sin[61 °]*0.5*(1 - r)*(Cos[x] - Cos[x]^3) Xssp[x_, r_] := (0.659*0.65*0.702* Sin[54 °])*0.5*(Cos[x]*(1 + r) - (1 - r)*Cos[x]^3) Xppp[x_, r_] := -(1.006*1.077*0.702*Cos[60 °]* Cos[61 °]* Sin[54 °]*0.5*(Cos[x]*(1 + r) - (1 - r)*(Cos[x]^3))) - ...


2

You can try the existance statement: Reduce[ Exists[{#2, #3}, a == b + c && a >= 2 && b <= 10 && c == 5 ], #1] & @@ RotateLeft[{a, b, c}, #] & /@ Range[0, 2] {2 <= a <= 15, -3 <= b <= 10, c == 5}


1

Some additional details on $Input. The Mathematica documentation states that $Input is bound to the name of the stream from which the loading file is being read. But what is that stream name? It appears to be whatever string Get, (<<), or Needs receive as their first argument. To test this hypothesis, I made a .m file with the following contents and ...


1

Perhaps what you are looking for is as simple as vars[expr_] := DeleteDuplicates@Cases[expr, _Symbol, \[Infinity]] vars[1 + y^2 + Sin[x] + Cos[x]] {y, x} Probably there are expressions on which this will fail, but it might handle those you are interested in.


1

You are not using the functions correctly In[9]:= DateString[] Out[9]= "Tue 30 Apr 2013 09:37:20" while In[10]:= DateString[TimeZone -> 0] Out[10]= "Tue 30 Apr 2013 07:37:26" and In[33]:= AstronomicalData["Sun", {"NextRiseTime", {2012, 10, 8, 6, 0, 0}}, TimeZone -> 1] Out[33]= {2012, 10, 8, 6, 35, 31.7528} In[34]:= AstronomicalData["Sun", ...



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