wolfram-mathematica

Equation Threading: Why the default behavior?

会有一股神秘感。 提交于 2019-12-05 12:52:34
问题 I recently rediscovered a small package by Roman Maeder that tells Mathematica to automatically thread arithmetic and similar functions over expressions such as x == y. Link to Maeder's package. First, to demonstrate, here's an example given by Maeder: In[1]:= Needs["EqualThread`"] Now proceed to use the threading behavior to solve the following equation for x 'by hand': In[7]:= a == b Log[2 x] In[8]:= %/b Out[8]:= a/b == Log[2 x] Now exponentiate: In[9]:= Exp[%] Out[9]= E^(a/b) == 2 x And

Match legend and Plot size

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 12:30:09
Please Consider : intense = Reverse[Round[Rationalize /@ N[10^Range[0, 3, 1/3]]]]; values = Range[0, 9/10, 1/10]; intensityLegend = Column[Prepend[MapThread[ Function[{intensity, values}, Row[{Graphics[{(Lighter[Blue, values]), Rectangle[{0, 0}, {4, 1}], Black, Text[Style[ToString[intensity], 16, Bold], {2, .5}]}]}]], {intense, values}], Text[Style["Photons Number", Bold, 15]]]]; IntersectionDp1={{1., 588.377}, {2.15443, 580.306}, {4.64159, 573.466}, {10.,560.664}, {21.5443, 552.031}, {46.4159, 547.57}, {100.,545.051}, {215.443, 543.578}, {464.159, 542.281}, {1000., 541.346}} FindD1

Mathematica dynamic to plot matrix data

元气小坏坏 提交于 2019-12-05 11:33:45
I am trying to dynamically plot data contained in a matrix with Mathematica 7. The data is contained in it like this, obtained via a chemical model. [year H He Li C ... C8H14+,Grain- ] [0 0 0.03 0.009 1E-3 ... 0 ] [100 .1 0.03 0.009 1E-3 ... 0 ] [200 .2 0.03 0.009 1E-3 ... 0 ] [300 .2 0.03 0.009 1E-3 ... 0 ] [... ... ... ... ... ... ... ] [1E6 .5 0.03 0.003 1E-8 ... 1E-25 ] The truth is, the matrix dimensions are 2001*1476 (2000 steps and first line for name, and 1475 compounds + 1 column for year), very heavy. I am trying to plot any compound with a concentration / year plot. This works

How to form submatrices with some non-consecutive rows and columns of a matrix

邮差的信 提交于 2019-12-05 11:25:43
I have a 10 by 10 matrix. I want to form a sub-matrix from this main matrix, using all the rows and columns except the 1st, 2nd and 8th columns and rows. I know Part can be used to form the sub-matrix, but the examples are mostly about forming the sub-matrix using consecutive rows and columns only. If this is your matrix: tst = RandomInteger[10, {10, 10}]; This will do the trick for the case at hand: tst[[{3, 4, 5, 6, 7, 9, 10}, {3, 4, 5, 6, 7, 9, 10}]] Instead of explicit list, you could use Complement[Range[10],{1,2,8}] . Here's another way. Call your matrix test = Array[m, {10, 10}] Then

How do you set a global Abort handler?

送分小仙女□ 提交于 2019-12-05 11:06:13
In answering this question , I suggested that the OP open a stream at the beginning of his notebook and close it at the end. However, if an Abort is generated, the stream will be left open, and will cause havoc if they attempt to open it again without checking first. If the stream was only required for a single function, the solution would be straightforward, but it's required for the entire notebook. Obviously, a check can be added to see if the stream is already open, but is there a way to tie into the global Abort handler so that this type of problem can be handled globally? Edit : to be

How to redefine FrontEndEventActions?

孤街醉人 提交于 2019-12-05 10:43:40
Good day, This question comes from the question on aborting evaluation of the full sequence of inputs . I think it is probably possible to achieve the desired behavior by redefining FrontEndEventActions for two events: "EvaluateCells" (or pressing Shift + Enter ) and for pressing Alt + . . It should be something like: SetOptions[$FrontEndSession, FrontEndEventActions -> {"EvaluateCells" :> Last$PreRead, {{"Alt", "."} :> AbortAllNextInputs}}] or SetOptions[$FrontEndSession, FrontEndEventActions -> {{{"ShiftKey", "ReturnKeyDown"} :> Last$PreRead} {{"Alt", "."} :> AbortAllNextInputs}}] Where

FullSimply Inequalities and then rearranging them in Mathematica 7

筅森魡賤 提交于 2019-12-05 10:12:57
I am using Mathematica 7 in the notebook interface and I want to rearrange an inequality so that I get a certain variable on one side. For eg. FullSimplify[x^3+L+r>3x^3+2r] Gives L > r + 2 x^3 However, I want : r < L-2x^3 Is there anyway we can instruct FullSimplify to order variables in a particular way? I am using Mathematica for presentation as well so, the way I arrange the variables is important to me. Thanks SR Edit: I tried Reduce, while that works for this example, it does not work for the actual expression I have, I get an error saying, This system cannot be solved with the methods

Weird behaviour with GroebnerBasis in v7

痞子三分冷 提交于 2019-12-05 10:09:47
I came across some weird behaviour when using GroebnerBasis . In m1 below, I used a Greek letter as my variable and in m2 , I used a Latin letter. Both of them have no rules associated with them. Why do I get vastly different answers depending on what variable I choose? Image: Copyable code: Clear["Global`*"] g = Module[{x}, x /. Solve[ z - x (1 - b - b x ( (a (3 - 2 a (1 + x)))/(1 - 3 a x + 2 a^2 x^2))) == 0, x]][[3]]; m1 = First@GroebnerBasis[\[Kappa] - g, z] m2 = First@GroebnerBasis[k - g, z] EDIT: As pointed out by belisarius, my usage of GroebnerBasis is not entirely correct as it

How can I constrain locators to a limited (but not regular) set of positions?

泄露秘密 提交于 2019-12-05 09:58:22
In Mathematica, locators can be constrained to certain screen regions via the parameters of LocatorPane (See LocatorPane documentation.) A list of three ordered pairs {{{minX, minY}, {maxX, maxY}, {dX, dY}}} is usually the key to determining the behavior of locators. {minX, minY} and {maxX, maxY} set the region. {dX, dY} sets the jump size: zero for unrestrained, any other positive number for the size of each hop. In the code below, {{{-.9, 0}, {1, 0}, {0, 0}}} sets the region and jumps for the locator pts . The first two ordered pairs limit the locators to the interval [-9, 1] on the number

Is there a way to import the results or data from Matlab to Mathematica automatically?

…衆ロ難τιáo~ 提交于 2019-12-05 09:51:05
Is there a way to import the results or data (such as matrices) from Matlab to Mathematica automatically ? Or is there any way to run a Matlab program first and then run a Mathematica program automatically ? Thanks for any helpful answers! High Performance Mark There are at least three approaches to tackling this: 'Through' Java, using Mathematica's JLink and Matlab's own Java capabilities. Either program can be run from the command line, execute a script and return output as required. Both programs can run 'external' commands and capture the results. Look, for example, in the Mathematica