mm-639 === Subject: Trial Version and Regular Version - Differences Hi buddies , Can anybody explain me the differences between a Trial Version (say 5.2 ) and the Regular (Professional) version of Mathematica ? === Subject: Re: Question on Thread > I have never fully understood Threads sometime strange behaviour. In any > case, MapThread gives me much less trouble and can do everything Thread > can. Your example would then read: > Clear[f, g] > MapThread[(f[g[#1], #2] &), {{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}}] > and this does what one would expect. > Daniel >> Clear[f] >> Thread[(f[#1, #2] & )[{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}]] >> Gives the expected output, i.e. {f[1,{a,1}], f[2,{b,2}],...} >> but >> Clear[f, g] >> Thread[(f[g[#1], #2] & )[{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}]] >> gives me: >> f[g[{1, 2, 3}], {a, 1}], f[g[{1, 2, 3}], {b, 2}], ..., etc. >> whereas I would have expected: >> f[g[1], {a, 1}], f[g[2], {b, 2}], ..., etc. >> I've looked at the 'Thread' documentation and in the Mathematica Book, >> but I can't see why the second case doesn't work. this is as usual a matter of evaluation order: Since neither Thread nor MapThread evaluate their arguments, these are evaluated before the functions actually see the arguments. In the case of MapThread nothing happens with the pure function given in the first argument, in the case of Thread, Thread will see as it's argument: Out[1]= f[g[{1, 2, 3}], {{a, 1}, {b, 2}, {c, 3}}] which is what In[1]:= (f[g[#1], #2] & )[{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}] evaluates to. To avoid this, you could use: Thread[Unevaluated[(f[#1, #2] &)[{1, 2, 3}, {{a, 1}, {b, 2}, {c, 3}}]]] which gives the expected results (at least my guess of your expectation :-). hth albert === Subject: Showing Animation Outputs together How to group together all animated (here 8) hexagonal prisms around the spin axis into one single final frame? ( It is assumed that there is less interference between individual objects which do not clutter up much in 3-space) . TIA . cylspin= {u Cos[t]+ Cos[v] Sin[t] ,-u Sin[t]+ Cos[v] Cos[t],Sin[v]} ; Do[ParametricPlot3D[cylspin,{u,2,3},{v,0,2*Pi}, PlotPoints->{9,7}],{t,0,2 Pi,Pi/4}] ; === Subject: Re: Eliminate Complex Roots the method with findinstance: In > (plot1 = ListPlot[Partition[Flatten[N[Table[Flatten[{b, a /. FindInstance[a^3 + 10*a^2 - 15*a + b == 0, a, Reals, 3]}], {b, -20, 30, 5}]] /. {x_, y1_, y2_, y3_} -> {x, y1}], 2], PlotJoined -> True, PlotStyle -> Hue[0]]; plot2 = ListPlot[Partition[Flatten[N[Table[ Flatten[{b, a /. FindInstance[a^3 + 10*a^2 - 15* a + b == 0, a, Reals, 3]}], {b, -20, 30, 5}]] /. {x_, y1_, y2_, y3_} -> {x, y2}], 2], PlotJoined -> True, PlotStyle -> Hue[0.4]]; plot3 = ListPlot[Partition[Flatten[N[Table[Flatten[{b, a /. FindInstance[a^3 + 10*a^2 - 15*a + b == 0, a, Reals, 3]}], {b, -20, 30, 5}]] /. {x_, y1_, y2_, y3_} -> {x, y3}], 2], PlotJoined -> True, PlotStyle -> Hue[0.2]]; DisplayTogether[plot1, plot2, plot3]) // Timing Out > {4.562 Second, -Graphics-} here is a much more efficient way (on my computer) woth NSolve: In > calcul := Module [{eq, points, resultat, graphe1, graphe2, graphe3}, eq = a^3 + 10*a^2 - 15*a + b == 0; resultat = Table[Map[{i, #} &, a /. NSolve[eq /. b -> i, a], {1}], {i, -20, 30, 0.1}] // Flatten[#, 1] &; points = Select[#, NumberQ[#[[ 1]]] &] & /@ Table[Partition[RotateLeft[ resultat /. {_, a_Complex} -> {rien}, i], 1, 3] // Flatten[#, 1] &, {i, 3}]; graphe1 = ListPlot[points[[1]], PlotJoined -> True, PlotStyle -> RGBColor[0, 0.7, 1], DisplayFunction -> Identity]; graphe2 = ListPlot[points[[2]], PlotJoined -> True, PlotStyle -> RGBColor[1, 0, 0], DisplayFunction -> Identity]; graphe3 = ListPlot[points[[3]], PlotJoined -> True, PlotStyle -> RGBColor[0.5, 0.8, 0], DisplayFunction -> Identity]; Show[graphe1, graphe2, graphe3, DisplayFunction -> $DisplayFunction] ] // Timing In > calcul out > {0.484 Second, -Graphics-} Rudy === Subject: Re: Counting circles (digital image processing) > Suppose we have a picture with a set of white circles on a black > background. > How can we count circles and measure their radius using mathematica > system??? That's a research topic for sure, but Hough Transforms come to mind. There is a vast literature. Google is your friend. Joe Gwinn === Subject: Re: Counting circles (digital image processing) label the connected components in the binarized image. For the radius I would suggest to use a distance transform on the binary image and the maximum value of the distance transform in every single unconnected component is your radius Jens Alexander schrieb im | | Suppose we have a picture with a set of white circles on a black | background. | How can we count circles and measure their radius using mathematica | system??? | | Alexander. | === Subject: Re: SetOptions with Column Rob, I don't understand your equation, but do you mean something like this? (eqns = {a == x y, a == u/v}) // TableForm or do you mean a Piecewise function, which is formatted for you? Generally I wouldn't think it is worth detailed formatting of a GridBox for a homework assignment. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ I am trying to use Mathematica to typeset homework assignments. I'm trying to use GridBoxes to format multi-line equations of the following sort: a = b = c = d = e = f Because I use formulas like this a lot, it would be nice if I could get Mathematica to make the default alignment for the columns of GridBoxes to be Left, instead of Center. However, when I try to use SetOptions to accomplish this, I get: In: SetOptions[GridBox,ColumnAlignments->{Left}] Options[GridBox,ColumnAlignments] Out: {ColumnAlignments->{Center}} In: SetOptions[GridBox,ColumnAlignments->Left] Options[GridBox,ColumnAlignments] Out: {ColumnAlignments->{Center}} My Mathematica abilities are somewhat limited, so I have no idea what is going wrong (or going write, as the case may be). Using Unprotect didn't help. Any ideas? I'm using Mathematica 5.1.0.0 on WinXP. Rob === Subject: Re: How to hide mathematica code? > Is there any possibility to define a function and hide it's > implementation? > The answer seems to be no. > Alexander. I think the answer is yes (with one reservation). Here is an example: In[1]:= f[x_]:=x^2; In[2]:= SetAttributes[f,{Locked,Protected,ReadProtected}] In[3]:= DumpSave[f.mx,f]; Now quite the kernel and read in the file f.mx. In[1]:= << f.mx In[2]:= f[2] Out[2]= 4 In[3]:= ?f Global`f Attributes[f] = {Locked, Protected, ReadProtected} Opening the file f.mx also does not reveal any information about f. The only problem is that the file f.mx is not portable to a different platform. === Subject: Re: How to hide mathematica code? Alexander, The answer is yes! 1) You could put the code in a package. Then you would see only the statement that calls the code. 2) You could put the code in a separate Section of a notebook, say a Routines Section. Then the reader would see the code only if they looked in the Routines Section. (And in general it is useful to learn how to use the Section-Subsection structure of notebooks.) 3) You could close the cell that contains the code. Use menu, Cell Properties, or select the cell bracket and use Alt CRC. This closes the cell and all the reader sees is a thin space and a thin bracket on the right. The cell can still be evaluated and a reader may have to be reminded to actually do the evaluation. This is especially useful for diagrams and graphics where the graphics code might be quite long and detailed. All you want the reader to see is the diagram. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Is there any possibility to define a function and hide it's implementation? The answer seems to be no. Alexander. === Subject: How to do a family of plots? Experts, I have used the scheme below with ParametricPlot and it worked. But with a simple plot it doesn't. It seems clear the plot function is not seeing the f variable. Plot is not getting machine sized numbers, etc. Nothing I've tried seems to help. help, Rob p[f_,L_]:=(1-f) ArcCos[Exp[-2/L]] {q,r,y,z}=Plot[p[f,L],{L,0.1,10}] /. f->{0.2,0.4,0.6,0.8} === Subject: Re: Using a text editor like interface for Mathematica? > An option to avoid the tab issue is to use InputForm instead of > StandardForm. I don't know how this works. There seemed to be a function that would convert between what's shown in Mathematica and how I would type it (good for importing to a text file or if I was using the command line kernel input), but I don't see (or can't find) any way to get Mathematica to allow me to do my own formatting. Am I missing something here? Changing from one format to another doesn't seem to be what I'm looking for. Here's my challenge: tell me of a way that I can get Mathematica to allow me to tab whenever I want, regardless of whether Mathematica thinks it's appropriate. This kind of restricted behaviour I'm currently experiencing is what I expect from MS Word, not from a programming environment. I know it sounds like I'm complaining about something trivial, but the ability to format easily leads to readable code, which leads to productive work. Try this: Start a new notebook. Type a single letter. Then try to tab. Result: Nothing happens. It's hard to align code easily under these circumstances. Tell me a way to fix this and I will send you a dollar. > > Oh, and the ability to use underscores in naming would've been nice. > While underscores are not available, you can use things like > [UnderBracket] (alias esc u [ esc), [UnderBrace] (alias esc u { esc), etc. I wasn't aware of the underscore option. It's a little awkward to type and looks awful, but I guess I'll take what I can get. Maybe I can map one of my function keys to do this. I appreciate it. john === Subject: Re: Re: Using a text editor like interface for Mathematica? To elablorate on point b): Since the underscore is used in Mathematica to indicate a pattern, then to allow an underscore as part of a name could cause vast confusion, e.g., for a symbol n, the expression n_Integer already has a meaning in Mathematica. > a) underscores in names are a matter of taste > b) this will never, never happen in Mathematica > Jens > schrieb im Newsbeitrag > | > > | > write you *.m files in TextPad (I use it too) > and > | > in your FrontEnd say > | > > | > < | > > for use in TextPad, and > | while I can't use it interactively with > Mathematica, I still like it. I read > | somewhere that Wolfram is putting syntax > highlighting in the next > | version of Mathematica -- a welcome addition. > | Now if only it would quit fighting me on > tabs.... grrrr........ > | Oh, and the ability to use underscores in naming > would've been nice. > | this_is_my_variable > | is much more readable than > | ThisIsMyVariable. > | Sigh...............YouCantWinThemAll. > | -- 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: Re: Using a text editor like interface for Mathematica? just what it says the Mathematica package I'm editing in my beloved TextPad .. and in the frontend I load the package, do some testing and go back to my editor change something, save it, reload it into the kernel ... Jens Jens Ingolf Dahl schrieb im | Please, explain what is MathematicaPackageImEditingNow? | No hits anywhere... | | Ingolf Dahl | Sweden | | > -----Original Message----- [mailto:kuska@informatik.uni-leipzig.de] === | > Subject: Re: Using a text editor like interface for | > Mathematica? | > write you *.m files in TextPad (I use it too) and in your FrontEnd say | > < and only do teh testing in the FrontEnd ... | > Jens | > schrieb im Newsbeitrag | > |I very much dislike how using Mathematica's front | > end is like programming in | > | Microsoft Word. It makes its own style and | > indenting choices, and I | > | prefer using something like the | > syntax-highlighted text editor format | > | that most traditional compilers use (e.g. Visual | > c++). | > | | > | The tabs / spacing, fonts and colors are never | > right. The non-bold | > | fonts look anemic. I know this sound neurotic, | > but I program in Mathematica | > | frequently, so it's important. | > | | > | To add to the problem, Mathematica 5.2 (and | > probably earlier releases) has some | > | nasty bug in the front end that loses track of | > my tabs and other | > | whitespaces. Occasionally (frequently) I have | > to cut my code and paste | > | it into a text editor and then cut and paste it | > back, which destroys | > | all my tabs and spacing. | > | | > | I'd like to get Mathematica to be as similar as | > possible to a text-editor | > | (preferably with syntax highlighting intact), | > but I've never been able | > | to get it quite right. Does anyone know of a | > style sheet that does | > | this? Or is there any other way to do it? I | > just want a nice, Courier | > | New, 12 or 14 pt. font, with the tabs and | > spacing behaving *exactly* | > | like they do in a text editor, and with a gray | > background. Exactly how | > | I've set my VC++ editor and Textpad settings. | > | | > | A million thank yous to anyone who can help. | > | | > | -john | > | | | === Subject: Re: How to hide mathematica code? I was just trying to figure this out myself. It doesn't look like you can completely hide it, but you can collapse the cell that it is in so the next person viewing the notebook doesn't see it without extra effort. You go to Cell->Cell Properties and disable the Cell Open check box. You will need to highlight the cell by going to the right of the notebook and highlighting the bar that defines the cell. Link to the forum page for this post: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Speci al:Forum_ViewTopic&pid=8366#p8366 === Subject: Beginner--Using subscripts in vectors I'm taking a class in Evolutionary Computation and I would like to provide the other students with some plots of around 20 2D functions that are defined over any length vector (of real numbers). I've defined a few of them already and it is more laborous that I would think it need be. What I'm currently doing is describing the function using standard mathematical notation in a text cell and then defining it again in a way that Mathematica can understand it in the next cell. The real problem is doing summations over vector components. I would like Subscript[x, i] to be interpretted as Part[x, i] and n to be interpretted as Length[x] when I do the plot. I would then like to be able to tell mathematica to plot it over all two dimensional vectors where Subscript[x, i] ranges from -10.0 to 10.0 for each i. Is there anyway I can do this? An example: Schwefel's Problem 1.2 is defined as: !(f ((x)) = [Sum]+(i = 1)%n(([Sum]+(j = 1)%i x_j))^2) I would like to be able to pass this in to Mathematica and get a 3D plot out of this function for i ranging from 1 to 2 and Subscript[x, i] ranging from -10 to 10 without having to translate the formula again.. Oh, I don't mind changing f(x) to be f[x]. I know that's how mathematica wants it. Link to the forum page for this post: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Speci al:Forum_ViewTopic&pid=8365#p8365 === Subject: multiple plots from a list of parameters? Apparently I finally stumbled into a way to invert a function p[f,L] on which I recently posted. But after a lot of trying I can't seem to stumble my way into the next step. The code below works: p[f_,L_] =: (defined) result16 := FindRoot[p[f, L] == 1600, {f, 0.5}]; result12 := FindRoot[p[f, L] == 1200, {f, 0.5}]; result08 := FindRoot[p[f, L] == 800, {f, 0.5}]; result04 := FindRoot[p[f, L] == 400, {f, 0.5}]; pL16 = Plot[f /. result16 // Evaluate, {L, 0.2, 10}] pL12 = Plot[f /. result12 // Evaluate, {L, 0.2, 10}] pL08 = Plot[f /. result08 // Evaluate, {L, 0.2, 10}] pL04 = Plot[f /. result04 // Evaluate, {L, 0.2, 10}] Show[pL16,pL12,pL08,pL04] I end up with 4 plots. Even I can tell this is crude and no way to do business. I need to be able to use a list={1600,1200,800,400} and get these 4 (or n plots) plots done in less than n sets of statements. All my attempts to use the list fail. Can someone give me some syntax that === Subject: Re: Mathematica 5.2 for Linux X Error rudy escreveu no grupo comp.soft-sys.math.mathematica: > I'm using Mathematica (student version) 5.2 on Linux too > (Ubuntu distrib with Gnome) and i've a problem too: > the front end and the kernel work fine, but when i start Matmematica, > it seems to be a problem with gnome because the desk is bloqued... > Has somebody the same problem or an idea to solve it? I ran Mathematica 5.0 on Ubuntu Linux with GNOME (and in Slackware Linux with KDE too) and had no problems with it. Try running it from a terminal and then post what happens. === Subject: Re: How to hide mathematica code? Hi Alexander, > Is there any possibility to define a function and hide it's > implementation? > The answer seems to be no. It depends what you mean by hide .... You could ... Set the closed cell size to be very small ... Use white on white as a special style ... Encode[] the package that you export. The first two might be more suitable for reports while the last is more suitable for package distribution. Perhaps if you told the group why you want to do this, you might get more answers. Dave. === Subject: Re: How to hide mathematica code? > Is there any possibility to define a function and hide it's implementation? > The answer seems to be no. I think the only option would be MathLink programming and a closed- source library. === Subject: Re: How to hide mathematica code? > Is there any possibility to define a function and hide it's > implementation? The answer seems to be no. Look at the attributes ReadProtected and Locked. In combination they will do what you want. Be aware that it is nevertheless possible to peak at your code with some tricks for an advanced user (like e.g. redefining common coding constructs like Block or Module so that they print their arguments).. hth albert === Subject: Re: How to hide mathematica code? you can make a package from your code and all what remains is Nedds[MayPackage`] you can make a subsection/section in your notebook call it Code and close the section and its sub-groups. Jens Alexander schrieb im | | Is there any possibility to define a function and hide it's implementation? | The answer seems to be no. | | Alexander. | === Subject: Re: How to hide mathematica code? > Is there any possibility to define a function and hide it's implementation? > The answer seems to be no. > Alexander. I think it would help to tell us a little more about what you want. By 'hide' do you mean to hide the implementation for convenience or to protect your algorithm from theft. The former is easily done using packages, but stopping someone examining your code deliberately is hard to do in a totally satisfactory way because at some point it has to be resident inside the kernel. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Not Using a Text Editor Interface for Mathematica > The average user would be better off mastering the regular Mathematica notebook interface. > The default interface automatically provides spaces and automatic indentation. I have spent a rather large amount of time tuning my favorite editor (Vim) to work with HTML and C/C++ programming. > Far better to think in terms of the Text-Equations-Diagrams (TED) interface. > Think of Mathematica as pencil and paper. > Write your textual explanations, write definitions, equations and rules, and draw diagrams. Most calculations I do with Mathematica are number crunching. I don't draw diagrams that often. === Subject: Re: Not Using a Text Editor Interface for Mathematica I started one of these recent threads, and while I appreciate what you're saying, my actual complaint (I gather the others had a different slant) wasn't with the notebook paradigm. I want the notebook idea, I just can't stand Mathematica's style choices. I find it easier to read programs written in c/c++, because the fonts, spacing, colors and such are much more easily set to my tastes (oh, and because of use of underscores in variable and function names.) This is the beginning and end of my point. I'm not criticising the notebook paradigm (though I don't write very large scale applications). I gather that deep down, Mathematica can be made closer to a text-editor in style, but using the notebook options in Mathematica is like graphing in Mathematica. Sure it's flexible, but it's needlessly difficult to get things exactly as you want them. Look at it this way: (1) Computer programmers do the most computer programming (natch) and therefore need the best possible programming environment. (2) They are the most qualified to do something about said environment if they don't like that it. And yet, after decades, the basic working environment is still a syntax-highlighted text editor (THAT LETS YOU TAB WHEN YOU WANT with function argument hints (a la MS VC++), then it would be pretty close to perfect. Wolfram has some brilliant programmers, but I think they need to concentrate on ease-of-use issues. Actually, I know from a friend who spoke to Stephan Wolfram himself they're working on improving the their rotten [my word] graphing capabilities. Hopefully they'll work on the front end while they're at it. john === Subject: Re: Using subscripts in vectors I think I've figured out how to get what I want. I'm going to have to figure out how this pattern matching system works. Are there any good books on how this all fits together? Link to the forum page for this post: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Speci al:Forum_ViewTopic&pid=8367#p8367