wolfram-mathematica

ListPlot With Two Data Sets in Mathematica

二次信任 提交于 2019-12-03 20:16:36
Is there a cleaner way to do the following, assuming that I have a reason to keep the data sets independent?: x = {1, 2, 3}; y = {1, 4, 9}; ListPlot[Partition[Riffle[x, y], 2]] Thanks! Davorak I do not think Timo's solution is standard. Here are two methods, using Transpose or Thread , that I have often seen used. x = {1, 2, 3}; y = {1, 4, 9}; Transpose[{x, y}] Thread[{x, y}] Output: {{1, 1}, {2, 4}, {3, 9}} {{1, 1}, {2, 4}, {3, 9}} Both of these methods avoid explicitly referencing the length of your data which is plus in my book. ListPlot[Transpose[{x, y}]] ListPlot[{x,y}] EDIT: @Davorak: it

Why doesn't RuleDelayed hold Unevaluated?

自古美人都是妖i 提交于 2019-12-03 19:38:29
问题 The Mathematica 's evaluator generally holds (or restores?) Head s Unevaluated of expressions supplied as arguments for Symbol s: In[1]:= f[s, Unevaluated[1 + 1]] Out[2]= f[s, Unevaluated[1 + 1]] In[5]:= Trace[f[s,Unevaluated[1+1]],TraceOriginal->True] Out[5]= {f[s,Unevaluated[1+1]],{f},{s},f[s,1+1],f[s,Unevaluated[1+1]]} But it is not true for RuleDelayed . Moreover, any number of Unevaluated wrappers are stripped in the case of RuleDelayed : In[1]:= Attributes@RuleDelayed RuleDelayed[s,

is mathematica able to do some planar geometry plotting

可紊 提交于 2019-12-03 16:30:13
I am trying to use computer to show some planar geometry plots. I donot know what software can do this, or whether mathematica can produce such plots easily. For example, I have the following plot to show. Given any triangle ABC, let AD be the line bisecting angle BAC and intersecting BC at D. Let M be the midpoint of AD. Let the circle whose diameter is AB intersects CM at F. How to produce these plots and show the relevant labeling of the points in mma? Is it easy to do? Could someone please give an example, or give some recommendation as to what software is best suited for this purposes?

Can anybody share a simple example of using Mathematica and Google scholar to extract academic research information

≡放荡痞女 提交于 2019-12-03 16:27:52
How can I use Mathematica and Google scholar to find the number of papers a person published in 2011? Google Scholar is not very suited for this goal as it doesn't have a formal API AFAIK. It also doesn't provide results in a structured (e.g. XML) format. So, we have to resort to a quick (and very, very fragile!) text pattern matching hack like: searchGoogleScholarAuthor[author_String] := First[StringCases[ Import["http://scholar.google.com/scholar?start=0&num=1&q=" <> StringDrop[ StringJoin @@ ("author:" <> # <> "+" & /@ StringSplit[author]), -1] <> "&hl=en&as_sdt=1,5"], ___ ~~ "Results" ~~ _

Is right-to-left operator associativity in R possible?

↘锁芯ラ 提交于 2019-12-03 16:16:33
问题 I'm new to R, and I just discovered I suffer from Bracket Phobia (see comment in the link). I like the way magrittr notation %>% works, because it avoids nested parenthesis in some situations, and makes code more readable. I came from Mathematica , where there is a very similar native // notation to do what %>% does. Here are some R and Mathematica comparisons: #R Notation c(1.5,-2.3,3.4) %>% round %>% abs %>% sum #Mathematica Notation {1.5,-2.3,3.4}//Round//Abs//Total So far so good, but, my

How do I create subplots in Mathematica using LevelScheme?

﹥>﹥吖頭↗ 提交于 2019-12-03 16:10:11
Consider the following arbitrary figure generated in MATLAB as an example. The basic idea is that I have a contour plot and I want to showcase selected slices from it in subplots on the right. Is there an equivalent of subplot in mma? The work around that I have right now is to have just the contour plot with the slices and the arrows and the two slice-plots separately and then put them together in latex. However, I'd like to be able to do this within mma. How do I go about doing this? An idea that I had is to generate a the contour plot with a full vertical & half horizontal aspect ratio, the

How to invoke a matlab function from mathematica?

假装没事ソ 提交于 2019-12-03 15:31:54
I would like to call a matlab function from mathematica. How best to do that? I have found an ancient post on Wolfram site describing a way to do this, is this still the way to connect the two? Szabolcs You can use mEngine . The precompiled Windows MathLink executable works with Mathematica 8. On Windows you may need to add MATLAB to the system path . The advantage of this compared to the NETLink method is that transferring variables between Mathematica and MATLAB will be as easy as mGet["x"] or mPut["x"] . Although this might be possible with NETLink too, the advantage of mEngine is that you

Is it possible to invoke Mathematica's diff functionality from the command line?

烂漫一生 提交于 2019-12-03 14:53:59
TortoiseSVN (as well as other Tortoise clients ) include a script to diff notebook files in Mathematica. Diff functionality for Mathematica is implemented in the AuthorTools package (perhaps there is something better?) The script currently works by creating a small notebook file in the temp directory, and opening it in the front end. The notebook has a big button that will do the diff and has the file names to be diffed hard coded. A disadvantage is that the notebook with the diff code will be left in the temp directory, and won't be cleaned up. It also seems unnecessary to have an auxiliary

Logarithmically spacing number

空扰寡人 提交于 2019-12-03 14:53:23
问题 I would like to test several values of intensity. I need them to be spaced logarithmically from 1 to 1000. Yet I just use 1, 10, 100, 1000, but I would like to have more data point, let`s say 10. How could I find 10 logarithmically spaced number between 1 and 1000 in Mathematica ? 回答1: If a is start, c is end and b is number of intervals: {a, b, c} = {1, 10, 1000}; t = (c/a)^(1/b) // N a*t^Range[b] 1.99526 {1.99526, 3.98107, 7.94328, 15.8489, 31.6228, 63.0957, 125.893, 251.189, 501.187, 1000.

Non-standard evaluation and PackedArray

喜夏-厌秋 提交于 2019-12-03 14:48:37
问题 I have earlier asked how to make allTrue[{x,list},test] function that protects the placeholder symbol x from evaluation in current context in the same way as Table[expr,{x,...}] protects x The recipe that I ended up using failed intermittently, and I found the problem down to be caused by automatic conversion of lists to PackedArrays. Here's a failing example SetAttributes[allTrue, HoldAll]; allTrue[{var_, lis_}, expr_] := LengthWhile[lis, TrueQ[ReleaseHold[Hold[expr] /. HoldPattern[var] -> #