mm-859 === Subject: Re: No output or In[n] prompt appearing that is usual a problem of the MathLink connection to the Mathematica kernel. But I can't say more without more information. Jens > I have this weird problem. When I enter anything as simple as 2+2 and shift+Enter, there is no error or anything. It seems that the cell > is evaluated, but nothing shows up, not even the In[1] prompt. I do not > know what to check or where to look. All help is very much appreciated. === Subject: Re: Postscipt fonts in graphics have you a PostScript (*.pfb) and a metric file (*.afm) file and told the Mathematica PostScript interpreter where it can find the AmazingFont ?? If you using the correct font name, i.e. Graphics[Text[Hello World!, {0, 0}, TextStyle -> {FontFamily ->Wingdings}]] // Show you will see it in the FrontEnd but exporting the set to PostScript may cause problems. Your second question is no because the kernel knows nothing about the font metrics and can't determine the character width .. only the FrontEnd read the font metrics. Jens > I have two questions related to fonts in graphics. First, I have a number of > postscript fonts installed. They appear as one would expect in the > Mathematica menu under Format->Font, and also, if I use something like txt = StyleForm[Hello World, FontSize -> 36, FontFamily -> AmazingFont, > FontWeight -> Ordinary] > then the output appears correctly (i.e., it looks right, having the correct > font) as the display value for txt. Furthermore, if I simply embrace this in > Text[] such as Text[txt, {0,0}] the output shows Text[Hello World, {0,0}] again with the text of Hello World being displayed within the Notebook in > AmazingFont. But when I put that Text[] into a graphic, Show[Graphics[Text[txt,{0,0}]]] the font is now substituted with Helvetica. I have used Ctrl-E to examine > the postscript of the graphic, which confirms the Helvetica. What am I doing > wrong, and please, how can I correct it? The second question is a repeat of one which appeared many years ago on the > newsgroup (1992?) but received no reply at the time. It is this. Can one > interrogate the font metrics from within Mathematica so that one can > discover the dimensions of, say, the letter i in Helvetica font 14 point. > Mark R. Diamond > === Subject: Re: How to run/call a Mathematica Notebook from another Notebook the classic way is to mark *all* input in notebook A and B as initialization, when you save the notebooks, the FrontEnd will ask you to generate a *Package* from the initialization cells and you should say yes. Now you can call Get[A.m]; Get[B.m] in notebook C and you are done ... Jens > HI, How to run/call a Mathematica Notebook from another Notebook ? say, I want Notebook A and B to be executed and then Notebook C. How do > I run/call Notebooks A and B from C ? Prashanth > === Subject: Re: benchmark...why don't you send it back? {MachineName -> ifbpc14, System -> Microsoft Windows, BenchmarkName -> 2006, BenchmarkResult -> 0.643, TotalTime -> 144.462, Results -> {{Data Fitting, 4.687}, {Digits of Pi, 2.003}, {Discrete Fourier Transform, 4.736}, { Eigenvalues of a Matrix, 9.694}, {Elementary Functions, 7.721}, {Gamma Function, 1.922}, {Large Integer Multiplication, 2.383}, {Matrix Exponential, 3.564}, {Matrix Multiplication, 39.017}, {Matrix Transpose, 8.131}, {Numerical Integration, 4.897}, {Polynomial Expansion, 6.159}, {Random Number Sort, 4.516}, {Singular Value Decomposition, 19.186}, {Solving a Linear System, 25.846}}, Processor -> Athlon XP 2.4 GHz, Memory -> 1 G, Operating System -> Windows 2000, SP 4, $Slaves -> $Slaves} Ouch, mine seems a bit slow... === Subject: Re: Using Map with function that has options... Each of you basically gave me a slightly different way to do the same thing, and all those work perfectly! Giacomo === Subject: perplexed by blank sequence in pattern replacement I have been blithely using blank sequences in pattern matching for some time. In persuit of a bug in a package of mine, I was quite alarmed to find that I don't really understand how to use the blank sequence, as expressed in the following simplified example: In[1]:=Replace[a*b*c,Times[mysequence__]:>{mysequence}] Out[1]={a b c} I expected Out[1]={a,b,c}, from a naieve reading of the full form of a*b*c In[2]:=FullForm[a*b*c] Out[2]//FullForm=Times[a,b,c] Will someone PLEASE tell me why In[1] does not yield the results I expected? (I can readily use a work-around, what I am concerned with is a correct understanding of pattern matching). Blake Laing thesis slave University of Oklahoma === Subject: Re: ListContourPlot3D and colors > ListPlot3D, DensityPlot, ContourPlot, Raster and not for > ListContourPlot3D (because it's Graphics3D object, not Graphics). so? > any others sugestions? You are right. I have been too fast to reply. Sorry about that. There exist an option ContourStyle but I beleive that can change only the whole color. However, I think that the following thread will help you to define your own color function: ContourPlot3D and mapping, http://forums.wolfram.com/mathgroup/archive/2005/Mar/msg00310.html HTTTTH (Hope that this time this help :-) Jean-Marc === Subject: Re: ListContourPlot3D and colors > What about using the option ColorFunction? > http://documents.wolfram.com/mathematica/functions/ColorFunction maybe i'm wrong, but the ColorFunction is an option for Graphics Objects (such as Plot3D, ListPlot3D, DensityPlot, ContourPlot...) and not for Graphics3D Object (ListContourPlot3D). any suggestion how to apply it with ListContourPlot3D? === Subject: RE: ListContourPlot3D and colors I would be interested if you could send me hy all, i have got a 3D grid of complex numbers and i want to plot isodensity surface from it. you can say - no problem, and i agree with this. ListContourPlot3D[Abs[test3d]^2, Contours -> {10}] but what i realy want is to color this surface in that way, that color is depening of the argument of the complex value at particular point - to do this i can use ArcColor[] - but how i can use it in ListContoPlot3D ?? gawryl === Subject: Re: Re: MemberQ > ... > >> While we are talking about MemberQ, what about the following behavior? >> In[15]:=Range[0,1,1/10] >> MemberQ[Range[0,1,1/10],2/10] >> Out[15]=!({0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, >> 9/10, 1}) >> Out[16]=True >> Is the above result correct given that 2/10 doesn't appear in the list >> produced by the range statement?? >> Mathematica automagically cancels 2/10. >> On the other hand 0.5 can be >> represented exactly as a binary number, but >> In[29]:=MemberQ[Range[0,1,1/10],.5] >> Out[29]=False >> 1/2 has head Rational, 0.5 has got head _Real. So they must not be the same. >> LP >> > http://people.freenet.de/Peter_Berlin/Mathe/NMemberQ/NMemberQ.m > and > http://people.freenet.de/Peter_Berlin/Mathe/NMemberQ/NMemberQ.nb Feel free to add the function NMemberQ to your own collection of utilities. Peter topic and will probably be interested in your function NMemberQ[]. As others have pointed out the use of MemberQ to compare fixed precision (Real) and Rational numbers produces unpredictable (machine and version dependent) results. My main point was that any such comparison should produce an error or warning that the comparison is not reliable, rather than True or False. It still strikes me as strange that In[8]:=.7//FullForm Range[0.,1.,.1][[8]]//FullForm MemberQ[Range[0.,1.,.1],.7] Out[8]//FullForm=0.7` Out[9]//FullForm=0.7000000000000001` Out[10]=True returns True for two numbers that Ma tells me are different. Leigh === Subject: Re: Two strange problems with a notebook... I'm not actually sure of what I've done, but I managed to solve the problem converting to and from different display and/or output formats... Giacomo > Sometimes notebooks get subtly corrupted. If you can read and correct > box expressions, then you can use ctrl+shift+e on a cell and manually > correct the problem. Otherwise, (1) copy the affected cells as plain > text, (2) paste it into a text editor, (4) manually correct any > problems in the text editor, (5) delete the problem cell, (6) create a > new cell, (7) paste the text back in. If that doesn't work, manually > retype the cell. > I'm been working on a Mathematica book for a lot of time, modifying it > often and changing cell division and so on, and saving every time the > modified version to a new file (as for now, I'm at version 23). > > In the last versions, I'm experiencing two strange problems: > > 1) There is a line in a cell that is something like this: > > myPath= c:myFolder > > When I evaluate the cell, the message windows shows the error (I'm > reporting a cut->paste form the message window): > > The string '' cannot be displayed with ShowStringCharacters->False due > to an error in the string. > > Observing the first double quote, I can notice that the space around it > is unusual. Deleting a retyping it fixes the problem, but the next time > I open (obviously after fixing and saving) the nb the problem is still > there... > > 2) After some initialization cells, I have the main cell that does few > operations and then to perform two nested loops to calculate a > evaluate the cell as is (after evaluating all the other cells), > mathematica just skip to the end of the cell without actually exectuing > any of the instruction in the cell. > To fix this, it suffices that I modify the cell adding and deleting a > carachter at any position... then I can evaluate the cell correctly. > As before, fixing and saving doesn't solve the problem, that is there > the next time I opne the nb... > > I also tried to copy all the cells to a new nb, but with no success... > > Any Idea about all this? > > Giacomo > -- > http://chris.chiasson.name/ === Subject: Re: Re: using answer form reduce The Mathematica system is so large - I am sure they have to be very vigilant to maintain their current level of cohesiveness and cross-referencing. If you send an email to technical support about it, you can probably persuade them to add a cross reference to ToRules to make things better for future users. ToRules did the trick. I don't know why Reduce just does not include an link to the section where > they explain ToRules, because an example using Reduce is shown there, as i > saw after all the advice I got. Akil akil schreef in bericht > After using reduce I get the following two types of answers: > > answer == Real1 || answer == Real2 > or > answer == Real3 > , the type can change from one formula to another. > > I need the Reals, and put them all in a list. The problem is getting all > the > reals, without knowing which type I deal with, it should be able to be > done > fast. > > I tried making a list of the returned adres, and then using > Cases[list, _Real, Infinity] and using Select[list,NumericQ] but both do > not > give me the answer I require. > > How can I get the answer I require e.g. something like {Real1,Real2,Real3} http://chris.chiasson.name/ === Subject: Re: simple question In[17]:= patternMatchReverse[lst_List]:= Flatten[Append[lst,{}]//.{x_,y___,{z___}}:>{y,{x,z}}]; In[18]:= patternMatchReverse[Range[10]] Out[18]= {10,9,8,7,6,5,4,3,2,1} dkr === Subject: Re: simple question I know it is simple but I can't find something. In[1]:= lst=Range[10] > Out[1]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} In[2]:= Reverse[lst] > Out[2]={10, 9, 8, 7, 6, 5, 4, 3, 2, 1} How we can get the same result with pattern matching? My unsuccesful attempts include In[9]:=Range[10]/.{x_,y___}->{y,x} Out[9]={2, 3, 4, 5, 6, 7, 8, 9, 10, 1} In[10]:= > Range[10]//.{x_,y___}->{y,x} ReplaceRepeated::rrlim: Exiting after !({1, 2, 3, 4, 5, 6, 7, 8, > 9, > 10}) scanned !(65536) times. Out[10]= > {7, 8, 9, 10, 1, 2, 3, 4, 5, 6} Can I add something to previous rules to work? One way is: lst=Range[10]; lst//.{a___,x_,y_,b___}/;OrderedQ[{x,y}]:>{a,y,x,b} {10,9,8,7,6,5,4,3,2,1} but you should be aware that this is a very inefficient way to achieve this result. Andrzej Kozlowski === Subject: Re: simple question ((Range[10] /. lst_ :> { lst, {}}) //. {{a_, b__}, {c___}} :> {{b}, {a, c}}) // Flatten if you wish to remove the last Flatten[] you can try (((Range[10] /. lst_ :> {lst, {}}) //. {{a_, b__}, {c___}} :> {{b}, {a, c}})) /. {{a_}, {c__}} :> {a, c} Jens I know it is simple but I can't find something. In[1]:= lst=Range[10] > Out[1]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} In[2]:= Reverse[lst] > Out[2]={10, 9, 8, 7, 6, 5, 4, 3, 2, 1} How we can get the same result with pattern matching? My unsuccesful attempts include In[9]:=Range[10]/.{x_,y___}->{y,x} Out[9]={2, 3, 4, 5, 6, 7, 8, 9, 10, 1} In[10]:= > Range[10]//.{x_,y___}->{y,x} ReplaceRepeated::rrlim: Exiting after !({1, 2, 3, 4, 5, 6, 7, 8, > 9, > 10}) scanned !(65536) times. Out[10]= > {7, 8, 9, 10, 1, 2, 3, 4, 5, 6} Can I add something to previous rules to work? === Subject: Re: simple question Range[10]//.{s___,x_,y_,e___}/;y>x:> {s,y,x,e} {10,9,8,7,6,5,4,3,2,1} Bob Hanlon I know it is simple but I can't find something. In[1]:= lst=Range[10] > Out[1]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} In[2]:= Reverse[lst] > Out[2]={10, 9, 8, 7, 6, 5, 4, 3, 2, 1} How we can get the same result with pattern matching? My unsuccesful attempts include In[9]:=Range[10]/.{x_,y___}->{y,x} Out[9]={2, 3, 4, 5, 6, 7, 8, 9, 10, 1} In[10]:= > Range[10]//.{x_,y___}->{y,x} ReplaceRepeated::rrlim: Exiting after !({1, 2, 3, 4, 5, 6, 7, 8, > 9, > 10}) scanned !(65536) times. Out[10]= > {7, 8, 9, 10, 1, 2, 3, 4, 5, 6} Can I add something to previous rules to work? -- Bob Hanlon hanlonr@cox.net === Subject: Product over an arbitrary index. I have a function f(x,y) that I would like to compute the product over indices i,j where i goes from an arbitrary list {1,4,3} and j goes 1 to m. Is this possible in mathematica the function Product itself seems to only work over a continous sequence and it is not clear how I can use two set of indices. Additionally can I specify the product over an intersection or complement of a list?. K Frou === Subject: namespace collision [bug] As far as I know, a named pattern created inside the A`Private` context should not interfere with the definition of a symbol with the same name from B`. Will someone verify this as a bug? Will someone please provide a workaround? In[1]:= BeginPackage[A`]; funA::usage=; Begin[Private`]; funA[funB_]:=funB!; End[]; EndPackage[]; BeginPackage[B`]; Off[General::spell1]; funB::usage=; funC::usage=; Begin[Private`]; funB[_]:=you called funB; funC[_]:=you called funC; End[]; EndPackage[]; In[16]:= funB[5] Out[16]= funB[5] In[17]:= funC[5] Out[17]= you called funC In[18]:= $Version Out[18]= 5.2 for Microsoft Windows (June 20, 2005) -- http://chris.chiasson.name/ === Subject: Re: Solving integrals > sorry, this post apparently got mangled (åÓ aka ^2 wasn't recognized). > Here is the integral again: f := int ( cos(x) / sqrt[ A*A*sin(x/2)*sin(x/2) + (Bx)^2] dx, x=0..N*2*pi where N==(int)0..20, and A and B are small fixed values (around > 0.0001..0.05). Hello everybody, since I've been told by email a number of times: yes, I know this integral has a singularity. However, it represents a physical measure (so it must exist), and a simpler form (without the (Bx)^2 in the denominator) can be and has been solved via conversion to Elliptic Integrals. I'm just at a los as how to split this one up. Please help me a bit :) -- Jens Benecke === Subject: Re: Solving integrals > Hello everybody, >> I am trying to solve this integral: >> f :== int ( cos(x) / sqrt[A=C2=B2=C2=B7sin=C2=B2(x/2) + (Bx)=C2=B2 = >> ] dx, x==0..N*2*pi > sorry, this post apparently got mangled (Ó aka ^2 wasn't recognized). > Here is the integral again: f := int ( cos(x) / sqrt[ A*A*sin(x/2)*sin(x/2) + (Bx)^2] dx, x=0..N*2*pi >> where N==(int)0..20, and A and B are small fixed values (around >> 0.0001..0.05). ... > Hi Jens, sorry, your integral does not converge on the interval [0, something], because your integrand is c_(-1)*x^(-1) + c_(1)*x + ... near x=0: expr = Cos[x]/Sqrt[(a*Sin[x/2])^2 + (b*x)^2]; Normal[Simplify[Series[expr, {x, 0, 1}], a > 0 && b > 0]]//InputForm Out[2]//InputForm= 2/(Sqrt[a^2 + 4*b^2]*x) + ((-11*a^2 - 48*b^2)*x)/(12*(a^2 + 4*b^2)^(3/2)) Peter === Subject: distance function In the book of Gaylord et al. (1996) there is one exercise which asks (see page 113) Given a list of points in the plane, write a function that finds the set of all distances between the points. Although there is one solution, that solution makes use of the Table and Length commands. Is it a way to define the same function using Higher-Order functions like Outer, MapThread etc? === Subject: too many special linear matrices In an old group theory book they talk about special linear groups over the modulo of prime Integers: SL[2,P] The formula given is number of matrices in the group =If [n=2,6,Prime[n]*(Prime[n]^2-1)] (Essentual Student Algebra, Volume 5 ,Groups, T.S. /Blyth and E.F. Robertson,1986, Chapman and Hall,New York, page 14) So I tried to generate the elements of the group in Mathematica by a search program for Determinant one matrices. I get: 6,24,124,348 instead of what I should get: 6,12,60,168 Since the famous Klein group SL[2,7] is one of these , it would help to have a set of elements for that group! Mathematica code: Clear[M, k, s] M = {{l, m}, {n, o}}; k = 3 s = Union[Delete[Union[Flatten[Table[Flatten[Table[Table[If[Mod[Abs[Det[M]], k] - 1 == 0, M , {}], {l, 0,k - 1}], {m, 0, k - 1}], 1], {n, 0, k - 1}, {o, 0, k - 1}], 2]], 1]] Dimensions[s] === Subject: position lists have In: a = {1, 1, 2, 2, 1, 4} want {{1, 2, 5}, {3, 4}, {0}, {6}}; more effectively than just In: Position[a, #] & /@ Range[4] Out: {{{1}, {2}, {5}}, {{3}, {4}}, {}, {{6}}} Ideas? Known one-liners? Igor === Subject: FileNames subdirectory count discrepancy from the help: FileNames[forms, dirs, n] includes files that are in subdirectories up to n levels down. why does a file that is only one level down require n=2? In[1]:= FileNames[system.ini,{C:},1] Out[1]= {} In[2]:= FileNames[system.ini,{C:},2] Out[2]= {C:WINDOWSsystem.ini} In[3]:= $Version Out[3]= 5.2 for Microsoft Windows (June 20, 2005) -- http://chris.chiasson.name/ === Subject: Re: No output or In[n] prompt appearing >I have this weird problem. When I enter anything as simple as >2+2 >and shift+Enter, there is no error or anything. It seems that the >cell is evaluated, but nothing shows up, not even the In[1] prompt. The only way I know to get a result like you describe is when there is no Kernel running. Look at the menu item, Kernel->Default Kernel. Is None checked? If so, that would explain your result. This can be corrected by selecting Kernel->Default Kernel->Local which will cause the local kernel to be started on after the first shift+Enter. -- To reply via email subtract one hundred and four