Subject: RE: simple bug about Sum/Product function? Hello all, I would like to follow up my previous mail because anyone seems not to have an interest in this kind of Mathematica bug. The output of following expressions are self-explanatory: Sum[1,{i,10}] > 10 Sum[1,{1000000}] > 1000000 OK. Sum[1,{1000001}] > Sum[1,{1000001}] What? Sum[1,{i,1000001}] > 1000001 Yes, it's good. But, .... Sum[Print@1; Random[],{i,3}] 1 1 1 1.52163 Sum[Print@1; Random[],{i,1000001}] 1 Only one line printed!!! Something wrong. 236974. Product[1,{i,10}] Product[1,{i,1000000}] Product[1,{i,1000001}] > StandardForm[Product[1,{i,1000001}]] ???? These outputs are produced in Mathemtatica ver5.0 and ver5.01. YUKO === Subject: Re: Generating my own martix template With[{nr = 2}, lst = Table[RowBox[{[Placeholder], [Placeholder]}], {nr}]; CellPrint[Cell[GridBox[lst], Input, TraditionalForm]] ] Jens > GentleBeings > Not sure where to look I want to create a simple matrix input based on some > variable nr, the number of rows > I tried the following > CellPrint[ > Cell[ > GridBox[ > {Table[{[Placeholder], [Placeholder]}, {nr}]} > ], > Input, TraditionalForm > ] > ] > No way, I have RowBox and BoxData elements as well the core of the problem > is > the return from Table I think, > Suggestions? > kenf === Subject: RE: Euler rotation angles Sam, stated such, your problem is not well determined. Te for example vector1 = {1,-1,0}/Sqrt[2]; vector2 = {1,1,0}/Sqrt[2]; Then a rotation about the z-axis viz. {0,0,1} with angle Pi/2 will do, but also a rotation about the x-axis viz. {1,0,0} with angle +(-)Pi; and there is an infinity of rotations between those which also will do. Euler angles have been introduced to this world to describe rotations of rigid bodies (or, if you prefer, between orthonormal triples of vectors of same orientation). Such you have to specify two sets of at least two (say normalized) vectors, not collinear, ming up the same angle (in the plane between them), which are to be rotated to each other. In effect your problem spezfies only cannoneers angles: azimuth and elevation, not a triple like Euler's. -- Hartmut >-----Original Message----- === >Subject: Euler rotation angles >Can anyone help me with the following? I have two vectors, one rotated >with respect to the other, and I wish to find the Euler rotation >angles that connect the vectors. Can mathematica tell me what the >required angles are? >Sam === Subject: Re: NDSolve and time-delayed equations? > Can NDSolve be used to approximate the dynamics of continuous but > time-delayed equations? Here is an example of the standard continuous > logistic model used in ecology: > NDSolve[{n'[t] == 0.5*n[t]*(1 - n[t]/100), n[0] == 10}, n, {t, 0, 20}] > It does, of course, have an analytical solution. > A time-delayed version would me the derivative a function of two > values: n'[t,t-lag], but I can't figure out if a formulation like this > is possible. The key thing seems to be that while the derivative of n > is a simple function of two parameters, n itself is not. > Any suggestions, other than iterating as a discrete-time model with > very small time-steps? Check out the NDelayDSolve package by Allan Hayes. http://library.wolfram.com/infocenter/MathSource/725/ I've used it to solve delay equations. -- Curt Fischer === Subject: Re: NDSolve and time-delayed equations? Mathematica can not do this. You need a continuos output Runge-Kutta method that can construct an interpolation function of the solution while the solution is computed. With Mathematica 5 you can try to define your own method and implement the algorithm. And a Google search with should help you. Jens > Can NDSolve be used to approximate the dynamics of continuous but > time-delayed equations? Here is an example of the standard continuous > logistic model used in ecology: > NDSolve[{n'[t] == 0.5*n[t]*(1 - n[t]/100), n[0] == 10}, n, {t, 0, 20}] > It does, of course, have an analytical solution. > A time-delayed version would me the derivative a function of two > values: n'[t,t-lag], but I can't figure out if a formulation like this > is possible. The key thing seems to be that while the derivative of n > is a simple function of two parameters, n itself is not. > Any suggestions, other than iterating as a discrete-time model with > very small time-steps? > Gareth Russell > Columbia University === Subject: Converting to Standard LaTeX Although Mathematica can save notebooks in LaTeX format, the output is not standard LaTeX. As it uses special macros and fonts, the output is not compatible with LaTeX editors such as Scientific Workplace. (It also tends to be incompatible with coauthors.) A couple of years ago I modified the TeXConvert package for Mathematica 4.1 to generate standard LaTeX. The modified package works fine with 4.1, but unfortunately Wolfram has changed TeXSave in 5.0. Faced with repeating my hack with 5.0, I thought I would first check if anyone else has a LaTeX conversion package. Given that Mathematica now can generate XML, it should be possible to generate standard LaTeX via DocBook. Does anybody know of an XSTL to transform SymbolicXML to DocBook? The possibility of doing this transformation is described in: http://documents.wolfram.com/v5/Add-onsLinks/XMLCapabilities/WorkingWithNote bookML/ProcessingNotebookML/ConvertingToSymbolicXML.html but Wolfram does not have (or know of) such an XSLT file. Jonas === Subject: Re: Bug report for MathixExp applied to a matrix of more-than-machine-precision numbers. I am working in 5.0.0 myself. In fact, closing Mathematica, and pasting and evaluating the troublesome input resulted in the answer. So it seems like this was some glitch in my code then. Sorry for generating noise :) Sasha > Sasha, > It works in 5.0.0. > MatrixExp[mat] > {{0.629715926773139433128201219496689223889890000573, > 0.043272133628995532550007419267088674906992865756, > -0.775619348662370882970279342923966405559596934692}, > {-0.758122129833913698997991421827919657171707362198, > -0.601450503086404894412320958240615636790215514137}, > {0.169436382823573626402281120713124219469209126192, > 0.966757153507535933149169968280951493199873521568, > 0.191499133986736366584649123028828807021013925819}} > David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ > I am not sure on how to report a bug in Mathematica, so > I would write to the forum, knowing that the list is > modetated :) > In[1]:= > $Version > Out[1]= > In[2]:= > mat = {{0, > 0.6151525466966055419759862386321433310005256421644620580451761964922`49.296 > 724682967415, > -0.7254275036630691476762861174949573251764090399344597452533905218986`49.29 > 6724682967415}, > {-0.6151525466966055419759862386321433310005256421644620580451761964922`49.2 > 96724682967415, > 0, > -1.2037607176452254987349374498805075260847239397930119102841747928461`49.29 > 6724682967415}, > {0.7254275036630691476762861174949573251764090399344597452533905218986`49.29 > 6724682967415, > 1.2037607176452254987349374498805075260847239397930119102841747928461`49.296 > 724682967415, > 0}}; > In[3]:= > MatrixExp[mat] > generates Divide::indet, Divide::infy, [Infinity]::indet errors > before Windows reports a crash of MathKernel, and shuts it down > prompting to report the incident to Microsoft. > Trying to reduce the accuracy helps to get the final result > In[4]:= > MatrixExp[N[mat,5]] > Out[4]= > {{0.6297160719436076796`3.7756975065769325, > 0.0432721390753584633`2.6576010298827444, > -0.7756190709530262614`3.833969641768763}, > {-0.7581218549510174401`3.8696850920659425, > 0.25200848487286692`3.4668879073986285, > -0.6014503110645328147`3.693042910203886}, > {0.1694363428295855821`3.1961977983341225, > 0.9667568181352670783`3.8868215583540806, > 0.1914994511208260971`3.1806736750156337}} > Sasha -- Office: 6H Osmond Web: http://www.pavlyk.com ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ No trees were destroyed to send this mail, but a lot of electrons were terribly disturbed. === Subject: RE: Bug report for MathixExp applied to a matrix of more-than-machine-precision numbers. Sasha, It works in 5.0.0. MatrixExp[mat] {{0.629715926773139433128201219496689223889890000573, 0.043272133628995532550007419267088674906992865756, -0.775619348662370882970279342923966405559596934692}, {-0.758122129833913698997991421827919657171707362198, -0.601450503086404894412320958240615636790215514137}, {0.169436382823573626402281120713124219469209126192, 0.966757153507535933149169968280951493199873521568, 0.191499133986736366584649123028828807021013925819}} David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ I am not sure on how to report a bug in Mathematica, so I would write to the forum, knowing that the list is modetated :) In[1]:= $Version Out[1]= In[2]:= mat = {{0, 0.6151525466966055419759862386321433310005256421644620580451761964922`49.296 724682967415, -0.7254275036630691476762861174949573251764090399344597452533905218986`49.29 6724682967415}, {-0.6151525466966055419759862386321433310005256421644620580451761964922`49.2 96724682967415, 0, -1.2037607176452254987349374498805075260847239397930119102841747928461`49.29 6724682967415}, {0.7254275036630691476762861174949573251764090399344597452533905218986`49.29 6724682967415, 1.2037607176452254987349374498805075260847239397930119102841747928461`49.296 724682967415, 0}}; In[3]:= MatrixExp[mat] generates Divide::indet, Divide::infy, [Infinity]::indet errors before Windows reports a crash of MathKernel, and shuts it down prompting to report the incident to Microsoft. Trying to reduce the accuracy helps to get the final result In[4]:= MatrixExp[N[mat,5]] Out[4]= {{0.6297160719436076796`3.7756975065769325, 0.0432721390753584633`2.6576010298827444, -0.7756190709530262614`3.833969641768763}, {-0.7581218549510174401`3.8696850920659425, 0.25200848487286692`3.4668879073986285, -0.6014503110645328147`3.693042910203886}, {0.1694363428295855821`3.1961977983341225, 0.9667568181352670783`3.8868215583540806, 0.1914994511208260971`3.1806736750156337}} Sasha === Subject: Symbolic computation with vector fields and tensors I'm trying to set up a symbolic computation involving covariant and contravariant vector fields, and second-order covariant tensors. Mathematica is probably the best tool for this, but I'm having a hard time getting past square one. My first problem is in getting Mathematica to recognize the standard algebra of functions, whereby f + g denotes the function whose value at x is f[x] + g[x], etc. For example: In[1]= f[x_] := x+1; g[x_] := 3x; h = f + g; h[x] Out[4]= (f+g)[x] I know that I can always define h pointwise with the statement h[x_]:=f[x]+g[x], instead of the functional approach I use above, but I want to avoid this if possible. I'm also aware of Through, but I want Mathematica to perform these conversions automatically (e.g. in respond to Expand) without prompting from me. A trickier problem is illustrated by the following. L and M are two differential operators, and the map LD returns the differential operator obtained from the commutator (in the sense of composition) of its two arguments: In[5]:= L[f_] := A[1] Derivative[1, 0][f] + A[2] Derivative[0, 1][f]; M[f_] := B[1] Derivative[1, 0][f] + B[2] Derivative[0, 1][f]; LD[L_, M_][f_] := Composition[L, M][f] - Composition[M, L][f]; LD[L, M][f]//Expand//OutputForm In[5]:= L[f_] := A[1] Derivative[1, 0][f] + A[2] Derivative[0, 1][f]; M[f_] := B[1] Derivative[1, 0][f] + B[2] Derivative[0, 1][f]; LD[L_, M_][f_] := Composition[L, M][f] - Composition[M, L][f]; LD[L, M][f]//Expand//OutputForm Out[8]//OutputForm= (0,1) (1,0) (0,1) -(B[2] (A[2] f + A[1] f ) ) + (0,1) (1,0) (0,1) A[2] (B[2] f + B[1] f ) - (0,1) (1,0) (1,0) B[1] (A[2] f + A[1] f ) + (0,1) (1,0) (1,0) A[1] (B[2] f + B[1] f ) How can I get Mathematica to compute, for example, the first partial derivative of (0,1) (1,0) (A[2] f + A[1] f ) and do so automatically (e.g. in response to Expand). In fact, how can I get Mathematica to acknowledge the linearity of the derivative and Leibniz's rule? In[12]:= Expand[Derivative[1,0][a b + c d]]//OutputForm Out[12]//OutputForm= (1,0) (a b + c d) (Incidentally, I need Derivative, and not D, because I want to be able to specify partial derivatives in terms of sets of subscripts/superscripts.) I wish I had better technical documentation for Mathematica. The Mathematica Book is basically a large collection of examples, which, however clever or illuminating, is no substitute for formal APIs. The number of important details that the Mathematica Book, despite its heft, leaves unsaid is vast. As a result, I end up figuring out these details by sheer trial and error. (I know that Mr. Wolfram is very enthusiastic about computer experimentation, but I trust that he is not trying to promote it by ming the Mathematica's documentation cryptic.) In some cases, like those that lead to this post, my trial and error gets me nowhere. Is there anything better as far as technical reference material for Mathematica goes? jill P.S. To send me mail, splice out the string bit from my address. === Subject: Re: DSolve change in v5 -- undocumented error message Version 5.0.0.0 on Max OSX gives me Solve::ifun: Inverse functions are being used by Solve , so some solutions may not be found; use Reduce for complete solution information. More[Ellipsis] Out[2]= r t E k n0 {{n[t] -> ----------------}} r t k - n0 + E n0 I verified the solution. Tom Burton The following expression used to work in v4: DSolve[{n'[t] == r*n[t]*(1 - n[t]/k), n[0] == n0}, n[t], t] In v5, I get the message DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. ... === Subject: NMinimize and WebServices I am trying to use NMinimize to minimize remote function (all calculations are done on another computer). I can call this function from Mathematica (works fine), but when I am trying to use it from NMinimize, I am getting error messages Could not serialize: x Could not serialize: y ... TIA, vvt === Subject: Re: DSolve change in v5 -- undocumented error message Perhaps this will help you: DSolve[{n'[t] == r*n[t]*(1 - n[t]/k)}, n[t], t]; n[t] /. First@% % /. t -> 0 Reduce[n[0] == %, C[1]] %%% /. Rule @@ First@Cases[%, Equal[C[1], b_]] // FullSimplify or DSolve[{n'[t] == r*n[t]*(1 - n[t]/k)}, n[t], t]; n[t] /. First@% % /. t -> 0 Reduce[n[0] == %, C[1]] %%% /. Cases[%, a : Equal[C[1], _] :> Rule @@ a] // FullSimplify Bobby > The following expression used to work in v4: > DSolve[{n'[t] == r*n[t]*(1 - n[t]/k), n[0] == n0}, n[t], t] > In v5, I get the message > DSolve::bvfail: For some branches of the general solution, unable to > solve the conditions. > Clicking on the More link tes me to a page in the Help Browser with > Notes for this message have not yet been added. > Interestingly, the expression without initial conditions works just > like before > In[31]:= > DSolve[{n'[t] == r*n[t]*(1 - n[t]/k)}, n[t], t] > Out[31]= > !({{n[t] [Rule] ([ExponentialE]^(r t + k C[1]) k)/((-1) > + > [ExponentialE]^(r t + k C[1]))}}) > Does anyone know what is being done differently in v5. And more > practically, is there a way to recover v4's ability to get a solution. > Perhaps with assumptions? > Gareth Russell > Columbia University === Subject: Re: DSolve change in v5 -- undocumented error message eqn=n'[t]==r*n[t]*(1-n[t]/k); ans1 =DSolve[eqn,n[t],t][[1]]; Off[Solve::ifun]; ans2 = ans1 /. Solve[(n[0] /. (ans1 /. t->0))==n0, C[1]][[1]] // Simplify {n[t] -> (E^(r*t)*k*n0)/ (k + (-1 + E^(r*t))*n0)} ans2 /. t->0 {n[0] -> n0} eqn /.Join[ans2, D[ans2, t]//Simplify]// Simplify True << The following expression used to work in v4: DSolve[{n'[t] == r*n[t]*(1 - n[t]/k), n[0] == n0}, n[t], t] In v5, I get the message DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Clicking on the More link tes me to a page in the Help Browser with Notes for this message have not yet been added. Interestingly, the expression without initial conditions works just like before In[31]:= DSolve[{n'[t] == r*n[t]*(1 - n[t]/k)}, n[t], t] Out[31]= !({{n[t] [Rule] ([ExponentialE]^(r t + k C[1]) k)/((-1) + [ExponentialE]^(r t + k C[1]))}}) Does anyone know what is being done differently in v5. And more practically, is there a way to recover v4's ability to get a solution. Perhaps with assumptions? === Subject: Re: DSolve change in v5 -- undocumented error message solve it by your self ss = DSolve[{n'[t] == r*n[t]*(1 - n[t]/k)}, n[t], t] isol=Solve[(n[t] /. ss[[1]] /. t -> 0) == n0, C[1]]; ss[[1]] /. isol[[1]] // FullSimplify Jens > The following expression used to work in v4: > DSolve[{n'[t] == r*n[t]*(1 - n[t]/k), n[0] == n0}, n[t], t] > In v5, I get the message > DSolve::bvfail: For some branches of the general solution, unable to > solve the conditions. > Clicking on the More link tes me to a page in the Help Browser with > Notes for this message have not yet been added. > Interestingly, the expression without initial conditions works just > like before > In[31]:= > DSolve[{n'[t] == r*n[t]*(1 - n[t]/k)}, n[t], t] > Out[31]= > !({{n[t] [Rule] ([ExponentialE]^(r t + k C[1]) k)/((-1) > + > [ExponentialE]^(r t + k C[1]))}}) > Does anyone know what is being done differently in v5. And more > practically, is there a way to recover v4's ability to get a solution. > Perhaps with assumptions? > Gareth Russell > Columbia University === Subject: Re: Fourier Transform Spectroscopy w/ Mathematica G'day, Stuff like this maybe? I haven't related the number of points in x to the frequency or anything and I leave that up to you. Sampling schemes differ between disciplines and can mean very different things in reality. Some decaying sinusoid. fid1 = Table[Cos[20.0t] Exp[-0.10t], {t, 0.0, 10, 0.1}]; l1 = Length[fid1]; ListPlot[fid1, PlotJoined -> True] Here is the Fourier transform without zero-filling. ft1 = Fourier[fid1]; left = Te[Re[ft1], (l1 - 1)/2]; right = Te[Im[ft1], (l1 - 1)/2]; (*a phasing step *) p[a_, b_, im_, re_] := Table[Sin[a + im]] + Table[Cos[b + re]] ListPlot[p[0, 3.52, left, right], PlotRange -> All, PlotJoined -> True] Here is the Fourier transform with zero filling. I suppose you now need a window function having truncated the data somewhat. fid2 = PadRight[fid1, 256]; l2 = Length[fid2]; ListPlot[fid2, PlotJoined -> True, PlotRange -> All] ft2 = Fourier[fid2]; left1 = Te[Re[ft2], (l2)/2]; right1 = Te[Im[ft2], (l2)/2]; p[a_, b_, im_, re_] := Table[Sin[a + im]] + Table[Cos[b + re]] ListPlot[p[0, 3.14, left1, right1], PlotRange -> All, PlotJoined -> True, Frame -> True] Yas > Does anybody have an example notebook for transforming interferograms > into spectra via FFT? > Kevin === Subject: Re: Bug report for MathixExp applied to a matrix of more-than-machine-precision numbers. >I am not sure on how to report a bug in Mathematica, so I would >write to the forum, knowing that the list is modetated :) >In[1]:= $Version generates Divide::indet, Divide::infy, [Infinity]::indet >errors before Windows reports a crash of MathKernel, and shuts it >down prompting to report the incident to Microsoft. I just pasted the definition for mat from your email to Mathematica 5 running on Mac OS 10.3.2 and had no problems with MatrixExp. So, this doesn't seem to be a bug in Mathematica. Perhaps you should do as the message suggests and report the incident to Microsoft. -- === Subject: Decent Reference Guide? In spite of the the thousands of pages of documentation, Mathematica just doesn't seem to have a decent function reference manual. The worst offense is that function options list the default value but never ever list the other values the option accepts. This should be standard with any reference guide. Are there any decent docs out there, maybe in book form, that provides a list of functions including ALL the option choices in one place? === Subject: Re: Computing sets of equivalences My colleague Frans Martens observed that in the solution I posted some time ago, the use of symbols for the function values is superfluous. We thus arrive at the very short function equivalences[lst_] := Block[{f}, Scan[Set @@ f/@#& ,lst]; Reap[Sow[#, f[#]]& /@ Union@@lst][[2]]] solutions posted so far. But it is very sensible for extra structures in the data list. If we construct the test data in the following way (n is the number of points and k the number of classes): n=10000;k =10; (f[#]=Random[Integer, {1,k}])& /@ Range[n]; data = Flatten[Partition[#,2,1]& /@ Reap[Sow[#,f[#]]& /@ Range[n]][[2]],1]; then my function becomes terribly slow. But when we place the pairs in a random order: n=10000;k =10; (f[#]=Random[Integer, {1,k}])& /@ Range[n]; data = Flatten[Partition[#,2,1]& /@ Reap[Sow[#,f[#]]& /@ Range[n]][[2]],1]; data = data[[Ordering[Table[Random[], { Length[data]}]]]]; the function becomes very fast. I used these data for the testing for various values of n and k. I think it is also amazing that the Sow-Reap construction is so fast. Fred Simons Eindhoven University of Technology === Subject: Re: simple bug about Sum/Product function? In version 5 for Windows, it works for me also up to 1,000,000. It returns unevaluated for values over that. Sum[2, {1000000}] 2000000 - - Sum[2, {1000001}] Sum[2, {1000001}] - - However, if I use NSum, I get a error no matter what the value. NSum[2, {100}] NSum::itraw : Raw object 100 cannot be used as an iteration. - - As others have mentioned, it works ok if the first item is not a Raw Object, but an iteration variable. Sum[2, {i, 1000001}] 2000002 Dana P.S. I have no idea why no error here though. Remove[junk] - - Sum[2, {junk}] Sum[2, {junk}] - - NSum[2, {junk}] ComplexInfinity > Hello there, > Try the following simple expressions in Mathematica(ver5) > Sum[1, {1000001}] > Product[1, {1000001}] > There are no problems in ver 4.2. > Yuko MATSUDA === Subject: Keeping Examples Open in Help Browser MathGroup: When using Help Browser, it is always a slowdown, and sometimes an irritant, to always have to click on the triangle which prefixes each Examples section. For example, when returning to a previous help page which has had its Examples opened, they are closed again upon returning to them from another page, and must be clicked to re-open. Does anyone know a way to tell Help Browser to always open the Examples section of each page it displays, and then to keep Examples open? === Subject: Re: Creating my own cell Ken: This simple library function for creating a m-by-n matrix may be of help to you. When you use it in a notebook, all you type, for example, is mx[5,8] to create a 5x8 matrix of placeholders for the user to instantiate. (* Display an mxn matrix initialized with placeholders. The global values of m,n are not changed. *) mx[m_,n_] := Table[[Placeholder], {m}, {n}] // MatrixForm === Subject: Re: Creating my own cell Clear[meIR] SetAttributes[meIR, HoldAll] meIR[gar_, numberOfRows_] := Module[{qar, lst}, lst = Prepend[Table[{[Placeholder], [Placeholder]}, {numberOfRows - 1}], {[SelectionPlaceholder], [Placeholder]}]; CellPrint[ Cell[BoxData[ RowBox[{ToString[Unevaluated[gar]], =, RowBox[{(, GridBox[lst], )}]}]], Input]] ] Jens > GentleBeings > Trying to create a cell with a variable assigned to the matrix > I have tried this but no assignemnt (Also lookscumbersome) > meIR[numberOfRows_] := > Module[{qar}, > StylePrint[Set[ qar, > MatrixForm[ > Partition[ > Flatten[ > Insert[ > Table[{ [Placeholder] , [Placeholder] }, { > numberOfRows - 1}], > {[SelectionPlaceholder], [Placeholder]}, 1 > ] > ], 2 > ] > ]], Input > ] > ] > I want to pass in the number of rows and me the 2D matrix for > a user to fill in > I want to position the current selection to the first placeholder. > Any suggestions are desperately needed, this is just over my ability. > kenf === Subject: Shared variables between notebooks? I'm using Mathematica 4.1 for Linux and am noticing some odd behavior. 1) It appears that when I have multiple notebooks open, the variables and functions are 'shared'.. ie they have global scope. Can I change this? 2) Is there a #include type command in mathematica? I'd like to be able to have a notebook with common functions I use, and include it in other notebooks where use the functions. As you can tell I'm a C/C++ programmer. Has anyone on the list used the Mathematica->C++ code generator? Opinions? Neal Richter === Subject: Re: Playing multiple sounds in sequence Erich, I can not understand what you refer to as 'this' in the last sentence. I assume you would like to play a sound which is a mixture of 13 monochromatic chanes. Then, you use Play[ Evaluate@Flatten@Table[ Sin[2*Pi*440*2^{i/12}*t], {i, 0, 12} ], {t, 0, 1} ] Sasha > Entering > Table[Play[Sin[2*Pi*440*2^(i/12)*t], {t, 0, 1}], {i, 0, 12}] > plays a chromatic scale, > but some things are somewhat inconvenient. > 13 graphics pop up and use a lot of screen estate. > Also, Mathematica starts playing the tones immediately > when they are rendered. Since renedring is faster than playing, > the first tone is cut off and the second tone starts playing too early. > I would like collapsed output, at most one graph, > and preferrably only in a ery small size so i till get the clickable > sound symbol in the outline region so I can play the whole scale > without rerendering. > How can this be done? === Subject: Playing multiple sounds in sequence Entering Table[Play[Sin[2*Pi*440*2^(i/12)*t], {t, 0, 1}], {i, 0, 12}] plays a chromatic scale, but some things are somewhat inconvenient. 13 graphics pop up and use a lot of screen estate. Also, Mathematica starts playing the tones immediately when they are rendered. Since renedring is faster than playing, the first tone is cut off and the second tone starts playing too early. I would like collapsed output, at most one graph, and preferrably only in a ery small size so i till get the clickable sound symbol in the outline region so I can play the whole scale without rerendering. How can this be done? === Subject: RE: Re: Creating my own cell The following might be slightly better because it creates an Input cell that you can then edit. mx[m_, n_] := StylePrint[ Table[[Placeholder], {m}, {n}] // MatrixForm, Input] David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Ken: This simple library function for creating a m-by-n matrix may be of help to you. When you use it in a notebook, all you type, for example, is mx[5,8] to create a 5x8 matrix of placeholders for the user to instantiate. (* Display an mxn matrix initialized with placeholders. The global values of m,n are not changed. *) mx[m_,n_] := Table[[Placeholder], {m}, {n}] // MatrixForm === Subject: RE: Shared variables between notebooks? Neal, Since the kernel runs independently of the front end, it doesn't distinguish between different notebooks that are open at the same time. If you want to localize variables you can use a Module, With or Block statement. But you can't very well do that for a whole notebook, if you also want notebook structure such as Sections and multiple cells. To me common functions available to many notebooks, write a package. Writing packages is pretty simple but unfortunately there doesn't seem to be a single place that lays out the simple procedure for doing so. The best book on the topic is Programming in Mathematica: Third Edition by Roman Maeder but he doesn't have the simple procedure. Here is a sample toy package. Copy it and paste it into a fresh notebook. Notebook[{ Cell[CellGroupData[{ Cell[A Toy Package, Title], Cell[BoxData[ (BeginPackage[])], Input], Cell[BoxData[ ((Algebra`ToyPackage::usage = ;))], Input], Cell[BoxData[ ((SquareTheQuantity::usage = ;))], Input], Cell[BoxData[ (Begin[<`Private`>])], Input], Cell[BoxData[ (SquareTheQuantity[x_] := x^2)], Input], Cell[BoxData[ (End[])], Input], Cell[BoxData[ ((Protect[Evaluate[$Context <> <*>]];))], Input], Cell[BoxData[ (EndPackage[])], Input] }, Open ]] }, FrontEndVersion->5.0 for Microsoft Windows, ScreenRectangle->{{0, 1280}, {0, 941}}, WindowSize->{494, 740}, WindowMargins->{{81, Automatic}, {Automatic, 61}} ] 1) Me all the cells initialization cells. (I uninitialized them so you could go through the following process.) 2) Give the notebook the name ToyPackage.nb and save it in the AddOns/ExtraPackages/Algebra folder using SaveAs. (You may have to first create the Algebra Folder there. You could also save it in Applications/Algebra.) Notice that the BeginPackage statement gives the name of the package as Algebra`ToyPackage` reflecting the folder location. 3) The first time you save the notebook Mathematica will ask if you want to create an AutoSave Package. Answer yes. Then when the save is done, Mathematica will also create a ToyPackage.m package file. Everytime you edit the .nb file and save, Mathematica will automatically update the .m package file. To load the package into a notebook use the following statement at the beginning of the notebook... Needs[Algebra`ToyPackage`] That is basically it, but I'm sure other people will have a number of glosses to add. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ I'm using Mathematica 4.1 for Linux and am noticing some odd behavior. 1) It appears that when I have multiple notebooks open, the variables and functions are 'shared'.. ie they have global scope. Can I change this? 2) Is there a #include type command in mathematica? I'd like to be able to have a notebook with common functions I use, and include it in other notebooks where use the functions. As you can tell I'm a C/C++ programmer. Has anyone on the list used the Mathematica->C++ code generator? Opinions? Neal Richter === Subject: Differences in Random Numbers My understanding is that the built-in Mathematica command Random[ ] will produce a uniformly distributed pseudo-random number in the range 0 to 1. Based on my read of the documentation, this should be equivalent to calling Random[UniformDistribution[0,1]] (after loading Statistics`ContinuousDistributions of course)). Is this correct? I ask this question because of some unusual results I obtained while testing another (fairly complex) program that mes use of uniform random variates. I initially used the Random[UniformDistribution[0,1]] function call and obtained final results of the complex program that were quire a bit different from the test case that I have been using to verify my code. When I switched to the simple Random[ ] call, my results looked much better. Sorry if this seems vague, but I found this behavior somewhat anomalous and wanted to be sure I understood the differences, in any, between these two methods of generating random variates. - === Subject: Substitution How to me the variable Subscript[p,D] wholly unrelated to variable p? For instance, the notebook... p = a x + b x; p + Subscript[p,D] ...produces a x + b x + Subscript[ax+bx,D]. But I want p + Subscript[p,D] and thereafter, to freely use Subscript[p,D] without it being affected by the p-value. Symbolizing Subscript[p,D] didn't work. Bruce === Subject: Re: Shared variables between notebooks? >1) It appears that when I have multiple notebooks open, the >variables and functions are 'shared'.. ie they have global scope. >Can I change this? Yes, use the BeginPackage/EndPackage for each notebook. Then, the variables in that notebook will be in a separate context and will distinct from variables in the global context. Note, you will have to deal with shadowing issues if the same name is used in more than one context. >2) Is there a #include type command in mathematica? I'd like to >be able to have a notebook with common functions I use, and include >it in other notebooks where use the functions. Save the common functions in a .m file. Then, that file can be loaded at the beginning of a session using Get. This should give you equivalent functionality to the #include construct of C/C++. -- === Subject: ND Solver problem Hello Steve, I have been using a program i have written which I am using for a project. The program differentiates some equations to obtain second order differential equations (ODEs). These equations are then integrated numerically using NDsolver to get the results that I want. The program below works fine. However when I increase the variables in my initial equations and then differentiate them the resultant ODEs are very large. When I integrate these using NDsolve an error appears saying that there is a singularity in my equations. I was wondering is there a limit to how large my ODEs can be without errors occurring from the NDsolver. I am very eager to know if there is. My initial program came up with the same error but then I simplified the equations and it worked fine. The equations in my other program are still quite large after I simplify them however. I would be very grateful if you could please give me some feedback on this matter. The first program below is my initial program the other after it is my second program that has more variables. Joseph. Lopez first Program: Clear[eqn1,eqn2,eqn3,MEarth,G,e,Rp,R0,[Theta]start,[Mu],a,p,VR,R0,orbvel , TOrbit,time,ans,R1,M]; !((cosB = ((R1^2 + R1^2 - R1^2))/((2*R1*R1));)[IndentingNewLine] (Mt = M + M + M;)[IndentingNewLine] (x = ((M*R1 + M*R1*cosB))/Mt;)[IndentingNewLine] (y = ((M*@((R1^2 - ((R1*cosB))^2))))/Mt;)[IndentingNewLine] (u = @((R1^2 - ((R1*cosB))^2)) - y;)[IndentingNewLine] (C1 = @(((R1*cosB - x))^2 + ((u))^2);)[IndentingNewLine] (C2 = @(y^2 + x^2);)[IndentingNewLine] (C3 = @(((R1 - x))^2 + y^2);)) [Phi]2=ArcCos[(C2^2+C1^2-R1^2)/(2*C2*C1)]; [Phi]3=ArcCos[(C2^2+C3^2-R1^2)/(2*C2*C3)]; x1=R[t]*Cos[[Theta][t]]+C1*Cos[[Phi]1[t]+[Theta][t]]; y1=R[t]*Sin[[Theta][t]]+C1*Sin[[Phi]1[t]+[Theta][t]]; x2=R[t]*Cos[[Theta][t]]+C2*Cos[[Phi]2+[Phi]1[t]+[Theta][t]]; y2=R[t]*Sin[[Theta][t]]+C2*Sin[[Phi]2+[Phi]1[t]+[Theta][t]]; x3=R[t]*Cos[[Theta][t]]+C3*Cos[[Phi]3+[Phi]2+[Phi]1[t]+[Theta][t]] ; y3=R[t]*Sin[[Theta][t]]+C3*Sin[[Phi]3+[Phi]2+[Phi]1[t]+[Theta][t]] ; !((([IndentingNewLine])((Ro1 = @(x1^2 + y1^2);) [IndentingNewLine] (Ro2 = @(x2^2 + y2^2);)[IndentingNewLine] (Ro3 = @(x3^2 + y3^2);)))) !((x1vel = [PartialD]_t x1;)[IndentingNewLine] (y1vel = [PartialD]_t y1;)[IndentingNewLine] (x2vel = [PartialD]_t x2;)[IndentingNewLine] (y2vel = [PartialD]_t y2;)[IndentingNewLine] (x3vel = [PartialD]_t x3;)[IndentingNewLine] (y3vel = [PartialD]_t y3;)) T=1/2*M*(x1vel^2+y1vel^2)+1/2*M*(x2vel^2+y2vel^2)+1/2*M*(x3vel^2+y3vel^2); !(* RowBox[{ RowBox[{ RowBox[{T, =, RowBox[{(, RowBox[{(1/2), , M, , RowBox[{(, RowBox[{ RowBox[{3, , SuperscriptBox[ RowBox[{ SuperscriptBox[R, [Prime], MultilineFunction->None], [, t, ]}], 2]}], +, RowBox[{((R1^2 + 3 R[t]^2)), , SuperscriptBox[ RowBox[{ SuperscriptBox[[Theta], [Prime], MultilineFunction->None], [, t, ]}], 2]}], +, RowBox[{2, , (R1^2), , RowBox[{ SuperscriptBox[[Theta], [Prime], MultilineFunction->None], [, t, ]}], , RowBox[{ SuperscriptBox[[Phi]1, [Prime], MultilineFunction->None], [, t, ]}]}], +, RowBox[{(R1^2), , SuperscriptBox[ RowBox[{ SuperscriptBox[[Phi]1, [Prime], MultilineFunction->None], [, t, ]}], 2]}]}], )}]}], )}]}], ;}], [IndentingNewLine]}]) V=-(G*MEarth)*(M/(Ro1)+M/(Ro2)+M/(Ro3)); !(((V = (-G) MEarth ((M ((1/@(R1^2/3 + (2 @R1^2 Cos[ [Phi]1[t]] R[t])/@3 + R[t]^2) + 1/(([Sqrt]((R1^2/3 + R[t]^2 - 1/3 @R1^2 R[ t] ((@3 Cos[[Phi]1[t]] - 3 Sin[[Phi]1[t]])))))) + 1/(([Sqrt]((R1^2/3 + R[t]^2 - 1/3 @R1^2 R[ t] ((@3 Cos[[Phi]1[t]] + 3 Sin[[Phi]1[ t]]))))))))));)( [IndentingNewLine]) )) Lagrange=T-V; !((eqn1 = [PartialD]_t (([PartialD]_(([Theta]')[t])Lagrange)) - [PartialD]_([Theta][t])Lagrange;)) !((eqn2 = [PartialD]_t (([PartialD]_((R')[t])Lagrange)) - [PartialD]_(R[t])Lagrange;)) !((eqn3 = [PartialD]_t (([PartialD]_(([Phi]1')[t])Lagrange)) - [PartialD]_([Phi]1[t])Lagrange;)) !(({MEarth, G, e, Rp, [Theta]start, R1, M} = {5.97*10^24, 6.672*10^(((-11))), 0, 7000*10^3, 0, 1*10^3, 100};)[IndentingNewLine] ([Mu] = G*MEarth;)[IndentingNewLine] (a = Rp*((1 + e))/((1 - e^2));)[IndentingNewLine] (p = Rp*((1 + e));)[IndentingNewLine] (VR = @([Mu]/p)*e*Sin[[Theta]start];)[IndentingNewLine] (R0 = p/((1 + e*Cos[[Theta]start]));)[IndentingNewLine] (orbvel = @([Mu]/p)*((1 + e*Cos[[Theta]start]))/ R0;)[IndentingNewLine] (TOrbit = 2*[Pi]/@([Mu]/((a^3)));)[IndentingNewLine] (time = 16*TOrbit;)) ans=NDSolve[{eqn1[Equal]0,eqn2[Equal]0, eqn3[Equal]0,[Theta]'[0][Equal] orbvel,[Theta][0][Equal][Theta]start,R'[0][Equal]0, R[0][Equal]R0,[Phi]1'[0][Equal]0,[Phi]1[0][Equal][Pi]/ 4},{[Theta],R,[Phi]1},{t,0,time},MaxSteps[Rule]Infinity] Plot[Evaluate[[Theta][t]/.ans],{t,0,time}, AxesLabel[Rule]{Time[sec],[Theta][t]},ImageSize[Rule]350, PlotRange[Rule]All] Plot[Evaluate[[Phi]1'[t]/.ans],{t,0,time}, AxesLabel[Rule]{Time[sec],[Phi]'[t]},ImageSize[Rule]350, PlotRange[Rule]All]Plot[Evaluate[[Phi]1[t]/.ans],{t,0,time}, AxesLabel[Rule]{Time[sec],[Phi][t]},ImageSize[Rule]350, PlotRange[Rule]All]Plot[Evaluate[R[t]/.ans],{t,0,time}, AxesLabel[Rule]{Time[sec],R[t]},ImageSize[Rule]350, PlotRange[Rule]All] Second Program: Clear[eqn1,eqn2,eqn3,MEarth,G,e,Rp,[Theta]start,[Mu],a,p,VR,R0,orbvel, TOrbit,time,ans,R1,R2,R3,M,Mt]; !((cosB = ((R1^2 + R2^2 - R3^2))/((2*R1*R2));)n (Mt = M + M + M;)n (x = ((M*R2 + M*R1*cosB))/Mt;)n (y = ((M*@((R1^2 - ((R1*cosB))^2))))/Mt;)n (u = @((R1^2 - ((R1*cosB))^2)) - y;)n (C1 = @(((R1*cosB - x))^2 + ((u))^2);)n (C2 = @(y^2 + x^2);)n (C3 = @(((R2 - x))^2 + y^2);)) [Phi]2=ArcCos[(C2^2+C1^2-R1^2)/(2*C2*C1)]; [Phi]3=ArcCos[(C2^2+C3^2-R2^2)/(2*C2*C3)]; x1=R[t]*Cos[[Theta][t]]+C1*Cos[[Phi]1[t]+[Theta][t]]; y1=R[t]*Sin[[Theta][t]]+C1*Sin[[Phi]1[t]+[Theta][t]]; x2=R[t]*Cos[[Theta][t]]+C2*Cos[[Phi]2+[Phi]1[t]+[Theta][t]]; y2=R[t]*Sin[[Theta][t]]+C2*Sin[[Phi]2+[Phi]1[t]+[Theta][t]]; x3=R[t]*Cos[[Theta][t]]+C3*Cos[[Phi]3+[Phi]2+[Phi]1[t]+[Theta][t]] ; y3=R[t]*Sin[[Theta][t]]+C3*Sin[[Phi]3+[Phi]2+[Phi]1[t]+[Theta][t]] ; !((Ro1 = @(x1^2 + y1^2);)[IndentingNewLine] (Ro2 = @(x2^2 + y2^2);)[IndentingNewLine] (Ro3 = @(x3^2 + y3^2);)) !((x1vel = [PartialD]_t x1;)[IndentingNewLine] (y1vel = [PartialD]_t y1;)[IndentingNewLine] (x2vel = [PartialD]_t x2;)[IndentingNewLine] (y2vel = [PartialD]_t y2;)[IndentingNewLine] (x3vel = [PartialD]_t x3;)[IndentingNewLine] (y3vel = [PartialD]_t y3;)) T=1/2*M*(x1vel^2+y1vel^2)+1/2*M*(x2vel^2+y2vel^2)+1/2*M*(x3vel^2+y3vel^2); V=-(G*MEarth)*(M/(Ro1)+M/(Ro2)+M/(Ro3)); Lagrange=T-V; !((eqn1 = [PartialD]_t (([PartialD]_(([Theta]')[t])Lagrange)) - [PartialD]_([Theta][t])Lagrange;)) !((eqn2 = [PartialD]_t (([PartialD]_((R')[t])Lagrange)) - [PartialD]_(R[t])Lagrange;)) !((eqn3 = [PartialD]_t (([PartialD]_(([Phi]1')[t])Lagrange)) - [PartialD]_([Phi]1[t])Lagrange;)) !(({MEarth, G, e, Rp, [Theta]start, R1, R2, R3, M} = {5.97*10^24, 6.672*10^(((-11))), 0.2, 7000*10^3, 0, 100, 100, 100, 100};)[IndentingNewLine] ([Mu] = G*MEarth;)[IndentingNewLine] (a = Rp*((1 + e))/((1 - e^2));)[IndentingNewLine] (p = Rp*((1 + e));)[IndentingNewLine] (VR = @([Mu]/p)*e*Sin[[Theta]start];)[IndentingNewLine] (R0 = p/((1 + e*Cos[[Theta]start]));)[IndentingNewLine] (orbvel = @([Mu]/p)*((1 + e*Cos[[Theta]start]))/ R0;)[IndentingNewLine] (TOrbit = 2*[Pi]/@([Mu]/((a^3)));)[IndentingNewLine] (time = 4*TOrbit;)) ans=NDSolve[{eqn1[Equal]0,eqn2[Equal]0, eqn3[Equal]0,[Theta]'[0][Equal] orbvel,[Theta][0][Equal][Theta]start,R'[0][Equal]0, R[0][Equal]R0,[Phi]1'[0][Equal]0,[Phi]1[0][Equal]0},{[Theta], R,[Phi]1},{t,0,time},MaxSteps[Rule]Infinity] Plot[Evaluate[[Theta][t]/.ans],{t,0,time}, AxesLabel[Rule]{Time[sec],[Phi][t]},ImageSize[Rule]350, PlotRange[Rule]All] _________________________________________________________________ Sign-up for a FREE BT Broadband connection today! http://www.msn.co.uk/specials/btbroadband === Subject: ReplaceList -- Unexpected Answer MathGroup: In The Mathematica 5 Book, Section 2.3.3 Naming Pieces of Patterns, we find the following pattern matching exercise ... Now both arguments of f are constrained to be the same, and only the first case matches. In[5]:= {f[h[4], h[4]], f[h[4], h[5]]} /. f[x:h[_], x_] -> r[x] Out[5]= {r[h[4]],f[h[4],h[5]]} Now, let's use ReplaceList to get more insight into this matching process ... In[6]:= ReplaceList[ {f[h[4],h[4]],f[h[4],h[5]]},f[x:h[_],x_] -> r[x] ] Out[6]= {} I do not understand why ReplaceList returns {} instead of { r[h[4]] }. === Subject: Re: Mathematica to Word The other possibility if all you have is text is to go to word via acrobat (if you have acrobat reader). Print to PDF then convert the PDF to RTF. In word you can convert the RTF to *.doc. This only works for plain text. If you have inline equations or other stuff they will not be transferred to the RTF file. Mike > processing. When you output text as HTML and read that into Word, it > comes in as a series of pictures. Another answer, not posted here, was > to convert the selected output to text (alt-7) and then do Cell Convert To > Input form. This does it nicely, with asterisks > separating the fields in each line. Word macros can do the rest. (I > think that subscripts and other nonstandard characters must be removed > from the Mathematica output to do this.) > Steve Gray >> save it as HTML and read the HTML into Word. >> Jens > > This must have been asked 1000 times, but I haven't seen the > answer. I have a large but ordinary-looking file of Mathematica text output > on > the screen with no special characters, unusual formatting, lines, or > colors, Just plain text. I want to get this data, just as it looks, > into MS Word for further processing. When I convert the Mathematica output > to > text or do anything else I can think of, I get a very complex format > in Word, which would te a complicated macro to undo. There must be a > simple way to get real, plain text with no mysterious codes, etc., in > the Mathematica output file. > > Steve Gray === Subject: Re: Mathematica to Word other than Linux. If this is the case and you need a solution that involves not having to get Microsoft Development Kits to write your own C++ program that can read the binary format that Word is saved as, then do the following. If you don't have a vesion of OpenOffice, then get the free download of OpenOffice 1.1.0 from http://download.openoffice.org/1.1.0/index.html I don't know if there is a Czech version. In any case this is free. ~74 MB. After you download and install OpenOffice on Linux. Run the OpenOffice Writer. 1. Open your Word Documents and save as the OpenOffice .sxw file format. 2. from command line unzip filenamehere.sxw (I used unzip ....) 3. There should be an extracted or decompressed file called content.xml (This is the file you need) 4. Run Mathematica and execute the following code (except please change Import[C:Documents and SettingshansDesktopdoccontent.xml, ... To the appropriate file path and format for your OS. I did this in Windows because my complementary copy of Mathematica for Linux has expired) XMLNote[XMLElement[tag_, attributes_, data_], m_Integer] := Cell[CellGroupData[{ Cell[TextData[ StyleBox[tag, FontFamily -> Swiss, FontWeight -> Bold, FontSize -> 15]]], Sequence @@ (XMLNote[#1, m] &) /@ attributes, Sequence @@ (XMLNote[#1, m + 30] &) /@ data }, Open], CellMargins -> {{m, Inherited}, {Inherited, Inherited}}] XMLNote[{an_String, a_String} -> v_String, m_Integer] := Cell[TextData[ StyleBox[an, FontColor -> Hue[0.6]], , StyleBox[a, FontWeight -> Bold], = , StyleBox[v, Background -> GrayLevel[0.8]]], CellMargins -> {{m + 5, Inherited}, {Inherited, Inherited}}] XMLNote[a_String -> v_String, m_Integer] := Cell[TextData[ StyleBox[a, FontWeight -> Bold], = , StyleBox[v, Background -> GrayLevel[0.8]]], CellMargins -> {{m + 5, Inherited}, {Inherited, Inherited}}] XMLNote[s_String, m_Integer] := Cell[s, Background -> GrayLevel[0.9], CellMargins -> {{m + 25, Inherited}, {Inherited, Inherited}}] doc = Import[C:Documents and SettingshansDesktopdoccontent.xml, XML,ConversionOptions -> {ReadDTD -> False, AllowRemoteDTDAccess -> False, ValidateAgainstDTD -> False, IncludeNamespaces -> False}] (* put semi-colon if you don't wish to see the output*) NotebookPut@ Notebook[{XMLNote[doc[[2]], 0]}, CellGrouping -> Manual] 5. Play around with the code. The XMLNote code is straight from the help files. I have not tested this with a Word file with any of entities, graphics. I suspect that you would have more entity problems if your files are in European langauge (accent, etc) at that point I would include the ConversionOption AllowUnrecognizedEntities -> True If this fails for you the first try with a converted Word doc then in OpenOffice Writer create a new file type stuff in and save, then try these steps again with your simple *.sxw file (content.xml). Good Luck > This must have been asked 1000 times, but I haven't seen the > answer. I have a large but ordinary-looking file of Mathematica text output on > the screen with no special characters, unusual formatting, lines, or > colors, Just plain text. I want to get this data, just as it looks, > into MS Word for further processing. When I convert the Mathematica output to > text or do anything else I can think of, I get a very complex format > in Word, which would te a complicated macro to undo. There must be a > simple way to get real, plain text with no mysterious codes, etc., in > the Mathematica output file. > Steve Gray > And I would like to append a similar question: > How can I read a .doc file (generated in MS Word) > using Mathematica 5.0 for Linux? > -- > Pavel Pokorny > Math Dept, Prague Institute of Chemical Technology > http://www.vscht.cz/mat/Pavel.Pokorny === Subject: ParametricPlot2D Is it possible to plot like :) ParametricPlot2D {x,y}=f(u,v), where u,v are two parameters? At present, I am plotting by setting z=0 in a 3D plot e.g., ParametricPlot3D[{u-v^2,u v,0},{u,-1,1},{v,-1,1},ViewPoint->{0,0,4}] ; But it adds colour to the domain that would have become a surface in 3D had z been non-zero. Actually I like to see clean plots, no matter if there are self-intersections.What is the simplest plot command recommended in such cases? === Subject: Problem with Mathematica driving me nuts FindRoot[x^2 == 4x - 4, {x, 1}] Out[4]= {x -> 1.99902} In[15]:= FindRoot[x^2 - 4*x + 4, {x, 3}] Out[15]= {x -> 2.00098} When the root is clearly two. Is Mathematica using Newton's Method like a Ti-92? Even if so, why wont it give a more accurate answer? I've tried N[%,30] but it doesn't do anything. I'm new to Mathematica coming over from a Ti-92, so everything is frustrating right now. === Subject: RE: simple bug about Sum/Product function? Hello all, I would like to follow up my previous mail because anyone seems not to have an interest in this kind of Mathematica bug. The output of following expressions are self-explanatory: Sum[1,{i,10}] > 10 Sum[1,{1000000}] > 1000000 OK. Sum[1,{1000001}] > Sum[1,{1000001}] What? Sum[1,{i,1000001}] > 1000001 Yes, it's good. But, .... Sum[Print@1; Random[],{i,3}] 1 1 1 1.52163 Sum[Print@1; Random[],{i,1000001}] 1 Only one line printed!!! Something wrong. 236974. Product[1,{i,10}] Product[1,{i,1000000}] Product[1,{i,1000001}] > StandardForm[Product[1,{i,1000001}]] ???? These outputs are produced in Mathemtatica ver5.0 and ver5.01. YUKO