A2 I'm trying to get a handle on Mathematica's XML capabilities. I'm finding a few things to be a bit confusing. One of these is where the http://www.wolfram.com/XML/DTD/2001/NBMLwMathML.dtd really is. Another point of confusion is how exactly the rendering in the browser is expected to take place. If needs be, I can spin up my own CSS. Does Mathematica provide CSS for MathML or NBML? I've character mentioned entity references before, but I still haven't found an answer. What I've found here seems inconsistent with what Mathematica chose for the character entity reference for an imaginary number: http://www.bitjungle.com/~isoent/ This is what Mathematica produced for a complex number:

cpx = 1066 + 42 ;

If I understand the http://www.bitjungle.com/~isoent/ent.xml, the imaginary number symbol should be ࠿ which is a black letter capital 'I'. That doesn't seem correct to me. I'm currently stumbling around in here looking for a possible clue as to what I should expect: http://www.physiome.org.nz/Docs/web-tech/specs/mathML20/chapter3.html Has anybody worked with this? STH . Reply-To: Lester Ingber ==== If you have very strong credentials for the position described below, Lester Ingber Director R&D DUNN Capital Management Stuart FL Some recent press on DUNN can be seen on http://www.businessweek.com/magazine/content/02_39/b3801113.htm http://www.businessweek.com/magazine/content/02_39/b3801114.htm Financial Engineer A disciplined, quantitative, analytic individual proficient in prototyping and coding (such as C/C++, Maple/Mathematica, or Visual Basic, etc.) is sought for financial engineering/risk:reward optimization research position with established Florida hedge fund (over two decades in the business and $1 billion in assets under management). A PhD in a mathematical science, such as physics, statistics, math, or computer-science, is preferred. Hands-on experience in the financial industry is required. Emphasis is on applying state-of-the-art methods to financial time-series of various frequencies. Ability to work with a team to transform ideas/models into robust, intelligible code is key. Salary: commensurate with experience, with bonuses tied to the individual's and the firm's performance. Status of Selection Process All applicants will be reviewed, and a long list will be generated for phone interviews. Other applicants will not be contacted further. Information on the status of this process will be available in http://www.ingber.com/open_positions.html face-to-face interviews. During the visit for the physical interview a small coding exam will be given. Start date for this position may range anywhere from immediately to six months thereafter, depending on both the candidate's and the firm's needs. -- Prof. Lester Ingber ingber@ingber.com ingber@alumni.caltech.edu www.ingber.com www.alumni.caltech.edu/~ingber ==== Sorry, my message was nonsense. The reason why it appeared to give the answer 1 is that I forgot to evaluate z1 an z2: In[7]:= z1 = a1 + b1*I; In[8]:= z2 = a2 + b2*I; In[9]:= ComplexExpand[Abs[(z1 - z2)/(z1 - Conjugate[z2])], TargetFunctions -> {Im, Re}] Out[9]= Sqrt[(a1 - a2)^2 + (b1 - b2)^2]/ Sqrt[(a1 - a2)^2 + (b1 + b2)^2] The answer is clearly not unless b2==0. What exactly did you have in mind? > To start with, what you are saying is simply not true. A simple > example: In[1]:= > Abs[(z1 - z2)/(1 - z1*Conjugate[z2])] /. > {z1 -> 1 + I, z2 -> 1 - I} Out[1]= > 2/Sqrt[5] Presumably you meant Abs[(z1 - z2)/(z1 - Conjugate[z2]) in which case: In[1]:= > ComplexExpand[Abs[(z1-z2)/(z1- > Conjugate[z2])],TargetFunctions->{Im,Re}] Out[1]= > 1 Andrzej Kozlowski > Yokohama, Japan > http://www.mimuw.edu.pl/~akoz/ > http://platon.c.u-tokyo.ac.jp/andrzej/ > I want to perform this calculation: > In[1]:=z1 = a1 + b1 I > Out[1]=a1 + [ImaginaryI] b1 > In[3]:=z2 = a2 + b2 I > Out[3]=a2 + [ImaginaryI] b2 > In[19]:=Abs[(z1 - z2)/(1 - z1 Conjugate[z2])] > This should output 1! But it doesn't work... > Also, Abs[a1+b1 I] doesn't get the right result. > Any ideeas? > CeZaR > > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ ==== Dear Listers, I find myself defining functions in terms of differentiation. For example, f[x_,t_]:=Sin[x*t] dfx[x_,t]:=D[Sin[y,t],y]/.y->x This works well, but it seems to me that there should be a better way to do this. That is, there should be a better way to define a 'derivative' of a previous function without going through the replacement contortions. I can't find the answer in the archive. Can someone tell me the most straightforward way to do this? Will it work to define a gradient vector or Jacobian matrix? A Hessian matrix? -- Jason Miller, Ph.D. Division of Mathematics and Computer Science Truman State University 100 East Normal St. Kirksville, MO 63501 http://vh216801.truman.edu 660.785.7430 ==== Jason, We have dfx[x_,t_]= D[f[x,t],x] t Cos[t x] One advantage of using = rather than := is that it differentiates once, when the definition is stored, Definition[dfx] t Cos[t x] With := we get Clear[dfx] dfx[x_,t_]:= D[f[x,t],x] Definition[dfx] dfx[x_, t_] := D[f[x, t], x] So the differentiation is done each time that the function dfx is evaluated. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Dear Listers, I find myself defining functions in terms of differentiation. For example, f[x_,t_]:=Sin[x*t] > dfx[x_,t]:=D[Sin[y,t],y]/.y->x This works well, but it seems to me that there should be a better way > to do this. That is, there should be a better way to define a > 'derivative' of a previous function without going through the > replacement contortions. I can't find the answer in the archive. > Can someone tell me the most straightforward way to do this? Will it > work to define a gradient vector or Jacobian matrix? A Hessian > matrix? -- > Jason Miller, Ph.D. > Division of Mathematics and Computer Science > Truman State University > 100 East Normal St. > Kirksville, MO 63501 > http://vh216801.truman.edu > 660.785.7430 > Reply-To: kuska@informatik.uni-leipzig.de ==== f[x_, t_] := Sin[x*t] dfx[x_, t_] := Module[{y, df}, df = D[f[y, t], y]; Block[{y = x}, df ] ] Jens Dear Listers, I find myself defining functions in terms of differentiation. For example, f[x_,t_]:=Sin[x*t] > dfx[x_,t]:=D[Sin[y,t],y]/.y->x This works well, but it seems to me that there should be a better way > to do this. That is, there should be a better way to define a > 'derivative' of a previous function without going through the > replacement contortions. I can't find the answer in the archive. > Can someone tell me the most straightforward way to do this? Will it > work to define a gradient vector or Jacobian matrix? A Hessian > matrix? -- > Jason Miller, Ph.D. > Division of Mathematics and Computer Science > Truman State University > 100 East Normal St. > Kirksville, MO 63501 > http://vh216801.truman.edu > 660.785.7430 ==== I was trying to write a function, when given a list, say, {a,b,c,d}, the output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c * esc ([CircleTimes]) in Mathematica. f[{x_}]:=x; f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]]; However, the output was not exactly what I expected, it looked like: ((a op b) op c) op d It seems when doing the Join operation, a pair of parenthesis was added. Can someone let me know how I can get rid of these parenthesis? JT _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com ==== > I was trying to write a function, when given a list, say, {a,b,c,d}, the > output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c * > esc ([CircleTimes]) in Mathematica. f[{x_}]:=x; > f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]]; However, the output was not exactly what I expected, it looked like: ((a op b) op c) op d It seems when doing the Join operation, a pair of parenthesis was added. Can someone let me know how I can get rid of these parenthesis? > JT > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com You can be very effective with a simple trick f[MyList_]:=Drop[Flatten[Transpose[{MyList,Table[op,Length[MyList]]}]],-1 ] then you can apply on it a conversion to string then save it to a file to be processed by TeX/LateX ==== JJJ, Try: f[{x_}]:=x; f[{x_,y__}]:=x[CircleTimes]y Test f[{a,b,c,d}] a[CircleTimes]b[CircleTimes]c[CircleTimes]d -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > I was trying to write a function, when given a list, say, {a,b,c,d}, the > output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c * > esc ([CircleTimes]) in Mathematica. f[{x_}]:=x; > f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]]; However, the output was not exactly what I expected, it looked like: ((a op b) op c) op d It seems when doing the Join operation, a pair of parenthesis was added. Can someone let me know how I can get rid of these parenthesis? > JT > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com Reply-To: kuska@informatik.uni-leipzig.de ==== SetAttributes[CircleTimes, Flat] f[{x_}] := x; f[{x_, y_, z___}] := f[Join[{x[CircleTimes]y}, {z}]]; Jens I was trying to write a function, when given a list, say, {a,b,c,d}, the > output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c * > esc ([CircleTimes]) in Mathematica. f[{x_}]:=x; > f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]]; However, the output was not exactly what I expected, it looked like: ((a op b) op c) op d It seems when doing the Join operation, a pair of parenthesis was added. Can someone let me know how I can get rid of these parenthesis? > JT _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com ==== the least of which was a power failure. For some strange reason Mathematica stopped producing the pretty html+MathML it had been. I started trouble shooting, and blew away what I had pointed to. I violated Tom Jackson's (IBM & UMUC) first rule of holes: when you're in one, stop digging. Here's the parent directory. http://public.globalsymmetry.com/proprietary/com/wri/notebooks/ As you can see (If I haven't fixed it by the time you look again,) Mathematica is outputting the conversion command, rather than the actual MathML I really don't know what happened. I removed the init.m and deleted the cache, and it still refuses to work correctly. It's kind of frustrating. There are a lot of powerful XML features in Mathematica, but they are not easy to use. STH > cannot access... > thanks, > Steven Taracevicz > PO Box 1752 > Santa Monica, CA 90406-1752 310.396.4001 > 310.388.3265 fax ==== > I'm attempting to identify the essential aspects of Mathematica. I believe > the > place to start is with the 'functional operations'. I'm seeking the > 'basis' of Mathematica. Kind of the orthonormal subset of functionality > which can be used to derive all the other. I'm also trying to be > pragmatic. I'm not trying to reinvent Mathematica, I'm just trying to > understand > the invention that already exists... I apologize in advance for this pessimistic response, but here goes: I have attempted something similar on two occasions, but with very specific audiences in mind. Even so, my efforts were little better than useless. (I would be willing to send you my most recent attempt, but as I said, it didn't work well.) I doubt that you can find agreement among the sea of users of Mathematica as to what is essential or basic or an orthonormal subset. The kernel is well described in the Mathematica book (for those of us who are careful readers or are refreshing memories) and in other books (for the rest of us). Would it not be a better use of your time to refer to selected passages in existing books? Documentation of the front end is uneven, with vast uncharted areas (I'm not even sure when it's round or flat!). Original writing about the front end might be more fruitful. Tom Burton ==== The way I learned XML, XML is for content, and CSS is for display. It seems that MathML violates that separation between style and content. There is little chance that I'm the first one to mention this. Is there a history of discussion on this topic somewhere? I don't want to get too far into MathML on this list, but, since I'm skinning my knuckles trying to learn to work with MathML and Mathematica, I figure a bit of discussion on this topic in this context is in order. STH ==== How can I plot functions like: (x-2)^2 + 2(y-3)^2 = 6 and x^3y + y^3 = 9 using Mathematica? David, x /. Solve[x^3 y + y^3 == 9, x]; g=Plot[Sign[(9 - y^3)/y]* Abs[(9 - y^3)/y]^(1/3) , {y, -7, 7} , AspectRatio -> Automatic]; Show[g /. {x_?NumberQ, y_?NumberQ} -> {y, x}, Epilog -> {RGBColor[1,0,0],Line[{{-(3^(7/9)/2^(2/9)), -5}, {-(3^(7/9)/2^(2/9)), 5}}]}]; ==== Is there an SGML catalog for the WRI DTDs on the CD? I'm not sure if I should expect psgml with xemacs to handle namespaces correctly. Currently, I'm having problems using the xml generated by Mathematica with psgml. I'm not sure exactly how to set up an sgml catalog to support these. I really don't want to try to reinvent the wheel, if there is already one available. I'm thouroughly preplexed by the overall behavior of the XML support. Things which were working have now stopped working, or have significantly changed their behavior. This is a very exciting area, but it seems very difficult to get started. I believe the dtd to include in a catalog is this: /opt/Wolfram/Mathematica/4.2/SystemFiles/IncludeFiles/XML/xhtml-math11-f.dtd I'm just not sure what the public identifier should be. STH -- Hatton's Law: There is only One inviolable Law. ==== Yes, there seems to be a lot of people who have a visceral hatred for Microsoft and Windows. They are even willing to shed blood to avoid Windows. But why? Windows works and you don't have to become a systems programmer. Furthermore, I think that Steven Wolfram uses some version of Windows. So guess which system Mathematica will be best tuned up for? I have no problems with Mathematica and Windows on my single computer. There may be reasons for using a non-Microsoft operating system. But if you are going to do it, make certain that they are good reasons. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ ==== > Yes, there seems to be a lot of people who have a visceral hatred for > Microsoft and Windows. They are even willing to shed blood to avoid > Windows. But why? Windows works and you don't have to become a systems > programmer. Furthermore, I think that Steven Wolfram uses some version of Windows. So > guess which system Mathematica will be best tuned up for? I have no problems with Mathematica and Windows on my single computer. > There may be reasons for using a non-Microsoft operating system. But if > you are going to do it, make certain that they are good reasons. that of Windows XP by orders of magnitude. I recall when I first started been using Windows NT since October of 1992. (Yes, I know it hadn't been paper on the architecture of NT. In 1997 I was well on my way to being an MCSE. no stinkin' GUI' to 'have a look at the KDE project'. I took the latter route. The KDE has gone from a simple graphical desktop with a few more features than the CDE, (and a lot more glitches) to being the best desktop available. It's growth seems to be exponential. Windows seems, at best, to be linear. All of these are usability issues. There is another reason I don't like using Microsoft products. I've also been using Mozilla since 1995. (Yes, it has always been called Mozilla.) I was one of the original beta testers for the Netscape line of internet servers. When I saw what Netscape Communications were aiming for, Windows quickly lost its luster. Netscape products were designed from the ground up with portability in mind. They were striving for uniform functionality across all platforms. I also saw what Microsoft did to undermine Netscape's R & D resources. Microsoft would condescend to having not competition in their market. Where I come from, people don't put up with that. Where do I come from? I was born in Illinois. I'm obviously not of the opinion that closed source is unacceptable. I wouldn't be using Mathematica if I were. I suspect one day Mathematica will face a real open source challeng. Her name is Charolette. She is the mother of Mozilla. That will probably be years from now. WRI need to be prepared to adjust to that eventuality when it comes. > David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ STH . ==== >In: DSolve[y*D[u[x, y],x] == x*D[u[x, y],y], u[x,y], {x, y}] > >Out: {{u[x, y] -> C[1][(1/2)*(x^2 + y^2)]}} > >Square brackets are used as grouping symbols in the result!?? :^O > >Somebody say it isn't so. > It isn't so The square bracket is not delineating a factor it is enclosing the argument to an arbitrary function named C[1]. While the function is dependent on both x and y the dependence only occurs in the combination (x^2+y^2). Bob Hanlon Reply-To: Mark Coleman ==== Greetings, I hope this inquiry is not off-topic for the list. I was wondering if anyone knew of Mathematica-based education resources (either for students or teachers) that would be suitable for teaching *elementary school* students (kindergartden - 5th grade) some basic fundamentals of mathematics, e.g., simple algebra, geometry, numbers,etc. I know there is a solid body of work directed towards high school and college students, but I am not sure of resources for younger students. Mark ==== > f[{x_}]:=x; > f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]]; However, the output was not exactly what I expected, it looked like: ((a op b) op c) op d It seems when doing the Join operation, a pair of parenthesis was added. Can someone let me know how I can get rid of these parenthesis? SetAttributes[CircleTimes,Flat] f[{a,b,c,d}] a[CircleTimes]b[CircleTimes]c[CircleTimes]d Tom Burton ==== The Illinois Institute of Technology's Stuart Graduate School of Business in collaboration with Wolfram Research, Inc. is offering a seminar series on applications of the Mathematica software system in mathematical and computational finance. The weekly seminars will begin Friday, October 25, 2002, and will be held at the Stuart Graduate School of Business in Chicago. The speakers will illustrate the built-in functionality of Mathematica as well as the extensive Mathematica applications available from both Wolfram Research and independent developers. They will also give detailed synopses of applications that solve a wide range of financial problems. Advance registration is required. You can register by writing to seminar@wolfram.com. For more information, visit the seminar website at: http://www.wolfram.com/services/seminars/chicago2002/ ==== Allan, I would like to add something to this , something which duzznt deal with the question directly but with the answer...since I've seen it many times on the mathgroup forum, I feel i'd like to make a philosophical comment here...when I look at the reply and the solution , which might be perfectly good, but it makes me wonder...of what value is it to a Newbie????......quite often I seen questions posted Who can do this or that the fastest?....How about who can come up with a solution that is the easiest to comprehend?....Allan, I realize that you are an advanced user, etc..and that you think along these lines...but for me, and perhaps many others, I cant think along these lines even though I have read mathgroup for many years now...with that said, naturally i'm quite thankful to the 'gurus' who provide answers.... jerry blimbaum NSWC panama city, fl -----Original Message----- To get the function for the norm of the derivative we can use norm = Evaluate/@(Simplify/@(Sqrt[#.#]&/@(f'))) 2*Sqrt[2] & We map the usual functions for calclulating and simplifying the norm inside Function[.] (which is the full form of (.)& and then map the function Evaluation to make the result evaluate -- this is needed since Function has the attribute HoldAll. Please note that the parentheses are essential. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 f[t_] = {t + Sqrt[3] Sin[t], 2 Cos[t], t Sqrt[3] - Sin[t]} So It's basically a vector whose coordinates are determined based on the > values you pass in. Then I took the derivative by just typing f', which outputs {1 + Sqrt[3] Cos[#1], -2 Sin[#1], Sqrt[3] - Cos[#1]}& > What I'd like to do is have Mathematica calculate the norm of this as it > would any vector, so that I can play with the norm function. As it turns > out, the norm in this case is identical to Sqrt[8], so it would be nice if > Mathematica could figure that out. Is it possible to do this? > ==== Dear Netters, I am also looking for Automated formal vector analysis. I am currently doing it with Mathematica and its package VectorAnalysis but it does not allow DIRECT algebra on tensors and vectors (or else I have not found how to do it) Can anyone else help ? Nicolas Fressengeas -- ________________________________________________________ Dr. Nicolas Fressengeas - - - http://www.ese-metz.fr/~fresseng Sup.8elec / Laboratoire Mat.8eriaux Optiques, Photonique et Syst.8fmes 2 rue E.Belin, 57070 METZ Cedex Plan d'acc.8fs: http://www.iti.fr/PlanPerso/23704/1 When everything else fails, read the instructions... Alexey Skoblikov a .8ecrit dans le message > Is there any tool for dealing with DIRECT tensor algebra, i.e. when tensor > is not a matrix of components, but considered to be the invariant object? ==== funcList = {Exp[x], Sin[y], z^3}; varList = {x, y, z}; MapThread[Plot[#1, {#2, -5, 5}] &, {funcList, varList}]; Inner[Plot[#1, {#2, -5, 5}] &, funcList, varList]; Bob Hanlon >how can I solve the following problem: The task is to successively plot > >the functions given in FuncList with the accociated variable >FuncList = {Exp[x], Sin[y], z^3}; > >VarList = {x, y, z}; > >Do[Plot[FuncList[LeftDoubleBracket] > i[RightDoubleBracket], {VarList[LeftDoubleBracket] > i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] ==== All you need is Evaluate in your code: Do[Plot[Evaluate[FuncList[[i]], {VarList[[i]], -5, 5}]], {i, 1, Length[VarList]}] or you might prefer: Plot[#1, {#2, -5, 5}] & @@@ Transpose[{FuncList, VarList}] Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ > Dear colleagues, how can I solve the following problem: The task is to successively plot > the functions given in FuncList with the accociated variable > FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; Do[Plot[FuncList[LeftDoubleBracket] > i[RightDoubleBracket], {VarList[LeftDoubleBracket] > i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] Frank Brand > ==== (Somehow the original posting never reached me). But what's wrong with dfx[x_, t_] := Derivative[1, 0][f][x, t] ? Andrzej Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ f[x_, t_] := Sin[x*t] > dfx[x_, t_] := Module[{y, df}, > df = D[f[y, t], y]; > Block[{y = x}, > df > ] > ] Jens > Dear Listers, > I find myself defining functions in terms of differentiation. For > example, > f[x_,t_]:=Sin[x*t] > dfx[x_,t]:=D[Sin[y,t],y]/.y->x > This works well, but it seems to me that there should be a better way > to do this. That is, there should be a better way to define a > 'derivative' of a previous function without going through the > replacement contortions. I can't find the answer in the archive. > Can someone tell me the most straightforward way to do this? Will it > work to define a gradient vector or Jacobian matrix? A Hessian > matrix? > -- > Jason Miller, Ph.D. > Division of Mathematics and Computer Science > Truman State University > 100 East Normal St. > Kirksville, MO 63501 > http://vh216801.truman.edu > 660.785.7430 > ==== It seems that I am having problems in embedding the eps fonts in Mathematica generated files using the program emmathfnt from Mathsource. Currently, I am using version 4.2 and with the previous version 4.1, I did not have any problems with emmathfnt. This is what I am doing: In[90]:= gr=Plot[Sin[x], {x, 0, Pi}, FrameLabel[Rule] { [Alpha] , [Beta]}]; scratchFile=Export[Close[OpenTemporary[]],gr,EPS]; Run[C:WINNTemmathfnt,-o,temp,-d, C:Program FilesWolfram ResearchMathematica4.2SystemFilesFontsType1,scratc hFile] Out[92]= 0 The file is generated but the fonts are not included. Can some one tell me what I am doing wrong? Note the executable file emmathfnt is the same found on Mathsource and the location of the file is in C:WINNT. Also since I still have version 4.0 fonts, I tried the above Run command without the -d flag and I got the same result. Finally, one can not help but wonder, why there is no option in export that allow the fonts to be included in Mathematica generated figures for better portability. Wissam AlSaidi ==== Frank, The first method is just to Evaluate the iterator. FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; Do[Plot[FuncList[[i]], Evaluate[{VarList[[i]], -5, 5}]], {i, 1, Length[VarList]}] But a simpler method is to use functional programming... MapThread[Plot[#1, {#2, -5, 5}] &, {FuncList, VarList}]; David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Frank Brand ==== I«m new, so I«m sorry if the question is so easy, I really think that is easy, but I don«t know how to do it. I have this: b=n-m a=x-b Y=3a + 4a^2 and the program show me this: 3(x-n+m) + 4(x-n+m)^2 or, something like that, the problem is that I want the program show me Y in function of b, or sometimes in function of a, something like this: Y=3(x-b) + 4(x-b)^2 or Y=3a + 4a^2 ==== Forget about procedural programming, i.e., no more Do's ever again. Use MapThread: In[1]:= FuncList={Exp[x],Sin[y],z^3}; VarList={x,y,z}; In[3]:= f[a_,b_]:=Plot[a,{b,-5,5}] In[4]:= MapThread[f,{FuncList,VarList}]; Oh, and try not to use uppercase letters in the first position of your functions and variable names. These are reserved for Mathematica built-in functions. Tomas Garza Mexico City ----- Original Message ----- > VarList = {x, y, z}; Do[Plot[FuncList[LeftDoubleBracket] > i[RightDoubleBracket], {VarList[LeftDoubleBracket] > i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] Frank Brand > ==== The solution is using Evaluate. In[1]:= FuncList = {Exp[x], Sin[y], z^3}; In[2]:= VarList = {x, y, z}; In[3]:= Do[Plot[Evaluate[FuncList[[i]], {VarList[[i]], -5, 5}]], {i, 1, Length[VarList]}] Greetings, Germ.87n Buitrago A. ----- Original Message ----- > VarList = {x, y, z}; Do[Plot[FuncList[LeftDoubleBracket] > i[RightDoubleBracket], {VarList[LeftDoubleBracket] > i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] Frank Brand > ==== Dear colleagues, how can I solve the following problem: The task is to successively plot the functions given in FuncList with the accociated variable FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; Do[Plot[FuncList[LeftDoubleBracket] i[RightDoubleBracket], {VarList[LeftDoubleBracket] i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] Frank Brand ==== Try something less clumsy, eg : Plot[#1,{#2,-5,5}]&@@@Transpose[{FuncList,VarList}] or why not have a particular symbol for the independent variable - then just map the plot command over the FuncList : Plot[#,{t,-5,5}]&/@{Exp[t],Sin[t],t^3} bye, Borut | Dear colleagues, | | how can I solve the following problem: The task is to successively plot | the functions given in FuncList with the accociated variable | | | FuncList = {Exp[x], Sin[y], z^3}; | | VarList = {x, y, z}; | | Do[Plot[FuncList[LeftDoubleBracket] | i[RightDoubleBracket], {VarList[LeftDoubleBracket] | i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] | | Frank Brand | | | ==== Frank, FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; MapThread[Plot[#1, {#2, -5, 5}] &, {FuncList, VarList}] -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Dear colleagues, how can I solve the following problem: The task is to successively plot > the functions given in FuncList with the accociated variable > FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; Do[Plot[FuncList[LeftDoubleBracket] > i[RightDoubleBracket], {VarList[LeftDoubleBracket] > i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] Frank Brand > Reply-To: kuska@informatik.uni-leipzig.de ==== FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; Plot[Evaluate[#[[1]], {#[[2]], -5, 5}]] & /@ Transpose[{FuncList, VarList}] Jens Dear colleagues, how can I solve the following problem: The task is to successively plot > the functions given in FuncList with the accociated variable FuncList = {Exp[x], Sin[y], z^3}; VarList = {x, y, z}; Do[Plot[FuncList[LeftDoubleBracket] > i[RightDoubleBracket], {VarList[LeftDoubleBracket] > i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]] Frank Brand ==== Greetings This problem can be solved by conventional programming, but I wonder if there is an elegant Mathematica solution ? A list contains pairs of values, with each pair representing the lower and upper edge of a sub-range. Some of the sub-ranges partially overlap, some fully overlap, others don't overlap at all. The problem is to produce a second list that contains the overall upper and lower edges of the overlapping sub-ranges. A simple example : {{100,200},{150,250},{120,270},{300,400}} would result in {{100,270},{300,400}}. In the real case, the input list has several hundred elements and the output list typically has five elements. I have a working solution based on loops, but there must be a more elegant one. I would be very grateful for any suggestions. John Leary ==== John The simplest solution to your trial problem that I could come up with was the following: Apply[List, Apply[Interval, {{100, 200}, {150, 250}, {120, 270}, {300, 400}}]] I hope you can figure it out. I didn't test it on a larger input dataset - my usual experience is that built-in functions are faster for operations on lists than fiddling around with loops. Mark Westwood Greetings This problem can be solved by conventional programming, but I wonder if > there is an elegant Mathematica solution ? A list contains pairs of values, with each pair representing the lower and > upper edge of a sub-range. Some of the sub-ranges partially overlap, some > fully overlap, others don't overlap at all. The problem is to produce a > second list that contains the overall upper and lower edges of the > overlapping sub-ranges. A simple example : {{100,200},{150,250},{120,270},{300,400}} would result > in {{100,270},{300,400}}. In the real case, the input list has several hundred elements and the > output list typically has five elements. I have a working solution based on loops, but there must be a more elegant > one. I would be very grateful for any suggestions. > John Leary ==== I remember there being a similar thread on this subject a while ago, but I am too lazy to check it out. The simplest solution seems to be using Interval, although it may not be very fast. For example In[3]:= Interval[{100,200},{150,250},{120,270},{300,400}] Out[3]= Interval[{100, 270}, {300, 400}] If the above is not sufficiently fast for you, then you may want to search the archives for the thread I mentioned above. Carl Woll Physics Dept U of Washington > Greetings This problem can be solved by conventional programming, but I wonder if > there is an elegant Mathematica solution ? A list contains pairs of values, with each pair representing the lower and > upper edge of a sub-range. Some of the sub-ranges partially overlap, some > fully overlap, others don't overlap at all. The problem is to produce a > second list that contains the overall upper and lower edges of the > overlapping sub-ranges. A simple example : {{100,200},{150,250},{120,270},{300,400}} would result > in {{100,270},{300,400}}. In the real case, the input list has several hundred elements and the > output list typically has five elements. I have a working solution based on loops, but there must be a more elegant > one. I would be very grateful for any suggestions. John Leary ==== >Greetings > >This problem can be solved by conventional programming, but I wonder if >there is an elegant Mathematica solution ? > >A list contains pairs of values, with each pair representing the lower and >upper edge of a sub-range. Some of the sub-ranges partially overlap, some >fully overlap, others don't overlap at all. The problem is to produce a >second list that contains the overall upper and lower edges of the >overlapping sub-ranges. > >A simple example : {{100,200},{150,250},{120,270},{300,400}} would result >in {{100,270},{300,400}}. > >In the real case, the input list has several hundred elements and the >output list typically has five elements. > >I have a working solution based on loops, but there must be a more elegant >one. I would be very grateful for any suggestions. Block[{data = {{100,200},{150,250},{120,270}, {300,400}}}, data = Sort[data,#[[1]]<#2[[1]]&]; {{data[[1,1]], Fold[If[#<#2[[1]],#,Max[#,#2[[2]]]]&, data[[1,2]],Rest[data]]}, {Fold[If[#>#2[[2]],#,Min[#,#2[[1]]]]&, (data=Reverse@data)[[1,1]],Rest[data]], data[[1,2]]}}] --> {{100, 270}, {300, 400}} I haven't tested too extensively. The so-called Mathematica way is illustrated by the use of Fold function to process data, without which you must resort to conventional looping. DH ==== John, The solution using Split that I previously supplied may unnecessarily sort more than once -- here is a correction -- it should be slightly quicker.. lst = Table[{#, # + Random[Integer, {0, 9}]} &[ Random[Integer, {0, 1000}]], {1000}]; FixedPoint[{Min[#],Max[#]}&/@ Split[Sort[#], #1[[2]][GreaterEqual]#2[[1]]&]&,lst]//Timing {0.22 Second,{{1,64},{66,66},{67,175},{177,363},{365,548},{551,853},{857, 857},{858,938},{940,1003}}} FixedPoint[{Min[#],Max[#]}&/@Split[#, #1[[2]][GreaterEqual]#2[[1]]&]&, Sort[lst]]//Timing {0.16 Second,{{1,64},{66,66},{67,175},{177,363},{365,548},{551,853},{857, 857},{858,938},{940,1003}}} Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Greetings This problem can be solved by conventional programming, but I wonder if > there is an elegant Mathematica solution ? A list contains pairs of values, with each pair representing the lower and > upper edge of a sub-range. Some of the sub-ranges partially overlap, some > fully overlap, others don't overlap at all. The problem is to produce a > second list that contains the overall upper and lower edges of the > overlapping sub-ranges. A simple example : {{100,200},{150,250},{120,270},{300,400}} would result > in {{100,270},{300,400}}. In the real case, the input list has several hundred elements and the > output list typically has five elements. I have a working solution based on loops, but there must be a more elegant > one. I would be very grateful for any suggestions. John Leary ==== ............. > A list contains pairs of values, with each pair representing the lower and > upper edge of a sub-range. Some of the sub-ranges partially overlap, some > fully overlap, others don't overlap at all. The problem is to produce a > second list that contains the overall upper and lower edges of the > overlapping sub-ranges. A simple example : {{100,200},{150,250},{120,270},{300,400}} would result > in {{100,270},{300,400}}. John, Generate a list of pairs: lst=Table[{#,#+Random[Integer,{0,9}]}&[Random[Integer,{0,1000}]],{1000}]; A slow solution Sort[lst]//. {x___,{a_,b_},{c_,d_},y___}/;c<=b:>{x,{a,Max[b,d]},y}//Timing {5. Second,{{0,219},{221,431},{432,568},{569,599},{600,697},{699,1005}}} A faster one FixedPoint[{Min[#],Max[#]}&/@Split[Sort[#], #1[[2]]>=#2[[1]]&]&, lst]//Timing {0.22 Second,{{0,219},{221,431},{432,568},{569,599},{600,697},{699,1005}}} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 ==== >This problem can be solved by conventional programming, but I wonder if >there is an elegant Mathematica solution ? >A list contains pairs of values, with each pair representing the lower and >upper edge of a sub-range. Some of the sub-ranges partially overlap, some >fully overlap, others don't overlap at all. The problem is to produce a >second list that contains the overall upper and lower edges of the >overlapping sub-ranges. >A simple example : {{100,200},{150,250},{120,270},{300,400}} would result >in {{100,270},{300,400}}. >In the real case, the input list has several hundred elements and the >output list typically has five elements. If the numbers are all integers less than 401, as in your example, then you could start with the list {1,2,3,...400} and compare each number to every pair in your list-of-pairs. If there exists no pair that the given number falls between (inclusive), replace the number with zero. Converting the resulting list to the output you want is an exercise for the reader (clever replacement rules will do it easily). -- Tim Dellinger www.ews.uiuc.edu/~tdelling tdelling@uiuc.edu ==== Interval[{100, 200}, {150, 250}, {120, 270}, {300, 400}] does what you want. -- Steve Luttrell West Malvern, UK > Greetings This problem can be solved by conventional programming, but I wonder if > there is an elegant Mathematica solution ? A list contains pairs of values, with each pair representing the lower and > upper edge of a sub-range. Some of the sub-ranges partially overlap, some > fully overlap, others don't overlap at all. The problem is to produce a > second list that contains the overall upper and lower edges of the > overlapping sub-ranges. A simple example : {{100,200},{150,250},{120,270},{300,400}} would result > in {{100,270},{300,400}}. In the real case, the input list has several hundred elements and the > output list typically has five elements. I have a working solution based on loops, but there must be a more elegant > one. I would be very grateful for any suggestions. John Leary ==== Mathematica Training Course Whether youâre a beginner or seasoned professional, our training services can help you improve your Mathematica skills. We offer public and private training. Mathematica Intermediate & Programming Course (2 days) ----------------- Amsterdam, December 19-20 Mathematica is an exhaustive, powerful, and user-friendly software package. It is easy to perform basic calculations right way, but when you really want to explore and use the real power of Mathematica an investment is necessary. This course helps you making this investment and is meant for Mathematica users who want to know more about the background of Mathematica and to get a deeper understanding of the package; also you will learn how to use Mathematica more effectively. price: EUR 790 per person excluding VAT URL For more information and subscription: http://www.candiensten.nl/english/cursussen/cursussendetail.asp?id=9 How to register? ----------------- You may register on line via the links provided, or fill in the registration form below and return it to me or to Heleen Henneman. voice : +31 (0)20 5608400 fax : +31 (0)20 5608448 Please contact me if you have any questions. Dick Verkerk P.S. Feel free to share this information amongst friends and colleagues who might be interested! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Registration Form Herewith I register for the course: Mathematica Intermediate & Programming Course (2 days) [ ] Amsterdam, December 19-20 Name : M/F Function : Department : Institute : Address : Zip : City : November 1 Pricing derivatives with PDE (Partial Differential Equations) http://www.candiensten.nl/english/cursussen/cursussendetail.asp?id=41 Check out our complete list of courses at: http://www.candiensten.nl/english/cursussen/home.asp _________________________ Dick Verkerk, managing director CANdiensten, Nieuwpoortkade 23-25, NL-1055 RX Amsterdam voice: +31 20 5608410 fax: +31 20 5608448 verkerk@candiensten.nl _________________________ Your Partner in Finance and Mathematics! ==== Greetings, I have read with great interest this lively debate on numerical prcesion and > accuracy. As I work in the fields of finance and economics, where we feel > ourselves blessed if we get three digits of accuracy, I'm curious as to what > scientific endeavors require 50+ digits of precision? As I recall there are > some areas, such as high energy physics and some elements of astronomy, that > might require so many digits in some circumstances. Are there others? > -Mark I'm not sure what scientific endeavors might directly benefit. I can say that alot of computational endeavors need high precision, and of course some of these are used behind the scenes in scientific computation. Below I list a few. (i) Exact computation that uses approximation behind the scenes. Even someting so mundane as integer division can fall into this category. (ii) Finding relations among real or integer values can be done with high precision arithmetic. For example, one can implement LLL lattice reduction via approximate arithmetic. it's cousin, PSLQ, is entirely an approximate arithmetic procedure and at times it requires high precision. Applications of these would include cryptography and the like, hence this lies at least partly in the realm of applied math. (iii) Some algorithms may have low precision input but require higher precision at intermediate steps. An example is the method we use for solving systems of multivariate polynomial equations. You can regard the input as representing a family of problems (parametrized by the range of fuzz implied by the low precision input). Clearly the raising of precision in such circumstances is in some sense artificial, insofar as what we obtain is a solution to a particular member of the family (actually to a narrow subfamily). However we also make some attempt to detect ill conditioning; if the problem is well conditioned then solutions to all members of the family will be reasonably near to the one we obtain. (iv) Some statistical functions may require fairly high precision behind the scenes in order to obtain reasonable results for inputs that are not outrageous. This can often be mollified by changing the algorithm used but sometimes high precision is the simplest way to proceed. (v) Computational geometry problems frequently become nongeneric arithmetic can help to handle cases wherein nongenericity makes the problem pathological (often perturbation or similar devices are also needed). integration to counter various ills such as cancellation error. I'm sure there are oodles of other computational examples wherein high precision saves the day. The moral is that, while scientific examples rarely provide high precison input, methods of computation required by scientists may well still require high precision arithmetic. Also note that while financial forecasting may be blessed to get three digits, other aspects of the financial world require much more. Around 10 years ago a bank investigated purchasing Mathematica. Apparently they wanted to be certain they had amounts figured to better than the nearest penny (or so I heard). When working with exchange rates I suppose this could be important; crude rounding might allow for those weird secrets work. Wanna buy a Euro from me? Daniel Lichtblau Wolfram Research ==== The more I play with the example the more > depressing it gets. Start > with floating point numbers but explicitly > arbitrary-precision ones. > In[1]:= > a=77617.00000000000000000000000000000; > b=33095.00000000000000000000000000000; > In[3]:= > !(333.7500000000000000000000000000000 b^6 + > a^2 ((11 a^2 > b^2 - > b^6 - 121 b^4 - 2)) + > 5.500000000000000000000000000000 b^8 + > a/(2 > b)) > Out[3]= > !((-4.78339168666055402578083604864320577443814`26.6715*^32)) > In[4]:= > Accuracy[%] > Out[4]= > -6 > Due to the manual section 3.1.6: > When you do calculations with arbitrary-precision > numbers, as > discussed in the previous section, Mathematica > always keeps track of > the precision of your results, and gives only > those digits which are > known to be correct, given the precision of your > input. When you do > calculations with machine-precision numbers, > however, Mathematica > always gives you a machine[CapitalEth]precision result, > whether or not all the > digits in the result can, in fact, be determined > to be correct on the > basis of your input. > Because I started with arbitrary-precision numbers > Mathematica should display > only those digits that are correct, that is none. > No, 26 digits are correct Here is the number: > -0.8273960599468213681 Here is the same number computed by Mathematica with 26 > correct digits: > -4.78339168666055402578083604864320577443814[Times]10^32 It looks like I have been using some wrong definition > of correct.:-) You just proved that Precision is useless as a measure > how good your numerical result is. [...] I rather hope I proved nothing of the sort. Also I'm afraid Mathematica kept better track of the numbers than you did. As for definitions of correct, rather than remark on yours I'll just expose what I meant with specific numerical examples below. You did not actually say why you thought -0.8273960599468213681 would be the appropriate result. So I'll go through the computation in exact arithmetic (I have to admit I am puzzled as to why you did not do this). First I'll rewrite your expression using more variables. a = 77617.00000000000000000000000000000; b = 33095.00000000000000000000000000000; c = 333.7500000000000000000000000000000; d = 5.500000000000000000000000000000; In[6]:= InputForm[val = c*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + d*b^8 + a/(2*b)] Out[6]//InputForm= -4.78339168666055402578083604864320577443814`26.6715*^32 This is what I got. Now we'll redo in exact arithmetic. rata = Rationalize[a]; ratb = Rationalize[b]; ratc = Rationalize[c]; ratd = Rationalize[d]; In[12]:= InputForm[exactval = ratc*ratb^6 + rata^2* (11*rata^2*ratb^2 - ratb^6 -121*ratb^4 - 2) + ratd*ratb^8 + rata/(2*ratb)] Out[12]//InputForm= -63322539148012414193286707611938758031/132380 In[13]:= InputForm[N[exactval]] Out[13]//InputForm= -4.783391686660554*^32 I think it is reasonable to claim that these agree. I dug through some early posts on the topic and came across a value for b at one time that was one larger (this supports my long-held suspicion that numbers slowly decay in discrete increments...). In[14]:= b2 = 33096.00000000000000000000000000000; In[15]:= InputForm[val2 = c*b2^6 + a^2*(11*a^2*b2^2 - b2^6 - 121*b2^4 - 2) + d*b2^8 + a/(2*b2)] Out[15]//InputForm= -0.827469148`-0.3833 What this reveals is a number that Mathematica claims has NO trustworty digits. The InputForm also reveals the untrustworthy digits, and, sure enough, it comes close to what you have called the correct value, and specifically they agree to four places. My opinion is that the Mathematica significance arithmetic is doing, shall I say, precisely as it ought. Daniel Lichtblau Wolfram Research Reply-To: Mark Coleman ==== Greetings, I have read with great interest this lively debate on numerical prcesion and accuracy. As I work in the fields of finance and economics, where we feel ourselves blessed if we get three digits of accuracy, I'm curious as to what scientific endeavors require 50+ digits of precision? As I recall there are some areas, such as high energy physics and some elements of astronomy, that might require so many digits in some circumstances. Are there others? -Mark ==== > Greetings, I have read with great interest this lively debate on numerical prcesion and > accuracy. As I work in the fields of finance and economics, where we feel > ourselves blessed if we get three digits of accuracy, I'm curious as to what > scientific endeavors require 50+ digits of precision? As I recall there are > some areas, such as high energy physics and some elements of astronomy, that > might require so many digits in some circumstances. Are there others? > -Mark Mark, There may be occasions when the outcome of a real process is so sensitive to changes in input that unless we know very precisely what the input is then we can know very little about the outcome - chaotic processes are of this kind. The difficulty is real and no amount of computer power or clever progamming will do much about it. Another situation is when the the process is not so sensitive but calculating with our formula or programme introduces accumulates significant errors. Here is a very artificial example of the latter (I time the computation and find the MaximumMemory used in the session as we go through the example): ser=Normal[Series[Cos[#],{#,0,200}]]; MaxMemoryUsed[] 1714248 Calculating with machine number does not show much of a pattern ( I have deleted the graphics - please evaluate the code), pts= With[{ss=ser},Table[ {#,ss}&[x], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True]; MaxMemoryUsed[] {5.11 Second,Null} 1723840 Using bigfloat inputs with precision 20 shows some pattern: pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,20]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {17.52 Second,Null} 1759664 Precision 40 does very well: pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,40]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {19.38 Second,Null} 1797072 Now we might think the correct outcomes are showing up, and use an interpolating function for further , and faster, calculation. f=Interpolation[pts] InterpolatingFunction[{{50.000000,70.00000}},<>] pts= Table[ f[x],{x,50, 70, .1}];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {0.33 Second,Null} As a matter of interest, this is what happens if we substitute exact numbers (rationals and integers) for reals-- the computation takes an excessively long time and quite a bit more memory. pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,Infinity]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {992.28 Second,Null} 2413808 This also shows that we may in fact want to replace exact inputs with bigfloats. I should be interested to hear of other example, really real one in particular. I imagine that there are many situations where trends and shapes are more important than specific values. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > > ==== In the real world of physics there are several subatomic level processes which can only be distinguished by small changes in the n-th decimal place. But there is one example which is fairly easy to comprehend, and that is the constancy of the speed of light in a vacuum regardless of reference frame, as proposed in Einstein's special theory of relativity. If this were true only to the 9th or 10th decimal place, or, for that matter, to the 50th place, then whoever managed to show that it was not really a constant would certainly be in Nobel Prize territory, and much of modern physics would need a rewrite. Kevin > Greetings, > I have read with great interest this lively debate on numerical prcesion > and > accuracy. As I work in the fields of finance and economics, where we feel > ourselves blessed if we get three digits of accuracy, I'm curious as to > what > scientific endeavors require 50+ digits of precision? As I recall there > are > some areas, such as high energy physics and some elements of astronomy, > that > might require so many digits in some circumstances. Are there others? > > -Mark . ==== > [...] This subthread gets difficult to follow with all the indenting and the like so I will edit a bit for clarity. Here is some input. f = SetPrecision[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; One question that arose is, as best I can phrase it, How might I set values for a and b and retain 100 digits of precision (or perhaps accuracy)? There are a few answers and which you like will depend on what you really want to do. (i) You can use a = SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; As has been pointed out a few times, this will give a number with 100 digits of precision. But that number will not resemble: Clear[a,b] a = SetPrecision[77617,100]; b = SetPrecision[33096,100]; 33375/100*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 11/2*b^8 + a/(2*b) or any of the equivalent variations that have been presented in this thread. (ii) You can make input exact before doing any approximate arithmetic wherein canellation error might arise. Using Rationalize, I show this below. Clear[a,b] f = 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b) f = Rationalize[f] In[39]:= Precision[N[f /. {a->77617,b->33096}, 100]] Out[39]= 100. (iii) You cannot do what you want because you work with low precision input and want a high precision result. > Assume that I want accuracy and precision of 100 for > f. You advice me to make experiments to find out, what > should be the initial precision and accuracy of a and > b to reach the requested accuracy and precision for f. > Notice, that you cannot just repeat I[26], we saw > already what happens. I have to re-type I[24], I[25], > I[26], I[27], I[28], and I[29] as many times as needed > to get f with accuracy and precision 100. I am curious to know how exactly you defined I[...]. It involves a protected symbol. In[54]:= I[a_] := a^2 SetDelayed::write: Tag Complex in I[a_] is Protected. Out[54]= $Failed As for obtaining requested accuracy or precision, I gave no such advice. If you begin with exact input this can be done via N as per response (ii) above. I did not do any experimenting but simply directed N[] to find the result to 100 digits precision. > Dan, you simply advocate to do MANUAL WORK that should > be done by machine. See my above remark. > Let's suppose that in the above example I just want 60 > digits not 61. Precisely, I want 60 digits and nothing > or zeros afterwards. Let's see if I could use > SetAccuracy. In[30]:= > SetAccuracy[%, 60] Out[30]= > -0.82739605994682136814116509547981629199903311578438481991781 In[31]:= > % // FullForm Out[30]//FullForm= > -0.827396059946821368141165095479816291999033115784384819917814841672467988` > 59.9177 Oops, it did not work (as expected). Actually it did. You have 59.9177 digits of precision. If you check you will find that you have 60. digits of accuracy as you had requested. > [...] > Dan, is there any simple way to get what I want? If what you wanted was a number with 60 digits accuracy (which certainly was what you requested), then indeed you got it. > As I repeated already number of times, at this stage > of the development of computer technology, software > should do it for me (!). We both know that this is > doable. Some of the textbooks that you just advised me > to read describe it. As a developer of Mathematica, > tell us why do you consider this to be a bad idea? Peter Kosta First I must request references since I am not certain what exactly you have in mind that the software will do. Then I'll comment on what, as best I can assess, you seem to want the software to do. Based on prior notes from you in this thread, it appears that you want it to treat a number such as 1.2 as an exact entity 5/6. This can be done by exact methods, e.g. preprocessing so that all numbers get rationalized. It cannot be done by our numerical engine (or any other), as that will not rationalize for you. It can also be done by you working with exact input. This would be a simple expedient, but quite effective. I would consider it to be a terrible idea to automatically rationalize every approximate number input and then to work with exact arithmetic. While I am not certain this is what you advocate, it is the only interpretation I can find with would allow for the sort of result you seem to expect. It is a terrible idea because it bypasses solid numerical methods that have been developed over several decades for handling computations accurately and reliably (subject to appropriate input!), and in reasonable time. It would entirely disable any functionality for which no exact methods are known, e.g. solving many ODEs, optimization, and the like. I could go on for a while but I my four typing fingers will get sore. I'll just finish by noting that it is a terrible idea because it would punish all users of numeric computation in Mathematica. I fail to see any useful purpose in that. Mind you, while I regard it as a terrible idea, I am still not certain that this was in fact what you propose. Again, it would be helpful to software) so I can see what it is you really want. Daniel Lichtblau Wolfram Research ==== > Here's an even more extreme result: f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - > 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50]; > a = 77617.; b = 33096.; > f > Precision[f] -1.180591620717411303424`71.0721*^21 > 71 71.0721 digits of precision? I don't think so!! Either I am it altogether or you are just simply beating to death the point that in case of machine arithmetic (only!) Precision and Accuracy are purely formal and essentially meaningless. One can argue whether in this case there is any point of returning any value for Precision, or Accuracy (like 71 above, or -5 for Accuracy in the example that fooled me), but it's not a big deal and it most certainly does not make SetPrecision meaningless. On the contrary, SetPrecision is very useful and in fact it is SetPrecision that can tell you that the answer above is meaningless: In[8]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50]; a=SetPrecision[77617.,$MachinePrecision]; b = SetPrecision[ 33096.,$MachinePrecision]; In[10]:= {f,Precision[f]} Out[10]= {1.19801754103509`0*^19, 0} I would say this is correct and show that SetPrecision is very useful indeed. It tells you (what of course you ought to already know in this case anyway) that machine precision will not give you a realiable answer in this case. If you know your numbers with a great deal of accuracy you can get an accurate answer: In[24]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; In[26]:= {f, Precision[f]} Out[26]= {-0.82739605994682136814116509547981629199903311578438481991 781484167246798617832`61.2597, 61} Again you can be pretty sure that you got an accurate answer, provided of course your original setting of precision was valid. Honestly, to say that SetPrecision and SetAccuaracy are useless is one of the silliest thing I have read on this list in years. > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ ==== [...] > I would say this is correct and show that SetPrecision is very useful > indeed. It tells you (what of course you ought to already know in this > case anyway) that machine precision will not give you a realiable > answer in this case. If you know your numbers with a great deal of > accuracy you can get an accurate answer: > In[24]:= > f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - > 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; > a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; > > In[26]:= > {f, Precision[f]} > Out[26]= > {-0.82739605994682136814116509547981629199903311578438481991 > 781484167246798617832`61.2597, 61} > > Congratulations! You just requested accuracy of 100 for f and got 61 ( > to convince yourself add Accuracy[f] to In[26]). If In[24] one > replaces SetAccuracy by SetPrecision the result is similar. PK > [...] One has (initially) an accuracy of 100 for an expression that contains variables. In[25]:= Clear[a,b,f] In[26]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; In[27]:= Accuracy[f] Out[27]= 100. Now we assign values to some indeterminants in f. In[28]:= a = SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; In[29]:= {f, Precision[f], Accuracy[f]} Out[29]= {-0.8273960599468213681411650954798162919990331157843848199178148, 61.2599, 61.3422} The precision and accuracy has dropped. This is all according to standard numerical analysis regarding cancellation error. You'll find it in any textbook on the topic. As for what happens when you artificially raise precision (or accuracy) of machine numbers far beyond that guaranteed by their internal representation, that falls into to category of garbage in, garbage out. It is, howoever, valid to use SetPrecision to raise precision in (typically iterative) algorithms where significance arithmetic might be unduly pessimistic due to incorrect assumptions about uncorollatedness of numerical error. Examples of such usage have appeared in this news group. Daniel Lichtblau Wolfram Research ==== [...] I would say this is correct and show that SetPrecision is very useful > indeed. It tells you (what of course you ought to already know in this > case anyway) that machine precision will not give you a realiable > answer in this case. If you know your numbers with a great deal of > accuracy you can get an accurate answer: In[24]:= > f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - > 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; > a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; > In[26]:= > {f, Precision[f]} Out[26]= > {-0.82739605994682136814116509547981629199903311578438481991 > 781484167246798617832`61.2597, 61} > Congratulations! You just requested accuracy of 100 for f and got 61 ( to convince yourself add Accuracy[f] to In[26]). If In[24] one replaces SetAccuracy by SetPrecision the result is similar. PK > Again you can be pretty sure that you got an accurate answer, provided > of course your original setting of precision was valid. Honestly, to say that SetPrecision and SetAccuaracy are useless is one > of the silliest thing I have read on this list in years. > Andrzej Kozlowski > Yokohama, Japan > http://www.mimuw.edu.pl/~akoz/ > http://platon.c.u-tokyo.ac.jp/andrzej/ ==== I've been trying to use PlotVectorField for the following differential equation: dy/dt = 0.08*y*(1-y/1000) but I haven't been successful yet. I tried to do the following: f[t_, y_] := {1, 0.08*y*(1 - y/1000)} < 1]; -- Steve Luttrell West Malvern, UK > I've been trying to use PlotVectorField for the > following differential equation: > dy/dt = 0.08*y*(1-y/1000) > but I haven't been successful yet. > I tried to do the following: > f[t_, y_] := {1, 0.08*y*(1 - y/1000)} > < PlotVectorField[f[t, y], {t, 0, 80}, {y, 0, 1400}]; > but I'm getting a meaningless plot so I'd appreciate > if someone could tell me what is what I'm doing wrong. > Ruben __________________________________________________ > Do you Yahoo!? > http://faith.yahoo.com > ==== Dear group, I have the following question regarding a lengthy calculation using Mathematica: For given w points in x direction and h points in y direction, I can construct all the points using h=10; w=8; points=Flatten[Transpose[Outer[List,Range[w],Range[h]]],1] Next, I need to find all the possible pairs of point including points themselves, i.e., pair AA. I can use pairs=Outer[List,points,points,1] Then, I have to clear those pairs that repeat themselves, i.e., pair AB and pair BA. Also, when w and h are of the order of 1000s, the computation takes a very long time. Is there a better way of doing the second part of Sincerely Cheng ==================================================== Cheng Liu, Ph.D. MST-8, Structure/Property Relations Materials Science and Technology Division Los Alamos National Laboratory Los Alamos, New Mexico 87545 ==================================================== ==== Cheng, If you have h and w on the order of 1000, then your points list will have 10^6 points in it. If you then want to have a list of every possible pair of points, that list will consist of 10^12 pairs. Each pair of points consists of 4 integers, so that means your pairs list will have 4 10^12 integers in it. Even if Mathematica could store each integer using 4 bytes, that would require over 10^13 bytes, or 10000 gigabytes of storage. In order for Mathematica to function efficiently, the above storage must be in memory and not in virtual memory on the hard drive. In other words, creating such a pairs list is impossible at the present time, and is probably impossible for the forseeable future. If you truly need such a pairs list, then you may be able to work with h and w on the order of 100 if you have a large amount of memory. What in the world are you trying to do? I doubt that creating such a pairs list is necessary for you to accomplish whatever it is you are trying to do. Carl Woll Physics Dept U of Washington > Dear group, I have the following question regarding a lengthy calculation > using Mathematica: For given w points in x direction and h points in y direction, I can > construct all the points using h=10; w=8; > points=Flatten[Transpose[Outer[List,Range[w],Range[h]]],1] Next, I need to find all the possible pairs of point including points > themselves, i.e., pair AA. I can use pairs=Outer[List,points,points,1] Then, I have to clear those pairs that repeat themselves, i.e., pair AB and > pair BA. Also, when w and h are of the order of 1000s, the computation > takes a very long time. Is there a better way of doing the second part of Sincerely Cheng > ==================================================== > Cheng Liu, Ph.D. > MST-8, Structure/Property Relations > Materials Science and Technology Division > Los Alamos National Laboratory > Los Alamos, New Mexico 87545 ==================================================== ==== >I've been using Mathematica 4.1 on Win98 as a word processor for >math-related documents, but often people that need to see the documents >don't have Mathematica, and for whatever reason on my computer the HTML >saves don't work at all. I'd like to export to PDF format. I can export >images to PDF format no problem using, for example >Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], >and I can export cells correctly to GIF, JPEG, and WMF formats (probably >more, those are the only ones I tested) using, for example >Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy >As->Cell Expression)...> ]] >When I change the filename to a .PDF and evaluate the cell, the program >displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf >' message as if a file was created, but no file is created anywhere with any >name that I could find with Start->Find->[All files and folders created in >the previous day]. >Is there a limitation to PDF exporting I don't know about? Do I need to >upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I >need a faster computer? A patch? Something else? This is a limitation of PDF export. The mechanism for exporting GIF, JPEG, and other raster formats is completely different than the system used for PDF export. Because of this PDF export is limited to graphics expressions. Cells and Notebooks cannot be converted via Export. However, there is a way to generate PDFs using the frontend. See http://support.wolfram.com/mathematica/graphics/export/convertpdfghostscript .html http://support.wolfram.com/mathematica/graphics/export/convertpdfdistiller.h tml ==== how can Mathematica 4.1 be used to combine sound and graphics? In particular, I would like to prepare a demo video about differential equations. I can Plot the solution and I can Play the solution. How to combine the 2 results into a single file that can be played back using xine or DivX, like ordinary video can? ==== it depends a bit what you want to do. E.g.: If you want to write applications for clients then go with that systems your clients use (probably Windows). If you just use it for yourself, for development: use what you like more. anymore, like there were in 3.0 times. The copy and paste problems are gone if you switch off the KDE Klipper. On the other hand, there are a few OS- (or better Window-manager-specific) 1.: you cannot rotate text (i.e., FrameLabel settings will look weird (vertically arranged horizontal letters), you have to use RotateLabel -> False generally, or play with the Fonts settings such that horizontal tick marks still fit) 2.: If you work with bigger graphics in notebooks I suggest Windows (or MacOS X) since least on my XFree 4.2 installation with a not too modern graphics card). Also I find resizing of larger notebooks somewhat slow. 3.: If you like to work with keyboard shortcuts: Windows is better, clearly. 4.: There are a couple of Font issues which are better on Windows since not all fonts ==== I'd like to add a JLink animation of the rolling ball based on Selwyn's solution: UseFrontEndForRendering = False; createWindow[] := Module[{frame}, frame = JavaNew[com.wolfram.jlink.MathFrame, Doppler Animation]; drawArea = JavaNew[com.wolfram.jlink.MathCanvas]; drawArea@setUsesFE[UseFrontEndForRendering]; drawArea@setSize[800, 600]; JavaBlock[frame@setLayout[JavaNew[java.awt.BorderLayout]]; frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]]; frame@pack[]; frame@setSize[800, 600]; frame@setLocation[200, 200]; JavaShow[frame]]; frame ] drawRoll[t_] := Show[curve, Graphics[{RGBColor[1, 0, 0], Disk[{xx[t], Cosh[xx[t]]}, 0.05]}], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes -> None, DisplayFunction -> Identity]; times = Range[0, 5, .05]; LoadJavaClass[java.lang.Thread]; AnimationPlot[t_List] := JavaBlock[Block[{frm}, frm = createWindow[]; Map[(obj = drawRoll[#]; drawArea@setMathCommand[obj]; drawArea@repaintNow[]; Thread@sleep[5];) &, t ] ]] AnimationPlot[times] jerry blimbaum panama city, fl -----Original Message----- and the equation of motion is diffeq = Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ] Now solve and animate ... xx[t_] = x[t]/. First[ NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]] curve = Plot[Cosh[x], {x, -1, 1}] Do[ Show[curve, Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes->None], {t, 0, 5, 0.1}] ---- > I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the > right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my means. ==== I noticed that n Mathematica 3.0 , IntegerDigits function is giving wrong results. This problem is not found in Mathematica 4.1. Whether any body else has also noted any such problem. For example IntegerDigits[10^18+7] will give the digits 0 and 7 , omitting 1. ==== You're right; I wasn't exporting a Cell. I misunderstood his post and successfully executed this: Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]] but that was working for him, already. Sorry for the confusion. ==== > w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > 2. In the latter case I also want to plot 4 types of points. > How do I get ListPlot to put down 4 plots superimposed? > Or can't I? You can, but you have to do it via Graphics`MulitpleListPlot`. Load the requisite packages Needs[Graphics`Colors`] Needs[Graphics`MultipleListPlot`] Define cols = {Black, Red, Green, Blue}; pnts = {PlotSymbol[Triangle], PlotSymbol[Box], PlotSymbol[Diamond], PlotSymbol[Star]}; Then grf = MultipleListPlot[w, x, y, z, PlotStyle->cols, SymbolShape->pnts, SymbolsStyle->cols ]; Documentation shows how to incorporate legends and to define other symbols. >How can I change points properties (such as Size and Color) for the plot >below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` > >listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, >{6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; > >LabeledListPlot[listcities, Axes -> None, Frame -> True, > DisplayFunction -> $DisplayFunction] It's not a built-in feature of LabeledListPlot, so you'll have to do it manually. gr=LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] You can add graphics directives to the points and text with a replacement rule. Show[gr/.x_Point|x_Text->{RGBColor[1,0,0],x}] >Question Three: Why the Goto statement below is not working? > >q = 2; >Label[start]; >q = 3; >Label[begin]; >Print[q]; >q += 1; If[q < 6, Goto[begin], Goto[start]] First, let me say that noone should ever use Goto. You should always use a loop or some other process instead. With that said . . . When you type semicolon separated input into the frontend, each command is treated as a separate input (as if they were in separate input cells). So the Labels and the Gotos are evaluated separately and there's no way to jump from one to the other. Instead, the commands need to be within the same expression. This can be done by wrapping the command in a CompoundExpression ( q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] ) Or some other expression, like a Module. -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== >I would appreciate help with these problems: 1. I'm plotting several thousand points, which I can do >either with something like this (this is a test): > >w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >dw = Graphics[{PointSize[0.01], RGBColor[ 1, 0, 0], w}]; >dx = Graphics[{PointSize[0.01], RGBColor[.8, .8, .8], x}]; >dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; >dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; >Show[dw, dx, dy, dz, AspectRatio -> Automatic, > PlotRange -> {{0, 1}, {0, 1}}, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026], > >This gives me dots in 4 colors for distinguishing different >kinds of points in my real application. This works fine but >needs the Point structure. Or, I can do (this is for one >kind of point), > >t = Table[{Random[], Random[]}, {i, 1, 1024}]; >ListPlot[t, AspectRatio -> Automatic, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026] > ]; > >which seems simpler and may fit into the rest of the program >more easily. 1. How do I get the RGBColor Rule or the equivalent into >the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. >How do I get ListPlot to put down 4 plots superimposed? >Or can't I? 3. In either case, I need to make the whole plot area about >twice as big. That is, it now occupies about a 4 square. To >see details better in my real plot, and because with 16k points >the small plot just looks almost like a solid blur, I want to >make it more like 8 square, or as big as will fit the screen >(without changing the plot range or anything else). There >must be a scale factor somewhere. > You can plot more than one list with MultipleListPlot. <Automatic,Axes->Automatic,Frame->True, SymbolShape->{ColorPoint[RGBColor[1,0,0]], ColorPoint[RGBColor[.8, .8, .8]],ColorPoint[RGBColor[ 0, .5, .9]], ColorPoint[RGBColor[.8, .8, 0]]}, SymbolStyle->PointSize[0.01],Background->GrayLevel[.026] ] -------------------------------------------------------------- http://www.wz.com/internet/Mathematica.html ==== >I have to use a graphics of mathematica with powerpoint for a little >Y-axes and line of function) are bold or more visible: how can I do >that? Use the PlotStyle and AxesStyle options as in Plot[x,{x,0,5},PlotStyle->Thickness[0.015],AxesStyle->Thickness[0.015]] ==== how can Mathematica 4.1 be used to combine sound and graphics? In particular, I would like to prepare a demo video about differential equations. I can Plot the solution and I can Play the solution. How to combine the 2 results into a single file that can be played back using xine or DivX, like ordinary video can? http://staffold.vscht.cz/mat/Pavel.Pokorny ==== I'd like to add a JLink animation of the rolling ball based on Selwyn's solution: UseFrontEndForRendering = False; createWindow[] := Module[{frame}, frame = JavaNew[com.wolfram.jlink.MathFrame, Doppler Animation]; drawArea = JavaNew[com.wolfram.jlink.MathCanvas]; drawArea@setUsesFE[UseFrontEndForRendering]; drawArea@setSize[800, 600]; JavaBlock[frame@setLayout[JavaNew[java.awt.BorderLayout]]; frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]]; frame@pack[]; frame@setSize[800, 600]; frame@setLocation[200, 200]; JavaShow[frame]]; frame ] drawRoll[t_] := Show[curve, Graphics[{RGBColor[1, 0, 0], Disk[{xx[t], Cosh[xx[t]]}, 0.05]}], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes -> None, DisplayFunction -> Identity]; times = Range[0, 5, .05]; LoadJavaClass[java.lang.Thread]; AnimationPlot[t_List] := JavaBlock[Block[{frm}, frm = createWindow[]; Map[(obj = drawRoll[#]; drawArea@setMathCommand[obj]; drawArea@repaintNow[]; Thread@sleep[5];) &, t ] ]] AnimationPlot[times] jerry blimbaum panama city, fl -----Original Message----- and the equation of motion is diffeq = Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ] Now solve and animate ... xx[t_] = x[t]/. First[ NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]] curve = Plot[Cosh[x], {x, -1, 1}] Do[ Show[curve, Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes->None], {t, 0, 5, 0.1}] ---- Selwyn Hollis > Dear Colleagues, I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the > right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my > means. > Matthias Bode > Sal. Oppenheim jr. & Cie. KGaA > Koenigsberger Strasse 29 > D-60487 Frankfurt am Main > GERMANY > Mobile: +49(0)172 6 74 95 77 > Internet: http://www.oppenheim.de ==== >I've been using Mathematica 4.1 on Win98 as a word processor for >math-related documents, but often people that need to see the documents >don't have Mathematica, and for whatever reason on my computer the HTML >saves don't work at all. I'd like to export to PDF format. I can export >images to PDF format no problem using, for example >Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], >and I can export cells correctly to GIF, JPEG, and WMF formats (probably >more, those are the only ones I tested) using, for example >Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy >As->Cell Expression)...> ]] >When I change the filename to a .PDF and evaluate the cell, the program >displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf >' message as if a file was created, but no file is created anywhere with any >name that I could find with Start->Find->[All files and folders created in >the previous day]. >Is there a limitation to PDF exporting I don't know about? Do I need to >upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I >need a faster computer? A patch? Something else? This is a limitation of PDF export. The mechanism for exporting GIF, JPEG, and other raster formats is completely different than the system used for PDF export. Because of this PDF export is limited to graphics expressions. Cells and Notebooks cannot be converted via Export. However, there is a way to generate PDFs using the frontend. See http://support.wolfram.com/mathematica/graphics/export/convertpdfghostscript .html http://support.wolfram.com/mathematica/graphics/export/convertpdfdistiller.h tml -Dale ==== I noticed that n Mathematica 3.0 , IntegerDigits function is giving wrong results. This problem is not found in Mathematica 4.1. Whether any body else has also noted any such problem. For example IntegerDigits[10^18+7] will give the digits 0 and 7 , omitting 1. Shyam Sunder Gupta ==== You're right; I wasn't exporting a Cell. I misunderstood his post and successfully executed this: Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]] but that was working for him, already. Sorry for the confusion. Bobby -----Original Message----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== > w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > 2. In the latter case I also want to plot 4 types of points. > How do I get ListPlot to put down 4 plots superimposed? > Or can't I? You can, but you have to do it via Graphics`MulitpleListPlot`. Load the requisite packages Needs[Graphics`Colors`] Needs[Graphics`MultipleListPlot`] Define cols = {Black, Red, Green, Blue}; pnts = {PlotSymbol[Triangle], PlotSymbol[Box], PlotSymbol[Diamond], PlotSymbol[Star]}; Then grf = MultipleListPlot[w, x, y, z, PlotStyle->cols, SymbolShape->pnts, SymbolsStyle->cols ]; Documentation shows how to incorporate legends and to define other symbols. Dave. ========================================== Dr. David Annetts EM Modelling Analyst Australia David.Annetts@csiro.au =========================================== ==== >Dear Group, It is a pleasure write to you again. I have three questions to ask. > Alexandre Costa > >Question Two: > >How can I change points properties (such as Size and Color) for the plot >below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` > >listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, >{6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; > >LabeledListPlot[listcities, Axes -> None, Frame -> True, > DisplayFunction -> $DisplayFunction] It's not a built-in feature of LabeledListPlot, so you'll have to do it manually. gr=LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] You can add graphics directives to the points and text with a replacement rule. Show[gr/.x_Point|x_Text->{RGBColor[1,0,0],x}] >Question Three: Why the Goto statement below is not working? > >q = 2; >Label[start]; >q = 3; >Label[begin]; >Print[q]; >q += 1; If[q < 6, Goto[begin], Goto[start]] First, let me say that noone should ever use Goto. You should always use a loop or some other process instead. With that said . . . When you type semicolon separated input into the frontend, each command is treated as a separate input (as if they were in separate input cells). So the Labels and the Gotos are evaluated separately and there's no way to jump from one to the other. Instead, the commands need to be within the same expression. This can be done by wrapping the command in a CompoundExpression ( q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] ) Or some other expression, like a Module. -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== Mario: Use, for example, PlotStyle->Thickness[0.01] for plot and AxesStyle->Thickness[0.01]. Other way is using AbsoluteThickness instead of Thickness. See The Mathematica Book: Section 2.9.3. Germ.87n Buitrago A. ----- Original Message ----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== Mario: Use, for example, PlotStyle->Thickness[0.01] for plot and AxesStyle->Thickness[0.01]. Other way is using AbsoluteThickness instead of Thickness. See The Mathematica Book: Section 2.9.3. Germ.87n Buitrago A. ----- Original Message ----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== >I have to use a graphics of mathematica with powerpoint for a little >Y-axes and line of function) are bold or more visible: how can I do >that? Use the PlotStyle and AxesStyle options as in Plot[x,{x,0,5},PlotStyle->Thickness[0.015],AxesStyle->Thickness[0.015]] ==== >I would appreciate help with these problems: 1. I'm plotting several thousand points, which I can do >either with something like this (this is a test): > >w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >dw = Graphics[{PointSize[0.01], RGBColor[ 1, 0, 0], w}]; >dx = Graphics[{PointSize[0.01], RGBColor[.8, .8, .8], x}]; >dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; >dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; >Show[dw, dx, dy, dz, AspectRatio -> Automatic, > PlotRange -> {{0, 1}, {0, 1}}, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026], > >This gives me dots in 4 colors for distinguishing different >kinds of points in my real application. This works fine but >needs the Point structure. Or, I can do (this is for one >kind of point), > >t = Table[{Random[], Random[]}, {i, 1, 1024}]; >ListPlot[t, AspectRatio -> Automatic, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026] > ]; > >which seems simpler and may fit into the rest of the program >more easily. 1. How do I get the RGBColor Rule or the equivalent into >the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. >How do I get ListPlot to put down 4 plots superimposed? >Or can't I? 3. In either case, I need to make the whole plot area about >twice as big. That is, it now occupies about a 4 square. To >see details better in my real plot, and because with 16k points >the small plot just looks almost like a solid blur, I want to >make it more like 8 square, or as big as will fit the screen >(without changing the plot range or anything else). There >must be a scale factor somewhere. > You can plot more than one list with MultipleListPlot. <Automatic,Axes->Automatic,Frame->True, SymbolShape->{ColorPoint[RGBColor[1,0,0]], ColorPoint[RGBColor[.8, .8, .8]],ColorPoint[RGBColor[ 0, .5, .9]], ColorPoint[RGBColor[.8, .8, 0]]}, SymbolStyle->PointSize[0.01],Background->GrayLevel[.026] ] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== For the life of me I am not sure why the following is not working in my v. 4.2: ru[a]=a->x; f[x_]:=(a+b) /. ru[a]; Why do I get f[c] = b+x and not f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com Reply-To: kuska@informatik.uni-leipzig.de ==== because te right hand side of SetDelayed[] is not evaluate. Try ru[a] = a -> x; f[x_] := (a + b) /. ru[a]; f1[x_] := Evaluate[(a + b) /. ru[a]]; and f1[] does what you expect In[]:={f[c], f1[c]} Out[]={b + x, b + c} Jens > For the life of me I am not sure why the following is not working in my > v. 4.2: ru[a]=a->x; > f[x_]:=(a+b) /. ru[a]; Why do I get > f[c] = b+x and not > f[c] = b+c? What gives? Lawrence -- > Lawrence A. Walker Jr. > http://www.kingshonor.com ==== > Could you tell me the CPU you used and its speed etc...i am curious, > other programs out there. I used one processor of a dual 1GH Mac and got the same answer with the following speed: 4.2 for Mac OS X (June 4, 2002) oldmax = $MaxPrecision 6 1. 10 $MaxPrecision = Infinity Infinity With[{n = 2^26}, Timing[ pd = RealDigits[N[Pi, n + 1], 10, 20, 19 - n]; ]] {28794.1 Second, Null} MaxMemoryUsed[] 512055204 pd {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, 4, 0, 9, 8, 0, 3}, -67108844} Tom Burton -- ==== So would it take about the same amont of time for the complete printout of digits? Of course it would take a few additional seconds to format the output... Or does Mathematica take alot less time when it truncates the output? > Could you tell me the CPU you used and its speed etc...i am curious, > other programs out there. I used one processor of a dual 1GH Mac and got the same answer with the > following speed: 4.2 for Mac OS X (June 4, 2002) > oldmax = $MaxPrecision > 6 > 1. 10 > $MaxPrecision = Infinity > Infinity > With[{n = 2^26}, Timing[ > pd = RealDigits[N[Pi, n + 1], 10, 20, > 19 - n]; ]] > {28794.1 Second, Null} > MaxMemoryUsed[] > 512055204 > pd > {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, > > 4, 0, 9, 8, 0, 3}, -67108844} Tom Burton ==== Sir, we are having FreeBSD Server, In this we connected a heavy duty Dot matrix printer locally. While on taking outputs, username and file name are printing as BANNER TYPE. Instead of this, we would like to take the print out as username and file name should be printed as header through out the file. if u are having any scripts like that please send us Raj Mohan System Administrator ==== I am considering the following integral W[m_,n_]:=Integrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}] where m,n are reals >=0. With Mathematica 4.1 I obtain: If[Re[m+n]>-1, -Cos[(m-n)Pi/2]/(2 Pi)* (2 EulerGamma + Log[4] + PolyGamma[0, 1/2(1 + m - n)] + PolyGamma[0, 1/2(1 - m + n)] + 2PolyGamma[0, 1/2(1 + m + n)]) and so using this answer as a definition I obtain W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi)=0.84564 I suspect that these integrals are divergent (*). So I try the numerical integration: NW[m_,n_]:=NIntegrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}] so that NW[0,0]=11.167 Othe couples are W[1,0]=Indeterminate NW[1,0]=0.597973 W[0,1.5]=0.537095 NW[0,1.5]=-5.79306 W[1,1]=0.20902 NW[1,1]=17.5425 W[2,0]=0.427599 NW[2,0]=-6.83464 W[2,1]=Indeterminate NW[2,1]=4.69013 (*) The integral is a particular case of the Weber-Schafheitlin integrals (Abramowitz, 11.4.33). Any explanation about the analytical expression will be gratefully accepteed. Roberto. Roberto Brambilla CESI Via Rubattino 54 20134 Milano tel +39.02.2125.5875 fax +39.02.2125.5492 rlbrambilla@cesi.it ==== WRI Tech Support sent me an answer to the font problem. Copying the Type 1 (not True Type) fonts made the error go away: A workaround for the font-related issue that you encountered, is to place copies of the Mathematica Type 1 fonts from C:Program FilesWolfram ResearchMathematica4.2SystemFilesFontsType1 into C:Program FilesAdobeAcrobat 5.0ResourceFont Sincerely, George Kambouroglou Technical Support Wolfram Research, Inc. support@wolfram.com -----Original Message----- I've been using Mathematica 4.1 on Win98 as a word processor for math-related documents, but often people that need to see the documents don't have Mathematica, and for whatever reason on my computer the HTML saves don't work at all. I'd like to export to PDF format. I can export images to PDF format no problem using, for example Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], and I can export cells correctly to GIF, JPEG, and WMF formats (probably more, those are the only ones I tested) using, for example Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy As->Cell Expression)...> ]] When I change the filename to a .PDF and evaluate the cell, the program displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf ' message as if a file was created, but no file is created anywhere with any name that I could find with Start->Find->[All files and folders created in the previous day]. Is there a limitation to PDF exporting I don't know about? Do I need to upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I need a faster computer? A patch? Something else? ==== SSG> I noticed that n Mathematica 3.0 , IntegerDigits function is SSG> giving wrong results. This problem is not found in Mathematica SSG> 4.1. Whether anybody else has also noted any such problem. SSG> For example IntegerDigits[10^18+7] will give the digits 0 SSG> and 7, omitting 1. Having made totally 4,000,000 attemtps, I was not able to reproduce your example. What version of Mathematica do you use? ...................................................... 4.2 for Microsoft Windows (February 28, 2002) 4.1 for Microsoft Windows (November 2, 2000) 4.0 for Microsoft Windows (April 21, 1999) Microsoft Windows 3.0 (April 25, 1997) Windows 387 2.2 (April 9, 1993) IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} ...................................................... Best wishes, Vladimir Bondarenko Mathematical Director Symbolic Testing Group Web : http://www.CAS-testing.org/ http://maple.bug-list.org/VER2/ (under tuning) http://maple.bug-list.org/VER3/ (under tuning) http://maple.bug-list.org/VER1/ (under tuning) Voice : (380)-652-447325 Mon-Fri 9 a.m.-6 p.m. Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== Just tested it with no errors, version 3.0 John A. Velling -----Original Message----- ==== You can use Export[file.dat, expr] where expr is a two-dimensional array. Or for more flexibility study the following. Assuming data has n rows and 2 columns. file = OpenWrite[file.dat]; Map[ ( (* the N may be redundant haven't tested the code w/o it *) str = ToString[PaddedForm[N[#[[1]]],{10,6}]]<> <> ToString[PaddedForm[N[#[[2]]],{10,6}]]; (* make numbers e notation: the *^ notation has given me fits, so I just put this in as a precaution *) str = StringReplace[str, *^ -> e]; WriteString[file, str, n] )&, data]; Close[file] Hope this helps, Lawrence > I'm trying to export a table from Mathematica 4.0 to Notepad, for examples, > or something similar, but it's impossible for me! It always exports the cell > with all its rubbish, or an image (if I use Word). > How can I export just plain _numbers_? Thanx > Fip -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== I'm trying to export a table from Mathematica 4.0 to Notepad, for examples, > or something similar, but it's impossible for me! It always exports the cell > with all its rubbish, or an image (if I use Word). > How can I export just plain _numbers_? Try with this: WriteSimpleTableForm[file_String, data_List, opts___] := Module[{str}, str = OpenWrite[file]; WriteString[str, ToString[TableForm[data, opts]]]; Close[str] ] This is my small solution for this problem. marek ==== I would appreciate any info on these issues. 1. I have a symbol slback. I was getting tag times lback protected (or something) errors. (A typically uninformative error message.) I suspected there was a separation between the s and l, and they looked too far apart, but when I spaced past them with the arrow keys, there did not appear to be anything like a space in between. I retyped the symbol and all was ok. This has happened before. What's going on ??? 2. I'm using Raster to plot data points in a 256x256 array. Two problems: First, regardless of the ImageSize setting (I need the display as big as possible), the individual data cells when examined closely at 300% vary in size by almost 2:1. This makes detailed inspection of the data values difficult. Surely there is some setting of something which would make each data cell an exact number of screen pixels? Second, I'm using Show[ Graphics[Raster[ rescol, ColorFunction -> Hue]], AspectRatio -> Automatic, ImageSize -> 700]; but the Hues don't allow enough easily distinguishable shades to visually recognize even 6 data values easily. (I'm slightly colorblind.) It would be nice to have black and white available for two of the data values, but Hue does not allow this. I don't understand what the documentation says about RasterArray. 3. I wanted to get this raster image into a format where I could dissect it with Photoshop or equivalent. After much fooling around, I found that I can export the selection as an html file, read it into Navigator, do File> Edit Page, which brings up Netscape Composer, right click the image which, allows saving it as a GIF, which I can finally work on with a photo editor. Maybe there is an easier way, or maybe this description will help someone with the same need. Reply-To: kuska@informatik.uni-leipzig.de ==== > I would appreciate any info on these issues. 1. I have a symbol slback. I was getting > tag times lback protected (or something) errors. > (A typically uninformative error message.) > I suspected there was a separation between the s > and l, and they looked too far apart, but when I > spaced past them with the arrow keys, there did > not appear to be anything like a space in between. > I retyped the symbol and all was ok. This has > happened before. What's going on ??? As long as you don't send us the *exact* input we can't help you. You should also send the mathematica version you are using. But typical this error comes from a equation a*b==c where the user has mixed up Equal[] and Set[] 2. I'm using Raster to plot data points > in a 256x256 array. Two problems: First, > regardless of the ImageSize setting (I need the > display as big as possible), the individual data cells > when examined closely at 300% vary in size by > almost 2:1. This makes detailed inspection of the > data values difficult. Surely there is some setting > of something which would make each data cell an > exact number of screen pixels? Second, I'm > using > Show[ Graphics[Raster[ rescol, > ColorFunction -> Hue]], > AspectRatio -> Automatic, > ImageSize -> 700]; > but the Hues don't allow enough easily distinguishable > shades to visually recognize even 6 data values easily. > (I'm slightly colorblind.) The most humans can distinguish 160 gray levels >It would be nice to have black > and white available for two of the data values, but Hue > does not allow this. And something like: mycolor[i_] := Switch[Round[i], 0, RGBColor[0, 0, 0], 1, RGBColor[1, 0, 0], 2, RGBColor[1, 1, 0], 3, RGBColor[0, 1, 0], 4, RGBColor[0, 1, 1], 5, RGBColor[0, 0, 1], _, RGBColor[1, 1, 1]] Show[Graphics[ Raster[Table[Random[Integer, {0, 6}], {16}, {16}], ColorFunction -> mycolor, ColorFunctionScaling -> False]]] does not help ? > I don't understand what the > documentation says about RasterArray. If you can't be more specific *what* you not understand we can not help you. 3. I wanted to get this raster image into a format > where I could dissect it with Photoshop or equivalent. And ? waht does Export[] do ? it write the expression in a desired format, TIFF, PNG, PPM are all lossless compressed bitmap formats, that Mathematica can export and that can be imported into PhotoShop > After much fooling around, I found that I can export the > selection as an html file, read it into Navigator, do File> > Edit Page, which brings up Netscape Composer, right > click the image which, allows saving it as a GIF, which > I can finally work on with a photo editor. Maybe > there is an easier way, or maybe this description will > help someone with the same need. May be that thhis description help someone who can't read the fancy documation on Import[] and Export[]. Jens ==== [snip] > 2. I'm using Raster to plot data points > in a 256x256 array. Two problems: First, > regardless of the ImageSize setting (I need the > display as big as possible), the individual data cells > when examined closely at 300% vary in size by > almost 2:1. This makes detailed inspection of the > data values difficult. Surely there is some setting > of something which would make each data cell an > exact number of screen pixels? GRAY: (No answer received.) I can get around this by making the images bigger but this is not a complete solution. > Second, I'm using > Show[ Graphics[Raster[ rescol, > ColorFunction -> Hue]], > AspectRatio -> Automatic, > ImageSize -> 700]; > but the Hues don't allow enough easily distinguishable > shades to visually recognize even 6 data values easily. > (I'm slightly colorblind.) The most humans can distinguish 160 gray levels >It would be nice to have black > and white available for two of the data values, but Hue > does not allow this. And something like: mycolor[i_] := > Switch[Round[i], > 0, RGBColor[0, 0, 0], > 1, RGBColor[1, 0, 0], > 2, RGBColor[1, 1, 0], > 3, RGBColor[0, 1, 0], > 4, RGBColor[0, 1, 1], > 5, RGBColor[0, 0, 1], > _, RGBColor[1, 1, 1]] Show[Graphics[ > Raster[Table[Random[Integer, {0, 6}], {16}, {16}], > ColorFunction -> mycolor, ColorFunctionScaling -> False]]] GRAY: Sounds good. I'll try it. Interesting that the help does not contain this in a form I could easily find. > 3. I wanted to get this raster image into a format > where I could dissect it with Photoshop or equivalent. And ? what does Export[] do ? it write the expression > in a desired format, TIFF, PNG, PPM are all lossless > compressed bitmap formats, that Mathematica can export > and that can be imported into PhotoShop GRAY: I foolishly thought something like Export would be under the File menu. > After much fooling around, I found that I can export the > selection as an html file, read it into Navigator, do File> > Edit Page, which brings up Netscape Composer, right > click the image which, allows saving it as a GIF, which > I can finally work on with a photo editor. Maybe > there is an easier way, or maybe this description will > help someone with the same need. GRAY: I just found that simply Copying the image and Pasting it into Paint Shop Pro (or no doubt lots of other bitmap editors) works. For outputting a Raster noninteractively, there is Export, but I haven't tried it yet. Jens, thank you for your reply. ==== explain to me why I get this behavior and what I can do to fix it. When I run Mathematica in X with the graphical user interface by typing mathematica, I can run the following commands and get the expected output, namely a plot with the plot label in a big font. However, when I run the math command and get the text interface and run the same code I do not get the label in a big font. cc = Plot[Sin[x], {x, 0, Pi}, {PlotLabel -> StyleForm[Label, FontSize -> 60]}] Export[test.eps, cc, eps] I believe that this is due to the different method in which the math and mathematica commands setup fonts. Is there anyway to get the behavior that I want? As a side note when I use the old syntax of cc=Plot[Sin[x],{x,0,Pi},{PlotLabel->FontForm[Label,{Courier,60}]}] I get it to work. However, I would like not to use this syntax as it has several limitations. Any suggestions would be greatly appreciated. ==== I have a dual processor Dell computer...unfortunately, I can only access one of the processors...I purchased Wolfram's parallel processing toolkit which , because of the very poor documentation, never did me any good...i'm told that another option for accessing the dual processors is to write C code etc...I can't C program, so i'm wondering this...duzz anyone have C code, both source and binary, that they could give me for accomplishing this....in addition, i would like to access this C code with JavaNativeCode, etc...can anyone help me with this? thanks... jerry blimbaum NSWC panama city, fl Reply-To: kuska@informatik.uni-leipzig.de ==== you can have a parallel implicit Runge-Kutta method programmed in C *and* with the Parallel Computing Toolkit both on the base of the MathLink protocol. Since I have a SGI I can't help you with the binary for a Dell what ever computer but if you like the source ... You can also have a native MPI source of the code but you will need a running MPI for your computer. Jens I have a dual processor Dell computer...unfortunately, I can only access one > of the processors...I purchased Wolfram's parallel processing toolkit which > , because of the very poor documentation, never did me any good...i'm told > that another option for accessing the dual processors is to write C code > etc...I can't C program, so i'm wondering this...duzz anyone have C code, > both source and binary, that they could give me for accomplishing this....in > addition, i would like to access this C code with JavaNativeCode, etc...can > anyone help me with this? thanks... jerry blimbaum NSWC panama city, fl ==== I have a set of inequalities that I solve with InequalitySolve. But then it gives a complete set of solutions, but not in the way I would like it to be! :-) For example, the simple following calculation will give: In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >= -1}; InequalitySolve[ineq,{y4,y6,y5}] Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 the result is good, but I would like it to be in the simpler but equivalent form y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 How can I tell InequalitySolve to do that? It is simple for this example, but for a large set of simple inequalities InequalitySolve gives lines and lines of results instead of a simple result. Vincent Bouchard ==== f[c] == (c+b)/.ru[c] == (c+b)/.c->x == x+b == b+x Bobby Treat -----Original Message----- f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== Sorry; disregard my earlier answer. ru[c] isn't defined, so that obviously wasn't the correct sequence of events. Here's the right one: f[c] == HoldPattern[(a+b)/.ru[a]]/.x->c == (a+b)/.ru[a] == (a+b)/.a->x == x + b == b + x The substitution of c for x occurs before the rule ru[a] is evaluated, so there's no x in the expression to replace. Instead, there's an 'a' to replace with x. If the other sequence had been correct, you have no rule for evaluating ru[c], so it would have remained just that -- ru[c]. When the kernel tried to apply it as a rule to (a+b), there would have been an error. That didn't happen, so that wasn't the sequence of events. Bobby Treat -----Original Message----- f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== You really should read about the difference between := (SetDelayed) and = (Set). When you enter your definition f[x_]:=(a+b) /. ru[a] the right hand side is not evaluated. So next when you evaluate f[c] you get (a+b)/.ru[a] and only now ru[a] is evaluated, thus giving you (a+b)/.a->x which is b+x There are several ways to get what you want. One is to use = instead of :=, another to force evaluation of the right hand side with f[x_]:=Evaluate[(a+b) /. ru[a]] yet another to insert the actual rule in the definition of f: f[x_]:=(a+b) /. a->x Andrzej Kozlowski Toyama International University JAPAN On Wednesday, September 25, 2002, at 02:50 PM, Lawrence A. Walker Jr. For the life of me I am not sure why the following is not working in my > v. 4.2: ru[a]=a->x; > f[x_]:=(a+b) /. ru[a]; Why do I get > f[c] = b+x and not > f[c] = b+c? What gives? Lawrence -- > Lawrence A. Walker Jr. > http://www.kingshonor.com > ==== Well, I have written the following notebook with Mathematica In[78]:= a=Sqrt[4*Pi/Sqrt[3]] In[79]:= fcom[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(1-Exp[-I*k*(a-mu)])/(I*k)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*(k+2*Pi/a)*(a-mu)])/(I*(k+2*Pi/a))+( 1-Exp[-I*(k-2*Pi/a)*(a-mu)])/(I*(k-2*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(k+4*Pi/a)*(a-mu)])/(I*(k+4*Pi/a))+( 1-Exp[-I*(k+2*Pi/a)*(a-mu)])/(I*(k+2*Pi/a)))+( 1-Exp[-I*(k-2*Pi/a)*(a-mu)])/(I*(k-2*Pi/a))+( 1-Exp[-I*(k-4*Pi/a)*(a-mu)])/(I*(k-4*Pi/a)))/(3*a) In[80]:= f0[k_,mu_]:=((1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(a-mu)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*2*Pi/a*(a-mu)])/(I*(2*Pi/a))+( 1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(4*Pi/a)*(a-mu)])/(I*(4*Pi/a))+( 1-Exp[-I*(2*Pi/a)*(a-mu)])/(I*(2*Pi/a)))+( 1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a))+( 1-Exp[-I*(-4*Pi/a)*(a-mu)])/(I*(-4*Pi/a)))/(3*a) In[81]:= fp1[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(1-Exp[-I*2*Pi/a*(a-mu)])/( I*2*Pi/a)+ Exp[-I*mu*2*Pi/a]*((1-Exp[-I*(4*Pi/a)*(a-mu)])/(I*(4*Pi/a))+(a-mu))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(6*Pi/a)*(a-mu)])/(I*(6*Pi/a))+( 1-Exp[-I*(4*Pi/a)*(a-mu)])/(I*(4*Pi/a)))+( a-mu)+(1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a)))/(3*a) In[82]:= fm1[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*( 1-Exp[I*2*Pi/a*(a-mu)])/(-I*2*Pi/a)+ Exp[-I*mu*2*Pi/a]*((a-mu)+(1-Exp[-I*(-4*Pi/a)*(a-mu)])/(I*(-4*Pi/a)))+ Exp[-I*mu*4*Pi/a]*((1-Exp[-I*(2*Pi/a)*(a-mu)])/(I*(2*Pi/a))+(a-mu))+( 1-Exp[-I*(-4*Pi/a)*(a-mu)])/(I*(-4*Pi/a))+( 1-Exp[-I*(-6*Pi/a)*(a-mu)])/(I*(-6*Pi/a)))/(3*a) In[83]:= fp2[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(1-Exp[-I*4*Pi/a*(a-mu)])/( I*4*Pi/a)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*(6*Pi/a)*(a-mu)])/(I*(6*Pi/a))+(1-Exp[-I*( 2*Pi/a)*(a-mu)])/(I*(2*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(8*Pi/a)*(a-mu)])/(I*(8*Pi/a))+( 1-Exp[-I*(6*Pi/a)*(a-mu)])/(I*(6*Pi/a)))+( 1-Exp[-I*(2*Pi/a)*(a-mu)])/(I*(2*Pi/a))+(a-mu))/(3*a) In[84]:= fm2[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*( 1-Exp[I*4*Pi/a*(a-mu)])/(-I*4*Pi/a)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a))+( 1-Exp[-I*(-6*Pi/a)*(a-mu)])/(I*(-6*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((a-mu)+(1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a)))+( 1-Exp[-I*(-6*Pi/a)*(a-mu)])/(I*(-6*Pi/a))+( 1-Exp[-I*(-8*Pi/a)*(a-mu)])/(I*(-8*Pi/a)))/(3*a) In[85]:= Lp[0|N[0],mu_]:=f0[0,mu] In[86]:= Lp[2*Pi/a|N[2*Pi/a],mu_]:=fp1[2*Pi/a,mu] In[87]:= Lp[-2*Pi/a|-N[2*Pi/a],mu_]:=fm1[2*Pi/a,mu] In[88]:= Lp[4*Pi/a|N[4*Pi/a],mu_]:=fp2[4*Pi/a,mu] In[89]:= Lp[-4*Pi/a|-N[4*Pi/a],mu_]:=fm2[-4*Pi/a,mu] In[90]:= Lp[k_,mu_]:=fcom[k,mu] In[91]:= Ll[k_,mu_]:=0/;mu>=a In[92]:= Ll[k_,mu_]:=0/;mu<=-a In[93]:= Ll[k_,mu_]:=Lp[k,mu]/;0<=muMonteCarlo,MaxPoints->100000000,Compiled->False] but this is not enough to ensure convergence of the integration. Notice that I have inserted some points in the integration path in order to avoid problems with numerical divergences which Mathematica detects in fcom[k,mu] (but these divergences do not really exist, analitically) Does somebody has a smart suggestion to perform this computation? Fabio ==== In a presentation I wish to use Plot to generate a sequence of frames and then animate them. The problem is that the audience sees the animation twice. Once when the frames are being generated and then again after I have closed the group and double clicked on the top graphic. However, the first showing during generation is enough (but uncontrolled). Is it possible to tidy up the generation of the graphic so that it becomes the animation? I have tried the following Do[Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEnd`SelectionAnimate[0.1]}]; FrontEndExecute[{FrontEndToken[Clear]}], {t, 0, 15, 0.1}] This works but the cell dividing line flashes on and off spoiling the animation and if there is anything in the cell below this jumps up and down. Is there a proper way of doing this? Hugh Goyder ==== I need to program the following recursion scheme for time series forecasting (The Innovation Algorithm). I will write it in pseudo-Mathematica notation. K is the given m x m autocovariance (numerical) matrix of the process v[0] = K[[1,1]]; H[n,n-k] = (v[k])^(-1) (K[[n+1,k+1]] - Sum[(H[k,k-j] H[n,n-j] v[j]), {j,0,k-}]) for k=0,1,...,n-1 v[n] = K[[n+1,n+1]] -Sum[(H[n,n-j])^2 v[j],{j,0,n-1}] The scheme should be solved in the order v[0], H[1,1], v[1], H[2,2], H[2,1], v[2], H[3,3], H[3,2], H[3,1], ... I have already tried to program it in a straght-forward way, but as have no experience with recursive functions with two variables, it doesn't seem to work properly and is also very slow. Any help would be Robert Reply-To: murray@math.umass.edu ==== I don't understand the problem. Say I enter the 2D form for the reciprocal of the square root of a^2 + b^2, but I enter it in Standard Form (i.e., using the Control key with / to form the fraction, and the Control key with 2 to get the square root symbol). If then I click anywhere within the subexpression inside the square root, then with 2 to three clicks the entire expression under the square root will be highlighted. I can then do a copy-and-paste to put that into any cell, in the usual way -- with keyboard key combinations, right-click context menu, or Mathematica Edit menu. Isn't that GUI enough? Would you REALLY want to be able to DRAG the highlighted expression to a new place? Think of how much of a mess this could cause through inadvertent movement of the mouse after highlighting some subexpression. In fact, I hate Microsoft Word's doing just that! >I'm a poor physicist trying to figure out how to sort out the >physical from the non-physical solutions to a problem. To do >>that, I need to be able to look at an expression and pick out a >>subexpression, the part under the radical. > GRAY: > This points up the need, which I've been aware of for years, to be > able to select any part of an expression and drag it to a new line for > further processing. Mathematica and the other CAS I'm familiar with are still > pretty much stuck with a command line interface. They need a true > GUI with extensive interaction. > When I can see on the screen exactly what I want to do, why > should I have to type a bunch of stuff in to access what I want? > Maybe we'll see this in version 5? 6? Never? > -- 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 Amherst, MA 01375 ==== > I'm a poor physicist trying to figure out how to sort out the > physical from the non-physical solutions to a problem. To do > that, I need to be able to look at an expression and pick out a > subexpression, the part under the radical. GRAY: This points up the need, which I've been aware of for years, to be able to select any part of an expression and drag it to a new line for further processing. Mathematica and the other CAS I'm familiar with are still pretty much stuck with a command line interface. They need a true GUI with extensive interaction. When I can see on the screen exactly what I want to do, why should I have to type a bunch of stuff in to access what I want? Maybe we'll see this in version 5? 6? Never? Reply-To: murray@math.umass.edu ==== I get the same result in 4.2 (under Windows). Not sure why. But you could try this modification: PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur]; Pause[dur], {i, Length[L]}] Then PlaySeq[{224, 256, 384}, 3] seems to work as expected, prolonging the notes before the last one to their full expected duration. > PlayTone[F_, dur_] := Play[Sin[2*Pi*F*t], {t, 0, dur}] > allows me to play a sine wave of frequency F and duration dur PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur], {i, Length[L]}] should allow me to play a sequence of tones > with a given list of frequencies L > and all the same duration dur. It does not work at least in 4.1 all tones but the last one are much shorter than dur. any help? > -- 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 Amherst, MA 01375 ==== this is almost the solution. but it creates some artificial rests. when the sounds are created, there is some silence between the different notes. when after creation one clicks the play sound icon of the group with all the sounds, these rests disappear. is there a way of Play creating ghte waves, but NOT playing them, and then, doubleclicking the sound icon, hearing the sound without rests immediately? > I get the same result in 4.2 (under Windows). Not sure why. But you > could try this modification: PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur]; > Pause[dur], {i, Length[L]}] Then PlaySeq[{224, 256, 384}, 3] seems to work as expected, prolonging the notes before the last one to > their full expected duration. >>PlayTone[F_, dur_] := Play[Sin[2*Pi*F*t], {t, 0, dur}] >>allows me to play a sine wave of frequency F and duration dur >>PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur], {i, Length[L]}] >>should allow me to play a sequence of tones >>with a given list of frequencies L >>and all the same duration dur. >>It does not work at least in 4.1 >>all tones but the last one are much shorter than dur. >>any help? -- -- Erich Neuwirth, Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at ==== PlayTone[F_, dur_] := Play[Sin[2*Pi*F*t], {t, 0, dur}] allows me to play a sine wave of frequency F and duration dur PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur], {i, Length[L]}] should allow me to play a sequence of tones with a given list of frequencies L and all the same duration dur. It does not work at least in 4.1 all tones but the last one are much shorter than dur. any help? -- -- Erich Neuwirth, Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at ==== using Set (=) instead of SetDelayed (:=) in f[x_]:=(a+b) /. ru[a]; will give you what you desire. Matthias Bode. -----UrsprÌ.b9ngliche Nachricht----- Gesendet: Mittwoch, 25. September 2002 07:51 An: mathgroup@smc.vnet.net Betreff: Strange ReplaceAll behavior For the life of me I am not sure why the following is not working in my v. 4.2: ru[a]=a->x; f[x_]:=(a+b) /. ru[a]; Why do I get f[c] = b+x and not f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== If you want to do it with the mouse, it's not that difficult. I click within the part I want and double-click until the part is selected. (Each double-click expands the selection by one level of nesting.) Then push Ctrl-C, click where you want to put the result, and push Ctrl-V. Does that help any? Bobby -----Original Message----- able to select any part of an expression and drag it to a new line for further processing. Mathematica and the other CAS I'm familiar with are still pretty much stuck with a command line interface. They need a true GUI with extensive interaction. When I can see on the screen exactly what I want to do, why should I have to type a bunch of stuff in to access what I want? Maybe we'll see this in version 5? 6? Never? ==== I met a critical problem for running Mathematica 4.1 on MacOS X 10.2. (OSX native version) I hope such a problem is suitable to be posted to this ML. What happens is the following. When Mathematica 4.1 installed in HDD is started, a window quickly appears saying that A serious error has occured while Mathematica was starting up. Mathematica will probably not function properly until this problem is resolved. ... The Mathematica fonts are not properly installed in your system. Without these fonts, typeset mathematical expressions cannot be displayed properly. This message is correct. If I chose Continue Anyway, mathematical expressins are totally broken. What is strange is that when I start Mathematica 4.1 by double clicking Mathematica in CDROM, it works without any problem. Further more, Once Mathematica 4.1 is correctly started in this way, I can restart Mathematica directly from double clicking Mathematica in HDD, which is the installed one. Once CDROM is ejected, the error appears again. It is clearly font related problem but I do not know how to solve. If someone know how to manage, please let me know. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- I met a critical problem for running Mathematica 4.1 on MacOS X 10.2. (OSX native version) I hope such a problem is suitable to be posted to this ML. What happens is the following. When Mathematica 4.1installed in HDD is started, a window quickly appears saying that A serious error has occured while Mathematica was starting up. Mathematica will probably not function properly until this problem is resolved. ... The Mathematica fonts are not properly installed in your system. Without these fonts, typeset mathematical expressions cannot be displayed properly. This message is correct. If I chose Continue Anyway, mathematical expressins are totally broken. What is strange is that when I start Mathematica 4.1 by double clicking Mathematica in CDROM, it works without any problem. Further more, Once Mathematica 4.1 is correctly started in this way, I can restart Mathematica directly from double clicking Mathematica in HDD, which is the installed one. Once CDROM is ejected, the error appears again. It is clearly font related problem but I do not know how to solve. If someone know how to manage, please let me know. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --Apple-Mail-2-977368608-- ==== Toshinao, Try reinstalling Mathematica from the CD. --- Selwyn Hollis I met a critical problem for running Mathematica 4.1 on MacOS X 10.2. > (OSX native version) I hope such a problem is suitable to be posted to > this ML. What happens is the following. When Mathematica 4.1 installed in HDD > is started, a window quickly appears saying that A serious error has occured while Mathematica was starting up. > Mathematica will probably not function properly until this problem is > resolved. > ... > The Mathematica fonts are not properly installed in your system. > Without these fonts, typeset mathematical expressions cannot be > displayed properly. This message is correct. If I chose Continue Anyway, mathematical > expressins are totally broken. What is strange is that when I start Mathematica 4.1 by double clicking > Mathematica in CDROM, it works without any problem. Further more, > Once Mathematica 4.1 is correctly started in this way, I can restart > Mathematica > directly from double clicking Mathematica in HDD, which is the > installed one. > Once CDROM is ejected, the error appears again. It is clearly font related problem but I do not know how to solve. If > someone > know how to manage, please let me know. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > I met a critical problem for running Mathematica 4.1 on MacOS X 10.2. (OSX native version) I hope such a problem is suitable to be posted to this ML. > What happens is the following. When Mathematica 4.1installed in HDD is started, a window quickly appears saying that > A serious error has occured while Mathematica was starting up. Mathematica will probably not function properly until this problem is resolved. ... The Mathematica fonts are not properly installed in your system. Without these fonts, typeset mathematical expressions cannot be displayed properly. > This message is correct. If I chose Continue Anyway, mathematical expressins are totally broken. > What is strange is that when I start Mathematica 4.1 by double clicking Mathematica in CDROM, it works without any problem. Further more, Once Mathematica 4.1 is correctly started in this way, I can restart > Mathematica directly from double clicking Mathematica in HDD, which is the > installed one. Once CDROM is ejected, the error appears again. > It is clearly font related problem but I do not know how to solve. If > someone know how to manage, please let me know. > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --Apple-Mail-2-977368608-- > ==== The reason why InequalitySolve returns it's answer in what sometimes turns out to be unnecessarily complicated form is that the underlying algorithm, Cylindrical Agebraic Decomposition (CAD) returns its answers in this form. Unfortunately it seems to me unlikely that a simplification of the kind you need can be can be accomplished in any general way. To see why observe the following. First of all: In[1]:= FullSimplify[x > 0 || x == 0] Out[1]= x >= 0 This is fine. However: In[2]:= FullSimplify[x > 0 && x < 2 || x == 0 && x < 2] Out[2]= x == 0 || 0 < x < 2 Of course what you would like is simply 0 <= x < 2. One reason why you can't get it is that while Mathematica can perform a LogicalExpand, as in: In[3]:= LogicalExpand[(x > 0 || x == 0) && x < 2] Out[3]= x == 0 && x < 2 || x > 0 && x < 2 There i no LogicalFactor or anything similar that would reverse what LogicalExpand does. if there was then you could perform the sort of simplifications you need for: In[4]:= FullSimplify[(x > 0 || x == 0) && x < 2] Out[4]= 0 <= x < 2 However, it does not seem to me very likely that such logical factoring can be performed by a general enough algorithm (though I am no expert in this field). In any case, certainly Mathematica can't do this. I also noticed that Mathematica seems unable to show that the answer it returns to your problem is actually equivalent to your simpler one. In fact this looks like a possible bug in Mathematica. Let's first try the function ImpliesQ from the Experimental context: << Experimental` Now Mathematica correctly gives: In[6]:= ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[6]= True However: In[7]:= ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[7]= False That simply means that ImpliesQ cannot show the implication, not that it does not hold. ImpliesQ relies on CAD, as does FullSimplify. Switching to FullSimplify we see that: In[8]:= FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[8]= True while In[9]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[9]= y4 >= -1 && y6 <= y5 <= 1 + y4 + y6 On the other hand, taking just the individual summands of Or as hypotheses; In[10]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[10]= True In[11]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6 ] Out[11]= True In fact FullSimplify is unable to use Or in assumptions, which can be demonstrated on an abstract example: In[12]:= FullSimplify[C,(A||B)&&(C)] Out[12]= True In[13]:= FullSimplify[C,LogicalExpand[(A||B)&&(C)]] Out[13]= C This could be fixed by modifying FullSimplify: In[14]:= Unprotect[FullSimplify]; In[14]:= FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify[exp r,y]]; In[15]:= Protect[FullSimplify]; Now at least we get as before: In[16]:= FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[16]= True but also: In[17]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[17]= True This seems to me a possible worthwhile improvement in FullSimplify, though of course not really helpful for your problem. Andrzej Kozlowski Toyama International University JAPAN > I have a set of inequalities that I solve with InequalitySolve. But > then > it gives a complete set of solutions, but not in the way I would like > it > to be! :-) For example, the simple following calculation will give: In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >= > -1}; > InequalitySolve[ineq,{y4,y6,y5}] Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 the result is good, but I would like it to be in the simpler but > equivalent form y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 How can I tell InequalitySolve to do that? It is simple for this > example, > but for a large set of simple inequalities InequalitySolve gives lines > and > lines of results instead of a simple result. > Vincent Bouchard ==== I have been trying to integrate the following : Integrate[Cosh[2 Abs[x-y]] 2 y, {y,0,1/2}, Assumptions->{Im[x]==0,x>0}] However, Mathematica chokes and simply returns the integral as it is. However, if I split up the integral into two portions, it quickly gives me an answer for the parts. Is there something implicit that I am missing in the Assumptions ? MS. -- 12:02am up 5:06, 1 user, load average: 0.54, 0.22, 0.08 ==== The modification to FullSimplify that I sent earlier works correctly only for assumptions of the form Or[a,b] (and even then not is not always what one would like). For what it's worth here is a better (but slow) version: In[1]:= Unprotect[FullSimplify]; In[2]:= FullSimplify[expr_, x_ || y__] := FullSimplify[ FullSimplify[expr, x] || FullSimplify[expr, Or[y]]]; In[3]:= Protect[FullSimplify]; For example: In[4]:= FullSimplify[Sqrt[(x - 1)^2] + Sqrt[(x - 2)^2] + Sqrt[(x - 3)^2], x > 1 || x > 2 || x > 3] Out[4]= -1 + x + Abs[-3 + x] + Abs[-2 + x] || -3 + 2*x + Abs[-3 + x] || 3*(-2 + x) Andrzej Kozlowski Toyama International University JAPAN > The reason why InequalitySolve returns it's answer in what sometimes > turns out to be unnecessarily complicated form is that the underlying > algorithm, Cylindrical Agebraic Decomposition (CAD) returns its > answers in this form. Unfortunately it seems to me unlikely that a > simplification of the kind you need can be can be accomplished in any > general way. To see why observe the following. First of all: In[1]:= > FullSimplify[x > 0 || x == 0] Out[1]= > x >= 0 This is fine. However: In[2]:= > FullSimplify[x > 0 && x < 2 || x == 0 && x < 2] Out[2]= > x == 0 || 0 < x < 2 Of course what you would like is simply 0 <= x < 2. One reason why you > can't get it is that while Mathematica can perform a LogicalExpand, > as in: > In[3]:= > LogicalExpand[(x > 0 || x == 0) && x < 2] Out[3]= > x == 0 && x < 2 || x > 0 && x < 2 There i no LogicalFactor or anything similar that would reverse what > LogicalExpand does. if there was then you could perform the sort of > simplifications you need for: In[4]:= > FullSimplify[(x > 0 || x == 0) && x < 2] Out[4]= > 0 <= x < 2 However, it does not seem to me very likely that such logical > factoring can be performed by a general enough algorithm (though I am > no expert in this field). In any case, certainly Mathematica can't do > this. I also noticed that Mathematica seems unable to show that the answer > it returns to your problem is actually equivalent to your simpler one. > In fact this looks like a possible bug in Mathematica. Let's first try > the function ImpliesQ from the Experimental context: << Experimental` Now Mathematica correctly gives: In[6]:= > ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] Out[6]= > True However: In[7]:= > ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] Out[7]= > False That simply means that ImpliesQ cannot show the implication, not that > it does not hold. ImpliesQ relies on CAD, as does FullSimplify. > Switching to FullSimplify we see that: In[8]:= > FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] Out[8]= > True while In[9]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] Out[9]= > y4 >= -1 && y6 <= y5 <= 1 + y4 + y6 On the other hand, taking just the individual summands of Or as > hypotheses; > In[10]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[10]= > True In[11]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 ] Out[11]= > True In fact FullSimplify is unable to use Or in assumptions, which can be > demonstrated on an abstract example: > In[12]:= > FullSimplify[C,(A||B)&&(C)] Out[12]= > True In[13]:= > FullSimplify[C,LogicalExpand[(A||B)&&(C)]] Out[13]= > C This could be fixed by modifying FullSimplify: In[14]:= > Unprotect[FullSimplify]; In[14]:= > FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify[ex > pr,y]]; In[15]:= > Protect[FullSimplify]; Now at least we get as before: In[16]:= > FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] Out[16]= > True but also: In[17]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] Out[17]= > True This seems to me a possible worthwhile improvement in FullSimplify, > though of course not really helpful for your problem. > Andrzej Kozlowski > Toyama International University > JAPAN > I have a set of inequalities that I solve with InequalitySolve. But > then > it gives a complete set of solutions, but not in the way I would like > it > to be! :-) For example, the simple following calculation will give: > In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >= -1}; > InequalitySolve[ineq,{y4,y6,y5}] > Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 > the result is good, but I would like it to be in the simpler but > equivalent form > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 > How can I tell InequalitySolve to do that? It is simple for this > example, > but for a large set of simple inequalities InequalitySolve gives > lines and > lines of results instead of a simple result. > Vincent Bouchard > > ==== >-----Original Message----- >Sent: Wednesday, September 25, 2002 7:51 AM > >For the life of me I am not sure why the following is not >working in my >v. 4.2: > >ru[a]=a->x; >f[x_]:=(a+b) /. ru[a]; > >Why do I get >f[c] = b+x > >and not >f[c] = b+c? > >What gives? > >Lawrence -- >Lawrence A. Walker Jr. >http://www.kingshonor.com > Lawrence, in your definition of f, x doesn't show up explicitely. So, in the evaluation sequence, when the definition for f[c] is applied, no x appears at rhs i.e. (a + b) /. ru[a] and such c cannot be inserted. The result is the same as directly executing In[11]:= (a + b) /. ru[a] Out[11]= b + x If you don't like this, you have to make explicit the Value of ru[a] in the definiton of f. One way to do so is to use Set instead of SetDelayed: In[9]:= f[x_] = (a + b) /. ru[a] Out[9]= b + x In[10]:= f[c] Out[10]= b + c The drawback of this that not only the value of ru[a] is inserted but also the whole expression including ReplaceAll is evaluated. If this is not wanted, you have to insert the value of ru[a] into the unevaluated rhs at the definition. The general means for this are function application, With or Replace: In[7]:= (g[x_] := (a + b) /. #) &[ru[a]] In[8]:= g[c] Out[8]= b + c In[16]:= Clear[g] In[20]:= Unevaluated[g[x_] := (a + b) /. rule] /. rule -> ru[a] In[21]:= g[c] Out[21]= b + c Here we have to prevent evaluation of the defintion before our rule is inserted, this is achieved by Unevaluated. With is a bit more complicated, since the scoping rules for SetDelayed would not allow the substition of an expression at rhs containing a pattern variable (the pattern variable is renamed in this case). A simple answer to this is to also substitute the argument variable (the pattern): In[31]:= Clear[g] In[32]:= With[{rule = ru[a], arg = x_}, g[arg] := (a + b) /. rule] In[33]:= g[c] Out[33]= b + c -- Hartmut Wolf ==== Hartmut, I add an explicit illustration to your ingenious solution using With. Hartmut's solution: Clear[g]; ru[a] = a -> x; With[{rule = ru[a], arg = x_}, g[arg] := a + b /. rule]; g[ c] b + c Why is arg = x_ needed? Without it we get Clear[g]; With[{rule=ru[a]}, g[x_]:=a+b/.rule]; g [c] b+x The reason for this shows in ?g Global`g g[x$_] := a + b /. a -> x The x in x_ has been changed to x$ and there is no x$ on the right side. This is a general feature of scoping. Taking it further we get Clear[g]; With[{rule=ru[a]},g[x_]:=a+x/.rule]; g [c] c+x ?g Global`g g[x$_] := a + x$ /. a -> x -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 >-----Original Message----- >Sent: Wednesday, September 25, 2002 7:51 AM > >For the life of me I am not sure why the following is not >working in my >v. 4.2: > >ru[a]=a->x; >f[x_]:=(a+b) /. ru[a]; > >Why do I get >f[c] = b+x > >and not >f[c] = b+c? > >What gives? > >Lawrence >-- >Lawrence A. Walker Jr. >http://www.kingshonor.com Lawrence, in your definition of f, x doesn't show up explicitely. So, in the > evaluation sequence, when the definition for f[c] is applied, no x appears > at rhs i.e. > (a + b) /. ru[a] and such c cannot be inserted. The result is the same as > directly executing In[11]:= (a + b) /. ru[a] > Out[11]= b + x If you don't like this, you have to make explicit the Value of ru[a] in the > definiton of f. One way to do so is to use Set instead of SetDelayed: In[9]:= f[x_] = (a + b) /. ru[a] > Out[9]= b + x In[10]:= f[c] > Out[10]= b + c The drawback of this that not only the value of ru[a] is inserted but also > the whole expression including ReplaceAll is evaluated. If this is not > wanted, you have to insert the value of ru[a] into the unevaluated rhs at > the definition. The general means for this are function application, With or > Replace: In[7]:= (g[x_] := (a + b) /. #) &[ru[a]] > In[8]:= g[c] > Out[8]= b + c In[16]:= Clear[g] > In[20]:= > Unevaluated[g[x_] := (a + b) /. rule] /. rule -> ru[a] > In[21]:= g[c] > Out[21]= b + c Here we have to prevent evaluation of the defintion before our rule is > inserted, this is achieved by Unevaluated. With is a bit more complicated, since the scoping rules for SetDelayed would > not allow the substition of an expression at rhs containing a pattern > variable (the pattern variable is renamed in this case). A simple answer to > this is to also substitute the argument variable (the pattern): > In[31]:= Clear[g] > In[32]:= > With[{rule = ru[a], arg = x_}, g[arg] := (a + b) /. rule] > In[33]:= g[c] > Out[33]= b + c -- > Hartmut Wolf ==== Try In[1]:= M={{1,2,3},{4,5,6},{7,8,9}}; In[2]:= Export[test.csv,M,CSV]; Also, avoid using names with capital initial, since these are usually reserved for Mathematica functions. Tomas Garza Mexico City ----- Original Message ----- > M={{1,2,3},{4,5,6},{7,8,9}}; > TableForm[M] 1 2 3 > 4 5 6 > 7 8 9 The commands like Put or Write create files with a standard Mathematica > matrix notation with braces, I get the the same result with Save As/Copy Robert ==== I would appreciate if someone could tell me how to put my output for example a matrix in TableForm as a space-delimited ASCII file in Mathematica 3.0. for example: M={{1,2,3},{4,5,6},{7,8,9}}; TableForm[M] 1 2 3 4 5 6 7 8 9 The commands like Put or Write create files with a standard Mathematica matrix notation with braces, I get the the same result with Save As/Copy Robert ==== Much longer. At least 10 times as long. Not sure because I quit. As I read Bobby Treat's response, one of my processors had been laboring for more than three days to generate all the digits. (I had not considered to display or print all of them. Why on Earth would I want to do that?) So I started over, asking RealDigits to skip most of the digits. Tom Burton > So would it take about the same amont of time for the complete printout > of digits? Of course it would take a few additional seconds to format > the output... Or does Mathematica take alot less time when it truncates the output? >> Could you tell me the CPU you used and its speed etc...i am curious, >> other programs out there. I used one processor of a dual 1GH Mac and got the same answer with the > following speed: 4.2 for Mac OS X (June 4, 2002) > oldmax = $MaxPrecision > 6 > 1. 10 > $MaxPrecision = Infinity > Infinity > With[{n = 2^26}, Timing[ > pd = RealDigits[N[Pi, n + 1], 10, 20, > 19 - n]; ]] > {28794.1 Second, Null} > MaxMemoryUsed[] > 512055204 > pd > {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, > > 4, 0, 9, 8, 0, 3}, -67108844} Tom Burton > ==== Often posters to MathGroup copy and paste in the complete cell expression, including the In and Out numbers, when posting to MathGroup. I wonder if this is the best method because one can't then just copy out all the statements and paste them into a Mathematica notebook. All the statement numbers have to be edited out and if there are many statement definitions this is an extended task for any responder. This, of course, decreases the chances for a response. A better method is for the poster to just copy and paste the CONTENTS of each cell. This is more work for the poster, but it may pay off in better responses. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ ==== David, I agree with you that it makes responding and using easier if the In and Out numbers are not included. An easier way to do this, rather than copying the contents of the cells, is Usually a little manual reformating is needed to distinguish text, input and output --- I try to use one tab indent for input and two tabs indent for output, plus some blank line adjustment. I wonder if anyone has a way of automatically achieving this reformating. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Often posters to MathGroup copy and paste in the complete cell expression, > including the In and Out numbers, when posting to MathGroup. I wonder if this is the best method because one can't then just copy out all > the statements and paste them into a Mathematica notebook. All the statement > numbers have to be edited out and if there are many statement definitions > this is an extended task for any responder. This, of course, decreases the > chances for a response. A better method is for the poster to just copy and > paste the CONTENTS of each cell. This is more work for the poster, but it > may pay off in better responses. David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ ==== copying and pasting is straightforward. I always run my notebooks this way, because showing the In[x], Out[x] does not seem to provide me with much beyond clutter. Kevin > Often posters to MathGroup copy and paste in the complete cell expression, > including the In and Out numbers, when posting to MathGroup. I wonder if this is the best method because one can't then just copy out all > the statements and paste them into a Mathematica notebook. All the statement > numbers have to be edited out and if there are many statement definitions > this is an extended task for any responder. This, of course, decreases the > chances for a response. A better method is for the poster to just copy and > paste the CONTENTS of each cell. This is more work for the poster, but it > may pay off in better responses. David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ ==== >In a presentation I wish to use Plot to generate a sequence of frames and >then animate them. The problem is that the audience sees the animation >twice. Once when the frames are being generated and then again after I have >closed the group and double clicked on the top graphic. However, the first >showing during generation is enough (but uncontrolled). > >Hugh Goyder This creates a graphics cell from a graphics expression. GraphicCell[graphics_] := Cell[GraphicsData[PostScript, DisplayString[graphics]],Graphics] cellgroup. Block[{$DisplayFunction=Identity, graphs}, graphs = Table[GraphicCell[ Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]], {t,0,15,.1}]; NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs,Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}] ] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== Actually, the reason why ImpliesQ (and FullSimplify) fail to prove the implication is not that the hypothesis is a disjunction. To use the cylindrical algebraic decomposition algorithm they need to know that the assumptions imply that all variables are real. The assumptions mechanism infers variable domains in a purely syntactical way, i.e. v is assumed to be real if there is an Element[v, Reals] statement or v appears in an inequality. It does not attempt to analyze assumptions further, to figure out that, say y6 >= -1 implies that y6 is real, and then if we have y5 == y6 then y5 must be real too. Doing such an analysis in general would require solving the assumptions over complex numbers, and then finding out which variables need to be real. This would be in general too time consuming to do, but analyzing linear dependencies like the ones in your example is a possible future improvement. ImpliesQ cannot prove the implication here, because it knows only that y6 is real. In[1]:= <= -1 && y5 == y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[2]= False If we add an explicit assumption that y4 and y5 are real, ImpliesQ (and FullSimplify) can prove this implication, and the full version of your example. In[3]:= ImpliesQ[Element[y4|y5, Reals] && y4 == -1 && y6 >= -1 && y5 == y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[3]= True In[4]:= ImpliesQ[Element[y4|y5, Reals] && (y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6), y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[4]= True In[5]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, Element[y4|y5, Reals] && (y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6)] Out[5]= True Adam Strzebonski Wolfram Research On second thoughts I realized that there seems to be an inherent > ambiguity about what one coudl mean by using alternatives (statements > joned by Or) assumptions. In fact it now seems to me that the > reasonable intertpretation for ImpliesQ and FullSimplify ought to > perhaps be different. It seems to me that ImpliesQ[Or[a,b],c] ought to > return True if aand only if ImpliesQ[a,c] and ImpliesQ[b,c] both return > True. If so this could be acomplished by adding the rule > ImpliesQ[Or[a,b],c] = And[ImpliesQ[a,c],ImpliesQ[b,c]]. That could then > be used in proving that the two answers to the system of inequalities > that of Vincent's original posting are equivalent. On the other hand > probably FullSimplify[a, Or[p,q]] ought to return > Or[FullSimplify[a,p],FullSimplify[a,q]] (or do nothing as it doe snow). > The first approach would seem to be consistent with the way > FullSimplify works with domain specifications but would however have > the strange effect of returning True if just one of the alternatives > were true and the other false. So perhaps after all it is best to > leave FullSimplify as it is. However, it seems to me that ImpliesQ > shoud be able to handle such cases (?) Andrzej Kozlowski > Toyama International University > JAPAN > The modification to FullSimplify that I sent earlier works correctly > only for assumptions of the form Or[a,b] (and even then not is not > always what one would like). For what it's worth here is a better (but > slow) version: > In[1]:= > Unprotect[FullSimplify]; > In[2]:= > FullSimplify[expr_, x_ || y__] := FullSimplify[ > FullSimplify[expr, x] || FullSimplify[expr, Or[y]]]; > In[3]:= > Protect[FullSimplify]; > For example: > In[4]:= > FullSimplify[Sqrt[(x - 1)^2] + Sqrt[(x - 2)^2] + > Sqrt[(x - 3)^2], x > 1 || x > 2 || x > 3] > Out[4]= > -1 + x + Abs[-3 + x] + Abs[-2 + x] || > -3 + 2*x + Abs[-3 + x] || 3*(-2 + x) > Andrzej Kozlowski > Toyama International University > JAPAN > > The reason why InequalitySolve returns it's answer in what sometimes > turns out to be unnecessarily complicated form is that the underlying > algorithm, Cylindrical Agebraic Decomposition (CAD) returns its > answers in this form. Unfortunately it seems to me unlikely that a > simplification of the kind you need can be can be accomplished in any > general way. To see why observe the following. First of all: > In[1]:= > FullSimplify[x > 0 || x == 0] > Out[1]= > x >= 0 > This is fine. However: > In[2]:= > FullSimplify[x > 0 && x < 2 || x == 0 && x < 2] > Out[2]= > x == 0 || 0 < x < 2 > Of course what you would like is simply 0 <= x < 2. One reason why > you can't get it is that while Mathematica can perform a > LogicalExpand, as in: > In[3]:= > LogicalExpand[(x > 0 || x == 0) && x < 2] > Out[3]= > x == 0 && x < 2 || x > 0 && x < 2 > There i no LogicalFactor or anything similar that would reverse > what LogicalExpand does. if there was then you could perform the sort > of simplifications you need for: > In[4]:= > FullSimplify[(x > 0 || x == 0) && x < 2] > Out[4]= > 0 <= x < 2 > However, it does not seem to me very likely that such logical > factoring can be performed by a general enough algorithm (though I > am no expert in this field). In any case, certainly Mathematica can't > do this. > I also noticed that Mathematica seems unable to show that the answer > it returns to your problem is actually equivalent to your simpler > one. In fact this looks like a possible bug in Mathematica. Let's > first try the function ImpliesQ from the Experimental context: > << Experimental` > Now Mathematica correctly gives: > In[6]:= > ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] > Out[6]= > True > However: > In[7]:= > ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] > Out[7]= > False > That simply means that ImpliesQ cannot show the implication, not that > it does not hold. ImpliesQ relies on CAD, as does FullSimplify. > Switching to FullSimplify we see that: > In[8]:= > FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 > && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] > Out[8]= > True > while > In[9]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] > Out[9]= > y4 >= -1 && y6 <= y5 <= 1 + y4 + y6 > On the other hand, taking just the individual summands of Or as > hypotheses; > In[10]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[10]= > True > In[11]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 ] > Out[11]= > True > In fact FullSimplify is unable to use Or in assumptions, which can be > demonstrated on an abstract example: > In[12]:= > FullSimplify[C,(A||B)&&(C)] > Out[12]= > True > In[13]:= > FullSimplify[C,LogicalExpand[(A||B)&&(C)]] > Out[13]= > C > This could be fixed by modifying FullSimplify: > In[14]:= > Unprotect[FullSimplify]; > In[14]:= > FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify[e > xpr,y]]; > In[15]:= > Protect[FullSimplify]; > Now at least we get as before: > In[16]:= > FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 > && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] > Out[16]= > True > but also: > In[17]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] > Out[17]= > True > This seems to me a possible worthwhile improvement in FullSimplify, > though of course not really helpful for your problem. > Andrzej Kozlowski > Toyama International University > JAPAN >> I have a set of inequalities that I solve with InequalitySolve. But >> then >> it gives a complete set of solutions, but not in the way I would >> like it >> to be! :-) For example, the simple following calculation will give: >> In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >>= -1}; >> InequalitySolve[ineq,{y4,y6,y5}] >> Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || >> y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> the result is good, but I would like it to be in the simpler but >> equivalent form >> y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> How can I tell InequalitySolve to do that? It is simple for this >> example, >> but for a large set of simple inequalities InequalitySolve gives >> lines and >> lines of results instead of a simple result. > Vincent Bouchard > ==== On second thoughts I realized that there seems to be an inherent ambiguity about what one could mean by using alternatives (statements joned by Or) assumptions. In fact it now seems to me that the reasonable intertpretation for ImpliesQ and FullSimplify ought to perhaps be different. It seems to me that ImpliesQ[Or[a,b],c] ought to return True if aand only if ImpliesQ[a,c] and ImpliesQ[b,c] both return True. If so this could be acomplished by adding the rule ImpliesQ[Or[a,b],c] = And[ImpliesQ[a,c],ImpliesQ[b,c]]. That could then be used in proving that the two answers to the system of inequalities that of Vincent's original posting are equivalent. On the other hand probably FullSimplify[a, Or[p,q]] ought to return Or[FullSimplify[a,p],FullSimplify[a,q]] (or do nothing as it doe snow). The first approach would seem to be consistent with the way FullSimplify works with domain specifications but would however have the strange effect of returning True if just one of the alternatives were true and the other false. So perhaps after all it is best to leave FullSimplify as it is. However, it seems to me that ImpliesQ shoud be able to handle such cases (?) Andrzej Kozlowski Toyama International University JAPAN > The modification to FullSimplify that I sent earlier works correctly > only for assumptions of the form Or[a,b] (and even then not is not > always what one would like). For what it's worth here is a better (but > slow) version: In[1]:= > Unprotect[FullSimplify]; In[2]:= > FullSimplify[expr_, x_ || y__] := FullSimplify[ > FullSimplify[expr, x] || FullSimplify[expr, Or[y]]]; In[3]:= > Protect[FullSimplify]; For example: In[4]:= > FullSimplify[Sqrt[(x - 1)^2] + Sqrt[(x - 2)^2] + > Sqrt[(x - 3)^2], x > 1 || x > 2 || x > 3] Out[4]= > -1 + x + Abs[-3 + x] + Abs[-2 + x] || > -3 + 2*x + Abs[-3 + x] || 3*(-2 + x) Andrzej Kozlowski > Toyama International University > JAPAN > The reason why InequalitySolve returns it's answer in what sometimes > turns out to be unnecessarily complicated form is that the underlying > algorithm, Cylindrical Agebraic Decomposition (CAD) returns its > answers in this form. Unfortunately it seems to me unlikely that a > simplification of the kind you need can be can be accomplished in any > general way. To see why observe the following. First of all: > In[1]:= > FullSimplify[x > 0 || x == 0] > Out[1]= > x >= 0 > This is fine. However: > In[2]:= > FullSimplify[x > 0 && x < 2 || x == 0 && x < 2] > Out[2]= > x == 0 || 0 < x < 2 > Of course what you would like is simply 0 <= x < 2. One reason why > you can't get it is that while Mathematica can perform a > LogicalExpand, as in: > In[3]:= > LogicalExpand[(x > 0 || x == 0) && x < 2] > Out[3]= > x == 0 && x < 2 || x > 0 && x < 2 > There i no LogicalFactor or anything similar that would reverse > what LogicalExpand does. if there was then you could perform the sort > of simplifications you need for: > In[4]:= > FullSimplify[(x > 0 || x == 0) && x < 2] > Out[4]= > 0 <= x < 2 > However, it does not seem to me very likely that such logical > factoring can be performed by a general enough algorithm (though I > am no expert in this field). In any case, certainly Mathematica can't > do this. > I also noticed that Mathematica seems unable to show that the answer > it returns to your problem is actually equivalent to your simpler > one. In fact this looks like a possible bug in Mathematica. Let's > first try the function ImpliesQ from the Experimental context: > << Experimental` > Now Mathematica correctly gives: > In[6]:= > ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] > Out[6]= > True > However: > In[7]:= > ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] > Out[7]= > False > That simply means that ImpliesQ cannot show the implication, not that > it does not hold. ImpliesQ relies on CAD, as does FullSimplify. > Switching to FullSimplify we see that: > In[8]:= > FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 > && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] > Out[8]= > True > while > In[9]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] > Out[9]= > y4 >= -1 && y6 <= y5 <= 1 + y4 + y6 > On the other hand, taking just the individual summands of Or as > hypotheses; > In[10]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[10]= > True > In[11]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 ] > Out[11]= > True > In fact FullSimplify is unable to use Or in assumptions, which can be > demonstrated on an abstract example: > In[12]:= > FullSimplify[C,(A||B)&&(C)] > Out[12]= > True > In[13]:= > FullSimplify[C,LogicalExpand[(A||B)&&(C)]] > Out[13]= > C > This could be fixed by modifying FullSimplify: > In[14]:= > Unprotect[FullSimplify]; > In[14]:= > FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify[e > xpr,y]]; > In[15]:= > Protect[FullSimplify]; > Now at least we get as before: > In[16]:= > FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 > && > y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + > y4 + y6] > Out[16]= > True > but also: > In[17]:= > FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 > <= 1 + y4 + y6] > Out[17]= > True > This seems to me a possible worthwhile improvement in FullSimplify, > though of course not really helpful for your problem. > Andrzej Kozlowski > Toyama International University > JAPAN >> I have a set of inequalities that I solve with InequalitySolve. But >> then >> it gives a complete set of solutions, but not in the way I would >> like it >> to be! :-) For example, the simple following calculation will give: >> In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >>= -1}; >> InequalitySolve[ineq,{y4,y6,y5}] >> Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || >> y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> the result is good, but I would like it to be in the simpler but >> equivalent form >> y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> How can I tell InequalitySolve to do that? It is simple for this >> example, >> but for a large set of simple inequalities InequalitySolve gives >> lines and >> lines of results instead of a simple result. > Vincent Bouchard > > ==== Hallo!, My name is Nagesh and pursuing research studies in Refrigeration. At present I am writing a Dynamic Refrigeration System Simulation Package. I am using Mathematica as a programming language for the same since last one year. I don't have any programming experience before this. I have following querries:- 1. Is any body here have expertise or information about the capability of Mathematica as a system simulation tool? 2. Is is possible to program a user friendly interface for my system simulation package with Mathematica or I have to use some other software? 3. My refrigeration system simulation package is likely to have approximately 60 First order Differential equations. Is is possible to solve these in Mathematica ? If yes then can anybody here guide me about this further. I am explaining below in short about the objectives I want to fulfill from coding out of my main input file 1. Example from Main Input File ( this will contain about 200-250 variables which will be entered by the user of this package) Below is examples of two variables entered into this file, which will be used in other analysis files for further evaluation. 2. Example from other analysis file ( there will be about 20-25 other such component analysis files ) where the above mentioned variables from main input file will be used for further evaluations:- Below is one example from this file explaining how the variables from main input file will be used in other files. I hope that this short information will be useful for guiding me to solve the following problems that I am facing. I am facing follwing problems or objectives:- 1. My 1st Objective:- The user of this package must be able to change only the value of the variable in the main input file but he must not be able to change the name of the variable itself. For example he must be able to change the value of the variable but he must not be able to change the name of this variable itself. Here our problem is how to achieve or program it so that our objective will be fullfilled. 2. My 2nd Objective:- How I can program the main input file so that it will be user friendly in terms of its visuals and satisfying the constraint mentioned above in objective1. 3. My 3rd Objective:- How can I program the optional values for each variable in the main input file ? so that there will be always a value assigned to each variable listed in main input file whenever the user opens up this file. If user want to change the values of some variables then he can change them and run the simulation otherwise the simulation run will be done with optional values assigned to each variable in the input file. 4. My 4th Objective:- How can I program the check for correctness of the input values supplied by the package user ? I will be very greatful to you for helping and suggesting some technique or method to solve some of my above mentioned programming problems. Can anybody here guide me about the above mentioned programming problems ? Nagesh Rajepandhare ==== I want to add a further suggestion: Probably each differential equation logically belongs to one of the defined classes in the sense, that it helps to define the behaviour of the component. In this case, each differential equation should be stored in one of theses classes as textstring in a form appropriate for the execution in Mathematica. Hermann Schmitt ----- Original Message ----- Is any body here have expertise or information about the capability of > Mathematica as a system simulation tool? > Mr. Kuska answers: > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. My comment: That is: He sees the simulation system merely as a set of differential > equations. The question of Mr. Nagesh: My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > The answer of Mr. Kuska is: > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) My comment: This is a nice command and shows the knowledge of Mr.Kuska. But does Mr. > Nagesh understand it and is it sufficient to check, if all inputs are > numerical? Additionally I think, it is not userfriendly to see the input merely as a > set of 200-250 numbers. My suggestion is, that JLink is used, a suggestion Mr. Kusk takes into > consideration, too. But further I suggest, that classes are defined in Java, which represent the > parts of the system. Constructors of the classes should build objects with default values. > Graphical user interfaces should give the opportunity to change the data fields in the objects and > check the input for correctness. The system should give the opportunity, to store the objects on harddisk > (serialization). accessed directly. > My name is Nagesh and pursuing research studies in Refrigeration. At > present I am writing a Dynamic Refrigeration System Simulation Package. > I > am using Mathematica as a programming language for the same since last > one > year. I don't have any programming experience before this. I have > following > querries:- > 1. Is any body here have expertise or information about the capability > of > Mathematica as a system simulation tool? > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > 2. Is is possible to program a user friendly interface for my system > simulation package with Mathematica or I have to use some other > software? > Write a MathLink or J/Link frontend that launch the kernel. But you > should keep > in mind that the user interface is typical 80-90 % of your code. > If you just whant to solve some ode's it is probably easyer to > include one of the excelent ode-solvers from netlib in your C-code > than to call Mathematica to do that. As long as you dont wish to change > the ode's very often (than Mathematica is more flexible) you should > not use Mathematica. > 3. My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. Is is possible to > solve these in Mathematica ? > Sure. > If yes then can anybody here guide me about > this further. > Write down the equations and call NDSolve[]. > I am explaining below in short about the objectives I want to fulfill > from > coding out of my main input file > 1. Example from Main Input File ( this will contain about 200-250 > variables > which will be entered by the user of this package) > This sounds like a *very* userfiendly interface ;-) > Below is examples of two variables entered into this file, which will be > used in other analysis files for further evaluation. > 2. Example from other analysis file ( there will be about 20-25 other > such > component analysis files ) where the above mentioned variables from main > input file will be used for further evaluations:- > Below is one example from this file explaining how the variables from > main > input file will be used in other files. > I hope that this short information will be useful for guiding me to > solve > the following problems that I am facing. I am facing follwing problems > or > objectives:- > 1. My 1st Objective:- The user of this package must be able to change > only > the value of the variable in the main input file but he must not be able > to > change the name of the variable itself. For example he must be able to > change the value of the variable but he must not be able to change > the > name of this variable itself. > Here our problem is how to achieve or program it so that our objective > will > be fullfilled. > Options with defaulf values ? or something like > {aParam,bParam}={ODEParameter1,ODEParameter2} /. > userRules /. > {ODEParameter1->1,ODEParameter2->2} > 2. My 2nd Objective:- How I can program the main input file so that it > will > be user friendly in terms of its visuals and satisfying the constraint > mentioned above in objective1. > What is *userfiendly* in a file with 250 variables ??? > 3. My 3rd Objective:- How can I program the optional values for each > variable in the main input file ? so that there will be always a value > assigned to each variable listed in main input file whenever the user > opens > up this file. If user want to change the values of some variables then > he > can change them and run the simulation otherwise the simulation run will > be > done with optional values assigned to each variable in the input file. > See above. > 4. My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > > Jens ==== I have developed one package where it is included a functions for solving System of ODE. You can downloaded from: http://web.usal.es/~guillerm/biokmod. The functions are: SystemDSolve and SystemNDSolve Guillermo Sanchez > I want to add a further suggestion: > Probably each differential equation logically belongs to one of the defined > classes in the sense, that it helps to define the behaviour of the > component. > In this case, each differential equation should be stored in one of theses > classes as textstring in a form appropriate for the execution in > Mathematica. > Hermann Schmitt > ----- Original Message ----- > I agree with Mr. Kuska, that the system Mr Nagesh describes is not > userfriendly. But I think, the suggestions of Mr. Kuska do not make it > more > userfriendly, rather the opposite is true. > Mr. Nagesh asks > Is any body here have expertise or information about the capability of > Mathematica as a system simulation tool? > Mr. Kuska answers: > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > My comment: > That is: He sees the simulation system merely as a set of differential > equations. > The question of Mr. Nagesh: > My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > The answer of Mr. Kuska is: > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > My comment: > This is a nice command and shows the knowledge of Mr.Kuska. But does Mr. > Nagesh understand it and is it sufficient to check, if all inputs are > numerical? > Additionally I think, it is not userfriendly to see the input merely as a > set of 200-250 numbers. > > My suggestion is, that JLink is used, a suggestion Mr. Kusk takes into > consideration, too. > But further I suggest, that classes are defined in Java, which represent > the > parts of the system. > Constructors of the classes should build objects with default values. > Graphical user interfaces > should give the opportunity to change the data fields in the objects and > check the input for correctness. > The system should give the opportunity, to store the objects on harddisk > (serialization). > accessed directly. > > My name is Nagesh and pursuing research studies in Refrigeration. At > present I am writing a Dynamic Refrigeration System Simulation > Package. > I > am using Mathematica as a programming language for the same since last > one > year. I don't have any programming experience before this. I have > following > querries:- > 1. Is any body here have expertise or information about the capability > of > Mathematica as a system simulation tool? > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > 2. Is is possible to program a user friendly interface for my system > simulation package with Mathematica or I have to use some other > software? > Write a MathLink or J/Link frontend that launch the kernel. But you > should keep > in mind that the user interface is typical 80-90 % of your code. > If you just whant to solve some ode's it is probably easyer to > include one of the excelent ode-solvers from netlib in your C-code > than to call Mathematica to do that. As long as you dont wish to change > the ode's very often (than Mathematica is more flexible) you should > not use Mathematica. > 3. My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. Is is possible to > solve these in Mathematica ? > Sure. > If yes then can anybody here guide me about > this further. > Write down the equations and call NDSolve[]. > I am explaining below in short about the objectives I want to fulfill > from > coding out of my main input file > 1. Example from Main Input File ( this will contain about 200-250 > variables > which will be entered by the user of this package) > This sounds like a *very* userfiendly interface ;-) > Below is examples of two variables entered into this file, which will > be > used in other analysis files for further evaluation. > 2. Example from other analysis file ( there will be about 20-25 other > such > component analysis files ) where the above mentioned variables from > main > input file will be used for further evaluations:- > Below is one example from this file explaining how the variables from > main > input file will be used in other files. > I hope that this short information will be useful for guiding me to > solve > the following problems that I am facing. I am facing follwing problems > or > objectives:- > 1. My 1st Objective:- The user of this package must be able to change > only > the value of the variable in the main input file but he must not be > able > to > change the name of the variable itself. For example he must be able to > change the value of the variable but he must not be able to > change > the > name of this variable itself. > Here our problem is how to achieve or program it so that our objective > will > be fullfilled. > Options with defaulf values ? or something like > {aParam,bParam}={ODEParameter1,ODEParameter2} /. > userRules /. > {ODEParameter1->1,ODEParameter2->2} > 2. My 2nd Objective:- How I can program the main input file so that it > will > be user friendly in terms of its visuals and satisfying the constraint > mentioned above in objective1. > What is *userfiendly* in a file with 250 variables ??? > 3. My 3rd Objective:- How can I program the optional values for each > variable in the main input file ? so that there will be always a value > assigned to each variable listed in main input file whenever the user > opens > up this file. If user want to change the values of some variables then > he > can change them and run the simulation otherwise the simulation run > will > be > done with optional values assigned to each variable in the input file. > See above. > 4. My 4th Objective:- How can I program the check for correctness of > the > input values supplied by the package user ? > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > Jens > > ==== I agree with Mr. Kuska, that the system Mr Nagesh describes is not userfriendly. But I think, the suggestions of Mr. Kuska do not make it more userfriendly, rather the opposite is true. Mr. Nagesh asks Is any body here have expertise or information about the capability of Mathematica as a system simulation tool? Mr. Kuska answers: Since the most system simulation tools are simply solving a system of ordinary differntial equations it is simple to do this with NDSolve[]. My comment: That is: He sees the simulation system merely as a set of differential equations. The question of Mr. Nagesh: My 4th Objective:- How can I program the check for correctness of the input values supplied by the package user ? The answer of Mr. Kuska is: And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) My comment: This is a nice command and shows the knowledge of Mr.Kuska. But does Mr. Nagesh understand it and is it sufficient to check, if all inputs are numerical? Additionally I think, it is not userfriendly to see the input merely as a set of 200-250 numbers. My suggestion is, that JLink is used, a suggestion Mr. Kusk takes into consideration, too. But further I suggest, that classes are defined in Java, which represent the parts of the system. Constructors of the classes should build objects with default values. Graphical user interfaces should give the opportunity to change the data fields in the objects and check the input for correctness. The system should give the opportunity, to store the objects on harddisk (serialization). accessed directly. > My name is Nagesh and pursuing research studies in Refrigeration. At > present I am writing a Dynamic Refrigeration System Simulation Package. I > am using Mathematica as a programming language for the same since last one > year. I don't have any programming experience before this. I have following > querries:- > 1. Is any body here have expertise or information about the capability of > Mathematica as a system simulation tool? Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > 2. Is is possible to program a user friendly interface for my system > simulation package with Mathematica or I have to use some other software? Write a MathLink or J/Link frontend that launch the kernel. But you > should keep > in mind that the user interface is typical 80-90 % of your code. > If you just whant to solve some ode's it is probably easyer to > include one of the excelent ode-solvers from netlib in your C-code > than to call Mathematica to do that. As long as you dont wish to change > the ode's very often (than Mathematica is more flexible) you should > not use Mathematica. > 3. My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. Is is possible to > solve these in Mathematica ? Sure. > If yes then can anybody here guide me about > this further. Write down the equations and call NDSolve[]. > I am explaining below in short about the objectives I want to fulfill from > coding out of my main input file > 1. Example from Main Input File ( this will contain about 200-250 variables > which will be entered by the user of this package) This sounds like a *very* userfiendly interface ;-) > Below is examples of two variables entered into this file, which will be > used in other analysis files for further evaluation. > 2. Example from other analysis file ( there will be about 20-25 other such > component analysis files ) where the above mentioned variables from main > input file will be used for further evaluations:- > Below is one example from this file explaining how the variables from main > input file will be used in other files. > I hope that this short information will be useful for guiding me to solve > the following problems that I am facing. I am facing follwing problems or > objectives:- > 1. My 1st Objective:- The user of this package must be able to change only > the value of the variable in the main input file but he must not be able to > change the name of the variable itself. For example he must be able to > change the value of the variable but he must not be able to change the > name of this variable itself. > Here our problem is how to achieve or program it so that our objective will > be fullfilled. Options with defaulf values ? or something like {aParam,bParam}={ODEParameter1,ODEParameter2} /. > userRules /. > {ODEParameter1->1,ODEParameter2->2} > 2. My 2nd Objective:- How I can program the main input file so that it will > be user friendly in terms of its visuals and satisfying the constraint > mentioned above in objective1. What is *userfiendly* in a file with 250 variables ??? > 3. My 3rd Objective:- How can I program the optional values for each > variable in the main input file ? so that there will be always a value > assigned to each variable listed in main input file whenever the user opens > up this file. If user want to change the values of some variables then he > can change them and run the simulation otherwise the simulation run will be > done with optional values assigned to each variable in the input file. See above. > 4. My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) Jens > ==== See my comments in the following text! Hermann Schmitt ----- Original Message ----- > Is any body here have expertise or information about the capability of > Mathematica as a system simulation tool? > Mr. Kuska answers: > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > My comment: > That is: He sees the simulation system merely as a set of differential > equations. hmm, since the original poster write My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. it seems not completly wrong to assume that the system consists of > of ode's .. > Yout should not ignore the word merely. It is not enough to have a set 60 differential equations and a set of 200-250 numbers. That is not simulation system, which can be used by users with the exception, perhaps, of the programmer of the system himself. How does e.g. the user know what meaning a number in the set has, ought he count the numbers from the beginning? Your nice command shows only, if there is an input, which is not a number. But I think the user would like to know, which of the 200 elements are not numbers. The only good of your command is, that it looks nice and shows your knowledge! > The question of Mr. Nagesh: > My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > The answer of Mr. Kuska is: > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > My comment: > This is a nice command and shows the knowledge of Mr.Kuska. But does Mr. > Nagesh understand it and is it sufficient to check, if all inputs are > numerical? It seems you have a deeper knowlege about the things that Mr. Nagesh > understand. You know him personally ? It is not very polite to > make speculations *what* a other person understand. And no it is not sufficent to check that all parameters are numbers. > Typical paramters described by intervals, where the assumptions of > a model are valid. But for this checks one needs more knowlege > about the meaning of the parameters. And one needs the knowlege about > the differntial equations, to find out the eigenvalues of the jacobian > ... > Additionally I think, it is not userfriendly to see the input merely as a > set of 200-250 numbers. > My suggestion is, that JLink is used, a suggestion Mr. Kusk takes into > consideration, too. That will be fast as lightning ! > But further I suggest, that classes are defined in Java, which represent the > parts of the system. That is notable nonsense! When the differntial equations should be > solved with Mathematica, the parts can't be Java classes. Mathematica's > NDSolve[] need a explicit expression to integrate the equations. That's not nonsense, the Mathematica program does not fetch the classes but the numbers in the classes (or better in the objects). the Java classes in textform. They can then be fetched from the Mathematica program and transformed into expressions by the Command ToExpression. The aim is, to have a clear separation of the system into components, which are manageable and understandable. OK you can call a Java class member from Mathematica but this will > be incredible slow when the right hand side is evaluated 200-300 > times and every evaluation make several callbacks to the Java source. > Event handler of the Java main program (without some modification in > the event loop) while it is evaluating an other command. My idea is to fetch the values once from the Java objects at the beginning. 200-250 numbers is not so much.. > Constructors of the classes should build objects with default values. That's a great idea. If a simulation run should be documented, one > always > need the full listing of the Java source to find the actual parameter > settings. That is not my opinion. I think not every user of the simulation system should have to know Java and Mathematica. The user must look for the values in the objects. And the values are in the objects, if they come from the constructor or from the graphical user interface. I think, there should be listings of the objects including names of the variables. In the objects the values are in an meaningful environment. > Graphical user interfaces > should give the opportunity to change the data fields in the objects and > check the input for correctness. *and* what has a GUI for 200-250 variables to do with Mathematica ? > BTW one has typical much less variables because many parameters > are fixed and it make no sense to change, for example, material > constants of materials that can't exchanged > The system should give the opportunity, to store the objects on harddisk > (serialization). > accessed directly. Can you be so kind, to explain *how* your posting help a person that > ask How can I build a simulation system with Mathematica ? You *can* say Don't use Mathematica, use Java! but this has nothing > to do with the question or with my reply. It is you, who proposes to solve the problem with C/C++ and not to use Mathematica (see below!) My point of view is: Use Mathematica, for what Mathemtica is good, and Java, for what Java is good. Mathematica is not so good as Java for data entry and Java is better than Mathematica to represent the simulation system (by objects). But I still would suggest to use C/C++ and a numerical > ode-solver, make a fancy GUI/Script > interface and don't use Mathematica for such a simple task. > The ode-solver is the smallest part of such a simulation system. Jens > My name is Nagesh and pursuing research studies in Refrigeration. At > present I am writing a Dynamic Refrigeration System Simulation Package. > I > am using Mathematica as a programming language for the same since last > one > year. I don't have any programming experience before this. I have > following > querries:- > 1. Is any body here have expertise or information about the capability > of > Mathematica as a system simulation tool? > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > 2. Is is possible to program a user friendly interface for my system > simulation package with Mathematica or I have to use some other > software? > Write a MathLink or J/Link frontend that launch the kernel. But you > should keep > in mind that the user interface is typical 80-90 % of your code. > If you just whant to solve some ode's it is probably easyer to > include one of the excelent ode-solvers from netlib in your C-code > than to call Mathematica to do that. As long as you dont wish to change > the ode's very often (than Mathematica is more flexible) you should > not use Mathematica. > 3. My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. Is is possible to > solve these in Mathematica ? > Sure. > If yes then can anybody here guide me about > this further. > Write down the equations and call NDSolve[]. > I am explaining below in short about the objectives I want to fulfill > from > coding out of my main input file > 1. Example from Main Input File ( this will contain about 200-250 > variables > which will be entered by the user of this package) > This sounds like a *very* userfiendly interface ;-) > Below is examples of two variables entered into this file, which will be > used in other analysis files for further evaluation. > 2. Example from other analysis file ( there will be about 20-25 other > such > component analysis files ) where the above mentioned variables from main > input file will be used for further evaluations:- > Below is one example from this file explaining how the variables from > main > input file will be used in other files. > I hope that this short information will be useful for guiding me to > solve > the following problems that I am facing. I am facing follwing problems > or > objectives:- > 1. My 1st Objective:- The user of this package must be able to change > only > the value of the variable in the main input file but he must not be able > to > change the name of the variable itself. For example he must be able to > change the value of the variable but he must not be able to change > the > name of this variable itself. > Here our problem is how to achieve or program it so that our objective > will > be fullfilled. > Options with defaulf values ? or something like > {aParam,bParam}={ODEParameter1,ODEParameter2} /. > userRules /. > {ODEParameter1->1,ODEParameter2->2} > 2. My 2nd Objective:- How I can program the main input file so that it > will > be user friendly in terms of its visuals and satisfying the constraint > mentioned above in objective1. > What is *userfiendly* in a file with 250 variables ??? > 3. My 3rd Objective:- How can I program the optional values for each > variable in the main input file ? so that there will be always a value > assigned to each variable listed in main input file whenever the user > opens > up this file. If user want to change the values of some variables then > he > can change them and run the simulation otherwise the simulation run will > be > done with optional values assigned to each variable in the input file. > See above. > 4. My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > Jens > Reply-To: kuska@informatik.uni-leipzig.de ==== > I agree with Mr. Kuska, that the system Mr Nagesh describes is not > userfriendly. But I think, the suggestions of Mr. Kuska do not make it more > userfriendly, rather the opposite is true. Mr. Nagesh asks Is any body here have expertise or information about the capability of > Mathematica as a system simulation tool? > Mr. Kuska answers: > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. My comment: That is: He sees the simulation system merely as a set of differential > equations. hmm, since the original poster write My refrigeration system simulation package is likely to have approximately 60 First order Differential equations. it seems not completly wrong to assume that the system consists of of ode's .. The question of Mr. Nagesh: My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > The answer of Mr. Kuska is: > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) My comment: This is a nice command and shows the knowledge of Mr.Kuska. But does Mr. > Nagesh understand it and is it sufficient to check, if all inputs are > numerical? It seems you have a deeper knowlege about the things that Mr. Nagesh understand. You know him personally ? It is not very polite to make speculations *what* a other person understand. And no it is not sufficent to check that all parameters are numbers. Typical paramters described by intervals, where the assumptions of a model are valid. But for this checks one needs more knowlege about the meaning of the parameters. And one needs the knowlege about the differntial equations, to find out the eigenvalues of the jacobian ... Additionally I think, it is not userfriendly to see the input merely as a > set of 200-250 numbers. My suggestion is, that JLink is used, a suggestion Mr. Kusk takes into > consideration, too. That will be fast as lightning ! But further I suggest, that classes are defined in Java, which represent the > parts of the system. That is notable nonsense! When the differntial equations should be solved with Mathematica, the parts can't be Java classes. Mathematica's NDSolve[] need a explicit expression to integrate the equations. OK you can call a Java class member from Mathematica but this will be incredible slow when the right hand side is evaluated 200-300 times and every evaluation make several callbacks to the Java source. Event handler of the Java main program (without some modification in the event loop) while it is evaluating an other command. Constructors of the classes should build objects with default values. That's a great idea. If a simulation run should be documented, one always need the full listing of the Java source to find the actual parameter settings. > Graphical user interfaces > should give the opportunity to change the data fields in the objects and > check the input for correctness. *and* what has a GUI for 200-250 variables to do with Mathematica ? BTW one has typical much less variables because many parameters are fixed and it make no sense to change, for example, material constants of materials that can't exchanged The system should give the opportunity, to store the objects on harddisk > (serialization). accessed directly. > Can you be so kind, to explain *how* your posting help a person that ask How can I build a simulation system with Mathematica ? You *can* say Don't use Mathematica, use Java! but this has nothing to do with the question or with my reply. But I still would suggest to use C/C++ and a numerical ode-solver, make a fancy GUI/Script interface and don't use Mathematica for such a simple task. The ode-solver is the smallest part of such a simulation system. Jens > > My name is Nagesh and pursuing research studies in Refrigeration. At > present I am writing a Dynamic Refrigeration System Simulation Package. > I > am using Mathematica as a programming language for the same since last > one > year. I don't have any programming experience before this. I have > following > querries:- > 1. Is any body here have expertise or information about the capability > of > Mathematica as a system simulation tool? > Since the most system simulation tools are simply solving a system of > ordinary differntial equations it is simple to do this with NDSolve[]. > 2. Is is possible to program a user friendly interface for my system > simulation package with Mathematica or I have to use some other > software? > Write a MathLink or J/Link frontend that launch the kernel. But you > should keep > in mind that the user interface is typical 80-90 % of your code. > If you just whant to solve some ode's it is probably easyer to > include one of the excelent ode-solvers from netlib in your C-code > than to call Mathematica to do that. As long as you dont wish to change > the ode's very often (than Mathematica is more flexible) you should > not use Mathematica. > 3. My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. Is is possible to > solve these in Mathematica ? > Sure. > If yes then can anybody here guide me about > this further. > Write down the equations and call NDSolve[]. > I am explaining below in short about the objectives I want to fulfill > from > coding out of my main input file > 1. Example from Main Input File ( this will contain about 200-250 > variables > which will be entered by the user of this package) > This sounds like a *very* userfiendly interface ;-) > Below is examples of two variables entered into this file, which will be > used in other analysis files for further evaluation. > 2. Example from other analysis file ( there will be about 20-25 other > such > component analysis files ) where the above mentioned variables from main > input file will be used for further evaluations:- > > Below is one example from this file explaining how the variables from > main > input file will be used in other files. > I hope that this short information will be useful for guiding me to > solve > the following problems that I am facing. I am facing follwing problems > or > objectives:- > 1. My 1st Objective:- The user of this package must be able to change > only > the value of the variable in the main input file but he must not be able > to > change the name of the variable itself. For example he must be able to > change the value of the variable but he must not be able to change > the > name of this variable itself. > Here our problem is how to achieve or program it so that our objective > will > be fullfilled. > Options with defaulf values ? or something like > {aParam,bParam}={ODEParameter1,ODEParameter2} /. > userRules /. > {ODEParameter1->1,ODEParameter2->2} > 2. My 2nd Objective:- How I can program the main input file so that it > will > be user friendly in terms of its visuals and satisfying the constraint > mentioned above in objective1. > What is *userfiendly* in a file with 250 variables ??? > 3. My 3rd Objective:- How can I program the optional values for each > variable in the main input file ? so that there will be always a value > assigned to each variable listed in main input file whenever the user > opens > up this file. If user want to change the values of some variables then > he > can change them and run the simulation otherwise the simulation run will > be > done with optional values assigned to each variable in the input file. > See above. > 4. My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? > And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > > Jens > Reply-To: kuska@informatik.uni-leipzig.de ==== > My name is Nagesh and pursuing research studies in Refrigeration. At > present I am writing a Dynamic Refrigeration System Simulation Package. I > am using Mathematica as a programming language for the same since last one > year. I don't have any programming experience before this. I have following > querries:- > 1. Is any body here have expertise or information about the capability of > Mathematica as a system simulation tool? Since the most system simulation tools are simply solving a system of ordinary differntial equations it is simple to do this with NDSolve[]. > 2. Is is possible to program a user friendly interface for my system > simulation package with Mathematica or I have to use some other software? Write a MathLink or J/Link frontend that launch the kernel. But you should keep in mind that the user interface is typical 80-90 % of your code. If you just whant to solve some ode's it is probably easyer to include one of the excelent ode-solvers from netlib in your C-code than to call Mathematica to do that. As long as you dont wish to change the ode's very often (than Mathematica is more flexible) you should not use Mathematica. > 3. My refrigeration system simulation package is likely to have > approximately 60 First order Differential equations. Is is possible to > solve these in Mathematica ? Sure. > If yes then can anybody here guide me about > this further. Write down the equations and call NDSolve[]. I am explaining below in short about the objectives I want to fulfill from > coding out of my main input file 1. Example from Main Input File ( this will contain about 200-250 variables > which will be entered by the user of this package) This sounds like a *very* userfiendly interface ;-) Below is examples of two variables entered into this file, which will be > used in other analysis files for further evaluation. 2. Example from other analysis file ( there will be about 20-25 other such > component analysis files ) where the above mentioned variables from main > input file will be used for further evaluations:- Below is one example from this file explaining how the variables from main > input file will be used in other files. I hope that this short information will be useful for guiding me to solve > the following problems that I am facing. I am facing follwing problems or > objectives:- 1. My 1st Objective:- The user of this package must be able to change only > the value of the variable in the main input file but he must not be able to > change the name of the variable itself. For example he must be able to > change the value of the variable but he must not be able to change the > name of this variable itself. > Here our problem is how to achieve or program it so that our objective will > be fullfilled. Options with defaulf values ? or something like {aParam,bParam}={ODEParameter1,ODEParameter2} /. userRules /. {ODEParameter1->1,ODEParameter2->2} 2. My 2nd Objective:- How I can program the main input file so that it will > be user friendly in terms of its visuals and satisfying the constraint > mentioned above in objective1. What is *userfiendly* in a file with 250 variables ??? 3. My 3rd Objective:- How can I program the optional values for each > variable in the main input file ? so that there will be always a value > assigned to each variable listed in main input file whenever the user opens > up this file. If user want to change the values of some variables then he > can change them and run the simulation otherwise the simulation run will be > done with optional values assigned to each variable in the input file. See above. 4. My 4th Objective:- How can I program the check for correctness of the > input values supplied by the package user ? And @@ (NumericQ /@ {aListOfAllYourNumericParameters}) > Jens ==== You would need to make assumptions about y, and you can't. The function and the limits have to take care of that, and when you try to do that, you end up with an expression that has different antiderivatives on different regions, for different values of x. So, you have to break it up. The assumption x > 0 implies that x is real, so Im[x]==0 is unnecessary. one = Integrate[Cosh[2 (y - x)] 2 y, {y, Min[x, 1/2], 1/2}, Assumptions -> {x > 0}]; two = Integrate[Cosh[2 (x - y)] 2 y, {y, 0, Min[x, 1/2]}, Assumptions -> {x > 0}]; one + two // FullSimplify Plot[{one, two, one + two}, {x, 0, 1/2}]; (1/4)*E^(-1 - 2*x)*(E + (-2 + E)*E^(4*x)) Bobby Treat -----Original Message----- there something implicit that I am missing in the Assumptions ? MS. -- 12:02am up 5:06, 1 user, load average: 0.54, 0.22, 0.08 Reply-To: spammers-go-here@yahoo.com ==== On Friday 27 September 2002 04:18 am, DrBob, as drbob@bigfoot.com, held forth the following in comp.soft-sys.math.mathematica () : > You would need to make assumptions about y, and you can't. The function > and the limits have to take care of that, and when you try to do that, > you end up with an expression that has different antiderivatives on > different regions, for different values of x. So, you have to break it > up. The assumption x > 0 implies that x is real, so Im[x]==0 is > unnecessary. one = Integrate[Cosh[2 (y - x)] > 2 y, {y, Min[x, 1/2], 1/2}, Assumptions -> {x > 0}]; > two = Integrate[Cosh[2 (x - y)] 2 > y, {y, 0, Min[x, 1/2]}, Assumptions -> {x > 0}]; > one + two // FullSimplify > Plot[{one, two, one + two}, {x, 0, 1/2}]; (1/4)*E^(-1 - 2*x)*(E + (-2 + E)*E^(4*x)) Bobby Treat -----Original Message----- I have been trying to integrate the following : Integrate[Cosh[2 Abs[x-y]] 2 y, {y,0,1/2}, > Assumptions->{Im[x]==0,x>0}] However, Mathematica chokes and simply returns the integral as > it is. However, if I > split up the integral into two portions, it quickly gives me an answer > for the parts. Is > there something implicit that I am missing in the Assumptions ? > MS. > ? Anyways, I will try what you suggest. -- 12:53pm up 27 min, 1 user, load average: 0.19, 0.15, 0.09 ==== Put this after the Plot statement, in the same cell: SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute[OpenCloseGroup] FrontEndTokenExecute[SelectionAnimate] Bobby Treat -----Original Message----- Do[Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEnd`SelectionAnimate[0.1]}]; FrontEndExecute[{FrontEndToken[Clear]}], {t, 0, 15, 0.1}] This works but the cell dividing line flashes on and off spoiling the animation and if there is anything in the cell below this jumps up and down. Is there a proper way of doing this? Hugh Goyder ==== >>So would it take about the same amont of time for the complete printout of digits? Of course it would take a few additional seconds to format the output... I think it would take FAR more time for a complete printout, and might crash the Front End. I was thinking about the fact that I calculated all those digits and then threw them away. I could save them with Save or DumpSave, and read them in with Get the next time I wanted any of them, although the file would be close to 70 MB (if not more). I may do that, in fact -- I have plenty of disk space. The next step would be to somehow reuse the stored digits if I wanted MORE digits. But how? The Bailey-Borwein-Plouffe Pi algorithm is an avenue of attack, since it can calculate digits far from the decimal point, without calculating those in between. Unfortunately, it calculates hexadecimal digits in that way, not decimal digits. (That's true for the version I've seen, anyway.) Still, I could take the stored digits, convert to hexadecimal, add more hexadecimal digits with the B-B-P algorithm, and then convert back to decimal. In both conversions, I'd have to be very cognizant of how much precision I end up with, but that shouldn't be too difficult. It might go faster if I store hexadecimal digits, as well as decimal digits, to eliminate one of those conversions at each increase in the number of digits. The next step would be to set up an application that allowed anyone to ping for digits across the Internet, and would return them if they're stored. Hasn't someone already done that? It seems as if someone would have. Bobby Treat -----Original Message----- > Could you tell me the CPU you used and its speed etc...i am curious, to > other programs out there. I used one processor of a dual 1GH Mac and got the same answer with the > following speed: 4.2 for Mac OS X (June 4, 2002) > oldmax = $MaxPrecision > 6 > 1. 10 > $MaxPrecision = Infinity > Infinity > With[{n = 2^26}, Timing[ > pd = RealDigits[N[Pi, n + 1], 10, 20, > 19 - n]; ]] > {28794.1 Second, Null} > MaxMemoryUsed[] > 512055204 > pd > {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, > > 4, 0, 9, 8, 0, 3}, -67108844} Tom Burton ==== I've been trying to get my Mathematica 4.1 properly configured. I set: ################################################################### /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/X/Specific.tr: @@resource maxForXListFonts 10000 # xlsfonts | wc -l 5572 /etc/X11/XF86Config: FontPath /usr/X11R6/lib/X11/fonts/100dpi:unscaled FontPath /usr/X11R6/lib/X11/fonts/75dpi:unscaled FontPath /usr/X11R6/lib/X11/fonts/CID FontPath /usr/X11R6/lib/X11/fonts/Speedo FontPath /usr/X11R6/lib/X11/fonts/Type1 FontPath /usr/X11R6/lib/X11/fonts/URW FontPath /usr/X11R6/lib/X11/fonts/kwintv:unscaled FontPath /usr/X11R6/lib/X11/fonts/latin2/Type1 FontPath /usr/X11R6/lib/X11/fonts/local/mma/Type1 FontPath /usr/X11R6/lib/X11/fonts/local/mma/X:unscaled FontPath /usr/X11R6/lib/X11/fonts/misc:unscaled FontPath /usr/X11R6/lib/X11/fonts/misc/sgi:unscaled FontPath /usr/X11R6/lib/X11/fonts/truetype FontPath /usr/X11R6/lib/X11/fonts/uni:unscaled # ls -R /usr/X11R6/lib/X11/fonts/ | grep / /usr/X11R6/lib/X11/fonts/: /usr/X11R6/lib/X11/fonts/100dpi: /usr/X11R6/lib/X11/fonts/75dpi: /usr/X11R6/lib/X11/fonts/CID: /usr/X11R6/lib/X11/fonts/Speedo: /usr/X11R6/lib/X11/fonts/Type1: /usr/X11R6/lib/X11/fonts/URW: /usr/X11R6/lib/X11/fonts/encodings: /usr/X11R6/lib/X11/fonts/encodings/large: /usr/X11R6/lib/X11/fonts/kwintv: /usr/X11R6/lib/X11/fonts/latin2: /usr/X11R6/lib/X11/fonts/latin2/Type1: /usr/X11R6/lib/X11/fonts/local: /usr/X11R6/lib/X11/fonts/local/mma: /usr/X11R6/lib/X11/fonts/local/mma/Type1: /usr/X11R6/lib/X11/fonts/local/mma/X: /usr/X11R6/lib/X11/fonts/misc: /usr/X11R6/lib/X11/fonts/misc/sgi: /usr/X11R6/lib/X11/fonts/truetype: /usr/X11R6/lib/X11/fonts/uni: /usr/X11R6/lib/X11/fonts/util: ######################################################## When I open the Mathematica Book Reference Guide in the Help Browser, I get a beep and the message says: Unable to find font with family Helvetica, weight Bold, slant Plain, and size 26. Substituting Courier. Compared to the things which *were* broken, this is a minor problem. I can live with the beep. What I would now like to know is how to tell Mathematica what fonts to use by default. This seemingly simple question seems to have no simple answer. Could someone please help me. TIA, ^L Reply-To: kuska@informatik.uni-leipzig.de ==== I expect that the Helvetica request comes from the Frontend menues and this is lited I your X resources $TopDirectory/SystemFiles/FontEnd/SystemResources/X/XMathematica request the helvetica font: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! GENERAL GUI STYLE / COLOR SETTINGS ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Choose your GUI widget background color. ! CDE: Comment this out. *background: #c0c0c0 ! Choose a font for buttons/text fields, etc. ! You can use xfontsel to get a listing of fonts. !*Menu*fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-*-* ! Or just set all the fonts at once. *fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-*-* Jens I've been trying to get my Mathematica 4.1 properly configured. I set: > ################################################################### > /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/X/Specific.tr: > @@resource maxForXListFonts > 10000 # xlsfonts | wc -l > 5572 /etc/X11/XF86Config: > FontPath /usr/X11R6/lib/X11/fonts/100dpi:unscaled > FontPath /usr/X11R6/lib/X11/fonts/75dpi:unscaled > FontPath /usr/X11R6/lib/X11/fonts/CID > FontPath /usr/X11R6/lib/X11/fonts/Speedo > FontPath /usr/X11R6/lib/X11/fonts/Type1 > FontPath /usr/X11R6/lib/X11/fonts/URW > FontPath /usr/X11R6/lib/X11/fonts/kwintv:unscaled > FontPath /usr/X11R6/lib/X11/fonts/latin2/Type1 > FontPath /usr/X11R6/lib/X11/fonts/local/mma/Type1 > FontPath /usr/X11R6/lib/X11/fonts/local/mma/X:unscaled > FontPath /usr/X11R6/lib/X11/fonts/misc:unscaled > FontPath /usr/X11R6/lib/X11/fonts/misc/sgi:unscaled > FontPath /usr/X11R6/lib/X11/fonts/truetype > FontPath /usr/X11R6/lib/X11/fonts/uni:unscaled # ls -R /usr/X11R6/lib/X11/fonts/ | grep / > /usr/X11R6/lib/X11/fonts/: > /usr/X11R6/lib/X11/fonts/100dpi: > /usr/X11R6/lib/X11/fonts/75dpi: > /usr/X11R6/lib/X11/fonts/CID: > /usr/X11R6/lib/X11/fonts/Speedo: > /usr/X11R6/lib/X11/fonts/Type1: > /usr/X11R6/lib/X11/fonts/URW: > /usr/X11R6/lib/X11/fonts/encodings: > /usr/X11R6/lib/X11/fonts/encodings/large: > /usr/X11R6/lib/X11/fonts/kwintv: > /usr/X11R6/lib/X11/fonts/latin2: > /usr/X11R6/lib/X11/fonts/latin2/Type1: > /usr/X11R6/lib/X11/fonts/local: > /usr/X11R6/lib/X11/fonts/local/mma: > /usr/X11R6/lib/X11/fonts/local/mma/Type1: > /usr/X11R6/lib/X11/fonts/local/mma/X: > /usr/X11R6/lib/X11/fonts/misc: > /usr/X11R6/lib/X11/fonts/misc/sgi: > /usr/X11R6/lib/X11/fonts/truetype: > /usr/X11R6/lib/X11/fonts/uni: > /usr/X11R6/lib/X11/fonts/util: ######################################################## When I open the Mathematica Book Reference Guide in the Help Browser, I get > a beep and the message says: Unable to find font with family Helvetica, weight Bold, slant Plain, and > size 26. Substituting Courier. Compared to the things which *were* broken, this is a minor problem. I can > live with the beep. What I would now like to know is how to tell Mathematica what > fonts to use by default. This seemingly simple question seems to have no > simple answer. Could someone please help me. TIA, ^L ==== I expect that the Helvetica request comes from the > Frontend menues and this is lited I your X resources $TopDirectory/SystemFiles/FontEnd/SystemResources/X/XMathematica $PreferencesDirectory? This is where I expected to find this kind of thing in the first place. The idea of chaning user preferences in a system file bothers me. request the helvetica font: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > ! > ! GENERAL GUI STYLE / COLOR SETTINGS > ! > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Choose your GUI widget background color. > ! CDE: Comment this out. > *background: #c0c0c0 ! Choose a font for buttons/text fields, etc. > ! You can use xfontsel to get a listing of fonts. > !*Menu*fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-*-* ! Or just set all the fonts at once. > *fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-*-* I still don't know why Mathematica would ship with the font defaults arranged in such a way as to cause it to give me errors when viewing the help files. It makes me think something is still amiss. Were they expecting my system to have these already installed? Should I have other fonts installed? Where would I get them, if I wanted them? Jens > STH ==== I have spent far more time attempting to get Mathematica configured than I have using it. I've found the the product to be exceptionally difficult to As an example, I spent several hours trying to figure out how to tell Mathematica to understand the delete key in the way most contemporary systems understand it. I wanted to avoid modifying system configuration files such as: /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/KeyEventTranslatio ns.tr I expected to be able to change something in my own ~/.Mathematic directory, but I could not figure out an obvious way to affect this modification. I want to adjust the font size used in the widgets, but again, I see no ovbious means of modifying these attributes. I suspect it can be accomplished by modifying the ~/.Mathematica/4.1/FrontEnd/init.m. Perhaps to an experienced Mathematica user, the syntax and semantics of this file are obvious. They aren't to me. I also find the overall look & feel of the interface to be archaic. I understand that Mathematica 4.1 was written years ago, and much of the desktops for Unix which exist today did not exist when it was written. I should be receiving Mathematica 4.2 in a few days, so perhaps these concerns will prove undounded. Something tells me that not a lot has changed in this respect. What have others observed? Reply-To: kuska@informatik.uni-leipzig.de ==== I can't understand your criticism. Open a terminal window and type >math the delete key work perfect, due to your terminal settings and a command line is the most modern interface I can imagine. It still comes with Mathematica 4.2 and is perfect as before. Jens I have spent far more time attempting to get Mathematica configured than I > have using it. I've found the the product to be exceptionally difficult to As an example, I spent several hours trying to figure out how to tell Mathematica to > understand the delete key in the way most contemporary systems understand > it. I wanted to avoid modifying system configuration files such as: > /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/KeyEventTranslation s.tr I expected to be able to change something in my own ~/.Mathematic directory, > but I could not figure out an obvious way to affect this modification. I > want to adjust the font size used in the widgets, but again, I see no > ovbious means of modifying these attributes. I suspect it can be > accomplished by modifying the ~/.Mathematica/4.1/FrontEnd/init.m. Perhaps > to an experienced Mathematica user, the syntax and semantics of this file are > obvious. They aren't to me. I also find the overall look & feel of the interface to be archaic. I > understand that Mathematica 4.1 was written years ago, and much of the desktops for > Unix which exist today did not exist when it was written. I should be > receiving Mathematica 4.2 in a few days, so perhaps these concerns will prove > undounded. Something tells me that not a lot has changed in this respect. What have others observed? ==== I can't understand your criticism. Open a terminal window > and type >math the delete key work perfect, due to your terminal settings and > a command line is the most modern interface I can imagine. > It still comes with Mathematica 4.2 and is perfect as before. Jens > If I could use bash to edit the command line, recall the command history, and other sorts of things that bash is good at, that would make the command line attractive. There *are* certain advantages to the gui side of things. For example the M-k code completion. That can really speed things up with languages such as Java and C++. I don't believe there is any fundamental reason such a thing could not exist with the command line. IMHO, a well conceived XEmacs lisp package could provide a wonderful frontend. I played around with mma.el for a few minutes, but it wasn't acting like a normal XEmacs package, so I switched back to cursing the Mod1<->Ctrl inversion of the Mathematica frontend. gui front end, get in the way of what really matters. The last thing I Mathematica. What I want to do is improve the overal experience for all of us. STH ==== Dear friends I have the following problem with Legend and LogPlot and LogPlotPlot: Needs[Graphics`Graphics`] Needs[Graphics`Legend`] {q1[t_],q2[t_],q3[t_]}={0.1 Exp[-0.02 t], 0.2 Exp[-0.025 t], 0.4 Exp[-0.028 t]}; (*With Plot legend works fine*) Plot[{q1[t],q2[t],q3[t]}, {t, 0, 100},PlotStyle[Rule]{ {AbsoluteThickness[0.5], AbsoluteDashing[{4,4}]}, AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1,8}]}}, AxesLabel[Rule]{Y, X}, PlotLabel[Rule]Title, PlotLegend[Rule]{1,3,5}, LegendPosition[Rule] {0.5,0}] (*However with LogPlot or LogLogPlot the legend desappear*) LogLogPlot[{q1[t],q2[t],q3[t]}, {t, 0, 100},PlotStyle[Rule]{ {AbsoluteThickness[0.5], AbsoluteDashing[{4,4}]}, AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1,8}]}}, AxesLabel[Rule]{Y, X}, PlotLabel[Rule]Title, PlotLegend[Rule]{1,3,5}, LegendPosition[Rule] {0.5,0}] I have shown a particular case, but I has this problem always with Legend and LogPlot and LogPlotPlot. I will appreciate any help. Guillermo Sanchez --------------------------------------------- This message was sent using Endymion MailMan. ==== IIRC, there is a way to get a list of all the symbols defined in the currently running session. I can't seem to find the reference to that command. Could somone point me in the direction of documentation which will tell me how to get information about the current session? TIA, Reply-To: murray@math.umass.edu ==== We are about to order new PCs for a university student lab in which Mathematica will be installed. Of course they will be using 2D and 3D graphics -- plots of surfaces, e.g. Sooner or later students will want to rotate such plots, too. An unresolved issue is how much graphics RAM to get. On existing machines we typically have 64MB. But for the PCs we are looking at, manufacturer's limits on graphics RAM, rather than cost, seems to limit us to 32 MB. Is 32 MB adequate not just now, but likely to be adequate as well for the near future (say, a 3- to 5-year equipment lifetime)? -- 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 Amherst, MA 01375 Reply-To: kuska@informatik.uni-leipzig.de ==== Mathematica's PostScript does not need a 3d graphics card and will not use it. Only the RealTime3D` package make use of the 3d graphics and it's memory. Since it make an off screen rendering it will be slow and since one must be mad to use it for 10^5 polygons it does not matter how much graphics memory you have. The tiny polygon counts of Plot3D[] & friends can be handled wit 8 MByte :-) MathGL3d will run fine (not fast) with 8 MByte. For the most MathGL3d applications 64 MByte sufficient. With more than 10^6 polygons or many huge (1024^2) textures you may run into problems. For the MathGL3d development I have GeForce 3/4 cards with 128 MByte RAM. BTW the RAM of the 3d graphics cards is for textures and Mathematica does not know what a texture is or how usefull it is for scientific visualization. Jens We are about to order new PCs for a university student lab in which > Mathematica will be installed. Of course they will be using 2D and 3D > graphics -- plots of surfaces, e.g. Sooner or later students will want > to rotate such plots, too. An unresolved issue is how much graphics RAM to get. On existing > machines we typically have 64MB. But for the PCs we are looking at, > manufacturer's limits on graphics RAM, rather than cost, seems to limit > us to 32 MB. Is 32 MB adequate not just now, but likely to be adequate as well for > the near future (say, a 3- to 5-year equipment lifetime)? -- > 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 > Amherst, MA 01375 Reply-To: kuska@informatik.uni-leipzig.de ==== Names[Global`*] ?? Jens IIRC, there is a way to get a list of all the symbols defined in the > currently running session. I can't seem to find the reference to that > command. Could somone point me in the direction of documentation which > will tell me how to get information about the current session? TIA, ==== To get a complete list of all variables that have been defined for the current Mathematica session, please try: ?`* which should return a list of all variables that have been defined for the current Mathematica session. Steven Shippee ==== > IIRC, there is a way to get a list of all the symbols defined in the > currently running session. I can't seem to find the reference to that > command. Could somone point me in the direction of documentation which > will tell me how to get information about the current session? > TIA, > Let's begin with a fresh session Quit Make some entries, notice that b, x and y have no definitions - they are simply created. a=3; b; p= 3x +1; f[y_]:=y^2; We can find all the symbols we have created so far. Names[`*] {a,b,f,p,x,y} Actually, they are the strings of the symbols (otherwise, for example, a would immediately evaluate to 3). InputForm[%] {a, b, f, p, x, y} How can we take out the strings of the undefined symbols? I make a function that test if the symbol has been defined (or has an attribute assigned): SetAttributes[definedQ, HoldFirst]; definedQ[x_String]:= Or[DownValues@@#=!={}, UpValues@@#=!={},OwnValues@@#=!={}, SubValues@@#=!={},DefaultValues@@#=!={},NValues@@#=!={}, Attributes@@#=!={}]&[ ToExpression[x, InputForm, Hold]] definedQ[x_]:= definedQ[Evaluate[ToString[Unevaluated[x]]]] Using this we get Select[Names[`*], definedQ] {a,definedQ,f,p} To get information about the symbols Information/@Select[Names[`*], definedQ]; a a = 3 definedQ Attributes[definedQ] = {HoldFirst} definedQ[x_String] := (DownValues @@ #1 =!= {} || UpValues @@ #1 =!= {} || OwnValues @@ #1 =!= {} || SubValues @@ #1 =!= {} || DefaultValues @@ #1 =!= {} || NValues @@ #1 =!= {} & )[ToExpression[x, InputForm, Hold]] definedQ[x_] := definedQ[Evaluate[ ToString[Unevaluated[x]]]] f f[y_] := y^2 p p = 1 + 3*x I have assumed that you are interested only in the symbols in the symbols in the default context Global`. Other context can be provided for. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 ==== There are several ways (note that newly defined things are by default in Global` context) , one would be ?@ bye, Borut | IIRC, there is a way to get a list of all the symbols defined in the | currently running session. I can't seem to find the reference to that | command. Could somone point me in the direction of documentation which | will tell me how to get information about the current session? | | | TIA, | ==== Dear all, As far as I understand, FindMinimum can be requested to use the Berndt-Hall-Hall-Hausman method, if the option Method->QuasiNewton is specified. I am pretty convinced that there is no way to tell mathematica to produce as an output the Jacobian vector and the Hessian matrix at every step. In addition, I have not found a way to specify the Davidon-Fletcher-Powell algorithm to be used. Before I start to program it myself, I was wondering if anybody has written some [non-commercial] code that produces such an output for BFGS and even better for DFP optimization. Kyriakos _____+**+____+**+___+**+__+**+_ Kyriakos Chourdakis Lecturer in Financial Economics URL: http://www.qmw.ac.uk/~te9001 tel: (++44) (+20) 7882 5086 Dept of Economics University of London, QM London E1 4NS U.K. ==== Both Simplify and ImpliesQ need the assumption that all variables are real in order to use the CAD algorithm. However, Simplify uses many other methods trying to simplify each subexpression of the input, while ImpliesQ only tries to prove that the whole input is implied by the assumptions. Here is the series of simplifications that Simplify does in this example. - An inequality simplification heuristic using the inequality assumption y6 >= -1 is applied to the whole system. We get simplification: y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 -> 1 + y4 >= 0 && y5 >= y6 && 1 + y4 + y6 >= y5 - We go into simplification of subexpressions, and get these simplifications using reduction modulo a GroebnerBasis of equation assumptions y4 == -1 and y5 == y6 (Simplify keeps the result of this transformation even if it has the same complexity as the original expression.) 1 + y4 -> 0 y5 -> y6 1 + y4 + y6 -> y6 y5 -> y6 - As the result of subexpression simplifications the three inequalities become then: 1 + y4 >= 0 -> 0 >= 0 y5 >= y6 -> y6 >= y6 1 + y4 + y6 >= y5 -> y6 >= y6 - 0 >= 0 evaluates to True, y6 >= y6 is simplified to True using transformation x >= y -> x - y >= 0. Adam Strzebonski Wolfram Research That makes everything clear, except for just one small mystery: In[1]:= > << Experimental` In[2]:= > FullSimplify[y4 >= -1 && y6 >= -1 && > y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6] Out[2]= > True In[3]:= > ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6, > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[3]= > False I now understand why the last one returns False, but why does the > second one return True? Should not the same arument apply in both > cases? Or is it because FullSimplify does not actually need the > assumption that the variables are real while ImliesQ does? Andrzej > Actually, the reason why ImpliesQ (and FullSimplify) fail to > prove the implication is not that the hypothesis is a disjunction. > To use the cylindrical algebraic decomposition algorithm they > need to know that the assumptions imply that all variables are > real. > The assumptions mechanism infers variable domains in a purely > syntactical way, i.e. v is assumed to be real if there is > an Element[v, Reals] statement or v appears in an inequality. > It does not attempt to analyze assumptions further, to figure > out that, say y6 >= -1 implies that y6 is real, and then if > we have y5 == y6 then y5 must be real too. Doing such an analysis > in general would require solving the assumptions over complex > numbers, and then finding out which variables need to be real. > This would be in general too time consuming to do, but analyzing > linear dependencies like the ones in your example is a possible > future improvement. > ImpliesQ cannot prove the implication here, because it knows only > that y6 is real. > In[1]:= < In[2]:= ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6, > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[2]= False > If we add an explicit assumption that y4 and y5 are real, ImpliesQ > (and FullSimplify) can prove this implication, and the full version > of your example. > In[3]:= ImpliesQ[Element[y4|y5, Reals] && y4 == -1 && y6 >= -1 && y5 == > y6, > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[3]= True > In[4]:= ImpliesQ[Element[y4|y5, Reals] && (y4 == -1 && y6 >= -1 && > y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6), > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[4]= > True > In[5]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > Element[y4|y5, Reals] && (y4 == -1 && y6 >= -1 && y5 == y6 || > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6)] > Out[5]= > True > > Adam Strzebonski > Wolfram Research > > On second thoughts I realized that there seems to be an inherent > ambiguity about what one coudl mean by using alternatives (statements > joned by Or) assumptions. In fact it now seems to me that the > reasonable intertpretation for ImpliesQ and FullSimplify ought to > perhaps be different. It seems to me that ImpliesQ[Or[a,b],c] ought to > return True if aand only if ImpliesQ[a,c] and ImpliesQ[b,c] both > return > True. If so this could be acomplished by adding the rule > ImpliesQ[Or[a,b],c] = And[ImpliesQ[a,c],ImpliesQ[b,c]]. That could > then > be used in proving that the two answers to the system of inequalities > that of Vincent's original posting are equivalent. On the other hand > probably FullSimplify[a, Or[p,q]] ought to return > Or[FullSimplify[a,p],FullSimplify[a,q]] (or do nothing as it doe > snow). > The first approach would seem to be consistent with the way > FullSimplify works with domain specifications but would however have > the strange effect of returning True if just one of the alternatives > were true and the other false. So perhaps after all it is best to > leave FullSimplify as it is. However, it seems to me that ImpliesQ > shoud be able to handle such cases (?) > Andrzej Kozlowski > Toyama International University > JAPAN >> The modification to FullSimplify that I sent earlier works correctly >> only for assumptions of the form Or[a,b] (and even then not is not >> always what one would like). For what it's worth here is a better >> (but >> slow) version: >> In[1]:= >> Unprotect[FullSimplify]; >> In[2]:= >> FullSimplify[expr_, x_ || y__] := FullSimplify[ >> FullSimplify[expr, x] || FullSimplify[expr, Or[y]]]; >> In[3]:= >> Protect[FullSimplify]; >> For example: >> In[4]:= >> FullSimplify[Sqrt[(x - 1)^2] + Sqrt[(x - 2)^2] + >> Sqrt[(x - 3)^2], x > 1 || x > 2 || x > 3] >> Out[4]= >> -1 + x + Abs[-3 + x] + Abs[-2 + x] || >> -3 + 2*x + Abs[-3 + x] || 3*(-2 + x) >> Andrzej Kozlowski >> Toyama International University >> JAPAN > On Thursday, September 26, 2002, at 11:14 AM, Andrzej Kozlowski > The reason why InequalitySolve returns it's answer in what sometimes >> turns out to be unnecessarily complicated form is that the >> underlying >> algorithm, Cylindrical Agebraic Decomposition (CAD) returns its >> answers in this form. Unfortunately it seems to me unlikely that a >> simplification of the kind you need can be can be accomplished in >> any >> general way. To see why observe the following. First of all: > In[1]:= >> FullSimplify[x > 0 || x == 0] > Out[1]= >> x >= 0 > This is fine. However: > In[2]:= >> FullSimplify[x > 0 && x < 2 || x == 0 && x < 2] > Out[2]= >> x == 0 || 0 < x < 2 > Of course what you would like is simply 0 <= x < 2. One reason why >> you can't get it is that while Mathematica can perform a >> LogicalExpand, as in: >> In[3]:= >> LogicalExpand[(x > 0 || x == 0) && x < 2] > Out[3]= >> x == 0 && x < 2 || x > 0 && x < 2 > There i no LogicalFactor or anything similar that would reverse >> what LogicalExpand does. if there was then you could perform the >> sort >> of simplifications you need for: > In[4]:= >> FullSimplify[(x > 0 || x == 0) && x < 2] > Out[4]= >> 0 <= x < 2 > However, it does not seem to me very likely that such logical >> factoring can be performed by a general enough algorithm (though I >> am no expert in this field). In any case, certainly Mathematica >> can't >> do this. > I also noticed that Mathematica seems unable to show that the answer >> it returns to your problem is actually equivalent to your simpler >> one. In fact this looks like a possible bug in Mathematica. Let's >> first try the function ImpliesQ from the Experimental context: > << Experimental` > Now Mathematica correctly gives: > In[6]:= >> ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= >> y5 >> <= 1 + y4 + y6] > Out[6]= >> True > However: > In[7]:= >> ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && >> y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + >> y4 + y6] > Out[7]= >> False > That simply means that ImpliesQ cannot show the implication, not >> that >> it does not hold. ImpliesQ relies on CAD, as does FullSimplify. >> Switching to FullSimplify we see that: > In[8]:= >> FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 >> && >> y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + >> y4 + y6] > Out[8]= >> True > while > In[9]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= >> y5 >> <= 1 + y4 + y6] > Out[9]= >> y4 >= -1 && y6 <= y5 <= 1 + y4 + y6 > On the other hand, taking just the individual summands of Or as >> hypotheses; >> In[10]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[10]= >> True > In[11]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 ] > Out[11]= >> True > In fact FullSimplify is unable to use Or in assumptions, which can >> be >> demonstrated on an abstract example: >> In[12]:= >> FullSimplify[C,(A||B)&&(C)] > Out[12]= >> True > In[13]:= >> FullSimplify[C,LogicalExpand[(A||B)&&(C)]] > Out[13]= >> C > This could be fixed by modifying FullSimplify: > In[14]:= >> Unprotect[FullSimplify]; > In[14]:= >> FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify >> [e >> xpr,y]]; > In[15]:= >> Protect[FullSimplify]; > Now at least we get as before: > In[16]:= >> FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 >> && >> y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + >> y4 + y6] > Out[16]= >> True > but also: > In[17]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= >> y5 >> <= 1 + y4 + y6] > Out[17]= >> True > This seems to me a possible worthwhile improvement in FullSimplify, >> though of course not really helpful for your problem. >> Andrzej Kozlowski >> Toyama International University >> JAPAN >> On Wednesday, September 25, 2002, at 02:51 PM, Vincent Bouchard >> I have a set of inequalities that I solve with InequalitySolve. But > then > it gives a complete set of solutions, but not in the way I would > like it > to be! :-) For example, the simple following calculation will give: >> In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 > = -1}; > InequalitySolve[ineq,{y4,y6,y5}] >> Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> the result is good, but I would like it to be in the simpler but > equivalent form >> y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> How can I tell InequalitySolve to do that? It is simple for this > example, > but for a large set of simple inequalities InequalitySolve gives > lines and > lines of results instead of a simple result. >> Vincent Bouchard >> Andrzej Kozlowski > Toyama International University > JAPAN ==== That makes everything clear, except for just one small mystery: In[1]:= << Experimental` In[2]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6] Out[2]= True In[3]:= ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[3]= False I now understand why the last one returns False, but why does the second one return True? Should not the same arument apply in both cases? Or is it because FullSimplify does not actually need the assumption that the variables are real while ImliesQ does? Andrzej > Actually, the reason why ImpliesQ (and FullSimplify) fail to > prove the implication is not that the hypothesis is a disjunction. > To use the cylindrical algebraic decomposition algorithm they > need to know that the assumptions imply that all variables are > real. The assumptions mechanism infers variable domains in a purely > syntactical way, i.e. v is assumed to be real if there is > an Element[v, Reals] statement or v appears in an inequality. > It does not attempt to analyze assumptions further, to figure > out that, say y6 >= -1 implies that y6 is real, and then if > we have y5 == y6 then y5 must be real too. Doing such an analysis > in general would require solving the assumptions over complex > numbers, and then finding out which variables need to be real. > This would be in general too time consuming to do, but analyzing > linear dependencies like the ones in your example is a possible > future improvement. ImpliesQ cannot prove the implication here, because it knows only > that y6 is real. In[1]:= <= -1 && y5 == y6, > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[2]= False If we add an explicit assumption that y4 and y5 are real, ImpliesQ > (and FullSimplify) can prove this implication, and the full version > of your example. In[3]:= ImpliesQ[Element[y4|y5, Reals] && y4 == -1 && y6 >= -1 && y5 == > y6, > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[3]= True In[4]:= ImpliesQ[Element[y4|y5, Reals] && (y4 == -1 && y6 >= -1 && > y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6), > y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] Out[4]= > True In[5]:= FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, > Element[y4|y5, Reals] && (y4 == -1 && y6 >= -1 && y5 == y6 || > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6)] Out[5]= > True Adam Strzebonski > Wolfram Research > On second thoughts I realized that there seems to be an inherent > ambiguity about what one coudl mean by using alternatives (statements > joned by Or) assumptions. In fact it now seems to me that the > reasonable intertpretation for ImpliesQ and FullSimplify ought to > perhaps be different. It seems to me that ImpliesQ[Or[a,b],c] ought to > return True if aand only if ImpliesQ[a,c] and ImpliesQ[b,c] both > return > True. If so this could be acomplished by adding the rule > ImpliesQ[Or[a,b],c] = And[ImpliesQ[a,c],ImpliesQ[b,c]]. That could > then > be used in proving that the two answers to the system of inequalities > that of Vincent's original posting are equivalent. On the other hand > probably FullSimplify[a, Or[p,q]] ought to return > Or[FullSimplify[a,p],FullSimplify[a,q]] (or do nothing as it doe > snow). > The first approach would seem to be consistent with the way > FullSimplify works with domain specifications but would however have > the strange effect of returning True if just one of the alternatives > were true and the other false. So perhaps after all it is best to > leave FullSimplify as it is. However, it seems to me that ImpliesQ > shoud be able to handle such cases (?) > Andrzej Kozlowski > Toyama International University > JAPAN >> The modification to FullSimplify that I sent earlier works correctly >> only for assumptions of the form Or[a,b] (and even then not is not >> always what one would like). For what it's worth here is a better >> (but >> slow) version: >> In[1]:= >> Unprotect[FullSimplify]; >> In[2]:= >> FullSimplify[expr_, x_ || y__] := FullSimplify[ >> FullSimplify[expr, x] || FullSimplify[expr, Or[y]]]; >> In[3]:= >> Protect[FullSimplify]; >> For example: >> In[4]:= >> FullSimplify[Sqrt[(x - 1)^2] + Sqrt[(x - 2)^2] + >> Sqrt[(x - 3)^2], x > 1 || x > 2 || x > 3] >> Out[4]= >> -1 + x + Abs[-3 + x] + Abs[-2 + x] || >> -3 + 2*x + Abs[-3 + x] || 3*(-2 + x) >> Andrzej Kozlowski >> Toyama International University >> JAPAN > On Thursday, September 26, 2002, at 11:14 AM, Andrzej Kozlowski > The reason why InequalitySolve returns it's answer in what sometimes >> turns out to be unnecessarily complicated form is that the >> underlying >> algorithm, Cylindrical Agebraic Decomposition (CAD) returns its >> answers in this form. Unfortunately it seems to me unlikely that a >> simplification of the kind you need can be can be accomplished in >> any >> general way. To see why observe the following. First of all: > In[1]:= >> FullSimplify[x > 0 || x == 0] > Out[1]= >> x >= 0 > This is fine. However: > In[2]:= >> FullSimplify[x > 0 && x < 2 || x == 0 && x < 2] > Out[2]= >> x == 0 || 0 < x < 2 > Of course what you would like is simply 0 <= x < 2. One reason why >> you can't get it is that while Mathematica can perform a >> LogicalExpand, as in: >> In[3]:= >> LogicalExpand[(x > 0 || x == 0) && x < 2] > Out[3]= >> x == 0 && x < 2 || x > 0 && x < 2 > There i no LogicalFactor or anything similar that would reverse >> what LogicalExpand does. if there was then you could perform the >> sort >> of simplifications you need for: > In[4]:= >> FullSimplify[(x > 0 || x == 0) && x < 2] > Out[4]= >> 0 <= x < 2 > However, it does not seem to me very likely that such logical >> factoring can be performed by a general enough algorithm (though I >> am no expert in this field). In any case, certainly Mathematica >> can't >> do this. > I also noticed that Mathematica seems unable to show that the answer >> it returns to your problem is actually equivalent to your simpler >> one. In fact this looks like a possible bug in Mathematica. Let's >> first try the function ImpliesQ from the Experimental context: > << Experimental` > Now Mathematica correctly gives: > In[6]:= >> ImpliesQ[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= >> y5 >> <= 1 + y4 + y6] > Out[6]= >> True > However: > In[7]:= >> ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && >> y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + >> y4 + y6] > Out[7]= >> False > That simply means that ImpliesQ cannot show the implication, not >> that >> it does not hold. ImpliesQ relies on CAD, as does FullSimplify. >> Switching to FullSimplify we see that: > In[8]:= >> FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 >> && >> y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + >> y4 + y6] > Out[8]= >> True > while > In[9]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= >> y5 >> <= 1 + y4 + y6] > Out[9]= >> y4 >= -1 && y6 <= y5 <= 1 + y4 + y6 > On the other hand, taking just the individual summands of Or as >> hypotheses; >> In[10]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6] > Out[10]= >> True > In[11]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 ] > Out[11]= >> True > In fact FullSimplify is unable to use Or in assumptions, which can >> be >> demonstrated on an abstract example: >> In[12]:= >> FullSimplify[C,(A||B)&&(C)] > Out[12]= >> True > In[13]:= >> FullSimplify[C,LogicalExpand[(A||B)&&(C)]] > Out[13]= >> C > This could be fixed by modifying FullSimplify: > In[14]:= >> Unprotect[FullSimplify]; > In[14]:= >> FullSimplify[expr_,Or[x_,y__]]:=Or[FullSimplify[expr,x],FullSimplify >> [e >> xpr,y]]; > In[15]:= >> Protect[FullSimplify]; > Now at least we get as before: > In[16]:= >> FullSimplify[y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 >> && >> y6 <= y5 <= 1 + y4 + y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + >> y4 + y6] > Out[16]= >> True > but also: > In[17]:= >> FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, >> y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= >> y5 >> <= 1 + y4 + y6] > Out[17]= >> True > This seems to me a possible worthwhile improvement in FullSimplify, >> though of course not really helpful for your problem. >> Andrzej Kozlowski >> Toyama International University >> JAPAN >> On Wednesday, September 25, 2002, at 02:51 PM, Vincent Bouchard >> I have a set of inequalities that I solve with InequalitySolve. But > then > it gives a complete set of solutions, but not in the way I would > like it > to be! :-) For example, the simple following calculation will give: >> In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 > = -1}; > InequalitySolve[ineq,{y4,y6,y5}] >> Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || > y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> the result is good, but I would like it to be in the simpler but > equivalent form >> y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 >> How can I tell InequalitySolve to do that? It is simple for this > example, > but for a large set of simple inequalities InequalitySolve gives > lines and > lines of results instead of a simple result. >> Vincent Bouchard >> Andrzej Kozlowski Toyama International University JAPAN ==== inside a program I need to solve this linear equation in terms of p1. However something odds happens. Sometimes the solution is computed and sometimes the result is empty [I mean no output...]. Is this a bug of the solve command or am I doing something wrong? The problem is robust to: changing name to the variables and other makeups.. David ps: Sorry for the stupid way in which I copied the command... Solve[(x^2*((-0.9*x^7*(p^2*(-1 - 5.8*x^6 - 14.010000000000002*x^12 - 18.04*x^18 - 13.06*x^24 - 5.040000000000001*x^30 - 0.81*x^36) + x*(7.777777777777779 - 9.074074074074076*x + 30.333333333333336*x^6 - 21.51851851851852*x^7 - 16.333333333333336*x^8 + 44.33333333333334*x^12 + 3.188888888888883*x^13 - 65.68333333333332*x^14 + 28.777777777777786*x^18 + 47.937037037037044*x^19 - 100.10000000000002*x^20 + 7.*x^24 + 45.6037037037037*x^25 - 69.53333333333333*x^26 + 13.299999999999999*x^31 - 19.833333333333332*x^32 - 1.0499999999999996*x^38) + p*(-6 + 8.296296296296296*x - 28.799999999999997*x^6 + 32.785185185185185*x^7 + 9.333333333333336*x^8 - 55.260000000000005*x^12 + 49.04777777777776*x^13 + 38.38333333333334*x^14 - 52.980000000000004*x^18 + 34.20518518518518*x^19 + 60.20000000000001*x^20 - 25.380000000000003*x^24 + 11.736296296296294*x^25 + 43.63333333333334*x^26 - 4.86*x^30 + 2.8999999999999986*x^31 + 13.533333333333333*x^32 + 0.81*x^37 + 1.0499999999999996*x^38)))/(x + 1.9*x^7 + 0.9*x^13)^2 - ((-1 + p - 7*x^6 + p*x^6 + 6*x^7)*(1.2962962962962965 - 3.111111111111112*x^6 + 9.333333333333336*x^7 - 10.111111111111114*x^12 + 22.05*x^13 - 5.703703703703705*x^18 + 17.15*x^19 + 5.483333333333331*x^25 + 1.0499999999999996*x^31 + p1*x^5*(7.000000000000002 - 7.000000000000002*x + 14.000000000000004*x^6 - 14.000000000000004*x^7 + 7.000000000000002*x^12 - 6.999999999999998*x^13) - 1.166666666666667*p*x^4*x1 - 3.500000000000001*p*x^10*x1 - 1.0500000000000003*p*x^11*x1 - 3.500000000000001*p*x^16*x1 - 3.150000000000001*p*x^17*x1 - 1.166666666666667*p*x^22*x1 - 3.150000000000001*p*x^23*x1 - 1.0500000000000003*p*x^29*x1))/((1 + 0.9*x^6)^2*(1 + x^6)^2)))/(p^2*(1 + x^6)^3) == 0, p1] ==== You're right; I misunderstood your problem. First of all, never use Do -- forget it exists -- and don't put the SelectionMove, etc. commands inside a loop. That's your biggest problem. This should help: Table[Plot[ Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}], {t, 0, 2Pi - Pi/32, Pi/32}]; SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute[OpenCloseGroup] FrontEndTokenExecute[SelectionAnimate] The first time through the animation is a bit slow because the frames are being generated, but then the cell group collapses and things are better. I used an increment that's an exact divisor of the period in order to catch the max and min values of Sin[t], as well as the zero value, on each swing. Use the period MINUS the step-size as the upper limit in order to avoid having a last frame identical to the first. I'm a bit annoyed at the tendency for the plot to jump near zero and Pi, but that's because the derivative of Sin is higher there, and we're not compensating by picking more points there. If we do pick more points there, however, we won't perceive t as time. If that's not a consideration, you could do it this way: f = Which[ -1 ? # ? 1, #, 1 < # ? 3, 2 - #, True, f@Mod[#, 4, -1] ] &; Table[Plot[ f[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}], { t, -1, 2.9, 0.1}]; SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute[OpenCloseGroup] FrontEndTokenExecute[SelectionAnimate] Bobby -----Original Message----- Put this after the Plot statement, in the same cell: SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute[OpenCloseGroup] FrontEndTokenExecute[SelectionAnimate] Bobby Treat -----Original Message----- Is it possible to tidy up the generation of the graphic so that it becomes the animation? I have tried the following Do[Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEnd`SelectionAnimate[0.1]}]; FrontEndExecute[{FrontEndToken[Clear]}], {t, 0, 15, 0.1}] This works but the cell dividing line flashes on and off spoiling the animation and if there is anything in the cell below this jumps up and down. Is there a proper way of doing this? Hugh Goyder ==== That's nice because it avoids watching the frames being slowly created, and the group doesn't always collapse as it should, the way I've been doing it. However, a couple of small changes give a smoother animation with 64 frames rather than 151, while GENERATING only 33 frames. Block[{$DisplayFunction = Identity, half, graphs, step = Pi/32}, half = Table[GraphicCell[Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]], {t, -Pi/2, Pi/2 - step, step}]; graphs = Rest@Join[half, Rest@Reverse@half]; NotebookWrite[EvaluationNotebook[], Cell[CellGroupData[graphs, Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}]] Bobby -----Original Message----- >showing during generation is enough (but uncontrolled). > >Hugh Goyder This creates a graphics cell from a graphics expression. GraphicCell[graphics_] := Cell[GraphicsData[PostScript, DisplayString[graphics]],Graphics] cellgroup. Block[{$DisplayFunction=Identity, graphs}, graphs = Table[GraphicCell[ Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]], {t,0,15,.1}]; NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs,Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}] ] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== I'm woking on a kind of a Mathematica cheat-sheet. So I don't have to repeat the same learning process if I get pulled away for another 6 months. I've attempted to get my domain name to resolve to my IP address, but it seems Verisign and I have different ideas about what 24 hours is. The site is supposed to be www.globalsymmetry.com, but that will not currently resolve. Here's the IP and path: http://66.92.149.152/proprietary/com/wri/index.html This is not a literary masterpiece. It's probably proof that giving just anybody the power to publish is, perhaps, not a guaranty that more quality publication will take place. If anybody has answers to the questions I've come up with, or comments about the answeres, etc. I'd be happy to know. ==== Edit ->Preferences -> Font Options In Preferences you will find everything you need to configure your Mathematica environment. Also you may want to look up Style Sheets in the book or the on line help. Yas > I've been trying to get my Mathematica 4.1 properly configured. I set: > ################################################################### > /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/X/Specific.tr: > @@resource maxForXListFonts > 10000 # xlsfonts | wc -l > 5572 /etc/X11/XF86Config: > FontPath /usr/X11R6/lib/X11/fonts/100dpi:unscaled > FontPath /usr/X11R6/lib/X11/fonts/75dpi:unscaled > FontPath /usr/X11R6/lib/X11/fonts/CID > FontPath /usr/X11R6/lib/X11/fonts/Speedo > FontPath /usr/X11R6/lib/X11/fonts/Type1 > FontPath /usr/X11R6/lib/X11/fonts/URW > FontPath /usr/X11R6/lib/X11/fonts/kwintv:unscaled > FontPath /usr/X11R6/lib/X11/fonts/latin2/Type1 > FontPath /usr/X11R6/lib/X11/fonts/local/mma/Type1 > FontPath /usr/X11R6/lib/X11/fonts/local/mma/X:unscaled > FontPath /usr/X11R6/lib/X11/fonts/misc:unscaled > FontPath /usr/X11R6/lib/X11/fonts/misc/sgi:unscaled > FontPath /usr/X11R6/lib/X11/fonts/truetype > FontPath /usr/X11R6/lib/X11/fonts/uni:unscaled # ls -R /usr/X11R6/lib/X11/fonts/ | grep / > /usr/X11R6/lib/X11/fonts/: > /usr/X11R6/lib/X11/fonts/100dpi: > /usr/X11R6/lib/X11/fonts/75dpi: > /usr/X11R6/lib/X11/fonts/CID: > /usr/X11R6/lib/X11/fonts/Speedo: > /usr/X11R6/lib/X11/fonts/Type1: > /usr/X11R6/lib/X11/fonts/URW: > /usr/X11R6/lib/X11/fonts/encodings: > /usr/X11R6/lib/X11/fonts/encodings/large: > /usr/X11R6/lib/X11/fonts/kwintv: > /usr/X11R6/lib/X11/fonts/latin2: > /usr/X11R6/lib/X11/fonts/latin2/Type1: > /usr/X11R6/lib/X11/fonts/local: > /usr/X11R6/lib/X11/fonts/local/mma: > /usr/X11R6/lib/X11/fonts/local/mma/Type1: > /usr/X11R6/lib/X11/fonts/local/mma/X: > /usr/X11R6/lib/X11/fonts/misc: > /usr/X11R6/lib/X11/fonts/misc/sgi: > /usr/X11R6/lib/X11/fonts/truetype: > /usr/X11R6/lib/X11/fonts/uni: > /usr/X11R6/lib/X11/fonts/util: ######################################################## When I open the Mathematica Book Reference Guide in the Help Browser, I get > a beep and the message says: Unable to find font with family Helvetica, weight Bold, slant Plain, and > size 26. Substituting Courier. Compared to the things which *were* broken, this is a minor problem. I can > live with the beep. What I would now like to know is how to tell Mathematica what > fonts to use by default. This seemingly simple question seems to have no > simple answer. Could someone please help me. TIA, ^L ==== > Edit ->Preferences -> Font Options In Preferences you will find everything you need to configure your > Mathematica environment. Also you may want to look up Style Sheets in the > book or the on line help. > Yas > I went into the preferences browser, and it was not clear to me what I was modifying. At one point I clicked on a field filled with text. I had inteded to edit it, and all the text vanished. It didn't bother me as much as such things use to, because I believe I know a backout strategy. It's been a while since I looked at this stuff, and I have to admit it seems far more tractible than it did a year ago. I'll look at the discussion again, and see if it makes more sence to me now. STH ==== > As an example, I spent several hours trying to figure out how to tell > Mathematica to understand the delete key in the way most contemporary > systems understand it. I wanted to avoid modifying system > configuration files such as: > /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/KeyEventTranslation s.tr I expected to be able to change something in my own ~/.Mathematic > directory, but I could not figure out an obvious way to affect this > modification. If you could post a precise description of what you expect the Delete key to do when depressed, we could probably provide you with a clear cut answer of what needs to be done. > I want to adjust the font size used in the widgets, but again, I see > no ovbious means of modifying these attributes. I suspect it can be > accomplished by modifying the ~/.Mathematica/4.1/FrontEnd/init.m. > Perhaps to an experienced Mathematica user, the syntax and semantics > of this file are obvious. They aren't to me. The size of fonts in user interface elements is not specified through the Mathemtica init.m file. It is set through an X resource. If you are not familiar with resources, you may want to track down an introductory text on the X Window System. Information on application-specific resource settings can be found in the Mathematica Getting Started Guide: http://documents.wolfram.com/v4/GettingStarted/TroubleshootingUnixX.html The setting that you would need to adjust is XMathematica*fontList. The value of the resource is an X Logical Font Description field. > I also find the overall look & feel of the interface to be archaic. That's because Mathematica relies on the Motif library for user interface elements. http://www.opengroup.org/desktop/motif.html The appearance of these elements, such as the menu and scroll bars, would be the same for any other Motif application, such as the DDD debugger or releases of Netscape prior to verison 4. -- User Interface Programmer paulh@wolfram.com Wolfram Research, Inc. ==== hi, > I sholdn't have to. If I start messing with X resource settings for my > user environment, I am sure to break something else which is configured > based on the current settings. There should either be a GUI interface, or a > clearly documented, and easily accessible configuration file to modify such > properties as the size of the fonts in the GUI widgets. This is > functionality which is rightfully expected of a modern desktop UI. [snip] > And I'm sure there is some configuration file in which I could place that, > and hope that what you think will be read by my system *will* in fact be > read, and not subsequently overridden during xsession startup. Things > aren't the way they used to be back in the 1980s. The modern Unix desktop > has moved beyond the paradigm of openlook and motif. See for example > http://www.trolltech.com, http://www.gnome.org, and http://www.kde.org > moving the frontend over to QT would have some neat side effects: consistent look & feel with the modern linux gui, themeability, source code truetype fonts as QT supports Xrender and Xft (looks great - see KDE3). i think all of those points are of value, but the most important might be source compatibility. ONE frontend for MOST (or ALL) platforms - sounds like a dream :-)) gerald -- ************************************* Gerald Roth M@th Desktop Development ************************************* ==== > If you could post a precise description of what you expect the Delete key > to do when depressed, we could probably provide you with a clear cut > answer of what needs to be done. Item[KeyEvent[Delete], DeleteNext] 'Most' means 'more than half.' > I want to adjust the font size used in the widgets, but again, I see > no ovbious means of modifying these attributes. I suspect it can be > accomplished by modifying the ~/.Mathematica/4.1/FrontEnd/init.m. > Perhaps to an experienced Mathematica user, the syntax and semantics > of this file are obvious. They aren't to me. The size of fonts in user interface elements is not specified through the > Mathemtica init.m file. It is set through an X resource. If you are not > familiar with resources, you may want to track down an introductory text > on the X Window System. I sholdn't have to. If I start messing with X resource settings for my user environment, I am sure to break something else which is configured based on the current settings. There should either be a GUI interface, or a clearly documented, and easily accessible configuration file to modify such properties as the size of the fonts in the GUI widgets. This is functionality which is rightfully expected of a modern desktop UI. > Information on application-specific resource > settings can be found in the Mathematica Getting Started Guide: http://documents.wolfram.com/v4/GettingStarted/TroubleshootingUnixX.html It should be in a clear and easy to access configuraton interface, or at least be redily available through the help system in such a way that reasonable queries will locate it. Changing fonts does not belong in a section on trouble shooting, unless this is an acknowledgement that the UI is broken. > The setting that you would need to adjust is XMathematica*fontList. The > value of the resource is an X Logical Font Description field. And I'm sure there is some configuration file in which I could place that, and hope that what you think will be read by my system *will* in fact be read, and not subsequently overridden during xsession startup. Things aren't the way they used to be back in the 1980s. The modern Unix desktop has moved beyond the paradigm of openlook and motif. See for example http://www.trolltech.com, http://www.gnome.org, and http://www.kde.org > I also find the overall look & feel of the interface to be archaic. That's because Mathematica relies on the Motif library for user interface > elements. http://www.opengroup.org/desktop/motif.html The appearance of these elements, such as the menu and scroll bars, would > be the same for any other Motif application, such as the DDD debugger or > releases of Netscape prior to verison 4. My point exactly. ==== Awk! Legends! Basically, the answer to your question is that the PlotLegend option works ONLY for the Plot command and does not work for other types of plots. For other types of plots you have to use ShowLegend. And ShowLegend is not all that easy to use, especially since WRI does not give an example for multiple curves in the Help. Needs[Graphics`Graphics`] Needs[Graphics`Legend`] {q1[t_], q2[t_], q3[t_]} = {0.1 Exp[-0.02 t], 0.2 Exp[-0.025 t], 0.4 Exp[-0.028 t]}; Let's look at your first plot. Plot[{q1[t], q2[t], q3[t]}, {t, 0, 100}, PlotStyle -> {{AbsoluteThickness[0.5], AbsoluteDashing[{4, 4}]}, AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1, 8}]}}, AxesLabel -> {Y, X}, PlotLabel -> Title, PlotLegend -> {1, 3, 5}, LegendPosition -> {0.5, 0}, ImageSize -> 500]; The legend is almost as big as the plot. It distracts from the real information you are trying to convey. Furthermore, the order of the curves in the legend is the reverse of their order in the plot. The following shows how to put the legend in a LogLogPlot, or other types of plots. I defined the plot styles independently because they are used in several places. I made the legend much smaller and put it in an empty area of the plot. I also reversed the order of the keys so they would match the order of the curves in the plot. styles={{AbsoluteThickness[0.5], AbsoluteDashing[{4,4}]},{AbsoluteThickness[1.5]},{AbsoluteThickness[ 2],AbsoluteDashing[{1,8}]}}; ShowLegend[ LogLogPlot[{q1[t], q2[t], q3[t]}, {t, 0, 100}, PlotStyle -> styles, AxesLabel -> {Y, X}, PlotLabel -> Title, ImageSize -> 500, DisplayFunction -> Identity], {MapThread[{Graphics[{Sequence @@ #1, Line[{{0, 0}, {1, 0}}]}], #2} &, {styles, {1, 3, 5}}] // Reverse, LegendPosition -> {-0.7, -0.4}, LegendSize -> {0.2, 0.3}, LegendShadow -> {0.02, -0.02}, LegendSpacing -> 0.5} ]; But why use a legend at all? After all, a legend is nothing but another plot in which you have put labels on the curves. Why not put the labels directly on the curves in the real plot in the first place? LogLogPlot[{q1[t], q2[t], q3[t]}, {t, 0, 100}, PlotStyle -> styles, AxesLabel -> {Y, X}, PlotLabel -> Title, ImageSize -> 500, Epilog -> MapThread[ Text[SequenceForm[Case , #1], {Log[10, 0.01], Log[10, #2[0.01]]}, {0, -1}] &, {{1, 2, 3}, {q1, q2, q3}}]]; In the legend you have keyed the curves to numbers 1, 3 and 5. (Perhaps you just used these as examples and meant to use something different in the real plots?) But these don't seem to have any obvious relation to your functions. I suppose the reader will have to look at another table or look into the text of your paper or notebook to find out what 1, 3 and 5 mean. So the reader has to go from the graph to the legend then to the text and then mentally transfer the meaning of the curve back to the main plot. It is so much nicer to put the meaning right on the curve if you can. For the most part, legends are just computer junk and not even easy to nicely construct. When the legend urge comes over you - try to resist. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1,8}]}}, AxesLabel[Rule]{Y, X}, PlotLabel[Rule]Title, PlotLegend[Rule]{1,3,5}, LegendPosition[Rule] {0.5,0}] (*However with LogPlot or LogLogPlot the legend desappear*) LogLogPlot[{q1[t],q2[t],q3[t]}, {t, 0, 100},PlotStyle[Rule]{ {AbsoluteThickness[0.5], AbsoluteDashing[{4,4}]}, AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1,8}]}}, AxesLabel[Rule]{Y, X}, PlotLabel[Rule]Title, PlotLegend[Rule]{1,3,5}, LegendPosition[Rule] {0.5,0}] I have shown a particular case, but I has this problem always with Legend and LogPlot and LogPlotPlot. I will appreciate any help. Guillermo Sanchez --------------------------------------------- This message was sent using Endymion MailMan. ==== Using the Front End as a interface with the kernel I was running some calulations when suddenly pressing Shift+Enter causes the contents of the cell being evaluated to transform to the next text underlined with a red line: NotebookObject[FrontEndObject[LinkObject[dd8,1,1]],8] foollowed by the next messages: An unknown box name (NotebookObject) was sent as the BoxForm for the expression. Check the format rules for the expression. An unknown box name (FrontEndObject) was sent as the BoxForm for the expression. Check the format rules for the expression. An unknown box name (LinkObject) was sent as the BoxForm for the expression. Check the format rules for the expression. An invalid typeset structure was generated: Missing BoxFormData. Any suggestions will be very aprreciated. Cesar ==== I have an odd problem. I need to use and simplify functions that have been provided by a piece of software that insists on outputing the functional results of a data mining proceedure, using e when outputing numbers in scientific notation. I'm having difficultly using Replace, Hold, etc. to correctly evaluate these types of function formats. For example, y = 5e+5x1+2e-1x2, should be transcribed into 5 10^5 x1 + 0.2 x2. Chuck Reply-To: kuska@informatik.uni-leipzig.de ==== str = 5e+5x1+2e-1x2; StringJoin[Characters[str] /. e -> *10^] // ToExpression ?? Work fine for me. But this type of output is typical generated by a C/FORTRAN Program and you should rewrite the formating rules in the code that produce this output. Jens > I have an odd problem. I need to use and simplify functions that have > been provided by a piece of software that insists on outputing the > functional results of a data mining proceedure, using e when > outputing numbers in scientific notation. I'm having difficultly using Replace, Hold, etc. to correctly evaluate > these types of function formats. For example, y = 5e+5x1+2e-1x2, > should be transcribed into 5 10^5 x1 + 0.2 x2. > Chuck ==== RB> I am considering the following integral RB> W[m_,n_]:=Integrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}] RB> where m,n are reals >=0. With Mathematica 4.1 I obtain: RB> If[Re[m+n]>-1, -Cos[(m-n)Pi/2]/(2 Pi)* RB> (2 EulerGamma + Log[4] + RB> PolyGamma[0, 1/2(1 + m - n)] + RB> PolyGamma[0, 1/2(1 - m + n)] + RB> 2PolyGamma[0, 1/2(1 + m + n)]) RB> Any explanation about the analytical expression will be RB> gratefully accepteed. The expression for W[m_,n_] returned by Mathematica is wrong. To prove, just substitute m = n = 0 which is exactly what you had done and observe that the output you had had W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi) = 0.84564 was incorrect. The correct answer is 1/2. Mathematica can handle the numeric integration successfully In[1] := NIntegrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}, Method -> Oscillatory] (* The warnings are skipped *) Out[1] = 0.5 Using NIntegrate[BesselJ[0, x]*BesselJ[0, x], {x, 0, Infinity}] without Method -> Oscillatory is not the optimal choice as the integrand oscillates fairly rapidly over the integration region. RB> I suspect that these integrals are divergent (*). In fact, not exactly. Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}] is equal to 1/2, and Mathematica 4.1 for Microsoft Windows (November 2, 2000) does it correctly, while Mathematica 4.2 for Microsoft Windows (February 28, 2002) concocts a strange mixture of a wrong divergence message and the warning that it cannot check the convergence [should I trust to the second warning? or the first?] As a matter of fact, Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}] converges because the integrand is regular at x=0, bounded over the whole right semi-axis, and decays as 2*Cos[Pi/4 - x]*Cos[(3*Pi)/4 - x]/(Pi*x) + o(1/x) at x -> Infinity . Say, calculate Normal[Series[BesselJ[1, x], {x, Infinity, 1}]] Normal[ Series[BesselJ[0, x], {x, Infinity, 1}]] // InputForm -> (2*(Cos[Pi/4 - x] - Sin[Pi/4 - x]/(8*x))*(Cos[(3*Pi)/4 - x] + (3*Sin[(3*Pi)/4 - x])/(8*x)))/(Pi*x) then Plot[%,{x,1,10}] and Plot[BesselJ[1,x]*BesselJ[0,x],{x,1,10}] and you could hardly see the difference. Generally, to get to the convergence domain for W in terms of m and n is easy via the asymtotics of the Bessel functions (use something like Expand[Normal[Series[BesselJ[m, x], {x, Infinity, 1}]]Normal[ Series[BesselJ[n, x], {x, Infinity, 1}]]] then analyze the main term). Best wishes, Vladimir Bondarenko Mathematical Director Symbolic Testing Group Web : http://www.CAS-testing.org/ http://maple.bug-list.org/VER2/ (under tuning) http://maple.bug-list.org/VER3/ (under tuning) http://maple.bug-list.org/VER1/ (under tuning) http://www.beautyriot.com/ (teamwork) http://www.ohaha.com/ (teamwork) Voice: (380)-652-447325 Mon-Fri 9 a.m. - 6 p.m. Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== > inside a program I need to solve this linear equation in terms of p1. > However something odds happens. Sometimes the solution is computed and > sometimes the result is empty [I mean no output...]. Is this a bug of the > solve command or am I doing something wrong? The problem is robust to: > changing name to the variables and other makeups.. > David That's the weirdest bug I've seen in weeks. As it happens, it's mine. At least the inconsistent behavior, that is. I'll fix it, and maybe also try to address the issue of how to handle approximate numbers in testing subexpressions for zero. I've excised your code and put in place a substantially smaller example that I believe is responsible. The table will tend to give erratic results. zz = (-1.*x^7*(-1. + p - 7.*x^6 + p*x^6 + 6.*x^7)* (7.000000000000002 - 7.000000000000002*x + 14.000000000000004*x^6 - 14.000000000000004*x^7 + 7.000000000000002*x^12 - 6.999999999999998*x^13))/ (p^2*(1. + 0.9*x^6)^2*(1. + x^6)^5); One workaround would be to use exact input, say by preprocessing with Rationalize. Daniel Lichtblau Wolfram Research ==== >inside a program I need to solve this linear equation in terms of p1. >However something odds happens. Sometimes the solution is computed and >sometimes the result is empty [I mean no output...]. Is this a bug of the >solve command or am I doing something wrong? The problem is robust to: >changing name to the variables and other makeups.. >David > >ps: Sorry for the stupid way in which I copied the command... > >Solve[(x^2*((-0.9*x^7*(p^2*(-1 - 5.8*x^6 - 14.010000000000002*x^12 - > 18.04*x^18 - 13.06*x^24 - > 5.040000000000001*x^30 - 0.81*x^36) + > x*(7.777777777777779 - 9.074074074074076*x + > 30.333333333333336*x^6 - > 21.51851851851852*x^7 - > 16.333333333333336*x^8 + > 44.33333333333334*x^12 + > 3.188888888888883*x^13 - > 65.68333333333332*x^14 + > 28.777777777777786*x^18 + > 47.937037037037044*x^19 - > 100.10000000000002*x^20 + 7.*x^24 + > 45.6037037037037*x^25 - > 69.53333333333333*x^26 + > 13.299999999999999*x^31 - > 19.833333333333332*x^32 - > 1.0499999999999996*x^38) + > p*(-6 + 8.296296296296296*x - > 28.799999999999997*x^6 + > 32.785185185185185*x^7 + > 9.333333333333336*x^8 - > 55.260000000000005*x^12 + > 49.04777777777776*x^13 + > 38.38333333333334*x^14 - > 52.980000000000004*x^18 + > 34.20518518518518*x^19 + > 60.20000000000001*x^20 - > 25.380000000000003*x^24 + > 11.736296296296294*x^25 + > 43.63333333333334*x^26 - 4.86*x^30 + > 2.8999999999999986*x^31 + > 13.533333333333333*x^32 + 0.81*x^37 + > 1.0499999999999996*x^38)))/(x + 1.9*x^7 + > 0.9*x^13)^2 - ((-1 + p - 7*x^6 + p*x^6 + > 6*x^7)*(1.2962962962962965 - 3.111111111111112*x^6 >+ > 9.333333333333336*x^7 - 10.111111111111114*x^12 >+ > 22.05*x^13 - 5.703703703703705*x^18 + 17.15*x^19 >+ > 5.483333333333331*x^25 + 1.0499999999999996*x^31 >+ > p1*x^5*(7.000000000000002 - 7.000000000000002*x >+ > 14.000000000000004*x^6 - > 14.000000000000004*x^7 + > 7.000000000000002*x^12 - > 6.999999999999998*x^13) - > 1.166666666666667*p*x^4*x1 - > 3.500000000000001*p*x^10*x1 - > 1.0500000000000003*p*x^11*x1 - > 3.500000000000001*p*x^16*x1 - > 3.150000000000001*p*x^17*x1 - > 1.166666666666667*p*x^22*x1 - > 3.150000000000001*p*x^23*x1 - > 1.0500000000000003*p*x^29*x1))/((1 + 0.9*x^6)^2*(1 >+ > x^6)^2)))/(p^2*(1 + x^6)^3) == 0, p1] > You might find it more robust (and the results cleaner) if you Simplify the equation prior to using Solve. Such as Solve[eqn // Rationalize // Simplify, p1] However, if you are assigning values to p or x prior to using Solve, there may not be a solution. That is, for whenever the numerator of the expression for p1 would be zero, e.g., p = (-6 x^7 + 7 x^6 +1)/(x^6 + 1). Bob Hanlon ==== > Could someone calculate the number Pi to 67,108,864 (2^26) decimal places > I made the calculation in another program and would like to verify its Does it really matter what program is used to verify it? If not, here's the digits (computed with the fastest pi crunching program for a PC): 33863220896223409803 ==== >>I believe the complexity is O(n log n), so this should be good enough. Umm ...good enough? I understand the words individually, but the phrase makes no sense to me. Bobby Treat -----Original Message----- > crash the Front End. I was thinking about the fact that I calculated > all those digits and then threw them away. I could save them with Save > or DumpSave, and read them in with Get the next time I wanted any of > them, although the file would be close to 70 MB (if not more). I may do > that, in fact -- I have plenty of disk space. The next step would be to somehow reuse the stored digits if I wanted > MORE digits. But how? The Bailey-Borwein-Plouffe Pi algorithm is an avenue of attack, since it > can calculate digits far from the decimal point, without calculating > those in between. Unfortunately, it calculates hexadecimal digits in > that way, not decimal digits. (That's true for the version I've seen, > anyway.) Still, I could take the stored digits, convert to hexadecimal, > add more hexadecimal digits with the B-B-P algorithm, and then convert > back to decimal. In both conversions, I'd have to be very cognizant of > how much precision I end up with, but that shouldn't be too difficult. > It might go faster if I store hexadecimal digits, as well as decimal > digits, to eliminate one of those conversions at each increase in the > number of digits. The next step would be to set up an application that allowed anyone to > ping for digits across the Internet, and would return them if they're > stored. Hasn't someone already done that? It seems as if someone would have. Bobby Treat If you're interested in decimal digits, I don't think the BBP algorithm is the way to go. In order to get the nth decimal digit of Pi you need to compute the previous n-1 digits, since base conversion is global, not local. The algorithm Mathematica uses for computing Pi is quite fast - I believe the complexity is O(n log n), so this should be good enough. David > -----Original Message----- calculation in So would it take about the same amont of time for the complete printout > of digits? Of course it would take a few additional seconds to format > the output... Or does Mathematica take alot less time when it truncates the output? > > Could you tell me the CPU you used and its speed etc...i am curious, performance > to > other programs out there. > I used one processor of a dual 1GH Mac and got the same answer with > the > following speed: > 4.2 for Mac OS X (June 4, 2002) > oldmax = $MaxPrecision > 6 > 1. 10 > $MaxPrecision = Infinity > Infinity > With[{n = 2^26}, Timing[ > pd = RealDigits[N[Pi, n + 1], 10, 20, > 19 - n]; ]] > {28794.1 Second, Null} > MaxMemoryUsed[] > 512055204 > pd > {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, > 4, 0, 9, 8, 0, 3}, -67108844} > Tom Burton ==== I prefer to delete all output and then Copy As>Notebook expression. It Bobby -----Original Message----- and output --- I try to use one tab indent for input and two tabs indent for output, plus some blank line adjustment. I wonder if anyone has a way of automatically achieving this reformating. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Often posters to MathGroup copy and paste in the complete cell expression, > including the In and Out numbers, when posting to MathGroup. I wonder if this is the best method because one can't then just copy out all > the statements and paste them into a Mathematica notebook. All the statement > numbers have to be edited out and if there are many statement definitions > this is an extended task for any responder. This, of course, decreases the > chances for a response. A better method is for the poster to just copy and > paste the CONTENTS of each cell. This is more work for the poster, but it > may pay off in better responses. David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ ==== Could someone explain what is going on here, please? In[1]:= a = 77617.; b = 33096.; In[2]:= SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; In[4]:= f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b) In[5]:= SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; In[6]:= f Out[6]= -1.1805916207174113*^21 In[7]:= a = 77617; b = 33096; In[8]:= g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + (55/10)*b^8 + a/(2*b) In[9]:= g Out[9]= -(54767/66192) In[10]:= N[%] Out[10]= -0.8273960599468214 PK ==== Peter, I hope that the following example will help - it is a matter or when things evaluate. The a in SetAccuracy[a, Infinity], below, evaluates before SetAccuracy acts, so we get SetAccuracy[2.3, Infinity]. The value of a is not changed. a = 2.3; aa = SetAccuracy[a, Infinity] 2589569785738035/1125899906842624 But, a 2.3 Whereas aa 2589569785738035/1125899906842624 -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Could someone explain what is going on here, please? In[1]:= > a = 77617.; b = 33096.; In[2]:= > SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; > SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; In[4]:= > f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b) In[5]:= > SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; In[6]:= > f Out[6]= > -1.1805916207174113*^21 In[7]:= > a = 77617; b = 33096; In[8]:= > g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + (55/10)*b^8 + a/(2*b) In[9]:= > g Out[9]= > -(54767/66192) In[10]:= > N[%] Out[10]= > -0.8273960599468214 > PK > ==== In receiving notebooks from many different people I have noticed that beginners often do not know how to use Text cells and write all of their comments as Input cells. I have even run across some extremely advanced users who did not know the easy method for entering Text cells. A good notebook is usually a blend of Text cells, Input/Output cells and graphics cells. Text cells are very useful for documenting what you are doing and passing information to other people. Since many people do not know how to use Text cells, I thought I would write a little explanation for beginners who are followers of MathGroup. The very easiest method for entering a Text cell is to put the insertion point where you want the new cell to be (at the end of the notebook or between two existing cells) and then type Alt-7. Then just start typing and you will have a Text cell. Alternatively you can use MenuFormatStyleText to start a new Text cell. Often, it is useful to put the ToolBar at the top of the notebook. Use MenuFormatShow ToolBar. The drop-down menu on the ToolBar has the various kinds of cells available for the current style of the notebook. You can select Text (or any other style) from there. Some users may hesitate to use Text cells because they want to include a mathematical expression in the comments. However, that is also very easy. Just use an Inline cell within the text cell. At the point within the text cell where you want to include a mathematical expression, start an Inline cell by typing Ctrl-(. A selection placeholder will appear on a pink background. You can type a Mathematica expression there just as in an Input cell. Use Ctrl-) to complete the Inline cell, or Shift-Space. You can even select an Inline cell and evaluate it with Shift-Ctrl-Enter. Putting comments in Text cells is far better than using Input cells (or cell group header cells). Mathematica won't try to evaluate Text cells, the text will wrap properly and adjust better to the notebook width if you change it. You can also check the spelling of words by putting the cursor after a word and using Ctrl-K. (In an Input cell Mathematica doesn't use the dictionary, but uses the table of symbols instead and hence it won't check spelling.) David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ ==== This is because inline cells are not in StandardForm by default, but TraditionalForm. Use the menu item Cell -> Default Inline Format Type -> StandardForm. >David Park's posting reminded me of a frequent annoyance when I am >trying to include some Mathematica expressions within text cells -- a >Mathematica input expression in Standard Form that involves use of a >Control-key combination to form a superscript, square-root, or built-up >fraction: > >For example, suppose I want to include within a text cell a Standard >Form expression for the square of x, with the exponent 2 raised. If I >type the x first, even if I immediately highlight it and change it to >Courier (to match the default font for Input cells in Standard Form), as >soon as I press the Control-^ key combination, an Inline cell is created >beginning with the x, and then when I type the exponent 2 everything in >that Inline cell is now in Times, and the x is Italic. To change both >characters to Courier is not so easy: it seems to require separately >the entire Inline cell and selecting Courier does not change the exponent!) > >So to avoid this annoyance I normally must first type the desired >expression in a separate Input cell, then copy the contents of that cell >to the desired point in the Text cell. > >Any suggestions on a more efficient method for handling this? > In receiving notebooks from many different people I have noticed that > beginners often do not know how to use Text cells .... > Some users may hesitate to use Text cells because they want to include a > mathematical expression in the comments.... > Just use an Inline cell within the text cell.... -- >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 >Amherst, MA 01375 -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html Reply-To: murray@math.umass.edu ==== David Park's posting reminded me of a frequent annoyance when I am trying to include some Mathematica expressions within text cells -- a Mathematica input expression in Standard Form that involves use of a Control-key combination to form a superscript, square-root, or built-up fraction: For example, suppose I want to include within a text cell a Standard Form expression for the square of x, with the exponent 2 raised. If I type the x first, even if I immediately highlight it and change it to Courier (to match the default font for Input cells in Standard Form), as soon as I press the Control-^ key combination, an Inline cell is created beginning with the x, and then when I type the exponent 2 everything in that Inline cell is now in Times, and the x is Italic. To change both characters to Courier is not so easy: it seems to require separately the entire Inline cell and selecting Courier does not change the exponent!) So to avoid this annoyance I normally must first type the desired expression in a separate Input cell, then copy the contents of that cell to the desired point in the Text cell. Any suggestions on a more efficient method for handling this? > In receiving notebooks from many different people I have noticed that > beginners often do not know how to use Text cells .... Some users may hesitate to use Text cells because they want to include a > mathematical expression in the comments.... > Just use an Inline cell within the text cell.... -- 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 Amherst, MA 01375 ==== correctly, all you need to do is to make sure the default inline cell format is StandardForm. Go to the menu item Cell, select Default Inline FormatType, and change it to StandardForm. Carl Woll Physics Dept U of Washington ----- Original Message ----- > type the x first, even if I immediately highlight it and change it to > Courier (to match the default font for Input cells in Standard Form), as > soon as I press the Control-^ key combination, an Inline cell is created > beginning with the x, and then when I type the exponent 2 everything in > that Inline cell is now in Times, and the x is Italic. To change both > characters to Courier is not so easy: it seems to require separately > the entire Inline cell and selecting Courier does not change the exponent!) So to avoid this annoyance I normally must first type the desired > expression in a separate Input cell, then copy the contents of that cell > to the desired point in the Text cell. Any suggestions on a more efficient method for handling this? > In receiving notebooks from many different people I have noticed that > beginners often do not know how to use Text cells .... > Some users may hesitate to use Text cells because they want to include a > mathematical expression in the comments.... > Just use an Inline cell within the text cell.... -- > 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 > Amherst, MA 01375 Reply-To: kuska@informatik.uni-leipzig.de ==== just one comment: the meaning of the Alt-7 key depend on the style sheet that is in use. The TMJ style use Alt-8 for text and one has to learn new key short-cuts for every style sheet ! Jens In receiving notebooks from many different people I have noticed that > beginners often do not know how to use Text cells and write all of their > comments as Input cells. I have even run across some extremely advanced > users who did not know the easy method for entering Text cells. A good > notebook is usually a blend of Text cells, Input/Output cells and graphics > cells. Text cells are very useful for documenting what you are doing and > passing information to other people. Since many people do not know how to > use Text cells, I thought I would write a little explanation for beginners > who are followers of MathGroup. The very easiest method for entering a Text cell is to put the insertion > point where you want the new cell to be (at the end of the notebook or > between two existing cells) and then type Alt-7. Then just start typing and > you will have a Text cell. Alternatively you can use MenuFormatStyleText to start a new Text cell. Often, it is useful to put the ToolBar at the top of the notebook. Use > MenuFormatShow ToolBar. The drop-down menu on the ToolBar has the various > kinds of cells available for the current style of the notebook. You can > select Text (or any other style) from there. Some users may hesitate to use Text cells because they want to include a > mathematical expression in the comments. However, that is also very easy. > Just use an Inline cell within the text cell. At the point within the text > cell where you want to include a mathematical expression, start an Inline > cell by typing Ctrl-(. A selection placeholder will appear on a pink > background. You can type a Mathematica expression there just as in an Input > cell. Use Ctrl-) to complete the Inline cell, or Shift-Space. You can even > select an Inline cell and evaluate it with Shift-Ctrl-Enter. Putting comments in Text cells is far better than using Input cells (or cell > group header cells). Mathematica won't try to evaluate Text cells, the text > will wrap properly and adjust better to the notebook width if you change it. > You can also check the spelling of words by putting the cursor after a word > and using Ctrl-K. (In an Input cell Mathematica doesn't use the dictionary, > but uses the table of symbols instead and hence it won't check spelling.) David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ ==== Solve[youre equation, p1, VerifySolutions->True] will return a solution. So will Solve[Rationalize[your equation],p1]. Andrzej Kozlowski Toyama International University JAPAN inside a program I need to solve this linear equation in terms of p1. > However something odds happens. Sometimes the solution is computed and > sometimes the result is empty [I mean no output...]. Is this a bug of > the > solve command or am I doing something wrong? The problem is robust to: > changing name to the variables and other makeups.. > David ps: Sorry for the stupid way in which I copied the command... Solve[(x^2*((-0.9*x^7*(p^2*(-1 - 5.8*x^6 - 14.010000000000002*x^12 - > 18.04*x^18 - 13.06*x^24 - > 5.040000000000001*x^30 - 0.81*x^36) + > x*(7.777777777777779 - 9.074074074074076*x + > 30.333333333333336*x^6 - > 21.51851851851852*x^7 - > 16.333333333333336*x^8 + > 44.33333333333334*x^12 + > 3.188888888888883*x^13 - > 65.68333333333332*x^14 + > 28.777777777777786*x^18 + > 47.937037037037044*x^19 - > 100.10000000000002*x^20 + 7.*x^24 + > 45.6037037037037*x^25 - > 69.53333333333333*x^26 + > 13.299999999999999*x^31 - > 19.833333333333332*x^32 - > 1.0499999999999996*x^38) + > p*(-6 + 8.296296296296296*x - > 28.799999999999997*x^6 + > 32.785185185185185*x^7 + > 9.333333333333336*x^8 - > 55.260000000000005*x^12 + > 49.04777777777776*x^13 + > 38.38333333333334*x^14 - > 52.980000000000004*x^18 + > 34.20518518518518*x^19 + > 60.20000000000001*x^20 - > 25.380000000000003*x^24 + > 11.736296296296294*x^25 + > 43.63333333333334*x^26 - 4.86*x^30 + > 2.8999999999999986*x^31 + > 13.533333333333333*x^32 + 0.81*x^37 + > 1.0499999999999996*x^38)))/(x + 1.9*x^7 + > 0.9*x^13)^2 - ((-1 + p - 7*x^6 + p*x^6 + > 6*x^7)*(1.2962962962962965 - > 3.111111111111112*x^6 + > 9.333333333333336*x^7 - > 10.111111111111114*x^12 + > 22.05*x^13 - 5.703703703703705*x^18 + > 17.15*x^19 + > 5.483333333333331*x^25 + > 1.0499999999999996*x^31 + > p1*x^5*(7.000000000000002 - > 7.000000000000002*x + > 14.000000000000004*x^6 - > 14.000000000000004*x^7 + > 7.000000000000002*x^12 - > 6.999999999999998*x^13) - > 1.166666666666667*p*x^4*x1 - > 3.500000000000001*p*x^10*x1 - > 1.0500000000000003*p*x^11*x1 - > 3.500000000000001*p*x^16*x1 - > 3.150000000000001*p*x^17*x1 - > 1.166666666666667*p*x^22*x1 - > 3.150000000000001*p*x^23*x1 - > 1.0500000000000003*p*x^29*x1))/((1 + > 0.9*x^6)^2*(1 + > x^6)^2)))/(p^2*(1 + x^6)^3) == 0, p1] > Reply-To: murray@math.umass.edu ==== For all names, perhaps: Names[*`*] For names you defined at a normal session (without changing to some other context than the default Global`): Names[Global`*] > IIRC, there is a way to get a list of all the symbols defined in the > currently running session. I can't seem to find the reference to that > command. Could somone point me in the direction of documentation which > will tell me how to get information about the current session? > TIA, > -- 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 Amherst, MA 01375 ==== > For all names, perhaps: Names[*`*] For names you defined at a normal session (without changing to some > other context than the default Global`): Names[Global`*] > IIRC, there is a way to get a list of all the symbols defined in the > currently running session. I can't seem to find the reference to that > command. Could somone point me in the direction of documentation which > will tell me how to get information about the current session? > TIA, I think I asked the wrong question. I'll have to look at things some more. What you gave me resulted in far more than I was looking for. http://public.globalsymmetry.com/proprietary/com/wri/system-symbols.html http://66.92.149.152/proprietary/com/wri/system-symbols.html I think I really hosed the code for generating that table. I used 5 lines. I probably didn't need more than two, but I'm too tired right now to think about it. Mathematica is totaly awesome when it comes to what it was intended for. They really need to rent a Troll for a few months and fix this interface. Qt will run on just about anything. Heck, my Win-XP partition runs XFree86, with the KDE, or it did when I booted into XP a month ago. STH ==== ?* does the trick. You can limit it to Global variables with ?Global`* Bobby -----Original Message----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== > Has anyone had any luck getting Mathematica 4.2 to work > on a Sun running Solaris 6? I get the following error message when starting Mathematica: ./Mathematica > ld.so.1: ./Mathematica: fatal: librt.so.1: open failed: No such file or > directory > Killed But math works. Any thoughts on this would be appreciated - even if it's just > Solaris 6 sucks - Reinstall with Solaris 8/9. I'd rather not go to the > trouble of reinstalling the box unless absolutely necessary (It is a > 270mhz Ultra 5) I'd be tempted to run 'ldd' and see what libraries it needs. On my Solaris 9 box, with Mathematica 4.2 I see: wren /usr/local/stow/Mathematica-4.2/SystemFiles/FrontEnd/Binaries/Solaris % ldd ../Mathematica libXt.so.4 => /usr/lib/libXt.so.4 libXext.so.0 => /usr/lib/libXext.so.0 libXmu.so.4 => /usr/lib/libXmu.so.4 libX11.so.4 => /usr/lib/libX11.so.4 libnsl.so.1 => /usr/lib/libnsl.so.1 libsocket.so.1 => /usr/lib/libsocket.so.1 libc.so.1 => /usr/lib/libc.so.1 libucb.so.1 => /usr/ucblib/libucb.so.1 librt.so.1 => /usr/lib/librt.so.1 libpthread.so.1 => /usr/lib/libpthread.so.1 libSM.so.6 => /usr/lib/libSM.so.6 libICE.so.6 => /usr/lib/libICE.so.6 libm.so.1 => /usr/lib/libm.so.1 libdl.so.1 => /usr/lib/libdl.so.1 libmp.so.2 => /usr/lib/libmp.so.2 libelf.so.1 => /usr/lib/libelf.so.1 libaio.so.1 => /usr/lib/libaio.so.1 libmd5.so.1 => /usr/lib/libmd5.so.1 /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1 libthread.so.1 => /usr/lib/libthread.so.1 /usr/platform/SUNW,Ultra-60/lib/libmd5_psr.so.1 You should be able to find the libraries it's using, and hopefully it might just be looking in the wrong place, in which case you may be able to create a symbolic link. However, if Solaris 2.6 is not supported (I don't know if it is) it is quite possible it wants a library you don't have, in which case you are stuck unless you re-install a later OS. -- Dr. David Kirkby, Senior Research Fellow, Department of Medical Physics, University College London, 11-20 Capper St, London, WC1E 6JA. Internal telephone: ext 46408 ==== Well, first of of all, your using SetAccuracy and SetPrecision does nothing at all here, since they do not change the value of a or b. You should use a = SetAccuracy[a, Infinity] etc. But even then you won't get the same answer as when you use exact numbers because of the way you evaluate f. Here is the order of evaluation that will give you the same answer, and should explain what is going on: f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121* b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]; a = 77617.; b = 33096.; a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity]; f 54767 -(-----) 66192 Andrzej Kozlowski Toyama International University JAPAN > Could someone explain what is going on here, please? In[1]:= > a = 77617.; b = 33096.; In[2]:= > SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; > SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; In[4]:= > f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + > a/(2*b) In[5]:= > SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; In[6]:= > f Out[6]= > -1.1805916207174113*^21 In[7]:= > a = 77617; b = 33096; In[8]:= > g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + > (55/10)*b^8 + a/(2*b) In[9]:= > g Out[9]= > -(54767/66192) In[10]:= > N[%] Out[10]= > -0.8273960599468214 > PK > ==== Andrzej, Bobby, Peter It looks as if using SetAccuracy succeeds here because the inexact numbers that occur have finite binary representations. If we change them slightly to avoid this then we have to use Rationalize: 1) Using SetAccuracy Clear[a,b,f] f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b^8+a/(2*b), Infinity]; a=77617.1; b=33096.1; a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity]; f -1564032114908486835197494923989618867972540153873951942813115514949 3891236234 5250077191686937045911977601879880463043614978691991293196257430102923631246 75 /108671061439707605510003578275547938881981431359756495796079898677435728240 16 0653953612982932181371232436367739737604096 2) Rewriting as fractions a=776171/10; b=330961/10; f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2*b) -(5954133808997234115690303589909929091649391296257/ 41370125000000) 3) Using Rationalize Clear[a,b,f] f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b^8+a/(2*b),0]; a=77617.1; b=33096.1; a=Rationalize[a,0];b=Rationalize[b,0]; f -(5954133808997234115690303589909929091649391296257/ 41370125000000) I use Rationalize[. , 0] besause of results like Rationalize[3.1415959] 3.1416 Rationalize[3.1415959,0] 31415959/10000000 -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Well, first of of all, your using SetAccuracy and SetPrecision does > nothing at all here, since they do not change the value of a or b. You > should use a = SetAccuracy[a, Infinity] etc. But even then you won't > get the same answer as when you use exact numbers because of the way > you evaluate f. Here is the order of evaluation that will give you the > same answer, and should explain what is going on: f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121* > b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]; a = 77617.; > b = 33096.; a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity]; f 54767 > -(-----) > 66192 Andrzej Kozlowski > Toyama International University > JAPAN > Could someone explain what is going on here, please? > In[1]:= > a = 77617.; b = 33096.; > In[2]:= > SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; > SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; > In[4]:= > f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + > a/(2*b) > In[5]:= > SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; > In[6]:= > f > Out[6]= > -1.1805916207174113*^21 > In[7]:= > a = 77617; b = 33096; > In[8]:= > g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + > (55/10)*b^8 + a/(2*b) > In[9]:= > g > Out[9]= > -(54767/66192) > In[10]:= > N[%] > Out[10]= > -0.8273960599468214 > > PK ==== > Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}] is equal to 1/2, and Mathematica 4.1 for Microsoft Windows > (November 2, 2000) does it correctly, while Mathematica 4.2 > for Microsoft Windows (February 28, 2002) concocts a strange > mixture of a wrong divergence message and the warning that > it cannot check the convergence [should I trust to the second > warning? or the first?] In[6]:= Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}] Out[6]= 1/2 In[7]:= Out[7]= 4.2 for Mac OS X (June 4, 2002) Andrzej Kozlowski Toyama International University JAPAN ==== That should read ...denominator of the expression for p1... Bob >You might find it more robust (and the results cleaner) if you Simplify >the >equation prior to using Solve. Such as > >Solve[eqn // Rationalize // Simplify, p1] > >However, if you are assigning values to p or x prior to using Solve, there > >may not be a solution. That is, for whenever the numerator of the expression > >for p1 would be zero, e.g., > >p = (-6 x^7 + 7 x^6 +1)/(x^6 + 1). > Bob Hanlon ==== > The expression for W[m_,n_] returned by Mathematica is wrong. To prove, just substitute m = n = 0 which is exactly what you had done and observe that the output you had had W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi) = 0.84564 was incorrect. The correct answer is 1/2. Mathematica can handle the numeric integration successfully In[1] := NIntegrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}, > Method -> Oscillatory] (* The warnings are skipped *) Out[1] = 0.5 You'll find that W[m=1,n=0]=1/2, so Mathematica gets that right. W[0,0] diverges. Mathematica gets that wrong. I note that Mathematica yields a result for Integrate[BesselJ[m, a*x]*BesselJ[n, b*x], {x, 0, Infinity}] that appears to agree with formula 6.512(1) of Gradshteyn and Ryshik (4th ed., 1965), including the condition b True] If the zi's need to be scaled, then you can do something like this: colorfn = Hue[.67#]&; With[{ m = {Min[#],Max[#]}&@vals }, Show[Graphics[ {colorfn[#[[3]]], PointSize[.01], Point[{#[[1]],#[[2]]}]}]& /@ (data /. {x_,y_,z_} -> {x, y, (z-m[[1]])/(m[[2]]-m[[1]])}), Axes -> True]] --- Selwyn Hollis > I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of ==== John, It is easier to do without ListPlot: Make some data, dat= Table[Random[],{10},{3}]; Show[Graphics[{PointSize[.05],{Hue[2/3#3],Point[{#1,#2}]}&@@@dat} ], Frame->True ]; If the points need to be joined then something like Show[Graphics[{ Line /@Partition[dat[[All,{1,2}]],2,1], PointSize[.05],{Hue[2/3#3],Point[{#1,#2}]}&@@@dat } ], Frame->True ]; -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of ==== A few years ago we made a package that do just this. See http://cern.ch/jowett/Mathematica/Graphics/ColorListPlot.html The type of plot you want is covered in the section Examples then Three-dimensional data. The Introduction gives links for downloading the package. JMJ > I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of ==== Your problem can be solved in numerous ways of course, try something like .: Module[ { data=Flatten[Table[{x,y,Random[]},{x,10},{y,10}],1] }, Show[ Graphics[ { AbsolutePointSize[10], data/.{x_,y_,z_}[Rule]{Hue[z],Point[{x,y}]} } ] ,AspectRatio[Rule]Automatic ] ] Note that you can replace the main part, ie the transforming rule from point lists to colored point directives with a function for example .: {Hue[#3],Point[{#1,#2}]}&@@@data bye, Borut | I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of Reply-To: kuska@informatik.uni-leipzig.de ==== data = Table[{Random[], Random[], Random[]}, {20}]; Show[Graphics[ {Hue[Last[#]], Point[Take[#, 2]]} & /@ data, Axes -> True ] ] Jens I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of ==== input = 5e+5x1+2e-1x2; StringJoin[Characters[input] //. e -> *10^] 5*10^+5x1+2*10^-1x2 ToExpression[%] 500000*x1 + x2/5 Bobby Treat -----Original Message----- should be transcribed into 5 10^5 x1 + 0.2 x2. Chuck ==== Neither SetAccuracy[expr,n] nor SetPrecisions[expr,n] modify expr. These functions modify the prinout not the internal representation. So, the first computation of f is done with approximate numbers and doesn't result in a correct answer due to approximate arithmetic. By assigning a rational expression to each of the variables, you have made them exact numbers and Mathematica responds with an exact solution. >Could someone explain what is going on here, please? > >In[1]:= a = 77617.; b = 33096.; > >In[2]:= SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; >SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; > >In[4]:= f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + >5.5*b^8 + a/(2*b) > >In[5]:= SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; > >In[6]:= f > >Out[6]= -1.1805916207174113*^21 > >In[7]:= a = 77617; b = 33096; > >In[8]:= g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + >(55/10)*b^8 + a/(2*b) > >In[9]:= g > >Out[9]= -(54767/66192) > >In[10]:= N[%] > >Out[10]= -0.8273960599468214 >PK > ==== SetAccuracy. However, I still don't understand why the order in which we set the accuracies for f, a, and b matters. In[1]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]; a = SetAccuracy[77617., Infinity]; b = SetAccuracy[33096., Infinity]; In[4]:= f Out[4]= -(54767/66192) In[5]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity] Out[5]= 1180591620717411303424 Similarily: In[1]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50]; a = SetAccuracy[77617., 100]; b = SetAccuracy[33096., 100]; In[4]:= f Out[4]= -0.8273960599468212641107299556`11.4133 In[5]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; Out[5]= 1.180591620717411303424`121.0721*^21 -PK ==== Hallo, I have the problem, that I want to determine the numerical solution of a double integral, like e.g. the following: << Statistics`ContinuousDistributions` ndist = NormalDistribution[0, 1]; N[Sigma^2/(Abs[Mu_1^2 - Mu_2^2]) Integrate[(Integrate[1/y_1 1/(y - y_1) PDF[ndist, d*Log[y_1] + c*Log[y - y_1] + f]* PDF[ndist, Sigma*(c*Log[y_1] + d*Log[y - y_1] + g)], {y_1,0,y}]), {y,0,Lambda}]] whereby Lambda := 3; Mu_1 := 4; Mu_2 := 5; Sigma := 0.25; a = 1/2 (Mu_1^2 + Mu_2^2/Sigma^2) b = 1/2 (Mu_2^2 + Mu_1^2/Sigma^2) c = -Mu_2/(Mu_1^2 - Mu_2^2) d = -Mu_1/(Mu_2^2 - Mu_1^2) f = d*a + c*b g = c*a + d*b Sorry for the poor code... The problem is, that Mathematica doesn't give me a result (after waiting 2 hours I turned my machine off). Thus, the question is, if there is still a possibility of solving such complicated expressions... TIA, Sven. ==== I am trying to solve a system of simultaneous equations with 26 variables and 14 equations (the 12 free variables can be any of the 26 from the eqns.. preferably ones that will minimize the computation time for the other 14). These equation are not linearly related.. the highest degree in any one eqn is degree 4 i believe.. and there are some cross terms in the equations but not every equation depends on every variable.. (some are actually rather simple eqns). Any ideas on how to get started with this using mathematica (any ideas for algorithms).. Anything will be helpful.. I can be reached at ngupta2@seas.upenn.edu Many thanks, Nachi ==== I should add that the solution is over natural numbers.. this will probably make a big difference.. Nachi > I am trying to solve a system of simultaneous equations with 26 variables > and 14 equations (the 12 free variables can be any of the 26 from the eqns.. > preferably ones that will minimize the computation time for the other 14). > These equation are not linearly related.. the highest degree in any one eqn > is degree 4 i believe.. and there are some cross terms in the equations but > not every equation depends on every variable.. (some are actually rather > simple eqns). Any ideas on how to get started with this using > mathematica (any ideas for algorithms).. Anything will be helpful.. I can be reached at ngupta2@seas.upenn.edu Many thanks, Nachi ==== This may seem like a trivial issue, but I find it very frustrating. I use variety of intellectual domains. In every package (JBuilder, KMail, Emacs, XEmacs, Mozilla, xterm, Konsole, etc.) the keyboar mapping is a bit differnt from the other. There are certain idioms which I find to be fairly invaraint between these different packages. I tend to use this common subset more than the package specific idioms. Switching from one package to the next can be a very disorienting experience. It can be even trickier to try and copy and paste from one to the next. I also use 'special' characters in certain domains, ç,?,.81,?,[CapitalYAcute],[CapitalThorn], ß, ¯, etc. Add to all of this, that I run beta code for just about everything. The function of my keyboard changed like the weather. I have spent hours trying to figure out why I can no longer type '.9a'. This doesn't even address the problems of switching between character encodings, or keyboard compose modes. The last thing I want to start doing is messing with the key mappings in my user environment. I want to control the way my keyboard works with Mathematica from within the Mathematica runtime environment. That is, the configuration should be loaded when Mathematica loads, and should not impact the rest of my X environment. If I have come across as a bit jaded regarding this issue, there are reasons. There is a history. I don't find keyboard configuration issues interesting. I want my fine keyboard to just work, the way I want it to Shift+point movement = select text. Ctrl+Insert = copy Shift+Insert = paste Ctrl+c = copy Ctrl+x = cut Ctrl+v = paste Shift+End = select to end of line. etc. Yes, I said I use XEmacs, and Emacs. Yes (X)Emacs is different, but adding yet another alteration with Mathematica is just too much. Is there a way around this? STH ==== >FrontEndExecute[{ > FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], > [LeftDoubleBracket][RightDoubleBracket],After]}] FrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][RightDoubleBracket],After], FrontEnd`SelectionMove[FrontEnd`SelectedNotebook[], Previous, Character]}] or FrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][SelectionPlaceholder][RightDoubleBracket], Placeholder]}] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== I'm trying to address the special issues related to using Mathematica on the would not if I used a Windows system. These are typically not all that big if a problem _once I figure out what's going on_. What I hope to do is collect all such matters and document them effectively in something like a haven't discussed here http://66.92.149.152/proprietary/com/wri/index.html I'm interested in hearing what you have to say. Of particular interest are the issues faced by a person who is not familiar with the technical aspects would help make this less painful? STH ==== particular, the y-axis label is typically rotated by 90deg so that it reads up the y-axis. This works fine on macs and windoze, but under linux the label runs up the y-axis; however, the letters are rotated so that they are the same orientation as that for the x-axis. Printouts of the NB are fine, but it looks really stupid when using a video projector to teach or give a talk. I have mentioned this before, and the stock answer is that ... it is Mathematica. I personally don't care why the label looks peculiar, just that it does and that there is no easy workaround. -- Kevin J. McCann Joint Center for Earth Systems Technology (JCET) Department of Physics UMBC Baltimore MD 21250 > I'm trying to address the special issues related to using Mathematica on the > would not if I used a Windows system. These are typically not all that big > if a problem _once I figure out what's going on_. What I hope to do is > collect all such matters and document them effectively in something like a which I > haven't discussed here http://66.92.149.152/proprietary/com/wri/index.html > I'm interested in hearing what you have to say. Of particular interest are > the issues faced by a person who is not familiar with the technical aspects > would help make this less painful? STH > Reply-To: jmt@dxdydz.net ==== See the MathLink API for C, or the JLink API for java. JLink is easier to use, MathLink is a lower level but native interface. JLink is built on MathLink. As far as I know, the perl API Math::ematica has not been upgraded to Mathematica 4. Is it possible to get a document of the description of how to > interface with the kernel? Kind of what should an interface say to the > kernel and how to connect to it. > Paulo ==== Is it possible to get a document of the description of how to interface with the kernel? Kind of what should an interface say to the kernel and how to connect to it. Paulo ==== for your extensive answer but I still have some doubts about convergence of the following integral (m,n integrers>=0) W[m_,n_]:=Integrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}] for wich Mathematica gives the close form W[m_,n_]:= -Cos[(m-n)Pi/2]/(2 Pi)* ( 2 EulerGamma + Log[4] + PolyGamma[0, 1/2(1 + m - n)] + PolyGamma[0, 1/2(1 - m + n)] + 2PolyGamma[0, 1/2(1 + m + n)] ) You say this integral is convergent to 1/2 for m=0 and n=1. Also Mathematica agrees to you since for m>=0 W[m,m+1]=1/2 W[m,m+3]=-1/2 Numerically we have NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, Infinity}] NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy.... 0.597973 NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, Infinity}, Method -> Oscillatory] NIntegrate::ploss : .... 0.5 So I define also the corresponding numeric definition NW[m_, n_] := NIntegrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}, Method -> Oscillatory] THEORY The integral is the critical case of Weber-Schafheitlin integral (see Watson book on Bessel function p.402, or Ryzhik-Gradshteyn 6.574(2)). According to this theory WS[m_,n_,p_]:=Integrate[BesselJ[m, x]*BesselJ[n, x] x^-p, {x, 0, Infinity}] = A/B where A=Gamma[p]*Gamma[(n+m-p+1)/2] B=2^p Gamma[(n-m+p+1)/2]Gamma[(n+m+p+1)/2]Gamma[(m-n+p+1)/2] By the presence of Gamma[p] in numerator A, in the case p=0 as in W[m,n] all these integrals are divergent since Gamma[0]=Infinity. The integral exist if m+n+1 > p > 0. ASYMPTOTICS The Watson theory is in conflict with Mathematica and your notes according which the asyntotic trend 1/x of the integrand in W[m,n] is enough for convergernce. I divide the integral in two parts Wasy[m_,n_,a_]=NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, a]+ NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, a, Infinity}] and if a>>1 I use asyntotic expansion of Bessel function in the second integral so that I can write Wasy[m_,n_,a_]= int1[m,n,a]+int2[m,n,a] where int1[m_,n_,a_]:=NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, a]+ int2[m_,n_,a_]:=(2/Pi)Integrate[Cos[x-(2m+1)Pi/4]*Cos[x-(2n+1)Pi/4], {x, a, Infinity}] The first integral is a quite normal finite integral. The second (int2) is singular and according to Mathematica 4.1 int2[m_, n_, a_] := -(1/Pi)*Log[a]*Cos[1/2(m - n)Pi]*]Log[a] + (1/Pi)*CosIntegral[2 a]*Sin[1/2(m+n)Pi] + 1/(2*Pi)*Cos[1/2(m+n)Pi]*(Pi-SinIntegral[2*a]) RESULTS m=1;n=0;a=20.; WS[m,n,0]=divergent W[m,n]=1/2 NW[m,n]=0.5 Wasy[m,n,a]=.49816 m=2;n=0;a=20.; WS[m,n,0]=divergent W[m,n]=0.427599 NW[m,n]=-2.43818 Wasy[m,n,a]=-1.48052 m=3;n=1;a=20.; WS[m,n,0]=divergent W[m,n]=0.639806 NW[m,n]=-2.31957 Wasy[m,n,a]=-1.26822 m=4;n=0;a=20.; WS[m,n,0]=divergent W[m,n]=-.852012 NW[m,n]=1.45786 Wasy[m,n,a]=1.06835 The cases W[m,m+1],W[m,m+3] well agrre with the numerical counterpart. Other case are doubtfully. I think the main problem is the convergence of this kind of integrals. Any suggestion will be well considerd. Robert Roberto Brambilla CESI Via Rubattino 54 20134 Milano tel +39.02.2125.5875 fax +39.02.2125.5492 rlbrambilla@cesi.it ==== On Sun, 29 Sep 2002 09:35:41, in the message Re: A Bessel integral, VB>> The expression for W[m_,n_] returned by Mathematica is wrong. VB>> VB>> To prove, just substitute m = n = 0 which is exactly what you had done VB>> VB>> and observe that the output you had had VB>> VB>> W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi) VB>> VB>> = 0.84564 VB>> VB>> was incorrect. The correct answer is 1/2. ^^^^^^^^^^^^^^^^^^^^^^^^^^ TB> W[0,0]diverges. Mathematica gets that wrong. (That my terrible bug shows how it is dangerous to do several posting to the MathGroup before sending them ;-) Why sure, you are right, the integral Integrate[BesselJ[0, z]^2, {z, 0, Infinity}] diverges because the integrand is bounded everywhere over the integration region and decays at z -> Infinity as Cos[Pi/4 - z]^2/z + o(z), that is as In[1] := Expand[TrigExpand[Cos[Pi/4 - z]^2/z]] // InputForm Out[1] = 1/(2*z) + (Cos[z]*Sin[z])/z which means that the integral Integrate[BesselJ[0, z]^2, {z, 0, x}] diverges logarithmically in x. By the way, the main term of Expand[Normal[Series[BesselJ[0, z], {z, Infinity, 1}]]^2] is (2*Cos[Pi/4 - z]^2)/(Pi*z) which conveys the suggestion that we should try it, too. This reveals us another integral which Mathematica 4.1 fails to calculate In[1] := Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}] // N Out[1]= -0.0173083 Out[2]= 4.1 for Microsoft Windows (November 2, 2000) but Mathematica 4.2 handles correctly In[1] := Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}] Out[1] = Integrate::idiv: Integral of... does not converge on {1, Infinity). Out[2]= 4.2 for Microsoft Windows (February 28, 2002) Even simpler, In[1] := Integrate[Cos[z]^2/z, {z, 1, Infinity}] Out[1] = -EulerGamma/2 - Log[2]/2 + (EulerGamma - CosIntegral[2] + Log[2])/2 Out[2]= 4.1 for Microsoft Windows (November 2, 2000) which is wrong while Mathematica 4.2 works excellent In[1] := Integrate[Cos[z]^2/z, {z, 1, Infinity}] Out[1] = Integrate::idiv: Integral of...does not converge on {1, Infinity). Out[2]= 4.2 for Microsoft Windows (February 28, 2002) Best wishes, Vladimir Bondarenko Mathematical Director Symbolic Testing Group Web : http://www.CAS-testing.org/ http://maple.bug-list.org/VER2/ (under tuning) http://maple.bug-list.org/VER3/ (under tuning) http://maple.bug-list.org/VER1/ (under tuning) http://www.beautyriot.com/ (teamwork) http://www.ohaha.com/ (teamwork) Voice: (380)-652-447325 Mon-Fri 9 a.m. - 6 p.m. Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== John, You could do something like this. points = With[{del = 2Pi/24}, Table[{Cos[t], Sin[t], t/(2Pi)}, {t, 0, 2Pi - del, del}]]; Show[Graphics[ {AbsolutePointSize[7], {Hue[Last[#]], Point[#[[{1, 2}]]]} & /@ points, Line[Drop[#, -1] & /@ points]}], AspectRatio -> Automatic, Background -> GrayLevel[0.4], ImageSize -> 400]; When I made the point list I made certain the z values were between 0 and 1. Otherwise you will have to define a color function that will associate a proper color with each value of z. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Approved: Steven M. Christensen , Moderator ==== Many thanks to all who replied. The original problem was as follows: In a presentation I wish to use Plot to generate a sequence of frames and then animate them. The problem is that the audience sees the animation twice. Once when the frames are being generated and then again after I have closed the group and double clicked on the top graphic. However, the first showing during generation is enough (but uncontrolled). Is it possible to tidy up the generation of the graphic so that it becomes the animation? There were two main solutions which I now apply to my real problem and not the simple, generic, problem in the original post. The real problem was how to build up a probably density function (PDF) in real time. In the examples below I redraw the PDF every time I add 10 points. Initialise <500] ], {500}]; NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs,Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}] ] This solution works but it generates 500 frames and sometimes exceeds the memory. The paradigm here is generate all frames, then animate all frames. We really need a loop that does: generate next frame, delete last frame, show next frame Is it possible to do this? Bobby Treat also offered a solution involving SelectionMove. The second solution was from Jerry Blimbaum and uses JAVA InstallJava[]; UseFrontEndForRendering = False; createWindow[] := Module[{frame}, frame = JavaNew[com.wolfram.jlink.MathFrame, Probability Density Function]; drawArea = JavaNew[com.wolfram.jlink.MathCanvas]; drawArea@setUsesFE[UseFrontEndForRendering]; drawArea@setSize[800, 600]; JavaBlock[frame@setLayout[JavaNew[java.awt.BorderLayout]]; frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]]; frame@pack[]; frame@setSize[800, 600]; frame@setLocation[100, 100]; JavaShow[frame]]; frame ] ClearAll[drawString]; drawString[] :=( data=Flatten[Join[data,RandomArray[wb,10]]]; freq=BinCounts[data,{0,50,1}]; BarChart[Transpose[{freq,midpts}],ImageSize ->500, DisplayFunction -> Identity]) LoadJavaClass[java.lang.Thread]; AnimationPlot[n_] := JavaBlock[ Block[{frm}, frm = createWindow[]; Do[(obj = drawString[]; drawArea@setMathCommand[obj]; drawArea@repaintNow[]; Thread@sleep[];) ,{n} ]]] data={}; AnimationPlot[500]; This solution works and does not use significant memory. However, we have not managed to control the speed of this animation. The JAVA code sleep does not work nor does the use of a Mathematica Pause which always rounds up to an integer (is this a bug?). Hugh Goyder ==== >>I need a loop that goes generate next frame, delete old frame, show new frame so that the number of frames does not become excessive. I'm pinging the group for that. I'm just following along in this, other than the trick of taking advantage of the half-period. I'll be very interested in a solution myself, as I frequently run out of memory in animations of fairly modest size -- despite having 1024MB of RAM. Bobby -----Original Message----- need a loop that goes generate next frame, delete old frame, show new frame so that the number of frames does not become excessive. Any ideas? Hugh Goyder -----Original Message----- graphs = Rest@Join[half, Rest@Reverse@half]; NotebookWrite[EvaluationNotebook[], Cell[CellGroupData[graphs, Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}]] Bobby -----Original Message----- >showing during generation is enough (but uncontrolled). > >Hugh Goyder This creates a graphics cell from a graphics expression. GraphicCell[graphics_] := Cell[GraphicsData[PostScript, DisplayString[graphics]],Graphics] cellgroup. Block[{$DisplayFunction=Identity, graphs}, graphs = Table[GraphicCell[ Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]], {t,0,15,.1}]; NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs,Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}] ] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== Actually, we don't know whether SetAccuracy succeeds, because we don't know how inexact those numbers really are. If they are known to more digits than shown in the original post, they should be entered with as much precision as they deserve. If not, there's no trick or algorithm that will give the result precision, because the value of f really is in the noise. That is, we have no idea what the value of f should be. Mathematica's failing is in returning a value without pointing out that it has no precision. Bobby -----Original Message----- f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b^8+a/(2*b), Infinity]; a=77617.1; b=33096.1; a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity]; f -1564032114908486835197494923989618867972540153873951942813115514949 3891236234 525007719168693704591197760187988046304361497869199129319625743010292363 1246 75 /10867106143970760551000357827554793888198143135975649579607989867743572 8240 16 0653953612982932181371232436367739737604096 2) Rewriting as fractions a=776171/10; b=330961/10; f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2*b) -(5954133808997234115690303589909929091649391296257/ 41370125000000) 3) Using Rationalize Clear[a,b,f] f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b^8+a/(2*b), 0]; a=77617.1; b=33096.1; a=Rationalize[a,0];b=Rationalize[b,0]; f -(5954133808997234115690303589909929091649391296257/ 41370125000000) I use Rationalize[. , 0] besause of results like Rationalize[3.1415959] 3.1416 Rationalize[3.1415959,0] 31415959/10000000 -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay@haystack.demon.co.uk Voice: +44 (0)116 271 4198 > Well, first of of all, your using SetAccuracy and SetPrecision does > nothing at all here, since they do not change the value of a or b. You > should use a = SetAccuracy[a, Infinity] etc. But even then you won't > get the same answer as when you use exact numbers because of the way > you evaluate f. Here is the order of evaluation that will give you the > same answer, and should explain what is going on: f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121* > b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]; a = 77617.; > b = 33096.; a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity]; f 54767 > -(-----) > 66192 Andrzej Kozlowski > Toyama International University > JAPAN > Could someone explain what is going on here, please? > In[1]:= > a = 77617.; b = 33096.; > In[2]:= > SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; > SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; > In[4]:= > f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + > a/(2*b) > In[5]:= > SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; > In[6]:= > f > Out[6]= > -1.1805916207174113*^21 > In[7]:= > a = 77617; b = 33096; > In[8]:= > g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + > (55/10)*b^8 + a/(2*b) > In[9]:= > g > Out[9]= > -(54767/66192) > In[10]:= > N[%] > Out[10]= > -0.8273960599468214 > > PK ==== It seems clear to me that what Allan and what you mean by succeeds here refer to quite different things and your objection is therefore beside the point. There are obviously two ways in which one can interpret the original posting. The first interpretation, which Allan and myself adopted, was that the question concerned purely the computational mechanism of Mathematica. Or, to put it in other words, it was why are the results of these two computations not the same?. In this sense success means no more than making Mathematica return the same answer using the two different routes the original poster used. You on the other hand choose to assume that the posting shows that its author does not understand not just the mechanism of significance arithmetic used by Mathematica but also computations with inexact numbers in general. I do not think this is necessarily the correct assumption. I also don't see that Mathematica is doing anything wrong. After all, one can always check the accuracy of your answer: In[1]:= a = 77617.; b = 33096.; In[2]:= f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b) In[3]:= f Out[3]= -1.1805916207174113*^21 In[4]:= Accuracy[%] Out[4]= -5 which tells you that it can't be very reliable. What more do you demand? Andrzej Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ > Actually, we don't know whether SetAccuracy succeeds, because we > don't > know how inexact those numbers really are. If they are known to more > digits than shown in the original post, they should be entered with as > much precision as they deserve. If not, there's no trick or algorithm > that will give the result precision, because the value of f really is > in the noise. That is, we have no idea what the value of f should > be. Mathematica's failing is in returning a value without pointing out that > it has no precision. Bobby -----Original Message----- > Sent: Monday, September 30, 2002 11:59 AM Andrzej, Bobby, Peter It looks as if using SetAccuracy succeeds here because the inexact > numbers > that occur have finite binary representations. If we change them > slightly to > avoid this then we have to use Rationalize: 1) Using SetAccuracy Clear[a,b,f] > f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b^8+a/ > (2*b), > Infinity]; a=77617.1; > b=33096.1; a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity]; f > -1564032114908486835197494923989618867972540153873951942813115514949 > 3891236234 52500771916869370459119776018798804630436149786919912931962574301029236 > 3 > 1246 > 75 / > 10867106143970760551000357827554793888198143135975649579607989867743572 > 8240 > 16 > 0653953612982932181371232436367739737604096 2) Rewriting as fractions a=776171/10; > b=330961/10; f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2*b) -(5954133808997234115690303589909929091649391296257/ > 41370125000000) 3) Using Rationalize Clear[a,b,f] > f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b^8+a/ > (2*b), > 0]; a=77617.1; > b=33096.1; a=Rationalize[a,0];b=Rationalize[b,0]; f -(5954133808997234115690303589909929091649391296257/ > 41370125000000) > I use Rationalize[. , 0] besause of results like Rationalize[3.1415959] 3.1416 Rationalize[3.1415959,0] 31415959/10000000 > -- > Allan >