wolfram-mathematica

ListPlot With Two Data Sets in Mathematica

十年热恋 提交于 2020-01-01 06:34:06
问题 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! 回答1: 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

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

大兔子大兔子 提交于 2020-01-01 06:27:22
问题 How can I use Mathematica and Google scholar to find the number of papers a person published in 2011? 回答1: 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[

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

假装没事ソ 提交于 2020-01-01 06:27:15
问题 How can I use Mathematica and Google scholar to find the number of papers a person published in 2011? 回答1: 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[

How do I create subplots in Mathematica using LevelScheme?

北城以北 提交于 2020-01-01 05:29:24
问题 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

Importing tables in Mathematica from web - empty cell problem

北城余情 提交于 2020-01-01 05:07:11
问题 I use: data=Import["http://weburl/","Data"] to import data from one site. On that page there are tables. This creates nested lists, and you can easily get the data in table form. For example: Grid[data[[1]]] would give something like this: Player Age Shots Goals P1 24 10 2 P2 22 5 0 P3 28 11 1 ... Now, here is the problem. If one cell in the html table is empty, for example an entry for "Age", then in html this would look like this: <td></td> . Mathematica doesn't include take it in the list

Conditional Data Manipulation in Mathematica

怎甘沉沦 提交于 2020-01-01 05:00:11
问题 I am trying to prepare the best tools for efficient Data Analysis in Mathematica. I have a approximately 300 Columns & 100 000 Rows. What would be the best tricks to : "Remove", "Extract" or simply "Consider" parts of the data structure, for plotting for e.g. One of the trickiest examples I could think of is : Given a data structure, Extract Column 1 to 3, 6 to 9 as well as the last One for every lines where the value in Column 2 is equal to x and the value in column 8 is different than y I

Is there any efficient easy way to compare two lists with the same length with Mathematica?

元气小坏坏 提交于 2020-01-01 04:42:05
问题 Given two lists A={a1,a2,a3,...an} and B={b1,b2,b3,...bn} , I would say A>=B if and only if all ai>=bi . There is a built-in logical comparison of two lists, A==B , but no A>B . Do we need to compare each element like this And@@Table[A[[i]]>=B[[i]],{i,n}] Any better tricks to do this? EDIT: Great thanks for all of you. Here's a further question: How to find the Maximum list (if exist) among N lists? Any efficient easy way to find the maximum list among N lists with the same length using

How to catch interrupts generated by TimeConstrained?

一个人想着一个人 提交于 2020-01-01 03:35:23
问题 Mathematica has the CheckAbort function which allows to catch and handle user-generated and programmatic Abort s. But it does not allow to catch interrupts generated by such functions as TimeConstrained and MemoryConstrained : TimeConstrained[CheckAbort[Pause[100], Print["From CheckAbort"]], 1] (does not print "From CheckAbort" ). Is there a way to catch such interrupts in Mathematica ? EDIT: I do know that third argument of TimeConstrained and MemoryConstrained allows to evaluate some code

Why do Replace and ReplaceAll give different results even when only one rule and one expression is used?

為{幸葍}努か 提交于 2020-01-01 02:31:11
问题 Maybe someone can explain to me why Replace gives a different answer than ReplaceAll , even though I am using one rule, and, I think, I have one expression. According to the documentation: ReplaceAll looks at each part of expr, tries all the rules on it, and then goes on to the next part of expr. The first rule that applies to a particular part is used; no further rules are tried on that part, or on any of its subparts and for Replace A list of rules can be given. The rules are tried in order

2 column documents in mathematica

风流意气都作罢 提交于 2020-01-01 02:18:08
问题 Mathematica can be used to write very nice documents. Does anyone know if it is possible to write documents with 2 columns? If so, can you provide some examples or links to other notebooks that show this style. 回答1: I don't think any good implementation of multicolumns are supported in Mathematica - it's not really compatible with the structure of the notebook interface. The fact that publicon does not support proper multiple columns is probably a good hint that Mathematica does not. Q: Does