A118 === Subject: Re: Possible values for the Method option for Graphics?? > One of the very disappointing things about the documentation is that the > possible values for certain options are very difficult to find. For example, takeNIntegrate. The doc page mentions the Method option, > but it does not say what the possible values are. This is just incorrect. The possible values of the Method option are listed in NIntegrate's function page. That page has the following paragraphs: * Possible explicit settings for the Method option include: GlobalAdaptive global adaptive integration strategy LocalAdaptive local adaptive integration strategy DoubleExponential double exponential quadrature MonteCarlo Monte Carlo integration AdaptiveMonteCarlo adaptive Monte Carlo integration QuasiMonteCarlo quasi Monte Carlo integration AdaptiveQuasiMonteCarlo adaptive quasi Monte Carlo integration * With Method->{strategy,Method->rule} or Method- >{strategy,Method->{Subscript[rule, 1],Subscript[rule, 2],[Ellipsis]}} possible strategy methods include: GlobalAdaptive subdivide based on global error estimates LocalAdaptive subdivide based only on local error estimates * Methods used as rules include: CartesianRule multidimensional Cartesian product of rules ClenshawCurtisRule Clenshaw[Dash]Curtis rule GaussKronrodRule Gauss points with Kronrod extension LobattoKronrodRule Gauss[Dash]Lobatto points with Kronrod extension MultidimensionalRule multidimensional symmetric rule MultipanelRule combination of 1D rules NewtonCotesRule Newton[Dash]Cotes rule TrapezoidalRule uniform points in one dimension Anton Antonov, Wolfram Research, Inc. > Clicking the link > just takes us to a generic information page for Method which doesn't > even mentionNIntegrate. It turns out that the values *are* documented > at tutorial/NIntegrateOverview, but it is not at all obvious that one > should look there. noticed that Graphics has a Method option too. What are the possible > values and where are they documented? Szabolcs Horv=E1t === Subject: Re: Write documentation for 6.0 under Solaris Hello Karen, I have Mathematica on Solaris 10. But I do not understand what is your problem. Could you use an example? with friendly greetings, P_ter === Subject: Re: Mathlink: How do I pass arbitrary data from Mathematica to C? Hello Karen, did you already write your program? I am interested. Maybe more. As an example !? with friendly greetings, P_ter === Subject: Re: Rotation of 3D objects > Here is some code for those who have the Presentations package. > For reflection in a mirror: > Needs[Presentations`Master`] > Module[ > {(* object to reflect *) > gr = ParametricDraw3D[{t, u + t, u t/5}, {t, 0, 2}, {u, -1, 1}, > Mesh -> 5, > BoundaryStyle -> Black], > (* Mirror location and normal *) > p = {1, 1, 2}, > normal = {0, 0, 1}, > vector1, vector2}, > {vector1, vector2} = NullSpace[{normal}]; > Draw3DItems[ > {(* Original object *) > {Opacity[.7, HTML[DarkSeaGreen]], gr}, > (* Reflected object *) > {Opacity[.7, HTML[DodgerBlue]], gr} // > ReflectionTransformOp[normal, p], > (* Draw the mirror *) > {Opacity[0.3, HTML[SkyBlue]], > ParametricDraw3D[ > p + s vector1 + t vector2, {s, -3, 3}, {t, -3, 3}, > Mesh -> None]}}, > NeutralLighting[0, 0.6, .1], > NiceRotation, > ViewPoint -> {2, -2.4, .6}, > Boxed -> False, > ImageSize -> 300] > ] > Multiple copies of rotation about an axis: > Module[ > {(* object to reflect *) > gr = ParametricDraw3D[{t, u + t, u t/5}, {t, 0, 2}, {u, -1, 1}, > Mesh -> 5, > BoundaryStyle -> Black], > (* axis, location and number of copies *) > axis = {1, 1, 0}, > axislocation = {-1.5, -1.5, 2}, > ncopies = 4, > rotationangle}, > rotationangle = 2 [Pi]/ncopies; > Draw3DItems[ > {(* Rotations *) > {Opacity[.7, HTML[DarkSeaGreen]], > Table[gr // > RotationTransformOp[n rotationangle, axis, axislocation], {n= , = > 0, > ncopies - 1}]}, > (* Draw the axis *) > Red, Arrow3D[axislocation, axislocation + 5 axis, {.10}]}, > NeutralLighting[0, 0.6, .1], > NiceRotation, > ViewPoint -> {-1, -2.4, .6}, > Boxed -> False, > ImageSize -> 300] > ] > A Manipulate statement allowing the rotation about an axis by an adjusta= bl= > e > angle theta. > Manipulate[ > Module[ > {(* object to reflect *) > gr = ParametricDraw3D[{t, u + t, u t/5}, {t, 0, 2}, {u, -1, 1},= > Mesh -> 5, > BoundaryStyle -> Black], > (* axis direction and location *) > axis = {1, 1, 0}, > axislocation = {-1.5, -1.5, 2}}, > Draw3DItems[ > {(* Original object *) > {Opacity[.7, HTML[DarkSeaGreen]], gr}, > (* Rotated object *) > {Opacity[.7, HTML[DodgerBlue]], > gr // RotationTransformOp[[Theta], axis, axislocation]}, > (* Draw the axis *) > Red, Arrow3D[axislocation, axislocation + 5 axis, {.10}]}, > NeutralLighting[0, 0.6, .1], > NiceRotation, > PlotRange -> {{-1, 4}, {-1, 4}, {-1, 5}}, > ViewPoint -> {-1, -2.4, .6}, > Boxed -> False, > ImageSize -> 300] > ], > Style[Rotation about axis by angle [Theta], 16], > {[Theta], 0, 2 [Pi], Appearance -> Labeled}] > -- > David Park > djmp...@comcast.nethttp://home.comcast.net/~djmpark/ > By what command is it possible to create (without writing a code > separately ): > 1) Reflections of 3D objects about a plane? > 2) Multiple copies equally spaced by rotation around an axis throug= h > two given points? > E.g., > surf = ParametricPlot3D[{ t,u+t, u*t/5}, {t,0,2},{u,-1,1}]; > Rotate[surf,Axis->{ {-1,-1,-1},{1,1,1}} , Copies-> 4 ] ; and, > 3) A single rotation of given object through a given angle on an axis > through two defined points? > Narasimham- Hide quoted text - > - Show quoted text - Actually in engineering drawing software e.g., CATIA, Autocad Pro E > &c. such 3D operations are routinely implemented, clicking on a > standard GUI...the mathematical basis of which I was sure is well > within Mathematica's range of computational capabilities. ( and it > also appeared in 200 seconds. ).Mathematica gives the user an > advantage to see those steps, or look into the black box.Of course, > some minimum code lines have to be written. Narasimham is posted here but meant to follow Jen's msg). Is it possible to have a same frame of reference to Show another 3D object together with say 3 rotated copies of an object out of the slider ? Narasimham === Subject: What's DSolve's output when it cant find a solution ? Im using Mathematica 6 to look for solutions to a system of nonlinear ODE's. I don't expect a solution, but the only output Im getting is an exact reprint of my input. This usually means that the arguments to the function are incorrect, but Im fairly certain they're OK. Here is my input: In[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] Out[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] Is this what I should expect when DSolve can't find a solution ? Also, this is returned immediately without any Running ... . Dennis === Subject: Re: What's DSolve's output when it cant find a solution ? > Im using Mathematica 6 to look for solutions to a system of nonlinear ODE's. I > don't > expect a solution, but the only output Im getting is an exact reprint > of my input. > This usually means that the arguments to the function are incorrect, > but Im > fairly certain they're OK. > > Here is my input: > > In[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - > Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] > Out[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - > Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] > > Is this what I should expect when DSolve can't find a solution ? Also, > this is returned immediately > without any Running ... . Yes, when DSolve returns unevaluated, it cannot solve the equation. You misspelled DSolve as Dsolve above, but Mathematica still cannot solve this equation. === Subject: Re: What's DSolve's output when it cant find a solution ? you mean DSolve[] and *not* Dsolve and it returns unevaluated if it can't find a solution. Jens > Im using Mathematica 6 to look for solutions to a system of nonlinear ODE's. I > don't > expect a solution, but the only output Im getting is an exact reprint > of my input. > This usually means that the arguments to the function are incorrect, > but Im > fairly certain they're OK. > > Here is my input: > > In[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - > Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] > Out[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - > Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] > > Is this what I should expect when DSolve can't find a solution ? Also, > this is returned immediately > without any Running ... . > > Dennis > === Subject: Re: What's DSolve's output when it cant find a solution ? Hi Dennis, it happens to everybody, you are fooling yourself: The command is DSolve, not Dsolve. hope this helps, Daniel > Im using Mathematica 6 to look for solutions to a system of nonlinear ODE's. I > don't > expect a solution, but the only output Im getting is an exact reprint > of my input. > This usually means that the arguments to the function are incorrect, > but Im > fairly certain they're OK. > > Here is my input: > > In[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - > Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] > Out[11]:= Dsolve[{s''[t] + Cot[u[t]/2]*s'[t]*u'[t] == 0, u''[t] - > Sin[u[t]]*s'[t]^2 == 0 }, {s[t], u[t]}, t] > > Is this what I should expect when DSolve can't find a solution ? Also, > this is returned immediately > without any Running ... . > > Dennis > === Subject: Pythonika and dictionaries. I'm trying to squeeze the most use out of Pythonika as I can, and Python's dictionaries are a feature that would be particularly convenient on the Mathematica side. Is there a reasonable quick Python function that one can define for Pythonika that takes a dictionary out of the Python namespace and feeds it into Mathematica as a Module so it can be used the same way? Denham Quantitative Management LP 200 Clarendon Street, 25th Floor Boston, MA 02216 T: 617-587-5812 M: 617-909-7786 omri.schwarz@denhamcapital.com ---------------------------------------------------------------------------= -------------------------------------- NOTICE: This e-mail message is intended for the named recipients above. It= may contain confidential information. If you are not the intended= recipient, you are hereby notified that any dissemination, distribution,= or copying of this e-mail and any attachment(s) is strictly prohibited. = If you have received this e-mail in error, please immediately notify the= sender by replying to this e-mail and delete the message and any= attachment(s) from your system. NO REPRESENTATION OR WARRANTY IS MADE TO= ANY PERSON AS TO THE ACCURACY OR COMPLETENESS OF THE INFORMATION CONTAINED= HEREIN. Denham Capital Management(sm) is a trademark of Denham Capital Management= LP. ---------------------------------------------------------------------------= === Subject: solving a system of polynomial equations I'm pretty new to Mathematica. I want to numerically solve a system of N polynomial equations with N unknowns. I've heard that Mathematica was able to find all the real/complex solutions due to the fact that equations only involve polynomials. Is that correct? If yes, what is the command/method? thank you, Pluton === Subject: Re: solving a system of polynomial equations Hi Pluton, you may use Solve or the more powerfull Reduce. hope this helps, Daniel > > I'm pretty new to Mathematica. I want to numerically solve a system of > N polynomial equations > with N unknowns. I've heard that Mathematica was able to find all the > real/complex solutions due to > the fact that equations only involve polynomials. Is that correct? If > yes, what is the command/method? > > thank you, > > Pluton > === Subject: Re: Mixed Numerical Derivatives > How can I come up with the Hessian of a function, at a particular > point, which can only be evaluated numerically? If I had a symbolic > function, I could do something like In[123]:= > D[x^3 + z*y^-1 + z^(1/2), {{x, y, z}, 2}] /. {x -> 3, y -> 5, > z -> 12} Out[123]= {{18, 0, 0}, {0, 24/ > 125, -1/25}, {0, -1/25, -1/(96 Sqrt[3])}} The function I'm interested in, though, can only be calculated > numerically. Using ND, I can find the diagonal elements of the > Hessian: In[92]:= rules = Last[ > FindMaximum[{Total[logPr[vdt, ddt, var, #] & /@ testData], ddt > 0, > var > 0}, {{vdt, .9}, {ddt, 120}, {var, 90}}]] Out[92]= {vdt -> 0.95945, ddt -> 151.097, var -> 103.255} In[111]:= Needs[NumericalCalculus`] In[124]:= ND[ > Total[logPr[vdtp, ddt, var, #] & /@ testData] /. rules, {vdtp, 2}, > Evaluate[vdt /. rules]] Out[124]= -64.4011 But what about the off diagonal elements? If you'll need to evaluate the derivatives of the function many times, try setting up a FunctionInterpolation. You can use D on that. === Subject: Re: Mixed Numerical Derivatives [note: message sent to comp.soft-sys.math.mathematica] > > I have version 6 and can not find ND. It is in the NumericalCalculus package. > > Nevertheless, you could try an iterative approach. E.g.: > > ND[ ND[fun[x,y],{x,2},1] ,{y,2}, 1] This will appear to work for simple functions, but I would not recommend it because the inner ND is evaluated /before/ the outer ND, and produces a semi-symbolic result, i.e. something containing both 'y' and floating point numbers. This might not work at all for complicated functions that /must/ take numerical arguments, and even for simple functions ND cannot check for convergence, etc., so it is problematic. A similar solution is to define one's own double-derivative function which avoids evaluation of the inner ND explicitly, e.g. ND2[expr_, x_, y_, x0_, y0_] := Module[{fun, a}, fun[a_?NumericQ] := ND[expr /. y -> a, x, x0]; ND[fun[a], a, y0] ] ND2[Sin[x y], x, y, 1, 1] ... but I am still not comfortable with this approach ... > > hope this helps, Daniel > > > > >> How can I come up with the Hessian of a function, at a particular > >> point, which can only be evaluated numerically? If I had a symbolic > >> function, I could do something like > > >> In[123]:= > >> D[x^3 + z*y^-1 + z^(1/2), {{x, y, z}, 2}] /. {x -> 3, y -> 5, > >> z -> 12} > > >> Out[123]= {{18, 0, 0}, {0, 24/ > >> 125, -1/25}, {0, -1/25, -1/(96 Sqrt[3])}} > > >> The function I'm interested in, though, can only be calculated > >> numerically. Using ND, I can find the diagonal elements of the > >> Hessian: > > >> In[92]:= rules = Last[ > >> FindMaximum[{Total[logPr[vdt, ddt, var, #] & /@ testData], ddt > 0, > >> var > 0}, {{vdt, .9}, {ddt, 120}, {var, 90}}]] > > >> Out[92]= {vdt -> 0.95945, ddt -> 151.097, var -> 103.255} > > >> In[111]:= Needs[NumericalCalculus`] > > >> In[124]:= ND[ > >> Total[logPr[vdtp, ddt, var, #] & /@ testData] /. rules, {vdtp, 2}, > >> Evaluate[vdt /. rules]] > > >> Out[124]= -64.4011 > > >> But what about the off diagonal elements? === Subject: Re: Something very simple..... very simple.... Here I report back what I think are the easiest suggestions. 1. Apply[Sphere, sphlst, 1] 2. Complement[lsta,lsta[[lstb]]] These answers can hardly be improved for compactness, simplicity, and transparency. I admittedly avoid processes that include a lot of terse symbology such as &, #, @, /. etc., on the grounds that I'm an irregular user of Mathematica and sometimes have to look up their function. Their appearance gives no clue about what they do. But the named functions are usually intuitive and their use is clear. Steve Gray === Subject: Re: Mathematica notebooks the best method for technical > On 1 Apr, 09:20, Mariano Su=E1rez-Alvarez > Indeed. I would not be able to describe such an effort > with any other term apart from misguided. Very misguided. > Essentially > proprietary formats cannot possibly be considered as a > the simple fact that Mathematica, say, is absurdly expensive > for most of the world, to rather more complicated issues > (for example, one can never tell when the whimsical ires > of whatever be the superpower of the day, any day, may decide > to forbid selling, say, Mathematica to country X in order > to `fight Y' for whatever value X has at the time---terrorists, > peadophiles, and so on.), to so many other issues... > It simply cannot withstand any analysis. > -- m The only way I could see this happening is if Wolfram Research > released the front end under the GPL or similar. Then it might, but > even then it is far from clear it would and I personally doubt it > would. Since the semantics of .nb files are handled by the kernel, mostly, having the front end be even public domain does not solve anything. Indeed, assuming one can render any notebook just with front-end functionality, having a free-as-in-freedom frontend but not a free-as-in-freedom kernel does not leave you in any better position than having a PDF reader, which you already have. -- m === Subject: Re: Mathematica notebooks the best method And indeed there is no reason not to author documents in Mathematica and distribut them as both PDFs and Mathematica notebooks. Mathematica Player will then allow the reader to read them in their native format (and perhaps do some dynamic experiments with them if they are digitally signed so that their Manipulates are functional); anyone who chooses not to install Mathematica Player can make use of the PDF version (or an HTML version, or one of the other set of output possibilities...). The question of whether it should be a standard is different. Perhaps, generally proprietary formats should not be a standard. But the key question there is price point. Also the question is whether one is defining standard to be exclusive of any other possibilities. Price point should be low--though Microsoft office is not cheap and it is unfortunately considered a standard--or zero, and functionality should be high. There really is no sensible reason why, given the existence of Mathematica Player, Mathematica notebooks should not be acceptable as one of the key distribution formats for technical documents: there are just too many reasons involving the incredible breadth of what you can do with it to pass it up. Why limit publishing to static material? PDFs are considered a standard distribution format largely because of the free Acrobat reader. TeX is a standard because it is a wonderful old workhorse that was adopted into the technical publishing industry when electronic typesetting was in its infancy and using such technologies was forward looking, extendable, and free. Of course some aspects of a discussion such as this are admittedly religious... :-) And I admit that I use Mathematica for essentially everything. And I extend its use and scope whenever I see a need. These personal needs ultimately lead me to create http://scientificarts.com/worklife/ for just such purposes... Hope this helps, --David A WorkLife FrameWork E x t e n d i n g MATHEMATICA's Reach... Trial Version at: http://scientificarts.com/worklife/ > I agree with everything below but to tell the truth I can't see what > is supposed to be the point of this entire thread. If one wants to > write a research paper using Mathematica and submit it to a print or > on-line journal one needs only to convert it to pdf and it should then = > be acceptable in many cases it would be (assuming of course that the > contents are good enough). If one wants in addition to provide people > who are able to use Mathematica with live calculations one can put a > Mathematica notebook for download on a web page. I can't see why > anyone should wish for more or argue against this. The rest seems to > me a complete waste of time and effort and some of what I have read I > actually found quite funny (comical) though I assume it was meant to > be serious. A completely different issue is whether academic institutions should > provide their students with the opportunity to discover the (in my > opinion) very remarkable possibilities offered by the latest version > of Mathematica. That's all that my own response was concerned with. > This is a real issue while a discussion of publishing standards is a = > waste of time. I should like to repeat that I have yet to meet a student who would > complain about the lack of a printed manual and I think using that as > an argument against Mathematica is a perfect example of the sort of > academic attitude I referred to in my first response. Andrzej Kozlowski > djvu vs. pdf: no big deal. Tex vs. Mathematica: BIG deal! > With djvu and pdf, it's merely a matter of the final format in which = > the > document appears and is disseminated. > With (La)TeX and Mathematica, there's a crucial difference in the > entire > authoring process. Among other things: > (1) (La)TeX concentrates upon the logical structure of the document,= > whereas Mathematica from the start involves the actual appearance of = > the > document. > (2) Typing math markup is typically quicker in (La)TeX than in > Mathematica, as it avoids Control-key sequences (unless one is using = > an > editor where such sequences are used as shortcuts) or at least uses > shorter keystroke-only sequences. > (3) Mathematica allows live calculations in the document itself, > whereas TeX does not (except of the most primitive kind). > Exception: a > specialized TeX+CAS system. > (4) Mathematica creates graphics of all sorts directly in the > document, whereas with the exception of a limited number of native or > package add-on graphics types, graphics must be imported into a TeX > document from an external source (such as Mathematica)! > There are two other another differences: > (5) One can have an entire TeX document preparation system -- > editor, > TeX engine plus packages, viewer, and converter (dvi to ps or pdf, > e.g.) > -- for free. Needless to say, Mathematica is not free. > (6) The source code for TeX and many or most of the supporting > utilities is open source; this is certainly not the case for > Mathematica. >> ...I would like to point out that publishing standards are not >> set in stone. For several years I have witnessed PDF visibly loosing >> ground to djvu in the mathematical preprint area. I like with many >> other things I learned about it first form students, who quickly >> understood its technical superiority over PDF (most of all, much >> smaller file size). Now I see that a number of on-line mathematics >> journals are offering djvu as an alternative to pdf. > -- > Murray Eisenberg mur...@math.uma= ss.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: The FinancialData Function Hello. I work at Wolfram and have worked on FinancialData, and other curated data projects (CountryData e.g.). I might be able to address some of your concerns. We consider FinancialData - as it is now - experimental in the sense that it isn't really finished growing yet and it is going to get a lot more powerful, not in the sense that it is going to go away. We started off just making it easier for people to get public forms of data, things that are readily available in formats like Excel, into Mathematica and in standardized Mathematica expressions. Instead of our users each doing a bunch of intervening steps themselves to use this stuff, we'd do it right, once, for all of them. And add value in the form of a flexible Mathematica function that works with others in ways our users expect, etc. But we realize the types of data readily available that way, are only the first layer of what practioners want. In the future we are going to make even more available through FinancialData. To do that, we've made deals with data providers to get our users free access, within Mathematica (and subject to the usual terms of use issues over resale etc), to much more comprehensive data feeds - including options, futures, mutual funds, detailed fundamentals, economic time series, intraday tick by tick prices, etc. That should also address some concerns over possible third party changes and code breakage - our partners aren't going to change their services in ways that break our agreements with them. Implementing each of those extra features takes some work and therefore some time. Internally we have all this stuff already, in some form, but there is an intervening curation step - and some function design for qualifying arguments and the like - to get it to final forms we are satisfied with and think our users will expect. The bottom line is stay tuned, more FinancialData coming soon... I hope this helps. And I'd be happy to answer additional questions. === Subject: Re: The FinancialData Function To Harvey: On oil prices, that is one in the coming soon category, but I can give you a solution that will work today, outside of FinancialData proper. Soon there won't be a need for these sorts of lines, that is sort of the idea. But for now, you can use - Daily spot oil prices from the Department of Energy, back to 1986 dailyDOEOil = {#[[1, 1 ;; 3]], N[#[[2]]]} & /@ DeleteCases[ Import[http://tonto.eia.doe.gov/dnav/pet/xls/ PET_PRI_SPT_S1_D.xls, XLS][[2, 4 ;;, 1 ;; 2]], {, } | {_, }]; Monthly spot oil prices from the Fed, back to 1946 Import[http://research.stlouisfed.org/fred2/series/OILPRICE/ downloaddata/OILPRICE.csv]]; Both are in the same format as any other FinancialData time series, A prime reason we made FinancialData is to spare everyone else the need to figure out the fiddly details of such lines of code. As for getting lists of symbols that work in FinancialData today, you can use string patterns and wildcards in the first argument, and Lookup in the second argument. So e.g. just to see how many that is, you could ask for Length[FinancialData[*, Lookup]] - where the * is a wildcard that will match any string. The answer is 186,000 symbols and change. I won't try to guarantee that every one of them will give you meaningful data - some will return Missings, representing entities that merged recently or failed etc. For any subset of them, the symbol and second argument Name will tell you what it is. Clearly this sort of discovery can be improved, and is another area I'd call experimental. Briefly, there is good coverage of stocks, mutual funds, and indices in the existing data. Including many foreign exchanges. Newer versions should have more of the futures and economic time series you'd want for commodity-specific questions. Fine questions by the way. Jason Cawley === Subject: Re: setting elements of an array based on a condition >>2) Then I want to calculate the sum of the elements in each column >>of W. How can I do this? >Plus @@@ W >or >Total /@ W For a 2 x 2 (W) matrix, your code will output W[[1,1]]+W[[1,2]] and W[[2,1]]+W[[2,2]] I believe the requester is asking for B[[1,1]]+B[[2,1]] and B[[1,2]]+B[[2,2]] For that you would want to use Total[W] or Plus@@@Transpose[W] === Subject: Re: Colorfunction based upon flux direction Hi Patrick, I answered this question 5 days ago, but it never made it to the group. Here it is the answer again: in ListVectorFieldPlot3D the color function gets the magnitude of the vector as argument. Therefore, there is no direction info available. You must use a trick to do this, e.g. you could use a counter to access the original vectors: n=5; d=Table[r=rad{Sin[p1]Sin[p2],Sin[p1]Cos[p2],Cos[p1]};{r,r},{rad,0.01,1,1/n}, {p1,0,Pi,Pi/n},{p2,0,2 Pi,Pi/n}]; d=Flatten[d,2]; count=0; ListVectorFieldPlot3D[d,ColorFunction->Function[{x},Hue[r= d[[++count,2]];0.5+0.5 r.{1,0,0}/Sqrt[ r.r]]]] hope this helps, Daniel > > I'm quite new at using Mathematica and I am attempting to assign > colors to vector field data (3d magnetic flux) using the > ListVectorFieldPlot3D function. I would like to assign colors to the > vectors based upon the direction in which they point. Hue gives me a > color based upon vector magnitude - is there a simple way to color > vectors based upon direction? > > > Patrick Keith-Hynes > University of Virginia Physics > > === Subject: running a program Hi all, i want to ask you something very dummy. I want to run a benchmark in mathematica, and i have a nb file. How can i run my program(that is in the nb file) and get the results? I am using mathematica only one day, so if you can explain me what to do exactly? nick === Subject: Re: running a program 1) Double-click the notebook to open it up in Mathematica. 2) Use Menu, Evaluation, Evaluate Notebook. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > Hi all, i want to ask you something very dummy. I want to run a benchmark in mathematica, and i have a nb file. How can i run my program(that is in the nb file) and get the results? I am using mathematica only one day, so if you can explain me what to do > exactly? nick > === Subject: Mathematica Player Pro now available Mathematica Player Pro, the professional application delivery system for Mathematica, is now available. Player Pro extends Player's reach to include more import/export capabilities, dialog-box entry, complete dynamic capabilities (instead of just Demonstrations), and more. Technically, Player Pro contains almost all of Mathematica and differs only in that it is a pure runtime environment. That means that developers can now build virtually stand-alone Mathematica applications for the first time. Almost any notebook you create in Mathematica 6 can be deployed with Player Pro--there's no conversion required. All current individual Mathematica 6 Premier Service customers are eligible to receive three complimentary copies of Player Pro for distribution (eligible users will receive an email in the next few days with instructions on how to claim their copies). Five-pack and other volume discounts are also available. More information is available at: http://www.wolfram.com/e/6/playerpro P.S. Get the inside story on developing for Player Pro from Conrad Wolfram, Director of Strategic and International Development, on the Wolfram Blog (http://www.wolfram.com/e/6/playerproblog). === Subject: Re: setting elements of an array based on a condition Hello Claus, > I have one array, W, which for testing purposes has 25 rows and 50 columns. > There are two more things I want to accomplish with this: > 1) I want to set all elements of W which are smaller than zero to zero. > 2) Then I want to calculate the sum of the elements in each column of W. > How can I do this? The code below shows how I get to W. Claus X = RandomReal[{0, 1}, 50]; > Y = RandomReal[{0, 1}, 50]; BinWidth = 0.2; > Radius = 0.2; xyzVals2 = Table[ > {i/(1/BinWidth) + (BinWidth/2) > , j/(1/BinWidth) + (BinWidth/2) > } > , {i, 0, (1/BinWidth) - 1} > , {j, 0, (1/BinWidth) - 1}]; RasterPtsVals = Partition[Flatten[xyzVals2], 2] RasterX = RasterPtsVals[[All, 1]] > RasterY = RasterPtsVals[[All, 2]] XDiffSq = (RasterX - a /. a -> X)^2; > YDiffSq = (RasterY - b /. b -> Y)^2; > Dist = Sqrt[(XDiffSq + YDiffSq)]; W = 1 - (Dist/Radius) tmp = (W + Abs[W])/2; Plus @@@ Transpose[tmp] hth, Oliver Ruebenkoenig, === Subject: Re: setting elements of an array based on a condition > [...] > 2) Then I want to calculate the sum of the elements in each column of W. > How can I do this? > [...] In[1]:= W = Table[Random[Integer],{4},{5}] Total@W Out[1]= {{0,1,1,1,1}, {1,0,1,0,1}, {0,0,1,0,0}, {1,0,1,1,1}} Out[2]= {2,1,4,2,3} === Subject: Re: setting elements of an array based on a condition > I have one array, W, which for testing purposes has 25 rows and 50 columns. > There are two more things I want to accomplish with this: > 1) I want to set all elements of W which are smaller than zero to zero. Among many other ways to do it, W = Clip[W, {0, Infinity}] > 2) Then I want to calculate the sum of the elements in each column of W. > How can I do this? Total@W Here is a running example of the above. X = RandomReal[{0, 1}, 50]; Y = RandomReal[{0, 1}, 50]; BinWidth = 0.2; Radius = 0.2; xyzVals2 = Table[{i/(1/BinWidth) + (BinWidth/2), j/(1/BinWidth) + (BinWidth/2)}, {i, 0, (1/BinWidth) - 1}, {j, 0, (1/BinWidth) - 1}]; RasterPtsVals = Partition[Flatten[xyzVals2], 2] RasterX = RasterPtsVals[[All, 1]] RasterY = RasterPtsVals[[All, 2]] XDiffSq = (RasterX - a /. a -> X)^2; YDiffSq = (RasterY - b /. b -> Y)^2; Dist = Sqrt[(XDiffSq + YDiffSq)]; W = 1 - (Dist/Radius) W = Clip[W, {0, Infinity}] (* Negative values are set to zero *) Total@W (* Sum by columns *) [... output discarded ...] Here is W Out[12]= {{-3.44977, -3.42712, -1.38462, -1.26534, -1.08044, -2.98646, -2.22725, -3.6861, -3.40791, -3.46006, -3.28652, -3.41354, -2.8053, -2.86024, 0.906464, -3.20979, -0.716005, -2.46973, -2.80043, -2.05446, [... output discarded ...] -2.15641, -1.84735, -2.72521, -1.6088, -4.45553, -1.20688, 0.55019, -4.8174, -0.927821, 0.529696, -2.5054, -1.2456, -0.522142, -0.823514, -2.39116, -0.780842}} This is W after clipping Out[13]= {{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.906464, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.47876, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.576626, 0., 0., 0.57248, 0., 0., 0., 0., 0., 0., 0., 0.}, {0., 0., 0., 0., 0., 0., 0., 0., [... output discarded ...] 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.55019, 0., 0., 0.529696, 0., 0., 0., 0., 0., 0.}} Sum by columns Out[14]= {0.501202, 1.12529, 1.0363, 0.869559, 1.04313, 1.06559, 1.04856, 0.997975, 1.02411, 1.00233, 0.882582, 0.584701, 1.03934, 0.999631, 0.906464, 0.939218, 0.67531, 0.973813, 0.999577, 1.05409, 0.863479, 0.925528, 0.999161, 0.875093, 1.01133, 0.990823, 0.893494, 1.03689, 0.949295, 1.06598, 0.999567, 0.907048, 0.770375, 1.00052, 1.01669, 1.06436, 1.1272, 0.989273, 0.976439, 0.526029, 0.915948, 0.665679, 0.983972, 1.08602, 1.15502, 1.03827, 0.789926, 0.990356, 1.05427, 0.976073} -- === Subject: What is @@@? I have seen several references to the command @@@ in this newsgroup, but a query of the online Documentation Center just refers me to Apply (@@). What does it do and where can I read about it? Kevin -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: What is @@@? Kevin, Look at More Information for Apply. Here is an example: {a, b, c, d} step1 = f /@ % g @@@ % Identity @@@ % giving {a, b, c, d} {f[a], f[b], f[c], f[d]} {g[a], g[b], g[c], g[d]} {a, b, c, d} So @@@ is really a shortcut for: g @@ # & /@ step1 {g[a], g[b], g[c], g[d]} -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ >I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > Kevin > -- Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 > === Subject: Re: What is @@@? Kevin > Kevin, > > Look at More Information for Apply. Here is an example: > > {a, b, c, d} > step1 = f /@ % > g @@@ % > Identity @@@ % giving > > {a, b, c, d} > {f[a], f[b], f[c], f[d]} > {g[a], g[b], g[c], g[d]} > {a, b, c, d} > > So @@@ is really a shortcut for: > > g @@ # & /@ step1 > {g[a], g[b], g[c], g[d]} > > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: What is @@@? @@@ is a special case of Apply where the specified head is being applied at level 1. @@ is a short form that applies the specified head at level 0. =46rom the help file: ---- Begin Excerpt ---- In[1]:= Apply[f, {{a, b, c}, {d, e}}, {1}] Out[1]= {f[a, b, c], f[d, e]} The short form @@@ is equivalent to applying at level 1: In[2]:= f @@@ {{a, b, c}, {d, e}} Out[2]= {f[a, b, c], f[d, e]} ---- End Excerpt ---- Januk > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > Kevin > -- Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 === Subject: RE: What is @@@? In the help of Apply, open the section (click the little triangle) More Information. As you can see there, @@@ is the infix form of Apply at level 1, in other words, f@@@g[h[a], z[b]] is the same as Apply[f, g[h[a], z[b]], {1}]. I think it is a good idea for you to use the following page. @@@ is briefly mentioned at the end of the page and compared with @, @@ and /@: http://homepage.cem.itesm.mx/lgomez/matecmatica/fp/fp.html Hope it helps! Jose Mexico -----Mensaje original----- De: Kevin J. McCann [mailto:Kevin.McCann@umbc.edu] Enviado el: Jueves, 03 de Abril de 2008 04:18 a.m. Para: mathgroup@smc.vnet.net Asunto: What is @@@? I have seen several references to the command @@@ in this newsgroup, but a query of the online Documentation Center just refers me to Apply (@@). What does it do and where can I read about it? Kevin -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: What is @@@? > I have seen several references to the command @@@ in this > newsgroup, but > a query of the online Documentation Center just refers me to Apply > (@@). > What does it do and where can I read about it? > @@@ is a shorthand for Apply[f,expr,{1}] in the same way @@ is shorthand for Apply[f,expr]. In v6.0 @@@ is described in the 3rd bullet under the More Information category in the documentation on Apply. Since the More Information tab is closed by default I suppose this can lead to confusion. There are no @@@@., @@@@@, ... Ssezi === Subject: Re: What is @@@? f@@@expr is equivalent to Apply[f,expr,{1}]. Adriano Pascoletti > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > Kevin > -- Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 === Subject: Re: What is @@@? > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > Kevin > -- Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 Hallo, it means:f@@@expr is equivalent to Apply[f,expr,{1}]. === Subject: Re: What is @@@? Kevin, The short form @@@ is equivalent to applying at level 1 : See : ref/Apply in Mathematica Help > Scope (10) > ($Line = 0; Null) HTH ... Syd Syd Geraghty B.Sc, M.Sc. sydgeraghty@mac.com My System Mathematica 6.0.1 for Mac OS X x86 (64 - bit) (June 19, 2007) MacOS X V 10.5 .20 > I have seen several references to the command @@@ in this newsgroup, > but > a query of the online Documentation Center just refers me to Apply > (@@). > What does it do and where can I read about it? > Kevin > -- Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 > === Subject: Re: What is @@@? You'll find this in the tutorial Input Syntax. -- tutorial/InputSyntax. (You can get to that from the main Documentation Center > Core Language > Syntax >tutorials. Or if in Mathematica 6.0.2 you open the built-in Virtual Book, then from Core Language > Appendix:Language Structure > Input Syntax > Types of Input Syntax.) On that tutorial page, search for @@@. You'll see that expr1 @@@ expr2 is a special input form that means Apply[expr1, expr2, {1}] So the effect is to replace heads in the parts of expr2 at level {1} by expr1. For example: Remove[f,g,a,b] Apply[f, g[List[1, 2], List[a, b]], {1}] g[f[1,2],f[a,b]] f@@@g[List[1,2],Lis[a,b]] (* same thing *) g[f[1,2],f[a,b]] More concrete example: Apply[Plus, {{1, 2}, {a, b}}, {1}] {3,a+b} Plus @@@ {{1, 2}, {a, b}} (* same thing *) {3,a+b} Contrast that with, e.g.: Plus @@ {{1, 2}, {a, b}} {1+a,2+b} that is, Apply[Plus,{{1,2},{a,b}}] (* same thing as preceding *) {1+a,2+b} > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > > > Kevin -- 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: What is @@@? and *if* you would have the text about Apply[] you have seen that f@@@expr is equivalent to Apply[f,expr,{1}]. Jens > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > > > Kevin === Subject: Re: What is @@@? > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > Kevin > -- Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 It's hidden away in the documentation: In version 6.02 ... under the documentation for Apply (@@) in the section Examples/Scope/Level Specifications The short form @@@ is equivalent to applying at level 1: In[2]:= f @@@ {{a, b, c}, {d, e}} Out[2]= {f[a, b, c], f[d, e]} === Subject: Re: What is @@@? > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > Hi Kevin, @@@ is apply at level 1. f @@@ expr is equivalent to Apply[f, expr, {1}]. This is under more information on the doc page of Apply[]. It is easy to remember the sytax: each of @, @@, and @@@ act at a deeper level: In[1]:= f@{{1, 2}, {3, 4}} Out[1]= f[{{1, 2}, {3, 4}}] In[2]:= f @@ {{1, 2}, {3, 4}} Out[2]= f[{1, 2}, {3, 4}] In[3]:= f @@@ {{1, 2}, {3, 4}} Out[3]= {f[1, 2], f[3, 4]} But there is no @@@@, it only goes until @@@. Szabolcs === Subject: How to display parameter in animation? How do I display the parameter in an animation? For example, I would like to see the values of the parameter 'a' in the following example from the mathematica documentation: Animate[Plot[Sin[x+a],{x,0,10}],{a,0,5}] In particular, if I pause the animation I would like to see what the value of the parameter is. === Subject: Re: How to display parameter in animation? > How do I display the parameter in an animation? For example, I would like to see the values of the parameter 'a' in the following example from the mathematica documentation: Animate[Plot[Sin[x+a],{x,0,10}],{a,0,5}] In particular, if I pause the animation I would like to see what the value of the parameter is. > One can also use PlotLabel, this will print the values dynamically as the animation is running. Animate[Plot[Sin[x + a], {x, 0, 10}, PlotLabel -> a], {a, 0, 5}] Hope this helps, Pratik Desai Wolfram Research === Subject: Re: How to display parameter in animation? Manipulate is probably the function of choice, even for animations. Manipulate[ Plot[Sin[x + a], {x, 0, 10}], {a, 0, 5, Appearance -> Labeled}] The Appearance option puts the slider value on the right of the slider control. If you click on the little gray square just to the right of the slider you can show the animation controls and run the display as an animation. The value of the slider is also shown in the animation controls and you can move the slider when the animation is stopped so in this mode the Appearance option might not be necessary. But one feature of Mathematica 6 that I find annoying is that animations, for me at least, sometimes just stop when they should run indefinitely. I do know how to control this behavior. I've tried many of the Animate options. Sometimes the problem is cured if I just click the 'Faster' button. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > How do I display the parameter in an animation? For example, I would like to see the values of the parameter 'a' in the > following example from the mathematica documentation: Animate[Plot[Sin[x+a],{x,0,10}],{a,0,5}] In particular, if I pause the animation I would like to see what the value > of the parameter is. > === Subject: Re: How to display parameter in animation? One way is to use Epilog to stick text right on the plot: Animate[Plot[Sin[x + a], {x, 0, 10}, Epilog -> Text[a = <> ToString[a], Scaled[{0.8, 0.8}]]], {a, 0, 5} ] Hope that helps! C.O. > How do I display the parameter in an animation? For example, I would like to see the values of the parameter 'a' in the > following example from the mathematica documentation: Animate[Plot[Sin[x+a],{x,0,10}],{a,0,5}] In particular, if I pause the animation I would like to see what the value > of the parameter is. -- 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 to display parameter in animation? Animate[Plot[Sin[x + a], {x, 0, 10}, Epilog -> {Text[a, Scaled[{0.8, 0.9}]]}], {a, 0, 5}] ?? Jens > How do I display the parameter in an animation? > > For example, I would like to see the values of the parameter 'a' in the following example from the mathematica documentation: > > Animate[Plot[Sin[x+a],{x,0,10}],{a,0,5}] > > In particular, if I pause the animation I would like to see what the value of the parameter is. > === Subject: Colored Output I would like to have evaluated expression with some costants painted in a particular color, just to make reading easier. Say my input is D[a*Sin[x]] and the output should be a*Cos[x] with colored a, say magenta. Is this achievable, and how? which kind of attributed of the constant a should I set? Best Roberto === Subject: Re: Colored Output > I would like to have evaluated expression with some costants painted > in a particular color, just to make reading easier. > Say my input is > > D[a*Sin[x]] > > and the output should be > > a*Cos[x] > > with colored a, say magenta. > > Is this achievable, and how? which kind of attributed of the constant > a should I set? I don't know much about expression formatting. While this appears to work in a few simple tests, I do not know how robust it is: MakeBoxes[a, StandardForm] = StyleBox[a, FontColor -> Red] After this line has been evaluated, the symbol 'a' will be printed in red (when output is set to StandardForm). The formatting rule can be removed with MakeBoxes[a, StandardForm] =. Szabolcs === Subject: Re: Colored Output A possible way to achieve this result is the following: << Graphics`Colors` Format[a] := StyleForm[SymbolName[a], FontColor -> Magenta] working with 5.2 on winxp. -- enzotib === Subject: Re: Colored Output I have been told I can use MakeBoxes: MakeBoxes[a, StandardForm] := StyleBox[a, Green] Then, evaluate D[a Sin[x], x] If you're default output format type is TraditionalForm, then just substitute TraditionalForm for StandardForm in the MakeBoxes rule. === Subject: Re: Colored Output a /: MakeBoxes[a, fmt_] := StyleBox[a, FontColor -> RGBColor[1, 0, 0]] for red. Jens > I would like to have evaluated expression with some costants painted > in a particular color, just to make reading easier. > Say my input is > > D[a*Sin[x]] > > and the output should be > > a*Cos[x] > > with colored a, say magenta. > > Is this achievable, and how? which kind of attributed of the constant > a should I set? > > Best > Roberto > === Subject: Re: Colored Output > I would like to have evaluated expression with some costants painted > in a particular color, just to make reading easier. > Say my input is > > D[a*Sin[x]] > > and the output should be > > a*Cos[x] > > with colored a, say magenta. > > Is this achievable, and how? which kind of attributed of the constant > a should I set? Depending on the complexity of your actual expressions, the easiest way to color some parts of them might be using replacement rules (and possibly some *Cases* statements) to apply the desired *Style* commands to the constants. For instance, D[a*Sin[x]] /. a -> Style[a, Magenta] -- === Subject: Re: Colored Output > I would like to have evaluated expression with some costants painted > in a particular color, just to make reading easier. > Say my input is > > D[a*Sin[x]] > > and the output should be > > a*Cos[x] > > with colored a, say magenta. > > Is this achievable, and how? which kind of attributed of the constant > a should I set? > > Best > Roberto > Try this: MakeBoxes[a, StandardForm] := StyleBox[a, Red] David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Colored Output >I would like to have evaluated expression with some costants painted >in a particular color, just to make reading easier. >Say my input is D[a*Sin[x]] and the output should be a*Cos[x] with colored a, say magenta. Is this achievable, and how? which kind of attributed of the constant >a should I set? Best >Roberto > > You can use MakeBoxes: MakeBoxes[a, StandardForm] := StyleBox[a, Green] Then, evaluate D[a Sin[x], x] If you're default output format type is TraditionalForm, then just substitute TraditionalForm for StandardForm in the MakeBoxes rule. Carl Woll Wolfram Research === Subject: Re: Colored Output You could try something like: a := Interpretation[Style[a, Magenta], a] D[a Sin[x], x] -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ >I would like to have evaluated expression with some costants painted > in a particular color, just to make reading easier. > Say my input is > > D[a*Sin[x]] > > and the output should be > > a*Cos[x] > > with colored a, say magenta. > > Is this achievable, and how? which kind of attributed of the constant > a should I set? > > Best > Roberto > === Subject: contouring It's been a blast dwelving into Mathematica, and I am fairly impressed how nice it is to work without loops! ;-) Now I've got some plotting issues. In the example below, specifically for the ListContourPlot: a) can I invert the colors (so for the case of Lake colors that deep blue is at the 50-value? b) can I change the contouring so that the the square with the corners {0,1},{1,0} is contoured? XYZDATA = {{0.9, 0.9, 50}, {0.8, 0.9, 30}, {0.9, 0.8, 30}, {0.5, 0.5, 15}, {0.2, 0.1, 1}, {0.1, 0.2, 1}} ListPlot[Transpose[{XYZDATA[[All, 1]], XYZDATA[[All, 2]]}] , PlotRange -> {{0, 1}, {0, 1}} , AspectRatio -> 1] ListContourPlot[XYZDATA , AspectRatio -> 1 , PlotRange -> {{0, 1}, {0, 1}} , ColorFunction -> LakeColors] It seems as if things get worse if there are more extreme values, like this: XYZDATA2 = {{0.95, 0.95, 150}, {0.9, 0.9, 50}, {0.8, 0.9, 30}, {0.9, 0.8, 30}, {0.5, 0.5, 15}, {0.2, 0.1, 1}, {0.1, 0.2, 1}} Dots = ListPlot[Transpose[{XYZDATA2[[All, 1]], XYZDATA2[[All, 2]]}] , PlotRange -> {{0, 1}, {0, 1}} , AspectRatio -> 1] ShadedPlot = ListContourPlot[XYZDATA2 , AspectRatio -> 1 , PlotRange -> {{0, 1}, {0, 1}} , ColorFunction -> LakeColors] Show[Dots, ShadedPlot] In the second case, the interpolation does not extent to the point at {0.95, 0.95}. Is there a way to set somehow limits for contouring, for the given example, say all z-values >50 should be contoured with the darkest shade of blue? I played around with creating a ColorScheme, like GreyColor[ z_ ] := GrayLevel[1 - z] and ShadedPlot2 = ListContourPlot[XYZDATA2 , AspectRatio -> 1 , PlotRange -> {{0, 1}, {0, 1}} , ColorFunction -> GreyColor ] which sort of solves my problems, because now all z-values >1 are black, which I verified by this code MaxCont = 1; MinCont = 0.1; DeltaCont = 0.1; Graphics[{ Table[{ GreyColor[i] , Rectangle[{i - DeltaCont, DeltaCont}, {i, 2*DeltaCont}] , Black, Text[Style[i, 20], {i - (DeltaCont/3), MinCont}, {i, 1.5*MaxCont}] }, {i, MinCont, MaxCont, DeltaCont}] }] However, the point at {0.95, 0.95} is still not included in the shading. So I guess my questions a) and b) from above are still my problems... ;-) Claus === Subject: Re: contouring Use PlotRange->All, or ClippingStyle->Automatic -Ulises Cervantes WRI === Subject: Re: reaction diffusion equation ! Hi Khaled, Mathematica uses Numerical method of lines and the number of independent variables must be restricted to atmost 2.However,Mathematica has exceptional symbolic computational abilities and it will not be difficult to rephrase your problem to a form that is solvable.Please provide further details like the form of f(U) and boundary conditions so that we can proceed further. Nabeel > Can NDSolve in Mathematica solves the nonlinear reaction diffusion > equation in two dimensions > (Tt-Uxx-Uyy=f(U) with Drichlit B.C.). I ask u kindly to send me the > mathematica program solves the transient heat equation in two dimension or > the heat diffusion equation if u already have it. > khaled sayed > Khaled Sayed Mahmoud Ibrahim Department of MathematicsFaculty of > ScienceHelwan University Helwan, Cairo, EgyptTel.: (+20)18-25-35-272 > Fax: (+20)-2-25588-586k_s_mahmoud@hotmail.com -- We have not succeeded in answering all our problems.The answers we have found only serve to raise a whole set of new questions.In some ways we feel that we are as confused as ever,but we believe we are confused on a higher level and about more important things. Nabeel Butt UWO,London Ontario, Canada === Subject: reaction diffusion equation ! Can NDSolve in Mathematica solves the nonlinear reaction diffusion equation in two dimensions (Tt-Uxx-Uyy=f(U) with Drichlit B.C.). I ask u kindly to send me the mathematica program solves the transient heat equation in two dimension or the heat diffusion equation if u already have it. khaled sayed Khaled Sayed Mahmoud Ibrahim Department of MathematicsFaculty of ScienceHelwan University Helwan, Cairo, EgyptTel.: (+20)18-25-35-272 Fax: (+20)-2-25588-586k_s_mahmoud@hotmail.com === Subject: mathematica on macbook... hangs on 5-4 Hi all, I have installed Mathematica 6.0.2.0 onto a macbook 2.2 GHz Intel Core 2 Duo running OS X 10.5.2 (2GB of ram). The program (as the version 6.0.0) hangs in evaluating even the simplest cells such as addition 2+2. It just hangs for minutes without giving any message. Mathematica 10.5.2 works fine... I have noticed that if I run it as admin it gives me these problems while if I run it as ROOT user it doesn't. Suggestions? === Subject: Derivative of a Conjugate Hi All, My first posting here, so please forgive me if I am being a bit stupid. I'm entering the following input: D[f[t0, t1], t0, t1] /. {f -> ((#1^2)*Conjugate[a[#2]] &)} and Mathematica gives the following output: 2 t0 a'[t1] Conjugate'[a[t1]] I would have expected: 2 t0 Conjugate[a'[t1]] i.e. the derivative of a conjugate is the conjugate of the derivative. Any idea how a force Mathematica to give the result I am expecting? In the above, I am assuming the variables t0 and t1 are real and the variable a is complex, although I have not explicitly told Mathematica this. David === Subject: Re: Derivative of a Conjugate > Hi All, My first posting here, so please forgive me if I am being a bit > stupid. I'm entering the following input: D[f[t0, t1], t0, t1] /. {f -> ((#1^2)*Conjugate[a[#2]] &)} and Mathematica gives the following output: 2 t0 a'[t1] Conjugate'[a[t1]] I would have expected: 2 t0 Conjugate[a'[t1]] i.e. the derivative of a conjugate is the conjugate of the derivative. Any idea how a force Mathematica to give the result I am expecting? > In the above, I am assuming the variables t0 and t1 are real and > the variable a is complex, although I have not explicitly told > Mathematica this. > David > Mathematica always assumes that the derivative is computed in the complex plane and it automatically applies the chain rule. It certianly would be wrong to assume that the derivative commutes with conjugation, as that is not true in general in the complex plane, so if Mathematica did not automatically apply the chain rule it would have to return your input unevaluated. One way to avoing your problem is to write your function a[x] explicitly as a sum of its real and imaginary parts, say c[x] and d[x]. First make a list of replacement rules for getting the output back in terms of a[x]: rules = {c[x_] :> Re[a[x]], d[x_] :> Im[a[x]], Derivative[n_][c][x_] :> Re[Derivative[n][a][x]], Derivative[n_][d][x_] :> Im[Derivative[n][a][x]]}; Now, we differentiate usign c[x]+I d[x] in place of a[x], apply rules and FullSimplify: FullSimplify[D[f[t0, t1], t0, t1] /. {f -> (#1^2*(c[#2] - I*d[#2]) & )} /. rules] 2*t0*Conjugate[Derivative[1][a][t1]] Andrzej Kozlowski === Subject: Re: Derivative of a Conjugate Hi David, Conjugate is not an analytic function. Consider: r=x+I y; z[r]= x+I y; Conjugate[z[r]]= x-I y; dz= dx + I dy; dConjugate[z]= dx -I dy now take the differential quotient and you see that the derivative depends on the direction. That is why Mathematica does not evaluate Conjugate'. If dr is real you may e.g. use a rule to get what you want: expression /. Conjugate'[y_[x_]]:= Conjugate[y'[x]] hope this helps, Daniel > Hi All, > > My first posting here, so please forgive me if I am being a bit stupid. > > I'm entering the following input: > > D[f[t0, t1], t0, t1] /. {f -> ((#1^2)*Conjugate[a[#2]] &)} > > and Mathematica gives the following output: > > 2 t0 a'[t1] Conjugate'[a[t1]] > > I would have expected: > > 2 t0 Conjugate[a'[t1]] > > i.e. the derivative of a conjugate is the conjugate of the derivative. > > Any idea how a force Mathematica to give the result I am expecting? In the above, I am assuming the variables t0 and t1 are real and the variable a is complex, although I have not explicitly told Mathematica this. > > > David > === Subject: Label vertices in Graph to display with GraphPlot I'm using some Combinatorica functions to create graphs where I do not specify individually the vertices -- and hence do not individually specify the vertex labels I want, e.g.: g = RotateVertices[Cycle[5], [Pi]/10]; g = AddEdge[g, {2, 5}]; g = SetGraphOptions[g, VertexLabel -> Characters[abcde]]; If I use Combinatorica`ShowGraph, then I'll see the vertex labels: ShowGraph[g] However, if I use Mathematica 6's kernel function GraphPlot, I don't see these individual labels, but rather the entire list {a,b,c,d,e} of labels at each vertex! GraphPlot[g,Method->None,VertexRenderingFunction->(Text[#2,#1]&) How do I coerce GraphPlot to reproduce the behavior of ShowGraph, so that it labels the individual vertices with a, b, c, d, e? (The interaction between Combintorica's graph-creating functions, on the one hand, and GraphPlot, on the other hand, remains mysterious and severely underdocumented for me. It seems there's a clear attempt to migrate display of graphs to the kernel function GraphPlot and thereby discourage use of ShowGraph, yet in almost everything I've attempted so far, GraphPlot does not so readily or gracefully reproduce the functionality of Combinatorica'a ShowGraph. This is most especially the case as it affects relative newcomers to Mathematica like my students.) -- 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: What is @@@? With the help for Apply (@@) expand out the MORE INFORMATION to see the statement: f@@@expr is equivalent to Apply[f,expr,{1}] f @@@ {{x1, x2, x3}, {y1, y2, y3}} {f(x1,x2,x3),f(y1,y2,y3)} Apply[f, {{x1, x2, x3}, {y1, y2, y3}}, {1}] {f(x1,x2,x3),f(y1,y2,y3)} Apply[f, {{x1, x2, x3}, {y1, y2, y3}}, 1] {f(x1,x2,x3),f(y1,y2,y3)} f @@ # & /@ {{x1, x2, x3}, {y1, y2, y3}} {f(x1,x2,x3),f(y1,y2,y3)} Map[f @@ # &, {{x1, x2, x3}, {y1, y2, y3}}] {f(x1,x2,x3),f(y1,y2,y3)} Map[Apply[f, #] &, {{x1, x2, x3}, {y1, y2, y3}}] {f(x1,x2,x3),f(y1,y2,y3)} Bob Hanlon > I have seen several references to the command @@@ in this newsgroup, but > a query of the online Documentation Center just refers me to Apply (@@). > What does it do and where can I read about it? > > > Kevin > -- > > Kevin J. McCann > Research Associate Professor > JCET/Physics > Physics Building > University of Maryland, Baltimore County > 1000 Hilltop Circle > Baltimore, MD 21250 > === Subject: Re: How to display parameter in animation? Manipulate[Plot[Sin[x + a], {x, 0, 10}], {a, 0, 5}] Then expand control Bob Hanlon > How do I display the parameter in an animation? > > For example, I would like to see the values of the parameter 'a' in the following example from the mathematica documentation: > > Animate[Plot[Sin[x+a],{x,0,10}],{a,0,5}] > > In particular, if I pause the animation I would like to see what the value of the parameter is. > === Subject: Mathematica to Tex I am trying to export to Tex. My idea is to paste parts of notebooks on my mediawiki, which can accept Tex. I am sure there is a good way to do this. Let's say I write the following as a Text cell in Mathematica: P(A) = 1-e^-[Lambda]t P(A)+P(B) Can I do TeXForm on a text cell? What would be the best way to export just that? If I save the file as .Tex I get: (P(A) = 1-e^{-text{$lambda $t}} P(A)+P(B)) but what I want is something along the lines of P(A) = 1-e^{-lambda t} P(A)+P(B) There might be an easier solution. Any suggestions? Ramiro === Subject: Re: Mathematica to Tex > If I save the file as .Tex I get: > > (P(A) = 1-e^{-text{$lambda $t}} > P(A)+P(B)) > > but what I want is something along the lines of > > P(A) = 1-e^{-lambda t} > P(A)+P(B) This is because you forgot to put a space between [Lambda] and t, so mathematica interprets [Lambda]t as text (a single word) and not as two mathematical symbols. === Subject: Re: Mathematica to Tex > > I am trying to export to Tex. My idea is to paste parts of notebooks > on my mediawiki, which can accept Tex. I am sure there is a good way > to do this. > Have you tried selecting the text, right clicking and choosing Copy As -> LaTeX? (This works in Mathematica 6.) === Subject: Re: Mathematica to Tex > If I save the file as .Tex I get: > > (P(A) = 1-e^{-text{$lambda $t}} > P(A)+P(B)) me too. i just edit that.... > > but what I want is something along the lines of > > P(A) = 1-e^{-lambda t} > P(A)+P(B) > .... because i want pretty much the same thing you do. you can see the results at rip94550.wordpress.com/ vale, rip -- NB eddress is r i p 1 AT c o m c a s t DOT n e t === Subject: Re: Mathematica to Tex > I am trying to export to Tex. My idea is to paste parts of notebooks > on my mediawiki, which can accept Tex. I am sure there is a good way > to do this. > > Let's say I write the following as a Text cell in Mathematica: > > P(A) = 1-e^-[Lambda]t > P(A)+P(B) > > Can I do TeXForm on a text cell? What would be the best way to export > just that? If I save the file as .Tex I get: > > (P(A) = 1-e^{-text{$lambda $t}} > P(A)+P(B)) > > but what I want is something along the lines of > > P(A) = 1-e^{-lambda t} > P(A)+P(B) > > There might be an easier solution. Any suggestions? Note that you should use valid Mathematica syntax (as if you were going to evaluate the expressions, say, given in Input syntax) and if you want to use Text Cell, the formulae should be entered as *inline cell*. In[1]:= TeXForm[P[A] == 1 - E^(-[Lambda] t)] Out[1]//TeXForm= P(A)=1-e^{-t lambda } In[2]:= TeXForm[P[A] + P[B]] Out[2]//TeXForm= P(A)+P(B) HTH, -- === Subject: Re: solving a system of polynomial equations >I'm pretty new to Mathematica. I want to numerically solve a system >of N polynomial equations with N unknowns. I've heard that >Mathematica was able to find all the real/complex solutions due to >the fact that equations only involve polynomials. Is that correct? >If yes, what is the command/method? The command to get a numerical solution to N polynomials with N unknowns is NSolve. In general, Mathematica commands that return numerical solutions start with a capital N such as NMinimize, NIntegrate etc. Also, while NSolve intended primarily for polynomials, Mathematica is not limited to solving polynomial equations. And in fact, NSolve will solve some non-polynomial equations. === Subject: Re: solving a system of polynomial equations > Also, while NSolve intended primarily for polynomials, > Mathematica is not limited to solving polynomial equations. And > in fact, NSolve will solve some non-polynomial equations. but only one solution with non polynomial equations, right? The one closest to the starting guess? Do you know if Nsolve use any of the Groebner Theory? Pluton === Subject: Re: What is @@@? >I have seen several references to the command @@@ in this newsgroup, >but a query of the online Documentation Center just refers me to >Apply (@@). What does it do and where can I read about it? When you have the page for Apply open, click the triangle beside More Information. There you will find a short blurb stating f@@@expr is equivalent to Apply[f, expr, {1}]. I seem to remember @@@ as being short for MapApply. But I see there is no MapApply function any longer in version 6. === Subject: Re: Solve inconsistant actions? Can someone enlighten me as to what discriminators Solve uses in providing some solutions while disdaining others in the attached simple code? Is it an operator or Mathematica bug? I am running 6.0.1 under win xp. newrent = Table[125000 [ExponentialE]^(r 14), {r, .01, .04, .005}] // N Table[Solve[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] Table[Solve[newrent[[i]]/rate == 1894000. , rate], {i, 1, 7}] Table[Reduce[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] Table[Solve[newrent[[i]] == 1894000 rate, rate], {i, 1, 7}] Marlyn Hicks mhicks@san.rr.com === Subject: Re: Solve inconsistant actions? > Can someone enlighten me as to what discriminators Solve uses in > providing some solutions while disdaining others in the attached simple > code? > > Is it an operator or Mathematica bug? I am running 6.0.1 under win xp. > > > newrent = Table[125000 [ExponentialE]^(r 14), {r, .01, .04, .005}] // N > > Table[Solve[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] > > Table[Solve[newrent[[i]]/rate == 1894000. , rate], {i, 1, 7}] > > Table[Reduce[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] > > Table[Solve[newrent[[i]] == 1894000 rate, rate], {i, 1, 7}] > This happens because Solve was designed to work with exact values and you are using it with approximate (floating point) values. When it verifies the solutions, it finds some of the solutions to be incorrect (because of precision issues). With VerifySolutions -> False Solve will return all solutions: Solve[#/rate == 1894000, rate, VerifySolutions -> False] & /@ newrent However, it is generally a very bad idea to mix exact and approximate values in calculations (or to use approximate values in symbolic calculations). Either use exact values in newrent: Solve[#/rate == 1894000, rate] & /@ Rationalize[newrent, 0] or use NSolve if you only need approximate solutions: NSolve[#/rate == 1894000, rate] & /@ newrent Szabolcs === Subject: Re: Solve inconsistant actions? > Can someone enlighten me as to what discriminators Solve uses in > providing some solutions while disdaining others in the attached simple > code? > > Is it an operator or Mathematica bug? I am running 6.0.1 under win xp. > > > newrent = Table[125000 [ExponentialE]^(r 14), {r, .01, .04, .005}] // N > > Table[Solve[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] > > Table[Solve[newrent[[i]]/rate == 1894000. , rate], {i, 1, 7}] > > Table[Reduce[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] > > Table[Solve[newrent[[i]] == 1894000 rate, rate], {i, 1, 7}] Keep in mind that *Solve* is a symbolic solver and it usually works better when fed with exact numbers, as you can see below. (Sorry not to be able to comment more on the internal algorithm of *Solve*.) newrent = Table[125000 E^(r 14), {r, 1/100, 4/100, 5/1000}] rate /. N@ Table[Solve[newrent[[i]]/rate == 1894000, rate], {i, 1, 7}] // Flatten rate /. Table[ Solve[newrent[[i]]/rate == 1894000., rate], {i, 1, 7}] // Flatten rate /. Table[ NSolve[newrent[[i]]/rate == 1894000, rate], {i, 1, 7}] // Flatten rate /. Table[ Solve[newrent[[i]]/rate == 1894000., rate], {i, 1, 7}] // Flatten rate /. ToRules /@ N@Table[Reduce[newrent[[i]]/rate == 1894000, rate], {i, 1, 7}] rate /. N@ Table[Solve[newrent[[i]] == 1894000 rate, rate], {i, 1, 7}] // Flatten {125000 E^(7/50), 125000 E^(21/100), 125000 E^(7/25), 125000 E^(7/20), 125000 E^(21/50), 125000 E^(49/100), 125000 E^(14/25)} {0.0759156, 0.0814201, 0.0873238, 0.0936555, 0.100446, 0.107729, 0.115541} {0.0759156, 0.0814201, 0.0873238, 0.0936555, 0.100446, 0.107729, 0.115541} {0.0759156, 0.0814201, 0.0873238, 0.0936555, 0.100446, 0.107729, 0.115541} {0.0759156, 0.0814201, 0.0873238, 0.0936555, 0.100446, 0.107729, 0.115541} {0.0759156, 0.0814201, 0.0873238, 0.0936555, 0.100446, 0.107729, 0.115541} {0.0759156, 0.0814201, 0.0873238, 0.0936555, 0.100446, 0.107729, 0.115541} HTH, -- === Subject: Re: How to put text on a curved surface? >I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, > P_ter Brute force. Not much slower than MeshShading. Make raster of text, compose Polygons on the flat raster grid, apply FaceForm[RGBColor] to each Polygon, and display with Graphics3D: w = 160; h = 40; map = Rasterize[**** Mathematica **** , RGBColor , RasterSize -> {w, h} , Background -> White]; Graphics3D[{EdgeForm[], Table[{FaceForm[map[[i, j]]], Polygon[{{i, j, 0}, {i, j + 1, 0}, {i + 1, j + 1, 0}, {i + 1, j, 0}}]} , {i, 1, h - 1} , {j, 1, w - 1}]} Next, map the 2D raster grid onto the 3D coordinates to on a torus: r = 1.0; r0 = 0.3; fx[i_, j_] := (r - r0 Cos[2 Pi i/40]) Cos[(2 Pi j)/160]; fy[i_, j_] := (r - r0 Cos[2 Pi i/40]) Sin[(2 Pi j)/160]; fz[i_, j_] := r0 Sin[2 Pi i/40]; w = 160; h = 40; map = Rasterize[**** Mathematica **** , RGBColor , Background -> White , RasterSize -> {w, h}]; Graphics3D[{EdgeForm[] , Table[{FaceForm[map[[i, j]]], Polygon[{{fx[i, j], fy[i, j], fz[i, j]} , {fx[i, j + 1], fy[i, j + 1], fz[i, j + 1]} , {fx[i + 1, j + 1], fy[i + 1, j + 1], fz[i + 1, j + 1]} , {fx[i + 1, j], fy[i + 1, j], fz[i + 1, j]}}]} , {i, 1, h - 1} , {j, 1, w - 1}]} ] It could be prettied up some, but it'd still be a pig. Fred Klingener === Subject: Re: How to put text on a curved surface? Here is a really nice demo from Michael Trott: http://www.mathematicaguidebooks.org/ Kevin > I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, > P_ter > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: How to put text on a curved surface? The Presentations package, at my web site below, has true 3D text that can be fitted to a curved surface. The package has many other features and is aimed both to making custom graphics and to extending Mathematica to make it easier to work with textbooks and research papers in a natural style. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ >I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, > P_ter > === Subject: Re: How to put text on a curved surface? here is a first attempt: a) define a 2dim parameter space. E.g. for a Torus {0,2Pi} x {0,2Pi} b) write your characters into the flat parameter space c) map the 2dim parameter space into 3D here is an example where we write two A characters onto a torus: R=10;r=3; map[p1_,p2_]:={R Sin[p1]+ r Cos[p2] Sin[p1],R Cos[p1]+ r Cos[p2] Cos[p1],r Sin[p2]}; charA2D[p_,pos_,size_]:=Plus[#,pos]&/@{{0.5 p,p},{0.5+0.5p,1-p},{0.25+0.5p,0.5}}; txt[p_]:=Join[charA2D[p,{0,-.5},1],charA2D[p,{1.1,-.5},1]]; g1={Graphics3D[Thickness[0.02]],ParametricPlot3D[map@@@txt[p],{p,0,1}]}//Sho w; g2=ParametricPlot3D[map[p1,p2],{p1,0,2Pi},{p2,0,2Pi}]; Show[g2,g1] hope thsi helps, Daniel > I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, > P_ter > === Subject: Re: How to put text on a curved surface? >I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, My response is a reprise of my post of a couple of weeks ago on texture mapping, for which there were helpful responses, but no satisfying resolution. One straightforward approach is to map an image of the text onto a mesh generated on a torus. Applying the earlier method to your case, I'll use Rasterize to generate an RGBColor array directly from the text: map = Rasterize[ ttMathematicatt , RGBColor , ImageSize -> {160, 30} , ImageResolution -> 20]; grid = Take[Dimensions[map, 2] - 1]; r = 1; r0 = 0.3; ParametricPlot3D[{ (r1 = (r + r0 Cos[phi])) Cos[theta] , r1 Sin[theta] , r0 Sin[phi]} , {phi, -Pi, Pi} , {theta, 0, 2 Pi} , Mesh -> Reverse[grid] , MeshStyle -> None , MeshFunctions -> {#5 &, -#4 &} , MeshShading -> map ,ViewPoint -> {-1, 2, 1} ] On the one hand, the technique evidently produces a useful result, but on the other, it's so bog-slow that it can't possibly be the right way to do it. On my WinXP 6.0.1, the timing (huge difference between Timing[] report and meat clock time elapsed) and memory (inexorable rise in page file usage) puzzles remain when I work with meshshading. Hth, Fred Klingener === Subject: Re: How to put text on a curved surface? > I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, > P_ter You mean the projected/mapped letters should be curved ? Try projecting stencil slots onto the torus from a suitable bright point as light source, which can be even at infinity.. as intersection with the conical rays. === Subject: Re: How to put text on a curved surface? > I would like to put Mathematica on a curved surface, e.g. a torus. > Can anyone help here? > with friendly greetings, > P_ter You mean the projected/mapped letters should be curved ? Try > projecting stencil slots onto the torus from a suitable bright point > as light source, which can be even at infinity.. as intersection with > the conical rays. It should be mentioned that the mapping can never be faithful ( per isometric mappings between flat to flat or curvrd to curved surfaces ) as there is bound to be alteration due to: 1) magnification/reduction ( strain of tension or compression), 2) distortion ( angle changes in shear). It is in other words so stated by Gauss Egregium theorem. After writing or printing the text on a flat label when you try to stick it on a torus of suitable size, a tendency to tear on areas outside the crown (Gauss Curvature > 0) and some folds/frills on the inside ( G.C < 0) is inevitable. The most faithful reproduction takes place at the crown ( G.C ~ 0). === Subject: Re: How to put text on a curved surface? I followed the link. I discovered that the Presentations Package of David Park is needed. I found in that a reason to buy it. I already wanted to do that a long time. Still, I am interested in other solutions. with friendly greetings, P_ter === Subject: Re: How to put text on a curved surface? I got help from Michael Trott. He suggested one could use:mText2D = ImportString[ExportString[Cell[TextData[StyleBox[Mathematica, FontWeight -> Bold]], Section], PDF]][[1]] I changed the text to A, the format to JPEG and the size to 24. After that I used Best way to draw a raster image onto a curved surface from Andrew Moylan. It worked. === Subject: Re: Fitting a inverse function from complicated integral I need to Fit this experimental data {x, OOT}: data = { > {1, 444.6}, > {3, 455.15}, > {5, 464.81}, > {7, 467.79}, > {10, 469.01}, > {15, 480.28}} But there is a big problem with model equation: x = Integrate[A*Exp[-B/T], {T, 0, OOT}, Assumptions -> A > 0 && B > 0 > && OOT > 0] So, after integration: x = A (Exp[-B/OOT] OOT - B Gamma[0, B/OOT]) I need to obtain a INVERSE function, i.e. OOT = f(x) and then find > (e.g. via FindFit) best fitting parameters A, B. I have tried Series expansion, PadeApproximant etc., but every > approximation of mentioned > model contain A*Exp[-B/T], so I cannot find inverse function. Can Somebody help me with this problem? > ***************** > $Version > 6.0 for Microsoft Windows (32-bit) (February 7, 2008) Assuming you are really just after the parameter estimates and attempting to symbolically invert the function is just a means to an end, one possibility is to define the model as a black box function that solves the equation numerically. This can be done using FindRoot. In[1]:= data = {{1, 444.6}, {3, 455.15}, {5, 464.81}, {7, 467.79}, {10, 469.01}, {15, 480.28}}; In[2]:= model[A_?NumericQ, B_?NumericQ, x_?NumericQ] := Module[{OOT}, (OOT /. FindRoot[ x == A (Exp[-B/OOT] OOT - B Gamma[0, B/OOT]), {OOT, 450, 500}])] In[3]:= FindFit[data, model[A, B, x], {{A, 7*10^13}, {B, 15000}}, x] 14 Out[3]= {A -> 3.23774 10 , B -> 15914.5} For the starting values for A and B, I took values close to those obtained by plugging the first and last data points into the equation and solving for A and B. Darren Glosemeyer Wolfram Research === Subject: Re: Fitting a inverse function from complicated integral > > I need to Fit this experimental data {x, OOT}: > > data = { > {1, 444.6}, > {3, 455.15}, > {5, 464.81}, > {7, 467.79}, > {10, 469.01}, > {15, 480.28}} > > But there is a big problem with model equation: > > x = Integrate[A*Exp[-B/T], {T, 0, OOT}, Assumptions -> A > 0 && B > 0 > && OOT > 0] > > So, after integration: > > x = A (Exp[-B/OOT] OOT - B Gamma[0, B/OOT]) > > I need to obtain a INVERSE function, i.e. OOT = f(x) and then find > (e.g. via FindFit) best fitting parameters A, B. > > I have tried Series expansion, PadeApproximant etc., but every > approximation of mentioned > model contain A*Exp[-B/T], so I cannot find inverse function. > > Can Somebody help me with this problem? Can be done by reversing data coordinates, specifying a function that only works for numeric input (to disable symbolic processing), and giving a large number of iterations. data = {{1, 444.6}, {3, 455.15}, {5, 464.81}, {7, 467.79}, {10, 469.01}, {15, 480.28}}; func[a_?NumberQ, b_?NumberQ, oot_?NumberQ] := NIntegrate[a*Exp[-b/t], {t, 0, oot}] ff = FindFit[Map[Reverse,data], func[a,b,oot], {a,b}, oot, MaxIterations->500] Or could do: xx[a_,b_,oot_] := Integrate[a*Exp[-b/t], {t,0,oot}, Assumptions->{a>0,b>0,oot>0}] ff2 = FindFit[Map[Reverse,data], xx[a,b,oot], {a,b}, oot, MaxIterations->500] Both give pretty much the same results: In[17]:= ff = FindFit[Map[Reverse,data], func[a,b,oot], {a,b}, oot, MaxIterations->500] Out[17]= {a -> 1.99859*10^11, b -> 12547.7} Here are the residuals: gg = xx /. ff; In[19]:= (gg /. OOT -> data[[All, 2]]) - data[[All, 1]] Out[19]= {0.63067, 0.282454, 1.0629, 0.29016, -2.14352, 0.410461} Daniel Lichtblau Wolfram Research === Subject: Fitting a inverse function from complicated integral I need to Fit this experimental data {x, OOT}: data = { {1, 444.6}, {3, 455.15}, {5, 464.81}, {7, 467.79}, {10, 469.01}, {15, 480.28}} But there is a big problem with model equation: x = Integrate[A*Exp[-B/T], {T, 0, OOT}, Assumptions -> A > 0 && B > 0 && OOT > 0] So, after integration: x = A (Exp[-B/OOT] OOT - B Gamma[0, B/OOT]) I need to obtain a INVERSE function, i.e. OOT = f(x) and then find (e.g. via FindFit) best fitting parameters A, B. I have tried Series expansion, PadeApproximant etc., but every approximation of mentioned model contain A*Exp[-B/T], so I cannot find inverse function. Can Somebody help me with this problem? ***************** $Version 6.0 for Microsoft Windows (32-bit) (February 7, 2008) === Subject: Re: How to put text on a curved surface? Remarkable enough I did not get sent to me all the responses . I also observed that not always my questions are in the forum -- although I have the impression they are normal. with friendly greetings, P_ter === Subject: Simple Q: How to give computed results from NSolve to a new I am new to Mathematica. And I just have a simple question for you: I have solved a system of equations by NSolve. And for instance, it returns the results as Root={{x->1,y->2}}. And now I want to use the computed results, say x & y to define a new variable Z=x^2+sqrt(xy). How should I use computed x and y to define the new variable Z? === Subject: Re: Label vertices in Graph to display with GraphPlot Hello Murray, when I take the last example in the documentation of GraphPlot3D (basic examples: the rendering) and use the following graph the labels do not show up. (the text comes from an application of Formal Concept Analysis to a consumer table for mobile phones). Anyway, they do now show up. gr1 = {Gesprekken -> Gebruik-+, Gesprekken -> Duurzaamheid-+, Gebruik-+ -> Draagbaarheid++,Gebruik-+ -> SMS-+, Gebruik-+ -> Lege knoop, Duurzaamheid-+ -> Accu++, Duurzaamheid-+ -> Lege knoop, Draagbaarheid++ -> Duurzaamheid++, Draagbaarheid++ -> SMS--, Lege knoop -> SMS--, SMS-+ -> Duurzaamheid++, SMS-+ -> 9, Lege knoop -> 9, Accu++ -> 9, Accu++ -> Gebruik+, Duurzaamheid++ -> Earth, SMS-- -> Earth, 9 -> Earth, Gebruik+ -> Earth}; === Subject: Inconsistent behavior? Binomial[n,4] yields 1/24 (-3+n) (-2+n) (-1+n) n Binomial[n,5] yields 1/120 (-4+n) (-3+n) (-2+n) (-1+n) n Binomial[n,6] yields Binomial[n,6] Binomial[n,7] yields Binomial[n,7] Is some setting doing this. Angela === Subject: same input ... different results??? hi, i'm trying to solve the following equation with mathematica. why are there different results depending on whether or not i factor x out (see the two def. for f1)? Sum[f1[n1, n2, x, m, i, j, k], {i, 0, n1}, {j, 0, n2}, {k, 0, n2 + i - j}] f1[n1_, n2_, x_, m_, i_, j_, k_] := Exp[I*2*Pi*(m/3*(n1 + n2 - i - 2 j - k) + x*(n2 + i - j - 2 k))] f1[n1_, n2_, x_, m_, i_, j_, k_] := Exp[I*2*Pi*(m/3*(n1 + n2 - i - 2 j - k) + x*n2 + x*i - x*j - 2 x*k)] and still, both results do not match the sum if i enter specific values. so there must be something wrong, but what? thx in advance. === Subject: Help with Check Function Arguments & Options I would like to thank everyone who has previously responded to my posts. Your advice has helped greatly. I have a couple of final questions. I am writing a package file and would like to do some argument and option checking if possible; that is check the number of arguments and see if there are unknown options. If my function has no options I think I can do this. f[x_,y_] := x + y f[args___] := If[Length[{args}] != 2, Message[f::argrx, f, Length[{args}], 2]; Return[$Failed]] This type of check has been posted to the message board before. My question is assume that f[x,y] has multiple options, that is Options[f] = {opt1 -> 1, opt2 -> True}, etc How do I check if the user entered the correct options? Andrew Andrew C Beveridge MS M888 Los Alamos National Laboratory Los Alamos, NM 87545 505-665-2092 e-mail: acbev@lanl.gov === Subject: Re: Solve inconsistant actions? newrent = Table[125000 E^(r 14), {r, .01, .04, .005}]; The only case with a problem (its algorithms couldn't find a solution) is Solve[#/rate == 1894000, rate] & /@ newrent // Column {{rate->0.0759156}} {} {} {{rate->0.0936555}} {} {{rate->0.107729}} {{rate->0.115541}} I find that simplifying an expression can sometimes help. Solve[Simplify[#/rate == 1894000], rate] & /@ newrent // Column {{rate->0.0759156}} {{rate->0.0814201}} {{rate->0.0873238}} {{rate->0.0936555}} {{rate->0.100446}} {{rate->0.107729}} {{rate->0.115541}} This is equivalent to what you did with Solve[# == 1894000 rate, rate] & /@ newrent Alternatively, use only exact or only approximate numbers (as in one of your examples). Hence, either Solve[Simplify[#/rate == 1894000.], rate] & /@ newrent // Column or Solve[#/rate == 1894000, rate] & /@ Rationalize[newrent, 0] // N // Column And Reduce has more robust capabilities than Solve Bob Hanlon > Can someone enlighten me as to what discriminators Solve uses in > providing some solutions while disdaining others in the attached simple > code? > > Is it an operator or Mathematica bug? I am running 6.0.1 under win xp. > > > newrent = Table[125000 [ExponentialE]^(r 14), {r, .01, .04, .005}] // N > > Table[Solve[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] > > Table[Solve[newrent[[i]]/rate == 1894000. , rate], {i, 1, 7}] > > Table[Reduce[newrent[[i]]/rate == 1894000 , rate], {i, 1, 7}] > > Table[Solve[newrent[[i]] == 1894000 rate, rate], {i, 1, 7}] > > > > Marlyn Hicks > > mhicks@san.rr.com > > === Subject: Re: Import .xlsx files > Is Import capable of reading Excel files stored in the new MSXML file > format (.xslx)? A quick trial shows that it is not, but maybe I am > not doing something right. > > I am aware that I could write a function to dig into the .xslx as a > zip archive, retrieve the .xml files, and try to extract the cell > values, but I am lazy and hoping somebody else did that for me already. > Why don't you export to CSV instead? Excel uses an extremely complex format, not really suitable for data exchange (unless Excel is the only software used for analysing the data), while implementing a CSV reader is trivial in any general purpose language. And Mathematica reads CSVs reliably out of the box. === Subject: Re: basic questions 3,1,4 > 1,5,9 > 2,6,5 > ..,.,. Hi Markus, The following examples should be of interest. First, we build a list of points pts that contains triple made of the first twenty-four digits of pi. Then we use several built-in functions to visualize and interact with the list (or dynamically build a new list). pts = Partition[First@RealDigits[Pi, 10, 24], 3] ListPlot3D[pts] ListContourPlot@pts Manipulate[ ListContourPlot@Partition[First@RealDigits[Pi, 10, n], 3], {n, 9, 192, 3}] Animate[ListContourPlot@Partition[First@RealDigits[Pi, 10, n], 3], {n, 9, 192, 3}] Animate[ListDensityPlot[Partition[First@RealDigits[Pi, 10, n], 3], ColorFunction -> SunsetColors], {n, 9, 384, 3}] -- === Subject: Re: noob questions :) > hi everyone! > > first of all i would like to introduce myself. being an artist i am mainly engaged in the visualization of chaotic systems such as iterated function systems or strange attractors from experimental data. i consider myself a completely mathematica noob (willing to learn ::)) i got introduced to mathematica by a friend who works in the math institute at our local university (hence, that's where i spent most of my recent time ... lol). to get myself started with the project i have in mind i could use some help, which i have not found in the databases yet: > > - how can i tell mathematica to import a three-column (x,y,z) txt file and do a 3d plot from the values. i already messed with the ListPlot3D command , unfortunately to no avail. the file containing the experimental data looks something like this: > point,x,y,z > 1,34,21,45 > 2,32,53,76 > 3,12,23,43 > 4,45,21,87 > 5,65,76,87 > etc Say that you have imported (Import[...]) your experimental data into the variable impt. impt {{1, 34, 21, 45}, {2, 32, 53, 76}, {3, 12, 23, 43}, {4, 45, 21, 87}, {5, 65, 76, 87}} Since the first column of the matrix (or the first entry of each quadruple if you want) contains only a line number, we can safely discard it to keep only the {x, y, z} values. data = impt[[All, 2 ;; 4]] {{34, 21, 45}, {32, 53, 76}, {12, 23, 43}, {45, 21, 87}, {65, 76, 87}} We can, now, use ListPlot3D. ListPlot3D[data] > - how can i then tell mathematica to color certain values from this data list with a color from my choice? eg: color the values X red (X could be something like the mean value of the entire list) You could use option such as *Epilog*. -- === Subject: Re: A small syntax error causing Kernel crash, Version 6.0.1 >> Fyi; >> This below causes Kernel crash >> Solve[Integrate[f[x]*Exp[x], {x}] == 1, r] >> Mathematica 6.0.1, on XP (the {x} is the problem). >> Nasser > > I forgot to mention that one might have to run the above command 2 times to > see the crash. The first time you might not see the crash. Hi Nasser, FWIW, with Mathematica 6.0.2 on Mac OS X Leopard 1.5.2 Intel 64-bit, the kernel crashes quietly each time the above expression is being evaluated. -- === Subject: Re: A small syntax error causing Kernel crash, Version 6.0.1 On my machine (Intel MacBook Pro) running 6.0.2.1, I get an error message: Integrate::ilim : Invalid integration variable or limit(s) in {x}. ButtonBox[, BaseStyle->Link, ButtonData:>paclet:ref/message/Integrate/ilim, ButtonFrame->None, ButtonNote->Integrate::ilim] So I guess the function now knows to do nothing when the limits are not correctly specified. george > Hi Nasser, this also happens with version 6.0.2 Daniel >> Fyi; >> This below causes Kernel crash >> Solve[Integrate[f[x]*Exp[x], {x}] == 1, r] >> Mathematica 6.0.1, on XP (the {x} is the problem). >> Nasser > === Subject: Path, Get, etc. I'm trying to read in ConvexHull.m with the line << ConvexHull3D`; but it always says Get::noopen: Cannot open ConvexHull3D`. >> Checking $Path, it includes paths to several folders which definitely have a copy of ConvexHull.m, including C:Documents and SettingsAll UsersApplication DataMathematica Autoload, and there's a copy in the same folder as the file that calls it. I don't understand why the file isn't found. I'd appreciate any tips. Steve Gray === Subject: Re: Path, Get, etc. > I'm trying to read in ConvexHull.m with the line << ConvexHull3D`; but it always says Get::noopen: Cannot open ConvexHull3D`. Checking $Path, it includes paths to several folders which definitely >have a copy of ConvexHull.m, including C:Documents and SettingsAll UsersApplication DataMathematica >Autoload, and there's a copy in the same folder as the file that calls it. >I don't understand why the file isn't found. I'd appreciate any tips. Steve Gray === Subject: Re: Path, Get, etc. > I'm trying to read in ConvexHull.m with the line > > << ConvexHull3D`; but it always says > > Get::noopen: Cannot open ConvexHull3D`. >> Steve, If the package you want to load is called ConvexHull.m (no 3D in the name) then you must use the exact name of the file without its extension. Any of the following expressions should work: << ConvexHull` << ConvexHull` Needs[ConvexHull`] > Checking $Path, it includes paths to several folders which definitely > have a copy of ConvexHull.m, including > > C:Documents and SettingsAll UsersApplication DataMathematica > Autoload, If the file ConvexHull.m is located in this directory, you should not to have to load it manually since it must be already there (it is automatically loaded whenever Mathematica starts). > and there's a copy in the same folder as the file that calls it. > I don't understand why the file isn't found. I'd appreciate any tips. > > Steve Gray > HTH, -- === Subject: Re: Path, Get, etc. > I'm trying to read in ConvexHull.m with the line > > << ConvexHull3D`; but it always says > > Get::noopen: Cannot open ConvexHull3D`. > > Checking $Path, it includes paths to several folders which definitely > have a copy of ConvexHull.m, including > > C:Documents and SettingsAll UsersApplication DataMathematica > Autoload, > If you want to load ConvexHull.m, use << ConvexHull` and not << ConvexHull3D` > and there's a copy in the same folder as the file that calls it. The location of the notebook has no significance. The working directory (returned by Directory[]) is what matters. To set the working directory to the notebook's directory, use SetDirectory[NotebookDirectory[]] > I don't understand why the file isn't found. I'd appreciate any tips. === Subject: Re: Path, Get, etc. I suppose that < I'm trying to read in ConvexHull.m with the line > > << ConvexHull3D`; but it always says > > Get::noopen: Cannot open ConvexHull3D`. > > Checking $Path, it includes paths to several folders which definitely > have a copy of ConvexHull.m, including > > C:Documents and SettingsAll UsersApplication DataMathematica > Autoload, > > and there's a copy in the same folder as the file that calls it. > I don't understand why the file isn't found. I'd appreciate any tips. > > Steve Gray > === Subject: Re: Bug in ExportString? > > using FullForm on ImportString[ExportString[{1,1}, PDF], PDF] > > //FullForm it is clear that the output is quite different from the > > input: {1,1}. Is any documetation available or is this a bug? > > Daniel > > I did not formulate a good question about: > ImportString[ExportString[ , PDF], PDF] > My point is that this gives an image, while > ImportString[ExportString[t, PDF], PDF] > gives with Inputform a polygon. > I think a space is also text ( ). It has an ASCII place. So, there should be no difference in structure with the letter t. > with friendly greetings, > P_ter > Hi Peter and Daniel, Why do you think that there is a bug in ImportString or ExportString? For all of , t, or {1,1} I get a result that is an image (Graphics object) and looks the same as the input. This is what I expect. The PDF format (unless it is a tagged PDF) does not preserve the structure of text, e.g. it does not preserve spaces and newlines as characters, or the exact order of lines of text (think about multicolumn layouts). What it does preserve exactly is what the document /looks/ like. PDF readers can work around these limitations partially, and they make it possible to copy text from untagged PDFs, but the results are usually not perfect ... It is possible to extract text from PDFs with Mathematica too, but just like copying with a PDF reader, this is not very reliable ... Try ImportString[ExportString[abc, PDF], {PDF, Plaintext}]. Now try ImportString[ExportString[{1,1}, PDF], {PDF, Plaintext}] and see how { and } are mangled. I get the same result even if I export the PDF to disk and copy the text with Adobe Reader. To avoid misunderstandings caused by e.g. version differences, here's the output of the two original examples: In[1]:= ImportString[ExportString[ , PDF], PDF] // InputForm Out[1]//InputForm= {Graphics[{Thickness[0.1203858530857692]}, ImageSize -> {6., 12.}, PlotRange -> {{0., 5.75}, {0., 12.}}, AspectRatio -> Automatic]} In[2]:= ImportString[ExportString[t, PDF], PDF] // InputForm Out[2]//InputForm= {Graphics[{Thickness[0.1203858530857692], Style[{Polygon[{{2.091796875, 8.509033203125}, {4.220947265625, 8.509033203125}, {4.421722625851167, 8.451835899501459}, {4.482421875, 8.303589152176556}, {4.421722625851167, 8.156801263831468}, {4.220947265625, 8.09814453125}, {2.091796875, 8.09814453125}, {2.091796875, 5.495071589250973}, {2.108850370770762, 5.332197101756292}, {2.1600108580830497, 5.183257225422544}, {2.2452783369368614, 5.0482519602497264}, {2.364652807332199, 4.927181306237841}, {2.516930475494741, 4.827340876360347}, {2.7009075476501696, 4.75602628359071}, {2.9165840237984852, 4.713237527928927}, {3.1639599039396877, 4.698974609375}, {3.366194069710223, 4.7067809227375665}, {3.5765993348355423, 4.730199862825267}, {3.7951756993156462, 4.7692314296381015}, {4.021923163150536, 4.82387562317607}, {4.239915941290354, 4.888295938810949}, {4.4322282486852504, 4.956655871914518}, {4.5988600853352235, 5.028955422486776}, {4.739811451240271, 5.105194590527724}, {4.893894204462548, 5.1688121276143}, {5.0240478515625, 5.107528935888862}, {5.080078125, 4.963367506687742}, {5.019378875851167, 4.8262102535262645}, {4.762354584333962, 4.657900419123906}, {4.553572510003116, 4.568766279999848}, {4.291277149957441, 4.476312659593871}, {4.005271056653925, 4.3939634686778035}, {3.72535678254955, 4.335142618023468}, {3.4515343276443184, 4.299850107630867}, {3.1838036919382304, 4.2880859375}, {3.016159801260507, 4.293133587967097}, {2.8572888622951877, 4.3082765393683875}, {2.565865839501763, 4.368848344973554}, {2.309534623557955, 4.469801354315495}, {2.0882952144637645, 4.6111355673942125}, {1.9100633970030552, 4.78668620781212}, {1.7827549559596911, 4.990288499171632}, {1.706369891333673, 5.221942441472747}, {1.680908203125, 5.481648034715468}, {1.680908203125, 8.09814453125}, {0.940258124088035, 8.09814453125}, {0.7345219593567602, 8.15621760624392}, {0.67236328125, 8.305923782526751}, {0.7345219593567602, 8.450960413120136}, {0.940258124088035, 8.509033203125}, {1.680908203125, 8.509033203125}, {1.680908203125, 9.6669921875}, {1.7389812781189207, 9.867767547726167}, {1.8840181937013618, 9.928466796875}, {2.0337240849951357, 9.867767547726167}, {2.091796875, 9.6669921875}, {2.091796875, 8.509033203125}}]}, Thickness[0.1203858530857692]]}, ImageSize -> {6., 12.}, PlotRange -> {{0., 5.75}, {0., 12.}}, AspectRatio -> Automatic]} === Subject: Re: Bug in ExportString? I interpret this as: for Input PDF can only be used for pictures. The manual is rather misleading here, because it says: Stores text, fonts, images, and 2D vector graphics in a device- and resolution-independent way. We can only hope that a furure version of import will work better. Daniel >> using FullForm on ImportString[ExportString[{1,1}, PDF], PDF] >> //FullForm it is clear that the output is quite different from the >> input: {1,1}. Is any documetation available or is this a bug? >> Daniel > > > > I did not formulate a good question about: > > ImportString[ExportString[ , PDF], PDF] > > My point is that this gives an image, while > > ImportString[ExportString[t, PDF], PDF] > > gives with Inputform a polygon. > > I think a space is also text ( ). It has an ASCII place. So, there > should be no difference in structure with the letter t. > > with friendly greetings, > > P_ter > > > Hi Peter and Daniel, > > Why do you think that there is a bug in ImportString or ExportString? > For all of , t, or {1,1} I get a result that is an image (Graphics > object) and looks the same as the input. This is what I expect. > > The PDF format (unless it is a tagged PDF) does not preserve the > structure of text, e.g. it does not preserve spaces and newlines as > characters, or the exact order of lines of text (think about multicolumn > layouts). What it does preserve exactly is what the document /looks/ > like. PDF readers can work around these limitations partially, and they > make it possible to copy text from untagged PDFs, but the results are > usually not perfect ... > > It is possible to extract text from PDFs with Mathematica too, but just > like copying with a PDF reader, this is not very reliable ... Try > ImportString[ExportString[abc, PDF], {PDF, Plaintext}]. Now try > ImportString[ExportString[{1,1}, PDF], {PDF, Plaintext}] and see > how { and } are mangled. I get the same result even if I export the PDF > to disk and copy the text with Adobe Reader. > > To avoid misunderstandings caused by e.g. version differences, here's > the output of the two original examples: > > In[1]:= ImportString[ExportString[ , PDF], PDF] // InputForm > > Out[1]//InputForm= > {Graphics[{Thickness[0.1203858530857692]}, ImageSize -> {6., 12.}, > PlotRange -> {{0., 5.75}, {0., 12.}}, AspectRatio -> Automatic]} > > In[2]:= ImportString[ExportString[t, PDF], PDF] // InputForm > > Out[2]//InputForm= > {Graphics[{Thickness[0.1203858530857692], > Style[{Polygon[{{2.091796875, 8.509033203125}, {4.220947265625, > 8.509033203125}, {4.421722625851167, 8.451835899501459}, > {4.482421875, 8.303589152176556}, {4.421722625851167, > 8.156801263831468}, {4.220947265625, 8.09814453125}, > {2.091796875, 8.09814453125}, {2.091796875, 5.495071589250973}, > {2.108850370770762, 5.332197101756292}, {2.1600108580830497, > 5.183257225422544}, {2.2452783369368614, 5.0482519602497264}, > {2.364652807332199, 4.927181306237841}, {2.516930475494741, > 4.827340876360347}, {2.7009075476501696, 4.75602628359071}, > {2.9165840237984852, 4.713237527928927}, {3.1639599039396877, > 4.698974609375}, {3.366194069710223, 4.7067809227375665}, > {3.5765993348355423, 4.730199862825267}, {3.7951756993156462, > 4.7692314296381015}, {4.021923163150536, 4.82387562317607}, > {4.239915941290354, 4.888295938810949}, {4.4322282486852504, > 4.956655871914518}, {4.5988600853352235, 5.028955422486776}, > {4.739811451240271, 5.105194590527724}, {4.893894204462548, > 5.1688121276143}, {5.0240478515625, 5.107528935888862}, > {5.080078125, 4.963367506687742}, {5.019378875851167, > 4.8262102535262645}, {4.762354584333962, 4.657900419123906}, > {4.553572510003116, 4.568766279999848}, {4.291277149957441, > 4.476312659593871}, {4.005271056653925, 4.3939634686778035}, > {3.72535678254955, 4.335142618023468}, {3.4515343276443184, > 4.299850107630867}, {3.1838036919382304, 4.2880859375}, > {3.016159801260507, 4.293133587967097}, {2.8572888622951877, > 4.3082765393683875}, {2.565865839501763, 4.368848344973554}, > {2.309534623557955, 4.469801354315495}, {2.0882952144637645, > 4.6111355673942125}, {1.9100633970030552, 4.78668620781212}, > {1.7827549559596911, 4.990288499171632}, {1.706369891333673, > 5.221942441472747}, {1.680908203125, 5.481648034715468}, > {1.680908203125, 8.09814453125}, {0.940258124088035, > 8.09814453125}, {0.7345219593567602, 8.15621760624392}, > {0.67236328125, 8.305923782526751}, {0.7345219593567602, > 8.450960413120136}, {0.940258124088035, 8.509033203125}, > {1.680908203125, 8.509033203125}, {1.680908203125, 9.6669921875}, > {1.7389812781189207, 9.867767547726167}, {1.8840181937013618, > 9.928466796875}, {2.0337240849951357, 9.867767547726167}, > {2.091796875, 9.6669921875}, {2.091796875, 8.509033203125}}]}, > Thickness[0.1203858530857692]]}, ImageSize -> {6., 12.}, > PlotRange -> {{0., 5.75}, {0., 12.}}, AspectRatio -> Automatic]} > === Subject: Re: Bug in ExportString? >I did not formulate a good question about: > ImportString[ExportString[ , PDF], PDF] > My point is that this gives an image, while > ImportString[ExportString[t, PDF], PDF] > gives with Inputform a polygon. > I think a space is also text ( ). It has an ASCII place. So, there > should be no difference in structure with the letter t. Here's my take: Doing first img = First@ImportString[ExportString[ , PDF], PDF] and looking at img//InputForm shows img to be a Graphics with no displayed object but an ImageSize of {6, 12} (presumably printer's points). You can convince yourself of this by looking at: Framed[img] Compare this to imgM = First[ImportString[ExportString[M, PDF], PDF]] and imgM//InputForm shows a Graphics[] of the same size with a Polygon specification to represent the image of the character. So the form offers the prospect of doing primitive composition with something like imgList = (First@First[ImportString[ExportString[#, PDF], PDF]]) & /@ Characters[Mathematica]; Graphics[Table[Translate[imgList[[i]], {6 (i - 1), 0}], {i, Length[imgList]}]] The uniform Translate inside a Table seems to work well enough for monospaced fonts (and you can probably obfuscate the code and otherwise show off with the corresponding Nest construct), and a separate rendering of each character would seem to be a useful approach if you're on your way to mapping text onto a curved surface. The PDF I/O form evidently uses long straight lines where possible in its rendering of many popular fonts. These lines won't map properly onto a curved surface, so they'll have to be filled in with interpolated points before transformation. So the conclusions seem to be that the idiom produces consistent results with a variety of characters, but, because the returned images are the same size, compositions or typesetting probably won't look right unless you use monospaced fonts or your Translate values come . Hth, Fred Klingener === Subject: Trace'ing Gradient in FindMinimum Can I track Gradient computations in FindMinimum using Trace? Here, tr is empty though df is evaluated several times: f[x_List] := (x.x - 10)^2 df[x : {__?NumericQ}] := 4 (x.x - 10) x init = RandomReal[1, {1000}]; tr = Trace[ FindMinimum[f[x], {x, init}, Gradient -> df[x]], df[x_] -> Norm[x] ] But Tracing the evaluation of f[] is possible and yields the same as EvaluationMonitor: ev = {}; tr = ReleaseHold /@ Flatten@Trace[ FindMinimum[f[x], {x, init}, Gradient -> df[x], EvaluationMonitor :> AppendTo[ev, Norm[x]] ], f[x_] -> Norm[x]]; Here, tr == ev. It looks like FindMinimum eats the function df and doesn't ever explicitly call it, but it doesn't eat f. I am trying to resolve an error where FindMinimum immediately complains my Gradient doesn't evaluate to a vector of reals for init and returns. Placing a Print inside df shows that FindMinimum does actually call df with init and when I separately evaluate df[init], there is no problem. I know I am doing something wrong so I was hoping to figure it out with Trace on df. I would also like to learn to use Trace. Second question: Is there a way to specify that FindMinimum should not try to find symbolic derivatives and such for it's arguments other than using patterns like x:{__?NumericQ}, which probably take time to compute. It would be nice for something like f[x_ /; And@@(MatrixQ[#,NumericQ]&/@x)] not to be evaluated each iteration. Is there a global $TrustUserUnconditionally = True option? === Subject: Re: Trace'ing Gradient in FindMinimum try f[x_List] := (x.x - 10)^2 df[x : {__?NumericQ}] := (Sow[x]; 4 (x.x - 10) x) init = RandomReal[1, {3}]; Reap[FindMinimum[f[x], {x, init}, Gradient -> df[x]]] Jens > Can I track Gradient computations in FindMinimum using Trace? Here, tr > is empty though df is evaluated several times: > > f[x_List] := (x.x - 10)^2 > df[x : {__?NumericQ}] := 4 (x.x - 10) x > init = RandomReal[1, {1000}]; > > tr = > Trace[ > FindMinimum[f[x], {x, init}, Gradient -> df[x]], > df[x_] -> Norm[x] > ] > > But Tracing the evaluation of f[] is possible and yields the same as > EvaluationMonitor: > > ev = {}; > tr = > ReleaseHold /@ > Flatten@Trace[ > FindMinimum[f[x], {x, init}, Gradient -> df[x], > EvaluationMonitor :> AppendTo[ev, Norm[x]] ], > f[x_] -> Norm[x]]; > > Here, tr == ev. > > It looks like FindMinimum eats the function df and doesn't ever > explicitly call it, but it doesn't eat f. > > I am trying to resolve an error where FindMinimum immediately > complains my Gradient doesn't evaluate to a vector of reals for init > and returns. Placing a Print inside df shows that FindMinimum does > actually call df with init and when I separately evaluate df[init], > there is no problem. I know I am doing something wrong so I was hoping > to figure it out with Trace on df. I would also like to learn to use > Trace. > > Second question: Is there a way to specify that FindMinimum should not > try to find symbolic derivatives and such for it's arguments other > than using patterns like x:{__?NumericQ}, which probably take time to > compute. It would be nice for something like f[x_ /; > And@@(MatrixQ[#,NumericQ]&/@x)] not to be evaluated each iteration. Is > there a global $TrustUserUnconditionally = True option? > > === Subject: Re: question on player pro There is no compiling process...we're just dealing with regular notebooks here. Simply opening and evaluating the notebook (or using dynamic interfaces) in Player Pro should work fine. There are some limitations, but not many...we're really talking about a full Mathematica kernel. A useful table is here... http://www.wolfram.com/solutions/interactivedeployment/compare.html As an executive summary for the kinds of things I suspect you might be interested in, I'd note most specifically, that Player Pro users can not... * Type in notebooks, except in InputFields. * Use GUIKit or .NET/Link (they're simply not included in Player Pro) * Use any alternative front end to the kernel; for example, writing your own J/Link interface to the kernel. * Load plain-text packages, although .mx files and packages encoded with Encode[] are perfectly okay. Note that Premier Service subscribers get three free Player Pro license, which you may use for your own experimentation or distribute to other users as you see fit. More info about that here... http://www.wolfram.com/products/playerpro/developerkit.html If you have any other questions, ask away. I know from experience that the Player Pro concept can generate a lot of questions, since there are a lot of unusual ways people might want to use it which we may not have considered or clearly outlined in our case studies... http://www.wolfram.com/solutions/interactivedeployment/casestudies.html I'm not the best person to answer detailed licensing issues, but I'm happy to address any technical or conceptual issues. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. > I have a simple question on the new Mathematica player pro. If person X, who has Mathematica, makes a Mathematica notebook (.nb > file), what are then the steps needed so that person Y can run the same > notebook if Y do not have Mathematica? Does Y need to buy player pro to run X's notebook? Or is it that only X needs to buy player pro, and use it to 'convert' or > 'compile' the notebook to a new file (what is the extension?) which I > assume will contain the Mathematica kernel in it, and send that file to > person Y. But then how will Y run it if they do not have player pro nor > Mathematica? use the free player? What about any licensing issue in sending playerpro files to someone else > to run? Nasser === Subject: a workaround for large EPS files from ContourPlot As others have noticed in previous posts, if one exports an EPS from a ContourPlot produced by Mathematica6, the result is far from being satisfactory. The EPS is one order of magnitude larger in size than the one generated by Math5 in similar situations, and displays ugly artefacts when viewed on screen. The problem comes from the fact that the plot is generated internally by a recursive method, producing a dense mesh of triangles even where the function is flat and there is a large monochromatic surface. I think this approach is incredibly inefficient, and I hope that future versions will fix this issue. In the meantime I came up with a package to heal the problem. Basically, the triangles are iteratively collapsed forming larger polygons and deleting useless segments. The function is rather slow, as a lot of complex pattern substitutions must be performed. If someone is able to make it faster, it would be great. However, it works. I experienced savings in EPS size from a factor of 5 up to 50, depending on the complexity of the initial plot. If you need an EPS of reasonable size, this is a viable workaround. I hope someone will benefit of this. Michele Ceriotti Package source code follows, the syntax is simply cp=ContourPlot[ ..... ] scp=ClearCP[cp] ***************************************************************** (* ::Package:: *) BeginPackage[ClearCP`, {Utilities`FilterOptions`,StatusBar`}] Options[ClearCP]={MaxRecursion->10000, Debug->True}; ClearCP::usage = ClearCP[contourplot,options] recursively simplify the mesh used internally to draw the fillup of the contours, reducing greatly the size of exported EPS; Begin[Private`] Module[{ patjoin,rulejoin,ruleclean,w1,w2,z1,z2,p1,p2,k1,k2, zl,pl,i,j,pair,tpair, ol,nl,ip}, patjoin=({{p2_,___,p1_},{p1_,___,p2_}}|{{___,p1_,p2_,___}, {p1_,___,p2_}}| {{p2_,___,p1_},{___,p2_,p1_,___}}|{{___,p1_,p2_,___}, {___,p2_,p1_,___}}); rulejoin={{{w1___,p1_,p2_,w2___},{z1___,p2_,p1_,z2___}}- >{w1,p1,z2,z1,p2,w2},{{w1___,p1_,p2_,w2___},{p1_,z1___,p2_}}- >{w1,p1,z1,p2,w2}, {{p2_,w1___,p1_},{z1___,p2_,p1_,z2___}}->{w1,p1,z2,z1,p2}, {{p2_,w1___,p1_},{p1_,z1___,p2_}}->{w1,p1,z1,p2}}; ruleclean={{k1___,p1_,p2_,p1_,k2___}->{k1,p1,k2}, {p1_,k1___,p1_}->{k1,p1}, {p2_,p1_,k1___,p1_}->{k1,p1}, {p1_,k1___,p1_,p2_}->{k1,p1} }; purify[l_]:=( zl=l; pl={};Replace[If[Length[zl]==1,zl, i=1;j=2; pl=Reap[ While[i1 && MatchQ[pair,patjoin], Sow[(pair/.rulejoin)]; zl=Delete[zl,{{i},{j}}];i=1;j=1;]; j++;If[j>Length[zl],i++;j=i+1] ]]; pl=Flatten[pl[[2]],1]; Join[pl,zl]//.ruleclean],{{k1__},{k2__}}->Sequence[{k1},{k2}],1] ); ]; Module[ { i,j,k,,w1,w2,w3, cl, clr,clp, clsimp, pl, plr, plp, plsimp,ppos, pnp, lpnp }, SimplifyGC[gc_GraphicsComplex,OptionsPattern[ClearCP]]:=( cl=gc[[2,2]]; clr=Union[Flatten[Cases[cl,Line[k__]:>k,Infinity]]]; clp=gc[[1,clr]]; clr=Table[clr[[i]]->i,{i,1,Length[clr]}]; clsimp=GraphicsComplex[clp,cl/.clr]; (*first simplification of polygon, we take only the relevant points*) pl=gc[[2,1]]; plr=Union[Flatten[Cases[pl,Polygon[k_List,___]:>k,Infinity]]]; plp=gc[[1,plr]]; plr=Table[plr[[i]]->i,{i,1,Length[plr]}]; (*then we collapse polygons.*) (*first we get rid of graphicsgroups*) pl=pl//. {GraphicsGroup[{Polygon[w1_List,___],Polygon[w2_List,___],w3___}]- >GraphicsGroup[{Polygon[Join[w1,w2]],w3}], GraphicsGroup[{Polygon[w1_List,___]}]->Polygon[w1]}; (*then we simplify the vertex lists of the polygons*) ppos=Position[pl,_Polygon]; Do[ pnp=pl[[Sequence@@ppos[[i]]]][[1]]; If[OptionValue[Debug]==True, Print[Simplifying contour ,i, of ,Length[ppos],. N. segs: ,Length[pnp]]]; Do[ lpnp=Length[pnp]; pnp=purify[pnp]; If[Length[pnp]==lpnp,Break[]],{j,1,OptionValue[MaxRecursion]}]; pl[[Sequence@@ppos[[i]]]]=Polygon[pnp]; ,{i,1,Length[ppos]}]; (*final removal of extra points*) plsimp=GraphicsComplex[plp,pl/.plr]; {plsimp,clsimp} ); ]; Module[{h}, ClearCP[cp__Graphics,OptionsPattern[ClearCP]]:=( cp/.(h_GraphicsComplex:> SimplifyGC[h, MaxRecursion->OptionValue[MaxRecursion],Debug->OptionValue[Debug]]) ) ] End[]; EndPackage[]; === Subject: Re: a workaround for large EPS files from ContourPlot Hi Michele, > If you need an EPS of reasonable size, this is a viable workaround. I > hope someone will benefit of this. Mathematica code :) I just read over my original code and it doesn't make much sense even to me. I've taken a closer look at your package, although I haven't yet tested against the edge cases that fail with my own FixPolygons function. I really love the debug output you do. Gives a much better user interface for cases that take a long time. After removing the StatusBar` dependence in ClearCP, I get a warning when the package is loaded but it seems to work fine. Here are the numbers on my 2.2GHz Core 2 Duo comparing your function to mine: SetDirectory@NotebookDirectory[] << FixPolygons` << ClearCP` g = ContourPlot[a^2 + b^2, {a, -10, 10}, {b, -5, 5}]; Export[polygons.pdf, g]; Show[Import[polygons.pdf]] g2 = FixPolygons@ContourPlot[ x^2 + y^2, {x, -2, 2}, {y, -1, 1}] // Timing g3 = ClearCP[ContourPlot[ x^2 + y^2, {x, -2, 2}, {y, -1, 1}], Debug -> False] // Timing My function takes 15.8606s Yours takes 106.889s Obviously this is totally dependent on the contour plot originally chosen. In my opinion, both are too slow! If it's any consolation, my original code was orders of magnitude slower than yours :) It required a complete re-write to get it useable. (Pattern matching those HUGE lists of co=F6rdinates was the problem.) I'd be interested to hear from others who may have looked at similar things. I hope we can work together to improve our respective packages. Who knows; if we do a good enough job, we may have solved Wolfram's own problem for them and they can just stick our code inside ContourPlot :) (The licence of my package was specifically chosen to allow this rather unlikely outcome.) Will === Subject: Re: a workaround for large EPS files from ContourPlot I looked more in-depth at tour code. It is definitely cleaner than mine :-). I think I understood both why your code is faster, and why it fails sometimes. I still have to come out with a solution, merging the best of the two approaches. What you do is breaking the polygons into segments, then deleting all the segments which appear more than once, then build back a closed contour. What I do is working on the polygons, merging any *couple of polygons* having a side in common. Of course this makes the pattern matching more complicated, hence the slowdown. If you look at a complicated plot simplifyed by my algorithm, and plot it prepending an EdgeForm directive so as to show the boundaries of the polygons, you'll notice that shapes with holes are in fact closed polygon, as there are always creeps connecting the outside to the inner holes. In this way, arbitrarily complicated shapes can be simplified withoud losing the holes. I don't know how this can be done with yout break and rebuild approach. I'll think to it, and in any case I'll try to make my code look more similar to yours :D. After all, I don't care too much about speed: when I need graphics for publication I can very well wait one night for simplifying and exporting. The guys at Wolfram should have much easier life, as I think we are basically trying to undo a recursive refinement they are doing themselves. After all, they just could revert to Math05 code, which was doing a pretty good job! anyway, I'll work on this and send you updates. can I use your private address, or do you know ho I can add attachments to these posts? michele === Subject: Re: a workaround for large EPS files from ContourPlot amyway, I am glad to see that others this mesh thing a bad regression in math 6. these are the thinks keeping me away from closed-source software, too bad that os mathematica alternatives don't quite compare yet to the original. sorry for the statusbar dependece, it is a package of my own to show progress in the status bar. I changed the debug option to display progress as print statements, but I forgot the dependence in the package. given your numbers, I think your package is the way to go... the size of the EPS was the same? you also mention artefacts in some cases, can you provide some example to test against? I will download your package and see if I can help in solving those. === Subject: Re: a workaround for large EPS files from ContourPlot > Basically, the triangles are iteratively > collapsed forming larger polygons and deleting useless segments. Awesome! You might be happy or annoyed to find out that I've done exactly the same thing: I think you've gone about things much differently than me; my code is also slow, but I haven't compared yours to mine yet. Hopefully with the two different techniques we'll be able to improve things. (I've found odd bugs in my output for very finely-meshed contours, so yours might be better than mine from the very beginning.) I look forward to investigating, at any rate. The output from Mathematica is simply unsuitable for use in publication graphics. Will === Subject: Documentation - what is the big secret? Given Mathematica 6 has been out for several months, why is there still no information about how to write documentation for 6? I see plenty of references to this on the web, including some on this mailing list very recently. But there seems to be no official information. I'm puzzled where there is so little information. Lin === Subject: Re: Documentation - what is the big secret? the secret is called Wolfram Workbench 1.2 .. Jens > Given Mathematica 6 has been out for several months, why is there still no > information about how to write documentation for 6? I see plenty of > references to this on the web, including some on this mailing list very > recently. But there seems to be no official information. > > I'm puzzled where there is so little information. > > Lin > > === Subject: Re: Documentation - what is the big secret? On 10 Apr, 07:16, Jens-Peer Kuska the secret is called Wolfram Workbench 1.2 .. Jens But Workbench 1.2 is no excuse for not documentating the method to produce documentation (there is a certain irony here). It is about a year ago that 6.0 was released and to leave it a year and still not have the information publically available seems bizare to me. There are 1001 tools designed specifically for creating web pages, yet many people, myself included, prefer to use a text editor and write PHP and HTML. At least give us that choice. And of course, 1.2 is not out, there is not even a link to download a beta of 1.2. === Subject: Re: Documentation - what is the big secret? > Given Mathematica 6 has been out for several months, why is there still no > information about how to write documentation for 6? I see plenty of > references to this on the web, including some on this mailing list very > recently. But there seems to be no official information. > > I'm puzzled where there is so little information. > > the secret is called Wolfram Workbench 1.2 .. > > Jens And a Google search just now for Wolfram Workbench 1.2 brought up exactly _two_ (2) hits, both of which seemed to be complaints about Mathematica's documentation, and neither of which actually pointed to Wolfram Workbench 1.2. So I guess the secret is safe! === Subject: Re: Documentation - what is the big secret? On Apr 10, 2:16 am, Jens-Peer Kuska the secret is called Wolfram Workbench 1.2 .. or the coming A WorkLife FrameWork 3.0 which I am trying to find time to get out the door :-) (http://scientificarts.com/worklife/ ) --David Jens > Given Mathematica 6 has been out for several months, why is there still = no > information about how to write documentation for 6? I see plenty of > references to this on the web, including some on this mailing list very > recently. But there seems to be no official information. > I'm puzzled where there is so little information. > Lin === Subject: Re: What is @@@? The link presented earlier in this thread, starts off with: A.2.7 Operator Input Forms Characters that are not letters, letter-like forms or structural elements are treated by Mathematica as operators. Since letters are not numbers (i.e., numerals); the formal documentation on letter-like forms makes no mention of numbers; and I don't think that numbers are structural elements (didn't look that one up, actually), does this mean that Mathematica treats 3 as an operator, so that inputs like a 3 b or a3b are taken as some kind of operator connecting a and b, or operating on b? === Subject: Pattern problem: How to count from a long list of numbers all occurrences of 2 numbers next to each others? Hello; I think using Pattern is my weakest point in Mathematica. I have this list, say this: (it is all a list of integers, no real numbers). x = {1, 3, 3, 3, 2, 3, 3, 1, 3, 3} And I want to count how many say a 3 followed immediately by 3. So in the above list, there will be 4 such occurrences. And if I want to count how many 1 followed by a 3, there will be 2 such cases, etc... I tried Count[] but I do not know how to set the pattern for 3 followed by a comma followed by 3 or just 3 followed immediately by 3. I tried few things,