A121 === Subject: Re: Mathematica notebooks There does not seem to be any such restriction for the Semester Edition, the Annual Edition, or the regular unlimited-time edition. Here is the entirety of the Product Summary for the Semester Edition; the language for the other two editions is similar: Mathematica for Students: Semester Edition is available for immediate download. It is a convenient and affordable option for students who may need the capabilities of Mathematica for only one or two prerequisite or elective classes. This time-limited version of Mathematica for Students is activated upon registration and expires six months later. A 12-month Annual Edition is also available. For those needing Mathematica for Students for more than one or two classes, the standard version is available. Note: Mathematica for Students is intended for students enrolled in accredited academic institutions and is for use on a student's own personal computer. Valid proof of student status is required prior to purchasing Mathematica for Students. > I htink the last time I checked they were only available to students at > institutions that have Mathematica site licenses. > If this has changed I am very glad to hear of it. > Of course there IS a time-limited, cheap student version of Mathematica >> available. In fact, two such: a 6-month version and a 12-month version. > .... A time limited cheap student version > available to any student, whether at an institution that has a site > license or not, would make an enormous contribution to the adoption of > Mathematica, >> -- >> Murray Eisenberg murray@math.umass.edu >> Mathematics & Statistics Dept. >> Lederle Graduate Research Tower phone 413 549-1020 (H) >> University of Massachusetts 413 545-2859 (W) >> 710 North Pleasant Street fax 413 545-1801 >> Amherst, MA 01003-9305 > -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 === Subject: Re: Mathematica notebooks the best method I think the last time I checked they were only available to students at institutions that have Mathematica site licenses. If this has changed I am very glad to hear of it. Andrzej Kozlowski > Of course there IS a time-limited, cheap student version of > Mathematica > available. In fact, two such: a 6-month version and a 12-month > version. >> .... A time limited cheap student version >> available to any student, whether at an institution that has a site >> license or not, would make an enormous contribution to the adoption >> of >> Mathematica, -- > Murray Eisenberg murray@math.umass.edu > Mathematics & Statistics Dept. > Lederle Graduate Research Tower phone 413 549-1020 (H) > University of Massachusetts 413 545-2859 (W) > 710 North Pleasant Street fax 413 545-1801 > Amherst, MA 01003-9305 > === Subject: Rotate axes label in 3D graphics I plotted two 3D surface figures, g1 and g2, and compined them using Show[] as the following: Show[ g1, g2, AxesLabel->{x, y, intensity} ] How can I rotate the label on the third axes? Alternatively I tried using Epilog->{ Rotate[ {Text[StyleForm[intensity],{ } ] ,Pi/2 } but got error message Graphics::gprim: <.....omit> was encountered where a Graphics primitive or directive was expected Can anyone tell me how to solve this problem? === Subject: Re: Rotate axes label in 3D graphics Plot3D[x*Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, AxesLabel -> {x, y, }, PlotRangePadding -> 0.25] /. Graphics3D[dta_, opts___] :> Graphics3D[{dta, Text[intensity, {-2.4, -2.4, 1}, {0, 0}, {0, 1}]}, opts] Jens I plotted two 3D surface figures, g1 and g2, and compined them using > Show[] as the following: Show[ g1, g2, AxesLabel->{x, y, intensity} ] How can I rotate the label on the third axes? > Alternatively I tried using Epilog->{ Rotate[ {Text[StyleForm[intensity],{ coord> } ] ,Pi/2 } but got error message Graphics::gprim: <.....omit was encountered where a Graphics primitive or directive was expected > Can anyone tell me how to solve this problem? > === Subject: same color above a treshold in ArrayPlot or ContourPlot, I need to color the points exceeding a certain treshold with the same color (say red). I guess that could be done defining an appropriate ColorFunction... but I cannot work it out. Could anyone help me? Luigi === Subject: Re: same color above a treshold ContourPlot[x*Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, PlotRange -> All, ColorFunctionScaling -> False, ColorFunction -> (If[Abs[#] > 0.25, RGBColor[1, 0, 0], RGBColor[0, 2 # + 1, 0]] &)] for z-values < 1/4 Jens > in ArrayPlot or ContourPlot, I need to color the points exceeding a > certain treshold with the same color (say red). > I guess that could be done defining an appropriate ColorFunction... > but I cannot work it out. > Could anyone help me? Luigi > === Subject: Re: The FinancialData Function I've never heard of this function, but have one immediate strong reaction/question: Is there -- or will there soon be -- a fully open, officially standardized, fully and openly specified, widely and near universally accepted, stable, long-term, NON-proprietary set of **formats** for the data and information that is to be transmitted back and forth between data providers and data users in this system? [Something akin to the more or less open, universal and stable graphics standards that have emerged over time.] Lacking that, I wouldn't personally go near this kind of financial data distribution system and related tools like FinancialData for building anything that was of any real and continuing importance to me. Think of mapping data, GPS and topographic data, or satellite imagery and related software tools as an analogous system. I play with some of this data, plan journeys using MapQuest, hiking trips using Google Earth (an incredible tool), etc -- but if someone suddenly decided to change all the standards for this data, I could still use all my old stored data and tools -- or just do without. (There would of course be many important commercial enterprises that would be much more seriously impacted.) But then suppose people get important, continuing personal or business activities deeply involved in an information system that uses tools like FinancialData; the data providers and Wolfram somehow get cross-wise commercially; and the data providers threaten to change their formats just enough to screw Wolfram (and all FinancialData users). Or, suppose the data providers decide to throw digital rights management complexities all over their data, as is the case now with music, films, video -- and the deep pockets financial data providers manage to bribe Congress to require that all computer tools like FinancialData contain provisions to enforce these DRM complexities. This may all come across as paranoid fears, and maybe it is -- but look what has actually happened in other areas of widely distributed electronic information distribution . . . === Subject: Re: The FinancialData Function > I've never heard of this function, but have one immediate strong > reaction/question: Is there -- or will there soon be -- a fully open, officially > standardized, fully and openly specified, widely and near universally > accepted, stable, long-term, NON-proprietary set of **formats** > for the data and information that is to be transmitted back > and forth between data providers and data users in this > system? [Something akin to the more or less open, universal and stable graphics > standards that have emerged over time.] Lacking that, I wouldn't personally go near this kind of financial data > distribution system and related tools like FinancialData for building > anything that was of any real and continuing importance to me. Why? You can export to any format you like (for archiving). FinancialData has nothing to do with data exchange formats. It simply gives you the requested data as a Mathematica expression. It spares you the trouble of having to import the data manually to Mathematica. === Subject: Re: finding positions of elements in a list > Having a few problems here with what I think should be a simple operation. I have a list as shown: mylist={{20, 109}, {20, 110}, {20, 111}, {21, 105}, {21, 106}, {21, 107},...} It's a list of {x,y} co-ordinates of some data points I'm analysing. I want to create a new list which contains only those data points whose y co-ordinate is greater than 80 ie. mylist[[n,2]]>80. Problem is, I can't work out how to use Select to do this when each element in the list has an x and a y co-ordinate. If I split the list into x and y co-ordinates and searched for those y values greater than 80, I would have a list of those y-values but would not know the corresponding x-values. I also tried Position but it wasn't clear to me if a pattern can be used for this. FWIW, Here is a summary of most of the post with some new solutions and some benchmarking to get you inspired by the versatility of Mathematica programming language. In[1]:= myList = {{20, 109}, {20, 110}, {20, 111}, {21, 105}, {21, 106}, {21, 107}} myList /. {x_, y_ /; y <= 107} -> Sequence[] Cases[myList, {x_, y_ /; y > 107}] DeleteCases[myList, {x_, y_ /; y <= 107}] Select[myList, Last@# > 107 &] Pick[myList, Thread[myList[[All, 2]] > 107]] myList[[Flatten@Position[myList, {_, y_ /; y > 107}]]] Table[If[myList[[j]][[2]] > 107, myList[[j]]], {j, Length[myList]}] /. Null -> Sequence[] If[#[[2]] > 107, #] & /@ myList /. Null -> Sequence[] Out[1]= {{20, 109}, {20, 110}, {20, 111}, {21, 105}, {21, 106}, {21, 107}} Out[2]= {{20, 109}, {20, 110}, {20, 111}} Out[3]= {{20, 109}, {20, 110}, {20, 111}} Out[4]= {{20, 109}, {20, 110}, {20, 111}} Out[5]= {{20, 109}, {20, 110}, {20, 111}} Out[6]= {{20, 109}, {20, 110}, {20, 111}} Out[7]= {{20, 109}, {20, 110}, {20, 111}} Out[8]= {{20, 109}, {20, 110}, {20, 111}} Out[9]= {{20, 109}, {20, 110}, {20, 111}} In[10]:= myList = Table[Sequence @@ myList, {20000}]; myList /. {x_, y_ /; y <= 107} -> Sequence[] // Timing // First Cases[myList, {x_, y_ /; y > 107}] // Timing // First DeleteCases[myList, {x_, y_ /; y <= 107}] // Timing // First Select[myList, Last@# > 107 &] // Timing // First Pick[myList, Thread[myList[[All, 2]] > 107]] // Timing // First myList[[Flatten@Position[myList, {_, y_ /; y > 107}]]] // Timing // First Table[If[myList[[j]][[2]] > 107, myList[[j]]], {j, Length[myList]}] /. Null -> Sequence[] // Timing // First If[#[[2]] > 107, #] & /@ myList /. Null -> Sequence[] // Timing // First Out[11]= 0.147246 Out[12]= 0.098208 Out[13]= 0.113085 Out[14]= 0.15736 Out[15]= 0.084279 Out[16]= 0.230995 Out[17]= 0.342529 Out[18]= 0.295696 In[19]:= $Version Out[19]= 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) -- === Subject: Separate input/output files A typical Mathematica notebook contains input and output together. With the objective of separating input and output for convenience and also eliminating repeated input commands and statements, I like to write two separate smaller files somewhat as under: ------ Harmonic.in Constant [{yi,ydi,w,tmax} = { 1.,.2, 1.,8.}]; NDSolve[{Y''[t]+w^2 Y[t]==0, Y[0]==yi,Y'[0]==ydi},Y,{t,0,tmax}]; y[t_]= Y[t] /.First[%] ; (* above two lines to be labelled ODE *) Plot[y'[t],{t,0,tmax}]; (* above line to be labelled PLT*) yi=2.; w=7. ; tmax= 4 ; Table[ {t,y[t],y'[t]}, {t,0,tmax,tmax/15.}]//ColumnForm (* above line to be labelled TABL*) Plot[y[t],{t,0,tmax}]; (* Only tmax = 4 takes effect but not yi and w, the quantities inside NDSolve curly barckets, do not take effect *) ------------ Harmonic.run yi = 1.6; w = 2; tmax= 4.; ODE PLT ydi = 2.; w = 1.2; tmax= 2.5 ; ODE PLT TABL --------------- Harmonic.out (* Contains output for ODE, PLT,TAB for changed input parameters, Harmonic.run lines echoed before respective outputs *) ------------- How to make such a file separation possible? Such separation I believe is convenient for dynamical simulation exercises. Narasimham === Subject: Re: Separate input/output files > A typical Mathematica notebook contains input and output together. > With the objective of separating input and output for convenience and > also eliminating repeated input commands and statements, I like to > write two separate smaller files somewhat as under: Take a look at the Splice[] command and the following program: http://ai.eecs.umich.edu/people/dreeves/mash/ === Subject: Re: floating point issue > K = Rationalize[{111.5, 10.5, 1.5}, 0]; > g = Rationalize[{-0.7071068, 0., -0.7071068}, 0]; K.Cross[K, g] 0 FWIW, On my system v6.0.2 Mac Os X 1.5.2 64-bit, g = Rationalize[{-0.7071068, 0., -0.7071068}] returns the list unevaluated. To get a list of nice/exact numbers, I must use *RootApproximant* (and of course K must be rationalized as well). Only then I can get the value of zero for the dot-cross product. In[1]:= $Version K = Rationalize@{111.5, 10.5, 1.5} g = RootApproximant@{-0.7071068, 0., -0.7071068} K.Cross[K, g] Out[1]= 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) Out[2]= {223/2, 21/2, 3/2} Out[3]= {-(1/Sqrt[2]), 0, -(1/Sqrt[2])} Out[4]= 0 In[5]:= K = Rationalize@{111.5, 10.5, 1.5} g = Rationalize@{-0.7071068, 0., -0.7071068} K.Cross[K, g] Out[5]= {223/2, 21/2, 3/2} Out[6]= {-0.707107, 0, -0.707107} Out[7]= 3.19744*10^-14 In[8]:= K = {111.5, 10.5, 1.5} g = {-0.7071068, 0., -0.7071068} K.Cross[K, g] Out[8]= {111.5, 10.5, 1.5} Out[9]= {-0.707107, 0., -0.707107} Out[10]= 3.19744*10^-14 -- === Subject: Re: floating point issue As shown previously, use 0 as the tolerance (dx) to force rational. g = Rationalize[{-0.7071068, 0., -0.7071068}, 0] Bob Hanlon > K = Rationalize[{111.5, 10.5, 1.5}, 0]; > g = Rationalize[{-0.7071068, 0., -0.7071068}, 0]; > > K.Cross[K, g] > > 0 FWIW, On my system v6.0.2 Mac Os X 1.5.2 64-bit, g = Rationalize[{-0.7071068, 0., -0.7071068}] returns the list unevaluated. To get a list of nice/exact numbers, I > must use *RootApproximant* (and of course K must be rationalized as > well). Only then I can get the value of zero for the dot-cross product. > In[1]:= $Version > K = Rationalize@{111.5, 10.5, 1.5} > g = RootApproximant@{-0.7071068, 0., -0.7071068} > K.Cross[K, g] Out[1]= 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) Out[2]= {223/2, 21/2, 3/2} Out[3]= {-(1/Sqrt[2]), 0, -(1/Sqrt[2])} Out[4]= 0 In[5]:= K = Rationalize@{111.5, 10.5, 1.5} > g = Rationalize@{-0.7071068, 0., -0.7071068} > K.Cross[K, g] Out[5]= {223/2, 21/2, 3/2} Out[6]= {-0.707107, 0, -0.707107} Out[7]= 3.19744*10^-14 In[8]:= K = {111.5, 10.5, 1.5} > g = {-0.7071068, 0., -0.7071068} > K.Cross[K, g] Out[8]= {111.5, 10.5, 1.5} Out[9]= {-0.707107, 0., -0.707107} Out[10]= 3.19744*10^-14 > -- > > === Subject: Re: Mathlink: How do I pass arbitrary data from Mathematica to C? > I am trying to write some code to interface Mathematica to a closed- > source library written in C. I'm using Mathlink for this, which is > typically used to interface Mathematica to external functions - see > for example > http://reference.wolfram.com/mathematica/tutorial/SettingUpExternalFu... > For example, if the library has a function 'f' with the following > prototype: > int f(int x, int y); > the following in a Mathlink template (.tm file) will allow me to call > this function from Mathematica by the name Foo, if I link to the > library., create an > executable, then install that executable in Mathematica with > Install[]. > :Begin: > :Function: f > :Pattern: Foo[x_Integer, y_Integer] > :Arguments: {x, y} > :ArgumentTypes: {Integer, Integer} > :ReturnType: Integer > :End: > (There is no need for me to write the function f, as that has been > done. I just need to link to the library containing the function f, in > much the same way you use the 'pow' function in C without writing it - > you would just link to the maths library.). > I have no problem with the above - it all works as expected. > The problem occurs with a function 'g', which instead of having only > integer arguments, takes a pointer to some data. The format of the > data is not specified - the C function just needs to know where in > memory the data is, and how many bytes there are. The C prototype is > int g(const void *data, long nbytes); > Does anyone know how I can write a Mathematica template so when I link > with the function 'g', I can pass the data properly? Note, that since > the library is closed-source, I am not able to change the calling > method in any way. But I expect it should be possible to write an > interface in C, such that data is passed from Mathematica in a form > compatible with Mathematica, and then converts it to a from the C > library accepts. But I am stuck as how to do this. > If its not possible to do this with a template, can it be done by > writing it all in C? If so, how? > I don't want Mathematica to try to interpret the data in any way - > just to pass an address of where the data is in memory, and also the > number of bytes of data. Than the library function g will return an > integer, which I want to pass back to Mathematica. > Someone suggested that I might look at the C code generated by mcc to > work out how to do this, (perhaps making use of MLPutInteger), but I > can't work out how to do this. > Does that make sense? Any ideas how to pass arbitrary data to a C > program? > I have a similar issue in trying to get arbitrary data from C to > Mathematica, but that is another story. >> When you pass data over MathLink, you are communicating between two >> processes - so no pointers can be passed. It certainly sounds as though >> you need to write an interface routine in C - as you suggest. Presumably >> you know the structure of this data, so perhaps you could transmit it >> from Mathematica in pieces and assemble it in the required format in the >> interface routine. >> Perhaps you should tell us the structure of this data, and how big it is. >> David Baileyhttp://www.dbaileyconsultancy.co.uk The data will be passed to some hardware via a library routine written > in C. For example, the first bit of data might bea command like RESET, the > next might be LOADFILE The next bit of data might be a binary file. > Hence I need to find a way of passing an arbitrary collection of > bytes. It might be one byte, two bytes, three bytes ... up to a couple > MB or so. I will know the exact length. It it was a file I wanted to send, then I assume something like > data=BinaryReadList[filenane.dat,Character8] would be suitable to read it, then I would need to send the contents > of 'data' But equally the data might just be a bit of text. > I think the easiest answer is to write a few little C routines which take data items of the various types and append them to a data structure (presumably a char[]). You will also need one C routine to initialise the array, and one to send the end result to its destination. The only problem with this scheme might be if it is too slow for your requirements (because of the number of MathLink calls), but I would certainly start with that approach. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Any body can help me solve the equation with piecewise function I have a problem to solve, but it seems not easy because of the piecewise function involved. I am wondering how we should deal with piecewise function when solving an equation or doing optimization. To give you an simple example, the piecewise function is f(x)= 3x if x<0; f(x)= 0 if x>=0. And I want to solve the equation f(x)+6=0. I actually define the piecewise function at first using Which and then try to use NSolve to solve it. However, NSolve doesn't work through. Anybody know how should I solve this kind of problem generally in Mathematica? Of course, for this simple example, we can divide it into two cases and then compare the solutions after solving the two cases. Yet my problem is more general and involves more than 3 piecewise functions, thus a lot of possible cases to deal with. So any command or function to deal with this kind of general problem? === Subject: Minimum width of Button[.] on different platforms Manipulate[Button[Null, ImageSize -> w], {w, 1, 100}] On my Windows XP PC, Button[.]s are always at least 8 pixels wide. On my friend's Mac, they are always at least 68 pixels wide. 68 seems a lot. Is there any way for Mathematica to force buttons on Mac OS X to render smaller than that? === Subject: Minimum width of Button[.] on different platforms A related curiosity: Button[Null, ImageSize -> 0] Button[Null, ImageSize -> 1] Button[Null, ImageSize -> 2] On my Windows XP PC, the actual apparent width of these buttons are: 10 pixels 9 pixels 8 pixels -----Original Message----- === Subject: Minimum width of Button[.] on different platforms Manipulate[Button[Null, ImageSize -> w], {w, 1, 100}] On my Windows XP PC, Button[.]s are always at least 8 pixels wide. On my friend's Mac, they are always at least 68 pixels wide. 68 seems a lot. Is there any way for Mathematica to force buttons on Mac OS X to render smaller than that? === Subject: Re: Operate on Heads I would like to thank to all respondents to my posted questions on this, as well as on previous topics. I would try to explain some of my desires? on a rather simple example related to some natural events I have a number of Modules (subroutines, functions, or whatever one prefer to call it) With (subject, object(s), event(s), action(s)) structure. For example, a subject is an Earth based location triad, Objects are Sun and Moon, Events are Rise and Set, ... Based on interrelations of all of above, Some unique action, based on the state of the system, should be described/specified, and executed One way to solve this problem is to have all logic in the main program and have a possibly large number of small modules, Each describing a unique but simple action. The logic could, in principle, be implemented via combination of If,Then,Else,Switch; And,Or,... ; (pattern construction) Alternatives; or something better ? In this simple example we have (hidden/protected possibly someone else or even Mathematica own) commands such as Set (possibly the same name for two completely different commands), Rise, but also commands (modules, or whatever) SunRise, SunSet, MoonRise, MoonSet, which name (Head) is a composite word. I have dealt with such situations along the lines described by Januk, tnx, and via fun[A,B,C][a,b,c][t] Polygon @@ Line Type of structures. The last line Apply approach actually just replaces the Head name. In principal no problem when I have my own relatively simple structures, however, ... Some of my Modules are to often inside some loops (Table, Plot). In complex interrelations between a larger number of objects and events, logic is becoming cumbersome and all things are getting to slow. Thus my imperative in those situations is getting under the hood, if I can and if I have enough time, And speed things up. Now comes Mathematica's sentence Operate is essentially a generalization of Apply, which allows you to apply an operator to the head of an expression, rather than simply to replace the head What this really means? This is what stimulated me, since I smell (possibilities toward) a number of better, more elegant, more efficient, solutions to my problems ... Of course there might be some Pandora Boxes in between ... (non)technical issues, etc. C pointers and list of all lists, the machine code list, and its 1:1 twin called assembler are coming to mind ... -----Original Message----- === Subject: Re: Operate on Heads Hi Andy, A basic approach would be to convert everything to strings, use Mathematica's string manipulation commands to create the expression you'd like evaluated, then convert back to an expression. See below for a simple example. f[something_, x__] := Module[{strArgs, strHeads}, strHeads = ToString[something]; strArgs = Riffle[ToString /@ {x}, ,]; (* Manipulate your heads here *) strHeads = StringReplace[strHeads, p -> P]; StringJoin[strHeads, [, strArgs, ] ] // ToExpression ] f[plus, 2, 3] Hope that helps, Januk On Mar 16, 6:49 am, Dr Andy D Kucar P2EE4 www.radio4u.com > I would like to be able to pass a composite name Head, e.g., > FirstSecondThird to a Module, > and then, inside the module, use FirstSecondThird, First, Second, Third Heads, and/or make other Operate ions on Heads How could this be accomplished? > === Subject: Re: Fast way to select those elements from a list that are in another > Unfortunately, Pick[a, Thread[a == b]] doesn't perform the same task. In > subsequently evaluates to true: >> SameQ[s1,s2,Sequence[]] >> SameQ[s1,s2] >> True This brings up an interesting quirk: you can only use SameQ to verify that > two things are identical if you can be sure that none of them is Sequence[]! You are right, of course. Sorry about my silly post! (I totally missed the point). -- === Subject: Re: Fast way to select those elements from a list that are in another Unfortunately, Pick[a, Thread[a == b]] doesn't perform the same task. In subsequently evaluates to true: >> SameQ[s1,s2,Sequence[]] >> SameQ[s1,s2] >> True This brings up an interesting quirk: you can only use SameQ to verify that two things are identical if you can be sure that none of them is Sequence[]! -----Original Message----- === Subject: Re: Fast way to select those elements from a list that are in another > Two lists of integers: {a, b} = Table[RandomInteger[10000, 1000], {2}]; Which elements from a are in b? Select[a, MemberQ[b, #] &]; // Timing > {0.351, Null} It takes about 0.351 seconds (on my slow laptop). Specialised > functions for related tasks, such as Intersection[a, b], are much > faster: Intersection[a, b]; // Timing > {0., Null} Using Intersection, here's a somewhat faster way to select those > elements from a that are in b: With[ > {c = Intersection[a, b]}, > Select[a, MemberQ[c, #] &] > ]; // Timing > {0.09, Null} Is there a better, faster way to do this? Andrew, I have came up with the following, which is, I believe, the fastest among all solutions that have been posted (as of today): Pick[a, Thread[a == b]] For instance, {a, b} = Table[RandomInteger[10000, 1000], {2}]; s1 = Select[a, MemberQ[b, #] &]; // Timing // First s2 = With[{c = Intersection[a, b]}, Select[a, MemberQ[c, #] &]]; // Timing // First s3 = Pick[a, Thread[a == b]]; // Timing // First (* 0.127442 0.01327 0.000111 True *) -- === Subject: Re: Fast way to select those elements from a list that are in another > Two lists of integers: {a, b} = Table[RandomInteger[10000, 1000], {2}]; Which elements from a are in b? Select[a, MemberQ[b, #] &]; // Timing > {0.351, Null} It takes about 0.351 seconds (on my slow laptop). Specialised > functions for related tasks, such as Intersection[a, b], are much > faster: Intersection[a, b]; // Timing > {0., Null} Using Intersection, here's a somewhat faster way to select those > elements from a that are in b: With[ > {c = Intersection[a, b]}, > Select[a, MemberQ[c, #] &] > ]; // Timing > {0.09, Null} Is there a better, faster way to do this? Andrew, I have came up with the following, which is, I believe, the fastest among all solutions that have been posted (as of today): Pick[a, Thread[a == b]] For instance, {a, b} = Table[RandomInteger[10000, 1000], {2}]; s1 = Select[a, MemberQ[b, #] &]; // Timing // First s2 = With[{c = Intersection[a, b]}, Select[a, MemberQ[c, #] &]]; // Timing // First s3 = Pick[a, Thread[a == b]]; // Timing // First (* 0.127442 0.01327 0.000111 True *) -- === Subject: Re: IsIntegerOrFloat for comparison, IIOF1[list_]:=With[{ll=Flatten@list}, If[Length[ll]==Length[Cases[ll,_Real|_Integer]], True,False]]; (* Peter Breitfeld *) (* Szabolcs Horvat *) IIOF3[expr_]:=Cases[expr, {False}->False/.{}->True; (* Gulliet *) IIOF4[expr_]:=VectorQ[expr,NumberQ[#]&&(Head[#]=!=Rational)&& (Head[#]=!=Complex)&]; (* Andrzej Kozlowski *) (* Albert Retey's submission not tested since it wasnt wrapped as function *) A timing test on a random-float list of 10^6 items gives (version 5.2 on MacBook Pro laptop running Mac OS X 10.4.11, dual 2.3GHz Intel processors) IIOF1 0.396629 Second IIOF2 2.47186 Second IIOF3 2.81298 Second II0F4 2.9122 Second I have no idea why IIOF1 is about 6 times faster than the others. === Subject: Re: IsIntegerOrFloat > (* Albert Retey's submission not tested since it wasnt > wrapped as function *) I just wanted to mention that it is just as good wrapped as a function as the others, it just makes definitions for more than one kind of arguments: IIOF5[n_Real] := True IIOF5[n_Integer] := True IIOF5[lst_List] := And @@ (IIOF5/@ lst) IIOF5[___] := False You can use IIOF5 just as any function with just one definition. I think this i a very common and useful technique in mathematica, especially for functions like this, which shall return either True or False for any kind of argument given (in mathematica, these usually end with Q for Question). If speed matters - as you have indicated with your comparisons - IIOF5 comes out as second best only, so you might also consider this: IIOF6[expr_List] := Union[Union[data[[All, 0]]], {Real, Integer}] == Union[{Integer, Real}] timings: {#, Timing[#[data];][[1]]} & /@ {IIOF1, IIOF2, IIOF3, IIOF4, IIOF5, IIOF6} { {IIOF1, 0.641}, {IIOF2, 3.593}, {IIOF3, 4.079}, {IIOF4, 4.156}, {IIOF5, 1.094}, {IIOF6, 0.265} } > I have no idea why IIOF1 is about 6 times faster than the others. In general things like this are not always easy to explain. In this case it looks like the use of pattern matching vs. extraction of heads seams to be crucial to improve speed. This was also what made me come up with IIOF6... hth, albert === Subject: Re: IsIntegerOrFloat One possibility is IsIntegerOrFloat[list_List] := VectorQ[list, MemberQ[{Real,Integer}, Head[#]]&] Bhuvanesh, Wolfram Research === Subject: Re: Number of monomials > To count the number of terms in a sum, use e.g. > Length[{ Sequence@@sum }] Sorry, this is incorrect. I think that the only reliable way to count the number of terms in a sum is to explicitly check if there is only one or more terms. numOfTerms[terms_Plus] := Length[terms] numOfTerms[term_] := 1 === Subject: Re: Global setting of Graphics options for plot, listplot, listlogplot... > Has anyone any experience (v6) with setting global graphics options. > What I want to do is fairly simple. I want all my graphics to have a > frame, automatic gridlines of a particular colour and the same font > etc. Fonts are easy, I can set those as in Option Inspector (Formatting > Options/Expression Formatting/Graphics Box Options/GraphicsBoxOptions) > in BaseStyle and DefaultBaseStyle. Setting Frame and GridLinesStyles here is not a good plan though as > plot legends and graphics Grid use invisible graphics boxes to > position things. Adding frames and grids lines to all graphics boxes > will corrupt these place holder boxes. I can, in my init.m file introduce altered values for Options[Plot] > with Frame->True etc but I have to do this for Plot, ListPlot, > LogPlot, ListLogPlot etc of which there are quite a few. Question is can anyone think of a better way? > I believe that there is no better way. You must set options explicitly for all plotting functions that you wish to alter. However, this can be done with a single SetOptions command: SetOptions[{Plot, ListPlot, ParametricPlot, ...}, Frame -> True, Axes -> False] But note that several of the graphics options have different default settings between these functions. === Subject: Re: Global setting of Graphics options for plot, listplot, listlogplot... I would recommend against spending too much time trying to make a 'universal plot format'. You can certainly do it if you are producing repetitive plots of a specific type, say weather data plotted each day or a number of experimental data runs whose results were quite similar. But the average technical person is going to have a range of graphics requirements. Each set of data or each mathematical idea will require its own style of presentation if the message is going to be conveyed with maximum effectiveness. What this come down to is that graphics is work if you really want to convey the clearest message and each graphic requires its individual treatment. Nevertheless, there are things you can do for a number of similar plots. One approach is to create your own Show statement with the desired options: MyShow[plot_] := Show[plot, Frame -> True, GridLinesStyle -> GrayLevel[0.8], GridLines -> Automatic, BaseStyle -> {FontSize -> 12}, ImageSize -> 450] This works fairly well for simple linear scale plots. MyShow[Plot[Sin[x], {x, 0, 6 [Pi]}]] data = Table[{x, x Cos[x]}, {x, 0, 6 [Pi], 6 [Pi]/100}]; MyShow[ListPlot[data]] But not for Log plots because there the grid has to be generated within the Log plot. MyShow[LogPlot[x!/(1 + x^2), {x, 0, 3}]] So you could make a second Show statement that did not set the GridLines so you could inherit them from the Log plot. MyLogShow[plot_] := Show[plot, Frame -> True, GridLinesStyle -> GrayLevel[0.8], BaseStyle -> {FontSize -> 12}, ImageSize -> 450] MyLogShow[LogPlot[x!/(1 + x^2), {x, 0, 3}, GridLines -> Automatic]] But then, do you really like Mathematics's choice of GridLines there? So trying to create a universal plot format or style will only tend to divert you from the much more interesting issues that have to do with your individual plots and probably won't save you much time in the long run. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > Has anyone any experience (v6) with setting global graphics options. > What I want to do is fairly simple. I want all my graphics to have a > frame, automatic gridlines of a particular colour and the same font > etc. Fonts are easy, I can set those as in Option Inspector (Formatting > Options/Expression Formatting/Graphics Box Options/GraphicsBoxOptions) > in BaseStyle and DefaultBaseStyle. Setting Frame and GridLinesStyles here is not a good plan though as > plot legends and graphics Grid use invisible graphics boxes to > position things. Adding frames and grids lines to all graphics boxes > will corrupt these place holder boxes. I can, in my init.m file introduce altered values for Options[Plot] > with Frame->True etc but I have to do this for Plot, ListPlot, > LogPlot, ListLogPlot etc of which there are quite a few. Question is can anyone think of a better way? > ZSG > === Subject: Re: Dynamic and J/Link > I'm using Java to do some agent-based modeling and am wondering what > the best way is to create a dynamic graphic that will update > automatically whenever the state of the simulation changes. Suppose - for sake of argument - that the simulation is a single Java > object saved in a Mathematica variable called model. Suppose that > calling the Java method step() advances the simulation one iteration > and that calling the Java method getState() returns a rectangular 2D > array of 0s and 1s. Now, one easy way of representing the state of > the model is by using Raster, so the following gives a basic graphic > representation: Graphics[ Raster[model@getState[]] ] Suppose, now, that we wrap that statement with Dynamic as follows: Dynamic[ > Graphics[ Raster[ model@getState[] ] ] > ] If I then evaluate the following, the displayed graphic doesn't change > at all, even though (intuitively, at least) it should: model@step[]; > Update[ model ] For some reason, calling Update on the variable model doesn't cause > the Dynamic object in the notebook to recognize that it needs to > refresh the displayed graphic. Why is that? Now, the only way I've found to solve this problem is the draw the > display using a second variable which contains a local copy of the > state of the Java object. First, set up the initial display in the > notebook as follows: array = model@getState[]; > Dynamic[ > Graphics[ Raster[ array ] ] > ] then manually update the variable array each time the simulation > changes: model@step[]; > array = model@getState[]; (* This triggers a redisplay *) The two irritations about this are that it (a) it requires polluting > the current Mathematica's session namespace with another variable that > doesn't do anything except hold a value which could be easily obtained > by calling model@getState[], and (b) it requires some (minor) > additional code to configure each display. Those aren't real worries, > but it does suggest that I'm not doing this the most efficient way. Is the above solution the best (or, indeed, only) way to get Dynamic > to recognize state changes of J/Link objects? Does anyone else have My experience is also that Update is, unlike stated in the documentation, not really causing Dynamic to realize changes, even in other circumstances. Others have given hints about workarounds, another thing that probably helps is the UpdateInterval option of Dynamic. Of course it doesn't do the same thing, but in many cases where external processes are involved in my opinion it is an even better approach. Other than that I have also used global variables that just indicate the changing of something that otherwise wouldn't be recognized by Dynamic. To make your code more clean and robust, it is probably a good idea to encapsulate this in an extra function as David Bailey has suggested. hth, albert === Subject: Re: conversion of sin to cos > Hello all, Here is my problem. I have a very long product of cosines with > arguments of the form k*Pi, k being integers. > I want to convert this expression to a sum of cosines. TrigReduce > works fine, except that it converts cos to sin. > So, I want all the sin (after the TrigReduce) to be converted to cos > and the arguments be of the form p*Pi, p being rational of course. > It has something to do with Hold or HoldAll, but I don't know the > details. Or perhaps the TrigReduce can be overridden > somehow. > Can someone help? > Hi Glenn, you don't need a CAS for this. I'll just use Mathematica syntax here: For integer k: Cos[k*Pi]==(-1)^k. If your product is Product[Cos[k[i]*Pi],{i,1,n}], then it can be written as (-1)^Mod[Sum[k[i],{i,1,n}],2] or if you insist on cosines: Cos[Mod[Sum[k[i],{i,1,n}],2]*Pi]. Peter === Subject: Re: conversion of sin to cos > Hello all, Here is my problem. I have a very long product of cosines with > arguments of the form k*Pi, k being integers. Cos[k*Pi] == (-1)^k, so your expression is probably a bit more complicated than that :-) > I want to convert this expression to a sum of cosines. TrigReduce > works fine, except that it converts cos to sin. > So, I want all the sin (after the TrigReduce) to be converted to cos > and the arguments be of the form p*Pi, p being rational of course. Have you tried expression /. Sin[a_] :> Cos[a - Pi/2] or expression /. Sin[a_] :> Cos[Collect[a - Pi/2, Pi]] or expression /. Sin[a_] :> Cos[Collect[a - Pi/2, Pi, Together]] ? It would be easier to answer if you posted a short sample of a Sin-expression that you need converted to a Cos-expression. > It has something to do with Hold or HoldAll, but I don't know the > details. Hold[] just prevents evaluation of its arguments. HoldAll is not a function, but an attribute. It is the attribute that gives Hold[] its magic. > Or perhaps the TrigReduce can be overridden > somehow. > Can someone help? > === Subject: Re: conversion of sin to cos > Here is my problem. I have a very long product of cosines with > arguments of the form k*Pi, k being integers. > I want to convert this expression to a sum of cosines. TrigReduce > works fine, except that it converts cos to sin. > So, I want all the sin (after the TrigReduce) to be converted to cos > and the arguments be of the form p*Pi, p being rational of course. > It has something to do with Hold or HoldAll, but I don't know the > details. Or perhaps the TrigReduce can be overridden > somehow. Hi Glenn, Please, could you post an actual (short) example of such a product as well as what you get having trigreduced it? Meanwhile, Simplify/FullSimplify with the option ComplexityFunction might be what you are looking for. -- === Subject: Re: conversion of sin to cos > Hello all, Here is my problem. I have a very long product of cosines with > arguments of the form k*Pi, k being integers. > I want to convert this expression to a sum of cosines. TrigReduce > works fine, except that it converts cos to sin. > So, I want all the sin (after the TrigReduce) to be converted to cos > and the arguments be of the form p*Pi, p being rational of course. > It has something to do with Hold or HoldAll, but I don't know the > details. Or perhaps the TrigReduce can be overridden > somehow. > Can someone help? > It might be helpful to give a small actual example of what you want to achieve. As you have described it, I would have thought the answer would reduce to +1 or -1. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: conversion of sin to cos > Hello all, Here is my problem. I have a very long product of cosines with > arguments of the form k*Pi, k being integers. > I want to convert this expression to a sum of cosines. TrigReduce > works fine, except that it converts cos to sin. > So, I want all the sin (after the TrigReduce) to be converted to cos > and the arguments be of the form p*Pi, p being rational of course. > It has something to do with Hold or HoldAll, but I don't know the > details. Or perhaps the TrigReduce can be overridden > somehow. > Can someone help? Cos[J Pi] is + or - depending on whether J is respy even/odd . If there are m odd Pis and n even Pis, then J = m alone decides the sign, - for odd m and + for even m. HTH === Subject: Re: variance of product of 2 independent variables Hi Rudy, obvioulsy the equation - ^2^2 = v(a) +v(b) + v(a)v(b) is wrong. You can see this easily by considering the units. This also gives a hint how to correct: - ^2^2 = v(a)^2 +v(b)^2 + v(a)v(b) hope this helps, Daniel > Hello Ben - I have a question about the subject matter. To review, you sent Frank > Brand the following: < correlations among them), > then you can compute the variance of their product quite easily v(ab) := < a^2b^2 > - < ab >^2 = - ^2^2 = v(a) + > v(b) + v(a)v(b); > v(a)=-^2, v(b)=-^2 here v(.) denotes variance, <.> denotes mean. > Note that we do not have to assume normal distributions for a and b, > essential is that their are uncorrelated, hence the means of products > factor into products of means. If = 1000 and = 0.001, and v(a) = 100 and v(b) = 1e-10 (in other > words, both a and b have 1% standard deviations), then I compute v(ab) = > 100*0.001 + 1e-10*1000 + 100*1e-10 ~ 0.1 > which is obviously wrong ( = 1.000 and std deviation would be > sqrt(0.1) = 0.31. Help! Da stimmt was nicht! Rudy dankwort > Phoenix AZ USA > === Subject: Re: Import pdf problem > Importing PDFs does indeed sometimes fail in my experience. I suggest > that you forward such examples to Wolfram so that they have cases that > they can degub from... --David > A WorkLife FrameWork > E x t e n d i n g MATHEMATICA's Reach...http://scientificarts.com/worklife/ > Hi all, > I'm importing data from pdf documents on a web site. This works well > most of the time. But for a few of the pdfs, Mathematica barfs and > does not return either the Pages or the Plinatext. (I am only > really interest in the Plaintext.) Instead it produces error > messages such as Expected PDF object and Expected array operator > argument, etc. > Here are actual examples. First, one that works fine: > Import[http://www.cmegroup.com/daily_bulletin/Section09_Interest_ > Rate_And_Energy_Futures_2008017.pdf, Rules] > Next, one that does not work fine: > Import[http://www.cmegroup.com/daily_bulletin/Section09_Interest_ > Rate_And_Energy_Futures_2008016.pdf, Rules] > Finally, one that really bums out Mathematica (it produces a Runtime > error from Visual C++): > Import[http://www.cmegroup.com/daily_bulletin/Section09_Interest_ > Rate_And_Energy_Futures_2008022.pdf, Rules] > Note that Adobe has no problem opening and reading the ones that give > Mathematica problems. > Presumably, this behavior is a bug. Have others encountered such > problems with other pdf files? (FYI, I'm using version 6 for Windows.) > --Mark Done. --Mark === Subject: AuthorTools obsolete Is there/will there be a replacement for AuthorTools. Kevin -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: mathematica 64-bit for ms windows But be aware that if you are buying a new computer, from Dell at least, and you specify a 64 bit microprocessor, you will not necessarily get a 64 bit operating system, and may not even be able to install a 64-bit operating system. So if you are looking to use 64-bit Mathematica check out very carefully before purchase that you will indeed have a 64-bit operating system. As I understand it, the main advantage of a 64-bit operating system is that you can address more memory, beyond 2GB, but that it is not significantly faster - and may even be slower. (Others may correct me or expand on this.) -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > hi > while browsing about the mathematica products i have noticed that there > is no something stated lucidly like: > mathematica 64-bit for windows > while there is such a statement (64-bit) regarding mathematica for Linux > does that mean that there is a one package for windows in which the > installer will detect whether the windows OS is 32 bit or 64 bit and will > install accordingly ?? > peter === Subject: Re: Test for Irreducibility of certain polynomials with Hi Guillermo, how can you determine if a polynomial is irreducible if the coefficients are unknown? It seems to me that you have to specify d before you can say if it is irreducible. hope this helps, Daniel > Hi there, I want to test the irreducibility of the following polynomials of > degree r with Mathematica. H[x_,d_] := Sum[(-d + 1)^(j)*Binomial[r - j, j]*x^(r - 2*j), {j, 0, (r - > 1)/2}] I use the Mathematica function > IrreducibleQ[p_?PolynomialQ,Modulus->m_]:=Module[{f=FactorList[p,Modulus->m]} , > Total[Last/@DeleteCases[f,{_Integer,_Integer}]]==1 > ] But I want Mathematica to consider H[x,d] as a function in x (not in x > and d). Is it possible??? Guillermo > === Subject: Re: more looping trouble > Sorry for these lame questions but I'm still trying to get my head around > loops. I though I had it but I hit a snag today. I have a table of numbers {{1,2,3},{2,3,4}} I want to use a loop to remove > the third integer in each set and reassemble them as a new table. > However, something is going wrong I think it's because i'm not grasping some > fundamental idea about how to perform these type of operations on tables. for many many cases you won't even need a Map or other constructs when learning that many functions in Mathematica work to various levels in nested lists, here I think the following will not only be very simple and easy to read but also quite efficient: lst = {{1, 2, 3}, {a, b, c}, {x, y, z}}; Take[lst, All, 2] hth, albert === Subject: 2d distribution in 3d Space I'm trying to plot 2d distributions (like a bell curve) in 3d space. I tried combining a contour plot with a regional plot with this code ---------------------------------------------------------------------------- plot1 = RegionPlot3D[x y z < 1, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, PlotStyle -> Directive[Yellow, Opacity[0.5]], Mesh -> None]; slice1 = ContourPlot3D[ y == 2*x - 4, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, Mesh -> False, BoxRatios -> {1, 1, 1}, AspectRatio -> 1]; Show[plot1, slice1] ---------------------------------------------------------------------------- however, I can't constrain the z-values to get the shape of the distribution, I just get a continuous plane that extends from the top to the bottom of the graph. Any hints? === Subject: NDSolve Singularity The following input for NDSolve is giving me a singularity error (see error message below). As a result, my system of equations is being solved until the singularity at t=0.179 and not until t=30 as va = 4.71*y[t] - 246; q = 6; kl = 5; kt = 40; b = 760; mrco2 = 250; caco2 = 48 + 6*(paco2 - 40)/7; paco2 = (b - 47)*r[t]; fico2 = 0.07; grodinstime0to30 = NDSolve[{r'[ t] == (1/ kl)*((fico2*va + 8.63*q*(y[t] - caco2)/(b - 47) - r[t]*va)), y'[t] == (mrco2 + 10*q*(caco2 - y[t]))/(10*kt), r[0] == 0.058, y[0] == 0.533}, {r, y}, {t, 0, 30}] ERROR MESSAGE: NDSolve::ndsz: At t == 0.17926445744166167`, step size is effectively zero; singularity or stiff system suspected. >> === Subject: Re: NDSolve Singularity if you look at your equations you see that the equation for r[t] include a term r'[t]== .. + 40.3234 * r[t] + .. and this must explode because it gives r[t] proportional to Exp[40.3234 *t] So there is only one solution .. solve other equations I would suggest {r'[t]==0,y'[t]==0} or fix you equations / parameters. Jens The following input for NDSolve is giving me a singularity error > (see error message below). As a result, my system of equations is > being solved until the singularity at t=0.179 and not until t=30 as va = 4.71*y[t] - 246; > q = 6; > kl = 5; > kt = 40; > b = 760; > mrco2 = 250; > caco2 = 48 + 6*(paco2 - 40)/7; > paco2 = (b - 47)*r[t]; > fico2 = 0.07; > grodinstime0to30 = > NDSolve[{r'[ > t] == (1/ > kl)*((fico2*va + 8.63*q*(y[t] - caco2)/(b - 47) - r[t]*va)), > y'[t] == (mrco2 + 10*q*(caco2 - y[t]))/(10*kt), r[0] == 0.058, > y[0] == 0.533}, {r, y}, {t, 0, 30}] > ERROR MESSAGE: > NDSolve::ndsz: At t == 0.17926445744166167`, step size is effectively > zero; singularity or stiff system suspected. > > === Subject: Re: Part or Partition or Split or Extract or ...... ???? First I tried the way Bill Rowe has suggested A =Import[new3.txt,Lines]; In[2]:= GetridOFF = A[[1]] Out[2]= (300a,011c) DS [2555] # 6, 2 LeafJawPositions In[3]:= StringReplace[GetridOFF,{RegularExpression@^.+ [->,RegularExpression@= [.+$->}] be followed by !(= (([.+$ -> ))).!() !(*ButtonBox[More..., ButtonStyle->RefGuideLinkText, ButtonFrame->None, ButtonData:>General::sntxf]) It shows some error .. which i did not understand !! Can you please tell me what it could be.. In[4]:= StringCases[GetridOFF,RegularExpression[(? import elem1 of file imported as format. Import[file, {format, elem1, subelem1, ...}] ---> When elem1 is itself a list of elements, you can import its subelements. This one means import the subelem1 of elem1 (when elem1 is a list of rules) of the file imported as format. Import[file, {format, {elem1, elem2, elem3...}}] ---> This is the syntax for importing multiple elements. To make things a little more confusing ;), there's a shorthand notation when the second argument is *only one string*: You can omit the {}'s: Import[file.pdf, Author] Import[file.pdf, Title] Import uses FileFormat[] for format detection if you don't explicitly specify the format, but the {}'s must remain as shown above if your second argument contains more than one string. Igor -- Igor C. Antonio Wolfram Research, Inc. http://www.wolfram.com To email me personally, remove the dash. > Hi all, I find Import wonderful but frustrating. For example, I can get > individual items such as Author and Title in separate calls: Import[file.pdf, Author] > Import[file.pdf, Title] but I can't get a list as in Import[file.pdf, {Author, Title}] Instead I get an error message that say Title is not present (which > seems misleading at best, since I already accessed it above). Is that > syntax supposed to work or not? (Frankly, I'm having a hard time > figuring out what the proper generic syntax is for Import, especially > since there are so few examples in the documentation.) BTW, I found out I can use {Author, Title} /. Import[file.pdf, Rules] Is that what I should be doing? (It seems like overkill since Import > has to import a bunch more stuff that I don't want, at least in this > example.) --Mark === Subject: Re: Import syntax question > Hi Mark, You should do: Import[file.pdf, {{Author, Title}}] or Import[file.pdf, {PDF, {Author, Title}]. The general syntaxes for extracting elements are: Import[file, {format, elem1}] > ---> import elem1 of file imported as format. Import[file, {format, elem1, subelem1, ...}] > ---> When elem1 is itself a list of elements, you can import its subelements. > This one means import the subelem1 of elem1 (when elem1 is a list of rules) of > the file imported as format. Import[file, {format, {elem1, elem2, elem3...}}] > ---> This is the syntax for importing multiple elements. To make things a little more confusing ;), there's a shorthand notation when the > second argument is *only one string*: You can omit the {}'s: Import[file.pdf, Author] > Import[file.pdf, Title] Import uses FileFormat[] for format detection if you don't explicitly specify > the format, but the {}'s must remain as shown above if your second argument > contains more than one string. Igor -- > Igor C. Antonio > Wolfram Research, Inc.http://www.wolfram.com To email me personally, remove the dash. > Hi all, > I find Import wonderful but frustrating. For example, I can get > individual items such as Author and Title in separate calls: > Import[file.pdf, Author] > Import[file.pdf, Title] > but I can't get a list as in > Import[file.pdf, {Author, Title}] > Instead I get an error message that say Title is not present (which > seems misleading at best, since I already accessed it above). Is that > syntax supposed to work or not? (Frankly, I'm having a hard time > figuring out what the proper generic syntax is for Import, especially > since there are so few examples in the documentation.) > BTW, I found out I can use > {Author, Title} /. Import[file.pdf, Rules] > Is that what I should be doing? (It seems like overkill since Import > has to import a bunch more stuff that I don't want, at least in this > example.) > --Mark --Mark === Subject: Re: Import syntax question > Of course you could do something like Import[file.pdf, #]&/@ {Author, Title} though it does call Import twice.... --David > A WorkLife FrameWork > E x t e n d i n g MATHEMATICA's Reach...http://scientificarts.com/worklife/ > Hi all, > I find Import wonderful but frustrating. For example, I can get > individual items such as Author and Title in separate calls: > Import[file.pdf, Author] > Import[file.pdf, Title] > but I can't get a list as in > Import[file.pdf, {Author, Title}] > Instead I get an error message that say Title is not present (which > seems misleading at best, since I already accessed it above). Is that > syntax supposed to work or not? (Frankly, I'm having a hard time > figuring out what the proper generic syntax is for Import, especially > since there are so few examples in the documentation.) > BTW, I found out I can use > {Author, Title} /. Import[file.pdf, Rules] > Is that what I should be doing? (It seems like overkill since Import > has to import a bunch more stuff that I don't want, at least in this > example.) > --Mark I sent an email to support and got a response that told me how to do it: Import[file.pdf, {{Author, Title}}] It was pointed out to me that there is an example on the PDF documentation page that illustrates this. It was also pointed out that the Import documentation page states that Import[..., {expr1, expr2, ...}] is for importing subexpressions of (sub)expressions. What was not pointed out, however, is that (as far as I can tell) the correct syntax is *not* noted on the Import page nor is it stated outside of scattered examples (to my knowledge). --Mark === Subject: Re: Re: How should I start with mathematica? If I'm correct in what you're remembering, the original author was Thomas Meunch; I got that message on 2007-08-04. Then David Reiss made some minor changes; that message was received on the next day. Both of those messages are quoted at the bottom of this message. If it helps, great! If not, I apologize to the list for the static. Best wishes, C.O. Murray, Mathematica book generator and posted it here - if you can, I will add > a link to it on my site, because that is all that we seem to have for > the foreseeable future! I think WRI's approach to documentation is a real mistake. Newbies must > find it almost impossible to get into the software. Also, some of the > new features of 6.0 - such as all the new capabilities of Import and > Export are almost buried and unusable because of poor, vague, > Microsoft-style documentation. David Bailey > http://www.dbaileyconsultancy.co.uk Many users on this discussion group have complained about the absence of The Mathematica Book in the new Documentation Center; mainly because of a missing linear introductory text of Mathematica which was present in the old Help system. I completely agree. However, I noticed that the various tutorial files in the Documentation center contain the text of The Book. What is really missing is the outline. So I decided to build my own do-it- to the ingenious naming rules of the tutorial files (all main chapter TOC files end with ...Overview.nb.) The following code opens a new notebook, and prints a collection of hyperlinks to Documentation Center tutorials, laid out in the order of the good old Mathematica book. Simply execute the code and save the notebook for your own use. There are 11 chapters that I could not find in The Mathematica Book of the v5.2 Help system, I integrated them in an order that seemed most appropriate to me. The are marked by New: . Note that this link collection does not contain links to all tutorials. For example, no links to the Manipulate tutorials exist. Neither are the packages represented. Also be warned that the code opens help files to extract hyperlinks for incorporation in The Book, and closes them again. Lots of windows appearing and disappearing on the screen. There will also be warnings and a beeps popping up because of a mismatch in cell styles, which you can ignore. Everything works fine despite the mismatch. At the end, just close the Why the beep dialog box. Here is the code that you need to execute to build your own book in v6.0.x: fn = FileNames[ =C2=A0 =C2=A0*Overview.nb, $InstallationDirectory <> =C2=A0 =C2=A0 DocumentationEnglishSystemTutorials]; (*Find Overview.nb files in the tutorials-directory*) nameList = {StringTake[#, {StringPosition[#, ][[-1, 1]] + =C2=A0 =C2=A0 =C2=A0 =C2=A0 1, -12}], =C2=A0 =C2=A0 =C2=A0paclet:tutorial/ <> =C2=A0 =C2=A0 =C2=A0 StringTake[#, {StringPosition[#, ][[-1, 1]] + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01, -4}], #} & /@ fn; (*create a list of strings needed for future code*) Do[nameList[[i, 1]] = =C2=A0 =C2=A0New: <> nameList[[i, 1]], {i, {3, 6, 7, 8, 18, 28, 29, 40, = 41, =C2=A0 =C2=A0 46, 48}}]; (* mark the chapter not present in v5.2 with New: *) orderOfChapters = {{36, 3, 8, 31, 4, 47, 1, 39, 32, 14, 20, 16, 18, =C2=A0 =C2=A0 17, 11, 43}, {10, 13, 35, 48, 22, 45, 9, 27, 38, 42, 44, 23, = 12, =C2=A0 =C2=A0 26, 15, 40, 41}, {30, 25, 2, 21, 5, 7, 37, 19, 33, 34, 28, 29= , 6, =C2=A0 =C2=A0 46, 24}}; (*The file list is alphabetical-this is the order in which the chapters should appear*) structure = Table[nameList[[i]], {k, 3}, {i, orderOfChapters[[k]]}]; (*needed for the code further down-represents the structure of the Matehmatica book*) mainChapters = {A practical introduction to Mathematica, =C2=A0 =C2=A0Principles of Mathematica, =C2=A0 =C2=A0Advanced Mathematics in Mathematica}; (*The three main headings*) d[x_] := Cell[ =C2=A0 =C2=A0BoxData[TagBox[ =C2=A0 =C2=A0 =C2=A0ButtonBox[ =C2=A0 =C2=A0 =C2=A0 PaneSelectorBox[{False -> x[[1]], =C2=A0 =C2=A0 =C2=A0 =C2=A0 True -> StyleBox[x[[1]], HyperlinkActive]}, =C2=A0 =C2=A0 =C2=A0 =C2=A0Dynamic[CurrentValue[MouseOver]], =C2=A0 =C2=A0 =C2=A0 =C2=A0BaselinePosition -> Baseline, FrameMargins -> 0, =C2=A0 =C2=A0 =C2=A0 =C2=A0ImageSize -> Automatic], BaseStyle -> Link, =C2=A0 =C2=A0 =C2=A0 ButtonData -> x[[2]], ButtonNote -> x[[2]]], =C2=A0 =C2=A0 =C2=A0Annotation[#, x[[2]], Hyperlink] &]], Subsection]; (*Cell representing a hyperlink to the ...Overview.nb files*) nb = NotebookPut[]; SetOptions[nb, StyleDefinitions -> BookTextbook.nb]; NotebookWrite[ =C2=A0 nb, {Cell[The Virtual Mathematica Book (v6), Title], =C2=A0 =C2=A0Cell[A collection of links to the tutorials present in the Mathematica 6.0 Documentation Center, arranged in the order of chapters in The Mathematica Book., Author]}]; Do[NotebookWrite[nb, Cell[mainChapters[[k]], Section]]; =C2=A0 Do[NotebookWrite[nb, d[i]]; =C2=A0 =C2=A0With[{nb1 = NotebookOpen[i[[3]]]}, =C2=A0 =C2=A0 NotebookFind[nb1, TOCChapter, All, CellStyle]; =C2=A0 =C2=A0 NotebookWrite[nb, NotebookRead[nb1]]; NotebookClose[nb1]], {i, =C2=A0 =C2=A0 structure[[k]]}], {k, 3}]; SelectionMove[nb, All, Notebook]; FrontEndExecute[ =C2=A0FrontEndToken[SelectionCloseAllGroups]]; FrontEndExecute[ =C2=A0FrontEndToken[OpenCloseGroup]]; (*Creates the Mathematica Book.The With[...] block in the middle opens an Overview.nb file,extracts the embedded hyperlinks,and prints those into the Mathematica Book as well.*) I hope that you might find this as helpful as I do! Happy clicking, Thomas This is good! I made a few small changes to your code so that it does not only work on Windows. The following version makes it OS independent =2D-David fn = FileNames[*Overview.nb, ToFileName[{$InstallationDirectory, Documentation, English, System, Tutorials}]]; (*Find Overview.nb files in the tutorials-directory*) nameList = With[{case = StringReplace[#, DirectoryName[#] -> ]}, {StringReplace[case, Overview.nb -> ], paclet:tutorial/ <> StringReplace[case, .nb -> ], #}] & /@ fn; (*create a list of strings needed for future code*) Scan[(nameList[[#, 1]] = New: <> nameList[[#, 1]]) &, {3, 6, 7, 8, 18, 28, 29, 40, 41, 46, 48}]; (*mark the chapter not present in v5.2 with New: *) orderOfChapters = {{36, 3, 8, 31, 4, 47, 1, 39, 32, 14, 20, 16, 18, 17, 11, 43}, {10, 13, 35, 48, 22, 45, 9, 27, 38, 42, 44, 23, 12, 26, 15, 40, 41}, {30, 25, 2, 21, 5, 7, 37, 19, 33, 34, 28, 29, 6, 46, 24}}; (*The file list is alphabetical-this is the order in which the chapters should appear*) structure = Table[nameList[[i]], {k, 3}, {i, orderOfChapters[[k]]}]; (*needed for the code further down-represents the structure of the Matehmatica book*) mainChapters = {A practical introduction to Mathematica, Principles of Mathematica, Advanced Mathematics in Mathematica}; (*The three main headings*) d[x_] := Cell[ BoxData[TagBox[ ButtonBox[ PaneSelectorBox[{False -> x[[1]], True -> StyleBox[x[[1]], HyperlinkActive]}, Dynamic[CurrentValue[MouseOver]], BaselinePosition -> Baseline, FrameMargins -> 0, ImageSize -> Automatic], BaseStyle -> Link, ButtonData -> x[[2]], ButtonNote -> x[[2]]], Annotation[#, x[[2]], Hyperlink] &]], Subsection]; (*Cell representing a hyperlink to the ...Overview.nb files*) nb = NotebookPut[]; SetOptions[nb, StyleDefinitions -> ToFileName[Book, Textbook.nb]]; NotebookWrite[ nb, {Cell[The Virtual Mathematica Book (v6), Title], Cell[A collection of links to the tutorials present in the Mathematica 6.0 Documentation Center, arranged in the order of chapters in The Mathematica Book., Author]}]; Do[NotebookWrite[nb, Cell[mainChapters[[k]], Section]]; Do[NotebookWrite[nb, d[i]]; With[{nb1 = NotebookOpen[i[[3]]]}, NotebookFind[nb1, TOCChapter, All, CellStyle]; NotebookWrite[nb, NotebookRead[nb1]]; NotebookClose[nb1]], {i, structure[[k]]}], {k, 3}]; SelectionMove[nb, All, Notebook]; FrontEndExecute[ FrontEndToken[SelectionCloseAllGroups]]; FrontEndExecute[ FrontEndToken[OpenCloseGroup]]; (*Creates the Mathematica Book.The With[...] block in the middle opens an Overview.nb file,extracts the embedded hyperlinks,and prints those into the Mathematica Book as well.*) =2D- Curtis Osterhoudt cfo@remove_this.lanl.and_this.gov PGP Key ID: 0x4DCA2A10 Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html === Subject: Re: How should I start with mathematica? My advice is get some good Mathematica books favorites of mine are Mathematica Navigator http://www.amazon.com/Mathematica-Navigator-Mathematics-Statistics-Graphics/ dp/012603642X/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1202763339&sr=8-1 an Introduction to Mathematica http://www.amazon.com/Introduction-Programming-Mathematica-Third/dp/05218467 81/ref=pd_bxgy_b_text_b and Mastering Mathematica http://www.amazon.com/Mastering-Mathematica-Second-Programming-Applications/ dp/0122961056/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1202763621&sr=1-1 If you can master those 3 books then update your knowledge about new functionality on version 6.0 with http://reference.wolfram.com/mathematica/guide/Mathematica.html if you have questions then come here and if you know all the answers them come here to help answering questions! :-) While reading the books put yourself little problems and try to solve them using mathematica and check on the above books on how to solve your own problems. another source of inspiration could be going to the wolfram demo project and try recreating some of the demo there or just reading the code to see how they are done. === Subject: Re: How should I start with mathematica? On Feb 11, 1:15 pm, David Bailey a link to it on my site, because that is all that we seem to have for > the foreseeable future! > David Baileyhttp://www.dbaileyconsultancy.co.uk David - it was me who posted the code. Here is a link to the post: The code that generates The Mathematica Book is in the first post of the linked thread. The code should be pasted into a new notebook and executed. It will generate another notebook, the Virtual Mathematica Book. This notebook can be saved and is a valuable resource - I believe - to learn about Mathematica. thomas === Subject: Re: How should I start with mathematica? >> At one of the conferences, there was much criticism over the statement >> that WRI would no longer offer a printed The Mathematica Book as of >> version 6. The WRI defense was that 3rd parties would fill the gap. >> Well, 3rd parties haven't. Maybe a bunch of books are about to appear. >> But so far it looks like WRI really dropped the ball on this. Perhaps >> WRI folks are so enamored with their electronic/on-line only mentality >> that they just don't care about books any more. A big mistake, IMHO. > In other words, approaching a year after its introduction there is > _still_ no really good, really usable, really readable, really > straightforward introduction to all the amazing, but immensely complex > and confusing, old and especially new features of the new 6.0 version of > Mathematica available for either newbies or experienced users of the > program, either online or (especially) in any printed _or printable_ > document(s). Given all the immense respect I have for the marvels of Mathematica > (and, as an aside, its stiff retail price), I still cannot comprehend > how Wolfram can have let this happen. > Murray, Mathematica book generator and posted it here - if you can, I will add > a link to it on my site, because that is all that we seem to have for > the foreseeable future! I think WRI's approach to documentation is a real mistake. Newbies must > find it almost impossible to get into the software. Also, some of the > new features of 6.0 - such as all the new capabilities of Import and > Export are almost buried and unusable because of poor, vague, > Microsoft-style documentation. David Bailey > http://www.dbaileyconsultancy.co.uk > I think the message you are looking for is this one from Thomas Muench: http://forums.wolfram.com/mathgroup/archive/2007/Aug/msg00334.html Stephen Luttrell West Malvern, UK === Subject: RE: Re: How should I start with mathematica? > Mathematica book generator and posted it here - if you can, > I will add a link to it on my site, because that is all that > we seem to have for the foreseeable future! I think WRI's approach to documentation is a real mistake. > Newbies must find it almost impossible to get into the > software. Also, some of the new features of 6.0 - such as all > the new capabilities of Import and Export are almost buried > and unusable because of poor, vague, Microsoft-style documentation. David Bailey > http://www.dbaileyconsultancy.co.uk > As a newbie I must say, that it is not so difficult to get into Mathematica 6. The free web seminars are great, I hope, that WRI is preparing the new ones, as I have already attended most of the now offered. But what I'm missing for my work is some structured list of functions. For example when I'm looking for let's say string manipulation functions, I start with writing word String and pressing F1 in notebook. Than I use See also, More about or Tutorials sections of the help and after while of clicking I usualy find what I need. But if I had such structured list of functions (may be printed on some bigger format poster), I think this searching could be much faster. Jakub === Subject: Re: How should I start with mathematica? >> Mathematica book generator and posted it here - if you can, >> I will add a link to it on my site, because that is all that >> we seem to have for the foreseeable future! >> I think WRI's approach to documentation is a real mistake. >> Newbies must find it almost impossible to get into the >> software. Also, some of the new features of 6.0 - such as all >> the new capabilities of Import and Export are almost buried >> and unusable because of poor, vague, Microsoft-style documentation. >> David Bailey >> http://www.dbaileyconsultancy.co.uk > As a newbie I must say, that it is not so difficult to get into Mathematica > 6. The free web seminars are great, I hope, that WRI is preparing the new > ones, as I have already attended most of the now offered. But what I'm missing for my work is some structured list of functions. For > example when I'm looking for let's say string manipulation functions, I start > with writing word String and pressing F1 in notebook. Than I use See also, > More about or Tutorials sections of the help and after while of clicking > I usualy find what I need. > But if I had such structured list of functions (may be printed on some bigger > format poster), I think this searching could be much faster. Jakub I am glad you are finding the seminars useful. I guess everyone has a different learning style, and I prefer to read a book at my own pace! To find all the string functions, type ?*String* This will give you a list of symbols containing 'String', and you can look them up to get the details. The asterisks stand for any text, and the '?' command looks up symbols that match the pattern. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: White on white font I'm having a weird problem with Mathematica 6. Suddenly, the text in notebooks is unreadable, it appears as white on white. See http://www.physik.fu-berlin.de/~goerz/download/mathematica.png. The same effect is also in the preferences (Appearance) The text there is white as well: http://www.physik.fu-berlin.de/~goerz/download/mathematica.png. Any way to solve this problem? I'm not aware of any specific change having caused this problem, as I don't start mathematica that regularly, but in case it has to do something with the the video settings, here's my xorg.conf: http://www.physik.fu-berlin.de/~goerz/download/xorg.conf Michale === Subject: LogLogPlot with WorkingPrecision bug I can reliably crash the kernel on my laptop with the following command: LogLogPlot[x, {x, .001, 1}, WorkingPrecision -> 20] Of course, I discovered this problem with a very different function, but this is the simplest example that will demonstrate the kernel crash. I have already sent a message to support@wolfram.com, but I thought I would post here to see if anyone else can shed light on this apparent bug. -- Dan === Subject: Re: How should I start with mathematica? >Mathematica book generator and posted it here - if you can, I will >add a link to it on my site, because that is all that we seem to >have for the foreseeable future! Although you addressed this question to Murray, I am taking the liberty to answer since I still happen to have the relevant emails in my archives. There were two notebooks that did created this documentation. One was written by Thomas Muench, last updated in his message of Aug 2007. The other notebook was created by Fred Simons. Fred posted is code in the same thread. Fred indicated is code was not as complete but used a somewhat different approach to the problem. -- To reply via email subtract one hundred and four === Subject: Re: open URL programmatically? > Hi all, > I know how to create a hyperlink and click on it to go to an URL in my > browser. But I don't know how to write a program that does that > without making the user click. In other words, I'd like a function > such as > openURL[url] > that goes to the URL in the browser. Any ideas? On Windows one can use Run[] and start: there a way to do this in a OS-free way? --Mark === Subject: Re: open URL programmatically? FrontEndExecute[{FrontEnd`NotebookLocate[{URL[theURL], None}]}] or NotebookLocate[{URL[theURL], None}] I hope that this helps... --David A WorkLife FrameWork E x t e n d i n g MATHEMATICA's Reach... http://scientificarts.com/worklife/ > Hi all, I know how to create a hyperlink and click on it to go to an URL in my > browser. But I don't know how to write a program that does that > without making the user click. In other words, I'd like a function > such as openURL[url] that goes to the URL in the browser. Any ideas? --Mark === Subject: Re: open URL programmatically? > FrontEndExecute[{FrontEnd`NotebookLocate[{URL[theURL], None}]}] or NotebookLocate[{URL[theURL], None}] I hope that this helps... > --David > A WorkLife FrameWork > E x t e n d i n g MATHEMATICA's Reach...http://scientificarts.com/worklife/ > Hi all, > I know how to create a hyperlink and click on it to go to an URL in my > browser. But I don't know how to write a program that does that > without making the user click. In other words, I'd like a function > such as > openURL[url] > that goes to the URL in the browser. Any ideas? > --Mark --Mark === Subject: Re: Re: open URL programmatically? By evaluating ?URL* I discovered that there's a System` context object URL. Anybody know what it does? >> Hi all, >> I know how to create a hyperlink and click on it to go to an URL in my >> browser. But I don't know how to write a program that does that >> without making the user click. In other words, I'd like a function >> such as >> openURL[url] >> that goes to the URL in the browser. Any ideas? On Windows one can use Run[] and start: > -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 === Subject: Re: Graph with different edge thicknesses here is a simple solution using a counter: count = 1; g = LayeredGraphPlot[{1 -> 2, 1 -> 3}, EdgeRenderingFunction -> ({Thickness[0.001 count++], Arrow[#1]} &)] However, there is a hitchup. The EdgeRenderingFunction is called twice on every edge (I do not know why). To prevent drawing each edge twice with different thickness, we may use a function that remembers its values: count=1; Clear[getThickness]; getThickness[d_]:=getThickness[d]=0.004 count++; g=LayeredGraphPlot[{1->2,1->3},EdgeRenderingFunction->({Thickness[getThickne ss[#1]],Arrow[#1]}&)] hope this helps, Daniel > Hello all, I created a graph with edges {1->2,1->3,2->4,2->5}. But I > want that these edge lines have thickness values {0.01, > 0.02,0.03,0.04} respectively. How can I do that with > === Subject: Re: Graph with different edge thicknesses > Hello all, I created a graph with edges {1->2,1->3,2->4,2->5}. But I > want that these edge lines have thickness values {0.01, > 0.02,0.03,0.04} respectively. How can I do that with Quick and dirty solution: In[1]:= edges = {1 -> 2, 1 -> 3, 2 -> 4, 2 -> 5} Out[1]= {1 -> 2, 1 -> 3, 2 -> 4, 2 -> 5} In[2]:= thickness = {0.01, 0.02, 0.03, 0.04} Out[2]= {0.01, 0.02, 0.03, 0.04} In[3]:= thickness /= 3. (* tone it down a bit *) Out[3]= {0.00333333, 0.00666667, 0.01, 0.0133333} In[4]:= GraphPlot[edges, EdgeRenderingFunction -> ({Thickness[thickness[[First@First@Position[edges, Rule @@ #2]]]], Arrow[#1, .05]} &)] === Subject: Re: Graph with different edge thicknesses what are these edge lines ?? or these edge. But GraphPlot[{1 -> 2, 1 -> 3, 2 -> 4, 2 -> 5}, EdgeRenderingFunction -> ({Thickness[RandomReal[{0.01, 0.04}]], Arrow[#1]} &)] look funny. Jens > Hello all, I created a graph with edges {1->2,1->3,2->4,2->5}. But I > want that these edge lines have thickness values {0.01, > 0.02,0.03,0.04} respectively. How can I do that with > === Subject: Table / TableForm Question Hi All, Simple question from the Homework section HW06.nb - Number 7. Use nested Table[] commands to create the following list display: TableForm[{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10}, {3, 6, 9, 12}, {4, 8, 12}, {5, 10}, {6}}] { {1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, }, {3, 6, 9, 12, , }, {4, 8, 12, , , }, {5, 10, , , , }, {6, , , , , } } Here is what it should look like Displayed:- 1 2 3 4 5 6 2 4 6 8 10 3 6 9 12 4 8 12 5 10 6 Here is my attempt. Table[i*j, {i, 6}, {j, 6}] {{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}, {4, 8, 12, 16, 20, 24}, {5, 10, 15, 20, 25, 30}, {6, 12, 18, 24, 30, 36}} ... I'm not quite there as you can see. Any help & advice gratefully received. === Subject: Re: Table / TableForm Question Hi Lea, the upper bound of the second iterator must depend on the first iterator: Table[i*j, {i, 6}, {j, 7 - i}] // TableForm hoipe this helps, Daniel > Hi All, Simple question from the Homework section HW06.nb - Number 7. Use nested Table[] commands to create the following list display: TableForm[{{1, 2, 3, 4, 5, 6}, > {2, 4, 6, 8, 10}, {3, 6, 9, 12}, > {4, 8, 12}, {5, 10}, {6}}] > { > {1, 2, 3, 4, 5, 6}, > {2, 4, 6, 8, 10, }, > {3, 6, 9, 12, , }, > {4, 8, 12, , , }, > {5, 10, , , , }, > {6, , , , , } > } Here is what it should look like Displayed:- > 1 2 3 4 5 6 > 2 4 6 8 10 > 3 6 9 12 > 4 8 12 > 5 10 > 6 > Here is my attempt. Table[i*j, {i, 6}, {j, 6}] > {{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, > 10, 12}, {3, 6, 9, 12, 15, 18}, > {4, 8, 12, 16, 20, 24}, > {5, 10, 15, 20, 25, 30}, > {6, 12, 18, 24, 30, 36}} ... I'm not quite there as you can see. > Any help & advice gratefully received. === Subject: Re: Table / TableForm Question Table[Table[i*j, {i, 1, 7 - j}], {j, 1, 6}] ?? Jens > Hi All, Simple question from the Homework section HW06.nb - Number 7. Use nested Table[] commands to create the following list display: TableForm[{{1, 2, 3, 4, 5, 6}, > {2, 4, 6, 8, 10}, {3, 6, 9, 12}, > {4, 8, 12}, {5, 10}, {6}}] > { > {1, 2, 3, 4, 5, 6}, > {2, 4, 6, 8, 10, }, > {3, 6, 9, 12, , }, > {4, 8, 12, , , }, > {5, 10, , , , }, > {6, , , , , } > } Here is what it should look like Displayed:- > 1 2 3 4 5 6 > 2 4 6 8 10 > 3 6 9 12 > 4 8 12 > 5 10 > 6 > Here is my attempt. Table[i*j, {i, 6}, {j, 6}] > {{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, > 10, 12}, {3, 6, 9, 12, 15, 18}, > {4, 8, 12, 16, 20, 24}, > {5, 10, 15, 20, 25, 30}, > {6, 12, 18, 24, 30, 36}} ... I'm not quite there as you can see. > Any help & advice gratefully received. === Subject: Re: What's the new Code Style? Hi... Search the archives of this group (under my login if you wish). This has been covered a few times. For example: thread/5db307336214aed1/e856569e98cbdbe9 Best, David > In the transition from earlier versions to 6.0, the Cmd-8 style in the > Default Format was changed from something like Small Text (if I'm > remembering correctly) to a style called Code, which appears to > function like Input but is formatted differently. What is this style? -- what's its purpose or objective? -- how does it > differ from Input? [And for those of you who've been following my ongoing rants against > Mathematica 6 documentation -- or lack of same -- a challenge: =A0Don't > answer the above questions, but instead show me how a novice or ordinary > user could find the answer to them, using what knowledge they might be > expected to have, and the Mathematica Help menu item. =A0 You'll find that looking for Input in the Find Selected Function menu > command brings up an immediate and informative answer. =A0Looking for > Code, however, brings up 356 entries -- spread over 36 pages that you > have to click through in sequence -- and this list is not alphabetized.] === Subject: Re: What's the new Code Style? > In the transition from earlier versions to 6.0, the Cmd-8 style in the > Default Format was changed from something like Small Text (if I'm > remembering correctly) to a style called Code, which appears to > function like Input but is formatted differently. What is this style? -- what's its purpose or objective? -- how does it > differ from Input? Code style cells are initialization cells. The main formatting difference is that they don't wrap like Input cells. -- Helen Read University of Vermont === Subject: Local variable in ToExpression? How can I create a local variable from text in ToExpression? test[] := Module[{result = 0}, ToExpression[result=1]; result] test[] will return 0 How can I make it return 1? (here ToExpression is creating a global variable; result=1, even though it is placed inside the Module) Karl Daggfeldt === Subject: Re: Local variable in ToExpression? > How can I create a local variable from text in ToExpression? test[] := Module[{result = 0}, > ToExpression[result=1]; result] test[] will return 0 > How can I make it return 1? > (here ToExpression is creating a global variable; result=1, even though it is placed inside the Module) This is because localization of variables is done by renaming: In[10]:= Module[{a}, a] Out[10]= a$343 But I am curious: what do you need this for? === Subject: Re: Local variable in ToExpression? Hi Karl, note that the local and global result are 2 different variables. Try e.g.: Module[{result = 3}, result = ToExpression[result=1]; result] note that this will set the global result as well. hope this helps, Daniel > How can I create a local variable from text in ToExpression? test[] := Module[{result = 0}, > ToExpression[result=1]; result] test[] will return 0 > How can I make it return 1? > (here ToExpression is creating a global variable; result=1, even though it is placed inside the Module) Karl Daggfeldt > === Subject: Re: Local variable in ToExpression? test[] := Block[{result = 0}, ToExpression[result=1]; result] ?? Jens > How can I create a local variable from text in ToExpression? test[] := Module[{result = 0}, > ToExpression[result=1]; result] test[] will return 0 > How can I make it return 1? > (here ToExpression is creating a global variable; result=1, even though it is placed inside the Module) Karl Daggfeldt > === Subject: Re: Re: How should I start with mathematica? > Hi Szabolcs, I am working my way through the link > You recommended - http://library.wolfram.com/infocenter/MathSource/1847/ Its Great! However many of the Homework questions do not have answers... Just wondering if there is a collection of ready made answers anywhere that > I can view after I have tried the problem myself... it would be very helpful > to double check my answers... Hi Lea, It was a long time ago when I played with this tutorial, but if I remember correctly, there were no answers to the problems ... However, if you are stuck, feel free to post to MathGroup! With friendly greetings, Szabolcs === Subject: RE: Re: How should I start with mathematica? Hi Szabolcs, I am working my way through the link You recommended - http://library.wolfram.com/infocenter/MathSource/1847/ Its Great! However many of the Homework questions do not have answers... Just wondering if there is a collection of ready made answers anywhere that I can view after I have tried the problem myself... it would be very helpful to double check my answers... -----Original Message----- === Subject: Re: How should I start with mathematica? > I'm new in mathematica, Is there any approach recommended to start with mathematica? It depends on what you plan to use Mathematica for. If you would like to understand the system well, and you are not in a hurry, take a look at these notes: http://library.wolfram.com/infocenter/MathSource/1847/ They are terribly outdated, but still useful to learn the core language, especially if you don't have much programming experience. Some exercises are included, too. And, as others said, read the included documentation! It is full of good tutorials (suitable for beginners), though unfortunately it is a bit more difficult to navigate in version 6 than in previous versions. === Subject: FindMaximum query Consider the following function: fun[x_] := Module[ {y, sol}, sol = FindRoot[Sqrt[y] == Abs[x], {y, 0, 0.001}]; (* AppendTo[list, sol]; *) -y /. sol[[1]] ] Then Plot[fun[x], {x, -2, 2}] works fine, but FindMaximum[fun[x], {x, 1, 1.001}] fails. If I uncomment the debug line in fun and execute list = {}; FindMaximum[fun[x], {x, 1, 1.001}] Then list contains {FindRoot[Sqrt[y$21471] == Abs[x], {y$21471, 0, 0.001}]} So, FindRoot fails because x is passed through unevaluated, I think. I would appreciate any advice on how to get FindMaximum (or NMaximize) to work in this case. Mathematic 6.0.1.0 x86 32 bit Mac OS X 10.4.11 E. Neely Atkinson Department of Biostatistics M. D. Anderson Cancer Center neely@pdq.net === Subject: Re: FindMaximum query Hi Neely, deine fun like: fun[x_?NumericQ] hope this helps, Daniel > Consider the following function: fun[x_] := > Module[ > {y, sol}, > sol = FindRoot[Sqrt[y] == Abs[x], {y, 0, 0.001}]; > (* AppendTo[list, sol]; *) > -y /. sol[[1]] > ] Then Plot[fun[x], {x, -2, 2}] works fine, but FindMaximum[fun[x], {x, 1, 1.001}] fails. If I uncomment the debug line in fun and execute list = {}; > FindMaximum[fun[x], {x, 1, 1.001}] Then list contains {FindRoot[Sqrt[y$21471] == Abs[x], {y$21471, 0, 0.001}]} > So, FindRoot fails because x is passed through unevaluated, I think. > I would appreciate any advice on how to get FindMaximum (or NMaximize) > to work in this case. Mathematic 6.0.1.0 x86 32 bit > Mac OS X 10.4.11 > E. Neely Atkinson > Department of Biostatistics > M. D. Anderson Cancer Center neely@pdq.net > === Subject: Re: NDSolve Percision > So I'm running a program that is trying to use NDSolve and parametrically plot the results. The result is periodic, so it should cycle back on itself with a period of 2Pi. It does that, but if I run from {t,0,20Pi} is starts to miss the initial point by more and more. Basically, it's spiraling outward at a slow but unwanted rate. This will be a problem for when I increase the difficulty of the function. How do I increase the precision of NDSolve to make it keep more decimals and make the answer more accurate? The function is solution = NDSolve[{x'[t] == 2p[t], x[0] == 2, > p'[t] == -2x[t],p[0] == N[Sqrt[-3], 50]}, {x, p}, {t,0,20Pi}] > Might want to consider a DAE or other conserved-quantity approach. One might be simplectic Ringe-Kutta. Documentation in the Help Browser is located under tutorial/NDSolveSPRK. Under subsection Symplectic method I see an example quite similar to yours. I suspect a projection approach might also be applicable. See tutorial/ NDSolveProjection. There, too, I see a harmonic oscillator example. Daniel Lichtblau Wolfram Research === Subject: Re: NDSolve Percision Hi Alex, look up the option AccuracyGoal of NDSolve. hope this helps, Daniel > So I'm running a program that is trying to use NDSolve and parametrically plot the results. The result is periodic, so it should cycle back on itself with a period of 2Pi. It does that, but if I run from {t,0,20Pi} is starts to miss the initial point by more and more. Basically, it's spiraling outward at a slow but unwanted rate. This will be a problem for when I increase the difficulty of the function. How do I increase the precision of NDSolve to make it keep more decimals and make the answer more accurate? The function is solution = NDSolve[{x'[t] == 2p[t], x[0] == 2, > p'[t] == -2x[t],p[0] == N[Sqrt[-3], 50]}, {x, p}, {t,0,20Pi}] === Subject: Re: NDSolve Percision The solution is represented by complex numbers, right? === Subject: Re: NDSolve Percision have you used Method -> {SymplecticPartitionedRungeKutta} ?? to avoid that ? An non-symplectic method *must* loss the energy of the system, this has nothing to do with the Precision, this has to do with the fact that a normal numerical method for initial value problems is designed to reduce the local error and not to preserve a global quantity like the energy. Jens > So I'm running a program that is trying to use NDSolve and parametrically plot the results. The result is periodic, so it should cycle back on itself with a period of 2Pi. It does that, but if I run from {t,0,20Pi} is starts to miss the initial point by more and more. Basically, it's spiraling outward at a slow but unwanted rate. This will be a problem for when I increase the difficulty of the function. How do I increase the precision of NDSolve to make it keep more decimals and make the answer more accurate? The function is solution = NDSolve[{x'[t] == 2p[t], x[0] == 2, > p'[t] == -2x[t],p[0] == N[Sqrt[-3], 50]}, {x, p}, {t,0,20Pi}] === Subject: NearestFunction Algorithm I'm looking to iteratively assign a list of initial points to a list of final points such that at each step, the initial point that is furthest from its nearest final point is assigned to its nearest final point. That final points is then no longer available to other initial points. I noticed that you can speed up repeated uses of Nearest by calling it with only one argument in order to produce a NearestFunction, and then using that in later calculations. Can anyone give me a clue about how this actually works? Is it possible to manipulate a NearestFunction in order to remove points that have already been assigned? Jason Merrill === Subject: Re: NearestFunction Algorithm I don't know what Mathematica actual does but http://www.cs.umd.edu/~mount/ANN/ may give you a hint .. Jens > I'm looking to iteratively assign a list of initial points to a list > of final points such that at each step, the initial point that is > furthest from its nearest final point is assigned to its nearest final > point. That final points is then no longer available to other initial > points. I noticed that you can speed up repeated uses of Nearest by calling it > with only one argument in order to produce a NearestFunction, and then > using that in later calculations. Can anyone give me a clue about how > this actually works? Is it possible to manipulate a NearestFunction in order to remove > points that have already been assigned? > Jason Merrill > === Subject: Mathematica and Google Desktop I uninstalled Google desktop. After reinstalling it, I installed again Wolfram Notebook Indexer, found on: but Wolfram Notebook Indexer doesn't work anymore. Google Desktop doesn't recognise nb files anymore. Is seems as if something got corrupted. Has anyone had the same trouble? Pianiel === Subject: ImageResolution bug In Mathematica 6.0 There is a bug in ImageResolution. In Mathematica 6.0 it seems that it is not possible to increase the resolution when exporting a jpg or a gif file. This function worked fine in previous versions of Mathematica. The following line: Graph2 = Plot[x^2, {x, 0, 3}] Export[Test.jpg, Graph2, ImageResolution -> 400] gives a bad picture. Does anyone have a workaround? (The goal is not increase the size of the picture using ImageSize, which makes the lines thiner...) Pianiel === Subject: Re: Bug Report for DiscreteMath`Combinatorica`Contract It does NOT seem to have been corrected in Mathematica 6: << Combinatorica` gc = Contract[g, {1, 2}]; Directed graph g has an edge from 1 to 3 and an edge from 3 to 2, of course. But gc has two edges from 1 to 2, both directed from 1 to 2. Unfortunately, your Contract2 does not seem to work with the Mathematica 6 Combinatorica package -- it generates a whole bunch of error messages. > The series of commands below describe a bug in > DiscreteMath`Combinatorica`Contract. Contracting vertices 1 and 2 in a > directed graph with edges {1,3} and {3,2} should give a graph with two > vertices and two edges {1,2} and {2,1}. Instead, it gives a graph with edges > {1,2} and {1,2}. The error in the existing version is the Sort command, > which for directed graphs leads to erroneous output. A corrected version of > the Contract function is included below. Please advise if this bug has been previously reported, whether the > existence of the bug and the proposed fix is confirmed, and where such > information is posted. Hunter Monroe < VertexNumberPosition*Center,VertexStyle*Disk[0.05]] Contract2[g_Graph,l_List]:=Module[{v=Vertices[g,All],t=Table[0,{V[g]}],cnt=0 > ,last=V[g]-Length[l]+1},Do[If[MemberQ[l,k],cnt++;t[[k]]=last,t[[k]]=k-cnt],{ > k,V[g]}]; Graph[DeleteCases[Edges[g,All]/.{{x_Integer,y_Integer},opts___?OptionQ}*{{t[ > [x]],t[[y]]},opts},{{last,last},opts___?OptionQ}],Append[v[[Complement[Range > [Length[v]],l]]],{Apply[Plus,Map[First,v[[l]]]]/Length[l],Apply[Sequence,App > ly[Intersection,Map[Drop[#,1]&,v[[l]]]]]}],Apply[Sequence,GraphOptions[g]]]] ShowGraph[Contract2[g,{1,2}]] -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 === Subject: Differential Equation I was trying to solve the following second order linear differential equation and got no result from Mathematica. DSolve[(x2-1)*D[y[x],{x,2}]SD[y[x],x]-x2*y[x],y[x],x] Any ideas? Sergio Terrazas This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. === Subject: Re: Differential Equation and what is SD[] ?? and is x2 eventual x^2 Can you please post valid Mathematica syntax or did you expect you find an analytical solution with DSolve[] to an ode with an unknown functional SD[y[x],x] ?? And posting to a public news group with This email and any files transmitted with it are confidential is nonsense. Jens I was trying to solve the following second order linear differential equation and got no result from Mathematica. DSolve[(x2-1)*D[y[x],{x,2}]SD[y[x],x]-x2*y[x],y[x],x] Any ideas? > Sergio Terrazas This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. > === Subject: Help with NMinimize of NIntegrate function What's wrong with this code: test[t_?NumericQ, J_?NumericQ, m_?NumericQ, (Q3_)?NumericQ, (Q2_)?NumericQ] := NIntegrate[ EAa[t, J, m, Q3, Q2]* HeavisideTheta[EAa[t, J, m, Q3, Q2]], {x, -Pi, Pi}, {y, -Pi, Pi}, {z, -Pi, Pi}, MaxPoints -> 1000000, Method -> LocalAdaptive]/8/(Pi^3) In[75]:= test[10, 1, 1, 1, 1] // Timing Out[75]= {5.819, 2.22142} where EAa[t, J, m, Q3, Q2]:= 1/2 (-3 J - 2 m - 2 t (Cos[x] + Cos[y]) - 2 t (Cos[x]/3 + Cos[y]/3 + (4 Cos[z])/3)) - 1/2 Sqrt[16 (-(Q2/2) - (t Cos[x])/Sqrt[3] + (t Cos[y])/Sqrt[ 3])^2 + (-2 Q3 + 2 t (Cos[x] + Cos[y]) - 2 t (Cos[x]/3 + Cos[y]/3 + (4 Cos[z])/3))^2] with NMinimize[test[10, 1, [Mu], q, Q], {[Mu], q, Q}] I get those inumr errors, have i set anything wrong? Everything should be numerical, x,y,z are integrated out, so what is it? === Subject: problem with Inset moving text I am trying to use Inset but have a problem in 6.0.1 see this code Manipulate[ Graphics[ {Circle[], Inset[Style[StringJoin[value:, ToString[N[c]]], Blue, 20]] } ] , {{c, (2 [Pi])/3, Value c}, -1, 2 Pi, 0.001}] use the slide to go to value 1.609 and then it jumps into value 1.61 the problem I have is that the text jumps horizontaly any way to make the text fix so it will not jump? this happens because the numbers 1.609 and 1.61 are different in leght any solution? === Subject: Re: problem with Inset moving text Hi Camille, the text is centered. Therefore, it will move when the length changes. To prevent this, either make the number always the same size: NumberForm[c // N, {4, 3}] or even better, place the text at an definite location by useing the second and third argument of Inset: Manipulate[Graphics[{Circle[],Inset[Style[StringJoin[value:,ToString[Num berForm[c//N,{4,3}]]],Blue,20],{-.3,0},{-1,-1}]}],{{c,(2 [Pi])/3,Value c},-1,2 Pi,0.001}] hope this helps, Daniel > I am trying to use Inset but have a problem in 6.0.1 see this code Manipulate[ > Graphics[ > {Circle[], > Inset[Style[StringJoin[value:, ToString[N[c]]], Blue, 20]] > } > ] > , {{c, (2 [Pi])/3, Value c}, -1, 2 Pi, 0.001}] use the slide to go to value 1.609 > and then it jumps into value 1.61 > the problem I have is that the text jumps horizontaly any way to make the text fix so it will not jump? > this happens because the numbers 1.609 and 1.61 are different in leght > any solution? > === Subject: Re: problem with Inset moving text from negative to positive or vise versa Any idea how to solve it? === Subject: Re: problem with Inset moving text Manipulate[ Graphics[{Circle[], Inset[Style[ StringJoin[value:, ToString[ NumberForm[N[c], {16, 8}, NumberPadding -> { , 0}, NumberSigns -> {-, }]]], Blue, 20]]}], {{c, (2 [Pi])/3, Value c}, -1, 2 Pi, 0.001}] and you should use a mono spaced font, otherwise the different width of the characters will make problems. Jens > I am trying to use Inset but have a problem in 6.0.1 see this code Manipulate[ > Graphics[ > {Circle[], > Inset[Style[StringJoin[value:, ToString[N[c]]], Blue, 20]] > } > ] > , {{c, (2 [Pi])/3, Value c}, -1, 2 Pi, 0.001}] use the slide to go to value 1.609 > and then it jumps into value 1.61 > the problem I have is that the text jumps horizontaly any way to make the text fix so it will not jump? > this happens because the numbers 1.609 and 1.61 are different in leght > any solution? > === Subject: Mathematica Book and Documentation There were some postings in the 'How should I get started with Mathematica' thread about the lack of a printed book. In August 2007 there were postings on the question of the old book organization and Thomas Muench posted some code that would create a Virtual Mathematica Book from the documentation material. I have pasted his code at the end of this posting. Paste it into a blank notebook and evaluate. It will create a Virtual Book notebook. One nice thing about this virtual book is that it has a listing of all the supplied 'standard' packages, which I find otherwise difficult to find. I do not think an actual printed book is that useful with the new Mathematica 6 because it is impossible to reproduce dynamic behavior on a static printed page. The world changes and the elderly can adapt as well as the young. We've had more practice. I think that one way to improve the new Version 6 documentation would be to increase the density of information on the 'index pages'. One should not have to go through a number of levels of index pages to get to the required information. I think this would go a long way to decreasing complaints. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{(*, , RowBox[{-=, RowBox[{=, RowBox[{ RowBox[{ RowBox[{ RowBox[{-, Make}], , , , based, , on, , <...Overview.nb>, , files, , in, , the, , tutorials, , directory}], -=}], =, -}]}]}], *)}], RowBox[{ RowBox[{ RowBox[{fn, =, RowBox[{FileNames, [, RowBox[{<*Overview.nb>, ,, RowBox[{ToFileName, [, RowBox[{{, RowBox[{ $InstallationDirectory, ,, , ,, , ,, , ,, }], }}], ]}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ Find, , , , files, , in, , the, , tutorials}], -, directory}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{nameList, =, RowBox[{ RowBox[{ RowBox[{{, RowBox[{ RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, 1}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 12}]}], }}]}], ]}], ,, RowBox[{, <>, RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, 1}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 4}]}], }}]}], ]}]}], ,, #}], }}], &}], /@, fn}]}], ;}], n, RowBox[{(*, RowBox[{ create, , a, , list, , of, , strings, , needed, , for, , future, , code}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{ RowBox[{nameList, [, RowBox[{[, RowBox[{i, ,, 1}], ]}], ]}], =, RowBox[{, <>, RowBox[{nameList, [, RowBox[{[, RowBox[{i, ,, 1}], ]}], ]}]}]}], ,, RowBox[{{, RowBox[{i, ,, RowBox[{{, RowBox[{ 3, ,, 6, ,, 7, ,, 8, ,, 18, ,, 28, ,, 29, ,, 40, ,, 41, ,, 46, ,, 48}], }}]}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{ mark, , the, , chapter, , not, , present, , in, , v5, .2, , with, , }], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{orderOfChapters, =, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{ 36, ,, 3, ,, 8, ,, 31, ,, 4, ,, 47, ,, 1, ,, 39, ,, 32, ,, 14, ,, 20, ,, 16, ,, 18, ,, 17, ,, 11, ,, 43}], }}], ,, RowBox[{{, RowBox[{ 10, ,, 13, ,, 35, ,, 48, ,, 22, ,, 45, ,, 9, ,, 27, ,, 38, ,, 42, ,, 44, ,, 23, ,, 12, ,, 26, ,, 15, ,, 40, ,, 41}], }}], ,, RowBox[{{, RowBox[{ 30, ,, 25, ,, 2, ,, 21, ,, 5, ,, 7, ,, 37, ,, 19, ,, 33, ,, 34, ,, 28, ,, 29, ,, 6, ,, 46, ,, 24}], }}]}], }}]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ The, , file, , list, , is, , alphabetical}], -, RowBox[{ this, , is, , the, , order, , in, , which, , the, , chapters, , should, , appear}]}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{structure, =, RowBox[{Table, [, RowBox[{ RowBox[{nameList, [, RowBox[{[, i, ]}], ]}], ,, RowBox[{{, RowBox[{k, ,, 3}], }}], ,, RowBox[{{, RowBox[{i, ,, RowBox[{orderOfChapters, [, RowBox[{[, k, ]}], ]}]}], }}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ needed, , for, , the, , code, , further, , down}], -, RowBox[{ represents, , the, , structure, , of, , the, , Mathematica, , book}]}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{mainChapters, =, RowBox[{{, RowBox[{ , ,, , ,, , ,, , ,, , ,, , ,, }], }}]}], ;}], n, RowBox[{(*, RowBox[{The, , three, , main, , headings}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{ RowBox[{beautify, [, ugly_, ]}], :=, RowBox[{StringReplace, [, RowBox[{ RowBox[{StringReplace, [, RowBox[{ugly, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{l1_, ?, LowerCaseQ}], ~~, RowBox[{l2_, ?, UpperCaseQ}]}], [RuleDelayed], RowBox[{l1, <>, < >, <>, l2}]}], }}]}], ]}], ,, RowBox[{{, RowBox[{ RowBox[{< And >, [Rule], < and >}], ,, RowBox[{< Of >, [Rule], < of >}], ,, RowBox[{< In >, [Rule], < in >}], ,, RowBox[{< The >, [Rule], < the >}], ,, RowBox[{< For >, [Rule], < for >}]}], }}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ based, , on, , code, , by, , Selwyn, , Hollis}], -, [IndentingNewLine], RowBox[{ RowBox[{d, [, RowBox[{x_, ,, RowBox[{style_:, ,
}], ,, RowBox[{margin_:, , RowBox[{{, RowBox[{ RowBox[{{, RowBox[{36, ,, 0}], }}], ,, RowBox[{{, RowBox[{5, ,, 5}], }}]}], }}]}]}], ]}], :=, RowBox[{Module, [, RowBox[{ RowBox[{{, RowBox[{sectitle, =, RowBox[{beautify, [, RowBox[{x, [, RowBox[{[, 1, ]}], ]}], ]}]}], }}], ,, RowBox[{Cell, [, RowBox[{ RowBox[{BoxData, [, RowBox[{ButtonBox, [, RowBox[{ RowBox[{PaneSelectorBox, [, RowBox[{ RowBox[{{, RowBox[{ RowBox[{False, [Rule], sectitle}], ,, RowBox[{True, [Rule], RowBox[{StyleBox, [, RowBox[{sectitle, ,, }], ]}]}]}], }}], ,, RowBox[{Dynamic, [, RowBox[{CurrentValue, [, , ]}], ]}]}], ]}], ,, RowBox[{BaseStyle, [Rule], RowBox[{{, RowBox[{, ,, style}], }}]}], ,, RowBox[{ButtonData, [Rule], RowBox[{x, [, RowBox[{[, 2, ]}], ]}]}], ,, RowBox[{ButtonNote, [Rule], RowBox[{x, [, RowBox[{[, 2, ]}], ]}]}]}], ]}], ]}], ,, style, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], margin}]}], ]}]}], ]}]}], n, RowBox[{(*, RowBox[{ Cell, , representing, , a, , hyperlink, , to, , a, , file}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{nb, =, RowBox[{NotebookPut, [, ]}]}], ;, RowBox[{SetOptions, [, RowBox[{nb, ,, RowBox[{StyleDefinitions, [Rule], RowBox[{ToFileName, [, RowBox[{, ,, }], ]}]}]}], ]}], ;}], [IndentingNewLine], RowBox[{(*, RowBox[{Open, , new, , Notebook}], *)}], [IndentingNewLine], RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{{, RowBox[{ RowBox[{Cell, [, RowBox[{ RowBox[{Row, [, RowBox[{{, RowBox[{ RowBox[{ToBoxes, [, RowBox[{Import, [, RowBox[{ RowBox[{ToFileName, [, RowBox[{ , ,, }], ]}], ,, , ,, RowBox[{ImageSize, [Rule], 70}]}], ]}], ]}], ,, RowBox[{Cell, [, RowBox[{ , ,, , ,, RowBox[{TextAlignment, [Rule], Center}]}], ]}]}], }}], ]}], ,, <Title>, ,, RowBox[{TextAlignment, [Rule], Center}]}], ]}], ,, RowBox[{Cell, [, RowBox[{ <A collection of links to the tutorials present in the Mathematica 6.0 Documentation Center, arranged in the order of chapters in The Mathematica Book.>, ,, <Text>, ,, RowBox[{TextAlignment, [Rule], Center}]}], ]}]}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{Print, , the, , titel}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{Cell, [, RowBox[{ RowBox[{StringJoin, [, RowBox[{Table, [, RowBox[{<xxxxxxxxxx>, ,, RowBox[{{, k, }}]}], ]}], ]}], ,, <Text>}], ]}]}], ]}], ;, [IndentingNewLine], RowBox[{If, [, RowBox[{ RowBox[{2, [LessEqual], k, [LessEqual], 4}], ,, RowBox[{Do, [, RowBox[{ RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{d, [, i, ]}]}], ]}], ;, [IndentingNewLine], RowBox[{With, [, RowBox[{ RowBox[{{, RowBox[{nb1, =, RowBox[{NotebookOpen, [, RowBox[{ RowBox[{i, [, RowBox[{[, 3, ]}], ]}], ,, RowBox[{Visible, [Rule], False}]}], ]}]}], }}], ,, RowBox[{ RowBox[{SelectionMove, [, RowBox[{nb1, ,, All, ,, Notebook}], ]}], ;, [IndentingNewLine], RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{ RowBox[{NotebookRead, [, nb1, ]}], //., RowBox[{{, RowBox[{ RowBox[{<TOCChapter>, [Rule], RowBox[{Sequence, @@, RowBox[{{, RowBox[{<Subsection>, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{48, ,, 0}], }}], ,, Inherited}], }}]}]}], }}]}]}], ,, RowBox[{<TOCSection>, [Rule], RowBox[{Sequence, @@, RowBox[{{, RowBox[{<Subsubsection>, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{58, ,, 0}], }}], ,, Inherited}], }}]}]}], }}]}]}], ,, RowBox[{<TOCSubsection>, [Rule], RowBox[{Sequence, @@, RowBox[{{, RowBox[{<Subsubsubsection>, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{68, ,, 0}], }}], ,, Inherited}], }}]}]}], }}]}]}], ,, RowBox[{<TOCSubsubsection>, [Rule], RowBox[{Sequence, @@, RowBox[{{, RowBox[{<Text>, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{78, ,, 0}], }}], ,, Inherited}], }}]}]}], }}]}]}], ,, RowBox[{ShowCellBracket, [Rule], True}]}], }}]}]}], ]}], ;, [IndentingNewLine], RowBox[{NotebookClose, [, nb1, ]}]}]}], ]}]}], ,, RowBox[{{, RowBox[{i, ,, RowBox[{structure, [, RowBox[{[, RowBox[{k, -, 1}], ]}], ]}]}], }}]}], ]}]}], ]}]}], ,, RowBox[{{, RowBox[{k, ,, RowBox[{Length, [, mainChapters, ]}]}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ write, , all, , the, , links, , to, , the, , main, , chapters}], ,, RowBox[{ RowBox[{as, , well, , as, , to, , sub}], -, chapters}]}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{ RowBox[{NotebookFind, [, RowBox[{ nb, ,, cellsToDelete, ,, All, ,, CellStyle}], ]}], ;, [IndentingNewLine], RowBox[{NotebookDelete, [, nb, ]}]}], ,, RowBox[{{, RowBox[{cellsToDelete, ,, RowBox[{{, RowBox[{ <SymbolColorBar>, ,, <AnchorBarGrid>, ,, <FooterCell>, ,, <TOCDocumentTitle>}], }}]}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{ Delete, , unnecessary, , styling, , cells, , that, , are, , part, , of, , the, , tutorial, , notebooks}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{SetOptions, [, RowBox[{nb, ,, RowBox[{StyleDefinitions, [Rule], RowBox[{ToFileName, [, RowBox[{<Book>, ,, <Textbook.nb>}], ]}]}]}], ]}], ;}], n, RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{ RowBox[{NotebookFind, [, RowBox[{nb, ,, RowBox[{StringJoin, [, RowBox[{Table, [, RowBox[{<xxxxxxxxxx>, ,, RowBox[{{, k, }}]}], ]}], ]}], ,, All}], ]}], ;, [IndentingNewLine], RowBox[{SelectionMove, [, RowBox[{nb, ,, All, ,, Cell}], ]}], ;, [IndentingNewLine], RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{Cell, [, RowBox[{ RowBox[{mainChapters, [, RowBox[{[, k, ]}], ]}], ,, <Subtitle>, ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{10, ,, 0}], }}], ,, RowBox[{{, RowBox[{5, ,, 10}], }}]}], }}]}], ,, RowBox[{CellTags, [Rule], RowBox[{<Section>, <>, RowBox[{ToString, [, k, ]}]}]}], ,, RowBox[{CellFrame, [Rule], RowBox[{If, [, RowBox[{ RowBox[{MemberQ, [, RowBox[{ RowBox[{{, RowBox[{1, ,, 6, ,, 7}], }}], ,, k}], ]}], ,, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{0, ,, 0}], }}], ,, RowBox[{{, RowBox[{0, ,, 2}], }}]}], }}], ,, False}], ]}]}]}], ]}]}], ]}]}], ,, RowBox[{{, RowBox[{k, ,, RowBox[{Length, [, mainChapters, ]}], ,, 1, ,, RowBox[{-, 1}]}], }}]}], ]}], ;}], [IndentingNewLine], RowBox[{(*, RowBox[{Finishing, , touches}], *)}], [IndentingNewLine], n, RowBox[{(*, , RowBox[{-=, RowBox[{=, RowBox[{ RowBox[{ RowBox[{ RowBox[{-, Add}], , links, , to, , tutorials, , that, , are, , not, , linked, , yet}], -=}], =, -}]}]}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{SelectionMove, [, RowBox[{nb, ,, All, ,, Notebook}], ]}], ;}], n, RowBox[{ RowBox[{links, =, RowBox[{StringCases, [, RowBox[{ RowBox[{ToString, [, RowBox[{ RowBox[{NotebookRead, [, nb, ]}], ,, InputForm}], ]}], ,, RowBox[{ RowBox[{Shortest, [, RowBox[{(, RowBox[{ <paclet:tutorial/>, ~~, y__, ~~, <>}], )}], ]}], [RuleDelayed], y}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ Extract, , all, , links, , to, , tutorials, , present, , in, , <The Book>}], ...}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{linkedFiles, =, RowBox[{Union, [, RowBox[{Flatten, [, RowBox[{ RowBox[{ RowBox[{If, [, RowBox[{ RowBox[{StringFreeQ, [, RowBox[{#, ,, RowBox[{<#>, ~~, RowBox[{DigitCharacter, ...}]}]}], ]}], ,, RowBox[{#, <>, <.nb>}], ,, RowBox[{StringCases, [, RowBox[{#, ,, RowBox[{ RowBox[{(, RowBox[{y__, ~~, <#>, ~~, RowBox[{DigitCharacter, ...}]}], )}], [RuleDelayed], RowBox[{y, <>, <.nb>}]}]}], ]}]}], ]}], &}], /@, links}], ]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{..., , and, , their, , filenames}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{allTutorials, =, RowBox[{Flatten, [, RowBox[{ RowBox[{ RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, 1}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 1}]}], }}]}], ]}], &}], /@, RowBox[{FileNames, [, RowBox[{<*.nb>, ,, RowBox[{ToFileName, [, RowBox[{{, RowBox[{ $InstallationDirectory, ,, <Documentation>, ,, <English>, ,, <System>, ,, <Tutorials>}], }}], ]}]}], ]}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ all, , tutorials, , in, , the, , tutorial, , directory}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{notUsed, =, RowBox[{Complement, [, RowBox[{allTutorials, ,, linkedFiles}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ RowBox[{ all, , tutorials, , not, , linked, , to, , in, , <The Book>, , so, , far, , RowBox[{(, RowBox[{in, , alphabetical, , order}], )}]}], ;, RowBox[{ these, , are, , 76, , tutorial, , notebooks}]}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{nameList, =, RowBox[{ RowBox[{ RowBox[{{, RowBox[{ RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{1, ,, RowBox[{-, 4}]}], }}]}], ]}], ,, RowBox[{<paclet:tutorial/>, <>, RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{1, ,, RowBox[{-, 4}]}], }}]}], ]}]}], ,, RowBox[{ RowBox[{ToFileName, [, RowBox[{{, RowBox[{ $InstallationDirectory, ,, <Documentation>, ,, <English>, ,, <System>, ,, <Tutorials>}], }}], ]}], <>, #}]}], }}], &}], /@, notUsed}]}], ;}], n, RowBox[{(*, RowBox[{ create, , a, , list, , of, , strings, , needed, , for, , future, , code}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{GettingStarted, =, RowBox[{{, RowBox[{21, ,, 18, ,, 75}], }}]}], ;, RowBox[{GraphPlotting, =, RowBox[{{, RowBox[{27, ,, 28, ,, 36, ,, 71}], }}]}], ;, RowBox[{MathematicaReferenceGuide, =, RowBox[{{, RowBox[{ 7, ,, 31, ,, 64, ,, 19, ,, 57, ,, 20, ,, 37, ,, 33, ,, 30}], }}]}], ;, RowBox[{MatrixAndVectorOperations, =, RowBox[{{, RowBox[{ 10, ,, 26, ,, 6, ,, 3, ,, 73, ,, 16, ,, 42, ,, 45, ,, 62, ,, 52, ,, 65, ,, 69}], }}]}], ;, RowBox[{Statistics, =, RowBox[{{, RowBox[{11, ,, 15, ,, 13, ,, 58}], }}]}], ;, RowBox[{DynamicFeatures, =, RowBox[{{, RowBox[{35, ,, 2, ,, 34, ,, 1}], }}]}], ;, RowBox[{SystemSpecificTopics, =, RowBox[{{, RowBox[{ 17, ,, 32, ,, 60, ,, 50, ,, 51, ,, 53, ,, 41, ,, 44, ,, 38, ,, 39, ,, 40}], }}]}], ;, RowBox[{FurtherNDSolveTutorials, =, RowBox[{{, RowBox[{46, ,, 47, ,, 48, ,, 49}], }}]}], ;, RowBox[{FrontendAndFormattingTopics, =, RowBox[{{, RowBox[{ 5, ,, 22, ,, 24, ,, 25, ,, 29, ,, 67, ,, 70, ,, 74}], }}]}], ;}], [IndentingNewLine], RowBox[{ RowBox[{topics, =, RowBox[{{, RowBox[{ GettingStarted, ,, MathematicaReferenceGuide, ,, GraphPlotting, ,, MatrixAndVectorOperations, ,, Statistics, ,, DynamicFeatures, ,, SystemSpecificTopics, ,, FurtherNDSolveTutorials, ,, FrontendAndFormattingTopics}], }}]}], ;}], n, RowBox[{ RowBox[{FurtherTopics, =, RowBox[{Complement, [, RowBox[{ RowBox[{Range, [, RowBox[{Length, [, notUsed, ]}], ]}], ,, RowBox[{Flatten, [, topics, ]}]}], ]}]}], ;}], n, RowBox[{ RowBox[{topics, =, RowBox[{Join, [, RowBox[{topics, ,, RowBox[{{, FurtherTopics, }}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ trying, , to, , get, , some, , order, , into, , these, , tutorials}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{topicNames, =, RowBox[{{, RowBox[{ <Getting Started>, ,, <Mathematica Reference Guide>, ,, <Graph Plotting>, ,, <Matrix And Vector Operations>, ,, <Statistics>, ,, <Dynamic Features>, ,, <System Specific Topics>, ,, <Further NDSolve Tutorials>, ,, <FrontEnd and Formatting Topics>, ,, <Others>}], }}]}], ;}], [IndentingNewLine], n, RowBox[{ RowBox[{NotebookFind, [, RowBox[{ nb, ,, <Section1>, ,, After, ,, CellTags}], ]}], ;, RowBox[{SelectionMove, [, RowBox[{nb, ,, After, ,, Cell}], ]}], ;}], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{d, [, RowBox[{ RowBox[{nameList, [, RowBox[{[, i, ]}], ]}], ,, <Subsection>, ,, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{48, ,, 0}], }}], ,, Inherited}], }}]}], ]}]}], ]}], ,, RowBox[{{, RowBox[{i, ,, GettingStarted}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{ Add, , links, , to, , <getting Started>, , topics}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{NotebookFind, [, RowBox[{ nb, ,, <Section5>, ,, After, ,, CellTags}], ]}], ;, RowBox[{SelectionMove, [, RowBox[{nb, ,, After, ,, Cell}], ]}], ;}], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{d, [, RowBox[{ RowBox[{nameList, [, RowBox[{[, i, ]}], ]}], ,, <Subsection>, ,, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{48, ,, 0}], }}], ,, Inherited}], }}]}], ]}]}], ]}], ,, RowBox[{{, RowBox[{i, ,, MathematicaReferenceGuide}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{ Add, , links, , to, , <Refrence Guides>, , topics}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{NotebookFind, [, RowBox[{ nb, ,, <Section6>, ,, After, ,, CellTags}], ]}], ;, RowBox[{SelectionMove, [, RowBox[{nb, ,, After, ,, Cell}], ]}], ;}], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{Cell, [, RowBox[{ RowBox[{topicNames, [, RowBox[{[, i, ]}], ]}], ,, <Section>, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{36, ,, 0}], }}], ,, RowBox[{{, RowBox[{5, ,, 5}], }}]}], }}]}]}], ]}]}], ]}], ;, [IndentingNewLine], RowBox[{Do, [, RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{d, [, RowBox[{ RowBox[{nameList, [, RowBox[{[, k, ]}], ]}], ,, <Subsection>, ,, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{48, ,, 0}], }}], ,, Inherited}], }}]}], ]}]}], ]}], ,, RowBox[{{, RowBox[{k, ,, RowBox[{topics, [, RowBox[{[, i, ]}], ]}]}], }}]}], ]}]}], ,, RowBox[{{, RowBox[{i, ,, 3, ,, RowBox[{Length, [, topics, ]}]}], }}]}], ]}], ;}], [IndentingNewLine], RowBox[{(*, RowBox[{ Add, , links, , to, , all, , other, , topics}], *)}], [IndentingNewLine], n, RowBox[{(*, , RowBox[{-=, RowBox[{=, RowBox[{ RowBox[{ RowBox[{ RowBox[{-, Add}], , links, , to, , Packages}], -=}], =, -}]}]}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{fnpdir, =, RowBox[{FileNames, [, RowBox[{<*>, ,, RowBox[{ToFileName, [, RowBox[{{, RowBox[{ $InstallationDirectory, ,, <Documentation>, ,, <English>, ,, <Packages>}], }}], ]}]}], ]}]}], ;}], n, RowBox[{(*, RowBox[{ Directory, , names, , of, , the, , Packages}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{fnptut, =, RowBox[{ RowBox[{ RowBox[{FileNames, [, RowBox[{<*.nb>, ,, RowBox[{ToFileName, [, RowBox[{{, RowBox[{ #, ,, <Documentation>, ,, <English>, ,, <Tutorials>}], }}], ]}], ,, Infinity}], ]}], &}], /@, fnpdir}]}], ;}], n, RowBox[{(*, RowBox[{ tutorial, , notebooks, , of, , the, , Packages}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{fnpguid, =, RowBox[{ RowBox[{ RowBox[{FileNames, [, RowBox[{<*.nb>, ,, RowBox[{ToFileName, [, RowBox[{{, RowBox[{ #, ,, <Documentation>, ,, <English>, ,, <Guides>}], }}], ]}], ,, Infinity}], ]}], &}], /@, fnpdir}]}], ;}], n, RowBox[{(*, RowBox[{ guide, , notebooks, , of, , the, , Packages}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{NotebookFind, [, RowBox[{ nb, ,, <Section7>, ,, After, ,, CellTags}], ]}], ;, RowBox[{SelectionMove, [, RowBox[{nb, ,, After, ,, Cell}], ]}], ;}], [IndentingNewLine], RowBox[{ RowBox[{Do, [, RowBox[{ RowBox[{With, [, RowBox[{ RowBox[{{, RowBox[{packageName, =, RowBox[{ RowBox[{ RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, 1}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 1}]}], }}]}], ]}], StyleBox[&, FontVariations->{Underline->True}, FontColor->RGBColor[0., 0., 1.]]}], StyleBox[@, FontVariations->{Underline->True}, FontColor->RGBColor[0., 0., 1.]], RowBox[{ StyleBox[fnpdir, FontVariations->{Underline->True}, FontColor->RGBColor[0., 0., 1.]], StyleBox[[, FontVariations->{Underline->True}, FontColor->RGBColor[0., 0., 1.]], RowBox[{ StyleBox[[, FontVariations->{Underline->True}, FontColor->RGBColor[0., 0., 1.]], StyleBox[package, FontVariations->{Underline->True}, FontColor->RGBColor[0., 0., 1.]], ]}], ]}]}]}], }}], ,, RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{Cell, [, RowBox[{ RowBox[{beautify, @, packageName}], ,, <Section>, ,, RowBox[{CellDingbat, [Rule], None}], ,, RowBox[{ShowGroupOpener, [Rule], True}], ,, RowBox[{CellMargins, [Rule], RowBox[{{, RowBox[{ RowBox[{{, RowBox[{36, ,, 0}], }}], ,, RowBox[{{, RowBox[{5, ,, 5}], }}]}], }}]}]}], ]}]}], ]}], ;, n, RowBox[{If, [, RowBox[{ RowBox[{ RowBox[{Length, [, RowBox[{fnptut, [, RowBox[{[, package, ]}], ]}], ]}], >, 0}], ,, RowBox[{ RowBox[{level, =, RowBox[{If, [, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringTake, [, RowBox[{ RowBox[{fnptut, [, RowBox[{[, package, ]}], ]}], ,, RowBox[{ RowBox[{{, RowBox[{1, ,, RowBox[{-, 1}]}], }}], +, RowBox[{ RowBox[{(, RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{Take, [, RowBox[{ RowBox[{#, [, RowBox[{[, 1, ]}], ]}], ,, RowBox[{{, RowBox[{ RowBox[{-, 2}], ,, RowBox[{-, 1}]}], }}]}], ]}], &}], @, RowBox[{Transpose, [, RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], ]}]}], &}], /@, RowBox[{fnptut, [, RowBox[{[, package, ]}], ]}]}], )}], [, RowBox[{[, 1, ]}], ]}]}]}], ]}], [, RowBox[{[, 1, ]}], ]}], [Equal], <Tutorials>}], ,, 1, ,, 2}], ]}]}], ;, [IndentingNewLine], RowBox[{nameList, =, RowBox[{ RowBox[{ RowBox[{{, RowBox[{ RowBox[{<Tutorial: >, <>, RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, level}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 4}]}], }}]}], ]}]}], ,, RowBox[{ <paclet:>, <>, packageName, <>, </tutorial/>, <>, RowBox[{StringReplace, [, RowBox[{ RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, level}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 4}]}], }}]}], ]}], ,, RowBox[{ <>, [Rule], </>}]}], ]}]}]}], }}], &}], /@, RowBox[{fnptut, [, RowBox[{[, package, ]}], ]}]}]}], ;, [IndentingNewLine], RowBox[{Do, [, RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{d, [, RowBox[{ RowBox[{nameList, [, RowBox[{[, k, ]}], ]}], ,, <Subsection>, ,, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{48, ,, 0}], }}], ,, Inherited}], }}]}], ]}]}], ]}], ,, RowBox[{{, RowBox[{k, ,, RowBox[{Length, [, RowBox[{fnptut, [, RowBox[{[, package, ]}], ]}], ]}]}], }}]}], ]}]}]}], ]}], ;, n, RowBox[{If, [, RowBox[{ RowBox[{ RowBox[{Length, [, RowBox[{fnpguid, [, RowBox[{[, package, ]}], ]}], ]}], >, 0}], ,, RowBox[{ RowBox[{level, =, RowBox[{If, [, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringTake, [, RowBox[{ RowBox[{fnpguid, [, RowBox[{[, package, ]}], ]}], ,, RowBox[{ RowBox[{{, RowBox[{1, ,, RowBox[{-, 1}]}], }}], +, RowBox[{ RowBox[{(, RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{Take, [, RowBox[{ RowBox[{#, [, RowBox[{[, 1, ]}], ]}], ,, RowBox[{{, RowBox[{ RowBox[{-, 2}], ,, RowBox[{-, 1}]}], }}]}], ]}], &}], @, RowBox[{Transpose, [, RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], ]}]}], &}], /@, RowBox[{fnpguid, [, RowBox[{[, package, ]}], ]}]}], )}], [, RowBox[{[, 1, ]}], ]}]}]}], ]}], [, RowBox[{[, 1, ]}], ]}], [Equal], <Guides>}], ,, 1, ,, 2}], ]}]}], ;, [IndentingNewLine], RowBox[{nameList, =, RowBox[{ RowBox[{ RowBox[{{, RowBox[{ RowBox[{<Guide: >, <>, RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, 1}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 4}]}], }}]}], ]}]}], ,, RowBox[{ <paclet:>, <>, packageName, <>, </guide/>, <>, RowBox[{StringReplace, [, RowBox[{ RowBox[{StringTake, [, RowBox[{#, ,, RowBox[{{, RowBox[{ RowBox[{ RowBox[{ RowBox[{StringPosition, [, RowBox[{#, ,, $PathnameSeparator}], ]}], [, RowBox[{[, RowBox[{ RowBox[{-, level}], ,, 1}], ]}], ]}], +, 1}], ,, RowBox[{-, 4}]}], }}]}], ]}], ,, RowBox[{ <>, [Rule], </>}]}], ]}]}]}], }}], &}], /@, RowBox[{fnpguid, [, RowBox[{[, package, ]}], ]}]}]}], ;, [IndentingNewLine], RowBox[{Do, [, RowBox[{ RowBox[{NotebookWrite, [, RowBox[{nb, ,, RowBox[{d, [, RowBox[{ RowBox[{nameList, [, RowBox[{[, k, ]}], ]}], ,, <Subsection>, ,, RowBox[{{, RowBox[{ RowBox[{{, RowBox[{48, ,, 0}], }}], ,, Inherited}], }}]}], ]}]}], ]}], ,, RowBox[{{, RowBox[{k, ,, RowBox[{Length, [, RowBox[{fnpguid, [, RowBox[{[, package, ]}], ]}], ]}]}], }}]}], ]}]}]}], ]}]}]}], n, ]}], ,, RowBox[{{, RowBox[{package, ,, RowBox[{Length, [, fnpdir, ]}]}], }}]}], ]}], ;}], n, RowBox[{(*, RowBox[{ Add, , links, , to, , package, , tutorials, , and, , guides}], *)}], [IndentingNewLine], [IndentingNewLine], RowBox[{ RowBox[{SelectionMove, [, RowBox[{nb, ,, All, ,, Notebook}], ]}], ;, RowBox[{FrontEndExecute, [, RowBox[{ FrontEndToken, [, <SelectionCloseAllGroups>, ]}], ]}], ;}], [IndentingNewLine], RowBox[{ RowBox[{FrontEndExecute, [, RowBox[{FrontEndToken, [, <OpenCloseGroup>, ]}], ]}], ;}], [IndentingNewLine]}]}]], Input, CellChangeTimes->{3.411770874483*^9}] }, WindowSize->{607, 750}, WindowMargins->{{2, Automatic}, {44, Automatic}}, FrontEndVersion->6.0 for Microsoft Windows (32-bit) (June 19, 2007), StyleDefinitions->Default.nb ] === Subject: Lowest Common Multiple programming Hi All, I am trying to make a programming code to find the LCM between the following numbers. I DO NOT want to use Prime Factorization but wish to setup some kind of table multiplication process until required results are found. Here are the correct results shown using LCM function LCM[Rationalize[1.4137, 0], Rationalize[2.5, 0], 5, Ratio