A28 == I noticed that n Mathematica 3.0 , IntegerDigits function isSSG> giving wrong results. This problem is not found in MathematicaSSG> 4.1. Whether anybody else has also noted any such problem.SSG> For example IntegerDigits[10^18+7] will give the digits 0SSG> 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 BondarenkoMathematical DirectorSymbolic Testing GroupWeb : 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.0John A. Velling-----Original Message----- ==== =I would appreciate any info on these issues.1. I have a symbol slback. I was gettingtag times lback protected (or something) errors.(A typically uninformative error message.)I suspected there was a separation between the sand l, and they looked too far apart, but when Ispaced past them with the arrow keys, there didnot appear to be anything like a space in between.I retyped the symbol and all was ok. This hashappened before. What's going on ???2. I'm using Raster to plot data pointsin a 256x256 array. Two problems: First,regardless of the ImageSize setting (I need thedisplay as big as possible), the individual data cellswhen examined closely at 300% vary in size byalmost 2:1. This makes detailed inspection of thedata values difficult. Surely there is some settingof something which would make each data cell anexact number of screen pixels? Second, I'musingShow[ Graphics[Raster[ rescol, ColorFunction -> Hue]], AspectRatio -> Automatic, ImageSize -> 700];but the Hues don't allow enough easily distinguishableshades to visually recognize even 6 data values easily.(I'm slightly colorblind.) It would be nice to have blackand white available for two of the data values, but Huedoes not allow this. I don't understand what thedocumentation says about RasterArray.3. I wanted to get this raster image into a formatwhere I could dissect it with Photoshop or equivalent.After much fooling around, I found that I can export theselection as an html file, read it into Navigator, do File>Edit Page, which brings up Netscape Composer, rightclick the image which, allows saving it as a GIF, whichI can finally work on with a photo editor. Maybethere is an easier way, or maybe this description willhelp 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'thelp you. You should also send the mathematica versionyou are using. But typical this error comes from a equationa*b==cwhere 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 understandwe 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 expressionin a desired format, TIFF, PNG, PPM are all losslesscompressed bitmap formats, that Mathematica can exportand 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 readthe 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 thisby making the images bigger but this is not a completesolution.> 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 notcontain 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 PhotoShopGRAY: I foolishly thought something like Export would be underthe 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 Pastingit into Paint Shop Pro (or no doubt lots of other bitmapeditors) 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 ithas several limitations.Any suggestions would be greatly appreciated. ==== =I have a dual processor Dell computer...unfortunately, I can only access oneof the processors...I purchased Wolfram's parallel processing toolkit which, because of the very poor documentation, never did me any good...i'm toldthat another option for accessing the dual processors is to write C codeetc...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....inaddition, i would like to access this C code with JavaNativeCode, etc...cananyone help me with this? thanks...jerry blimbaum NSWC panama city, ßReply-To: kuska@informatik.uni-leipzig.de ==== =you can have a parallel implicit Runge-Kutta methodprogrammed in C *and* with the Parallel Computing Toolkitboth on the base of the MathLink protocol.Since I have a SGI I can't help you with the binaryfor a Dell what ever computer but if you like the source ...You can also have a native MPI source of the code but you willneed 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, ß ==== I have a set of inequalities that I solve with InequalitySolve. But thenit gives a complete set of solutions, but not in the way I would like itto 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 + y6the result is good, but I would like it to be in the simpler butequivalent form y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6How can I tell InequalitySolve to do that? It is simple for this example,but for a large set of simple inequalities InequalitySolve gives lines andlines of results instead of a simple result.Vincent Bouchard ==== f[c] == (c+b)/.ru[c] == (c+b)/.c->x == x+b == b+xBobby 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 thatobviously 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 + xThe 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 evaluatingru[c], so it would have remained just that -- ru[c]. When the kerneltried 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 definitionf[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+xThere are several ways to get what you want. One is to use = instead of :=, another to force evaluation of the right hand side withf[x_]:=Evaluate[(a+b) /. ru[a]]yet another to insert the actual rule in the definition of f:f[x_]:=(a+b) /. a->xAndrzej KozlowskiToyama International UniversityJAPANOn 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 MathematicaIn[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>=aIn[92]:=Ll[k_,mu_]:=0/;mu<=- aIn[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 andthen animate them. The problem is that the audience sees the animationtwice. Once when the frames are being generated and then again after I haveclosed the group and double clicked on the top graphic. However, the firstshowing during generation is enough (but uncontrolled). Is it possible to tidy up the generation of the graphic so that it becomesthe animation?I have tried the followingDo[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 ßashes on and off spoiling theanimation 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 seriesforecasting (The Innovation Algorithm).I will write it in pseudo-Mathematica notation. K is the given m x mautocovariance (numerical) matrix of the processv[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-1v[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 ashave no experience with recursive functions with two variables, itdoesn't seem to work properly and is also very slow. Any help would beRobertReply-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.eduMathematics & Statistics Dept.Lederle Graduate Research Tower phone 413 549-1020 (H)University of Massachusetts 413 545-2859 (W)710 North Pleasant StreetAmherst, 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 beable to select any part of an expression and drag it to a new line forfurther processing. Mathematica and the other CAS I'm familiar with are stillpretty much stuck with a command line interface. They need a trueGUI with extensive interaction. When I can see on the screen exactly what I want to do, whyshould 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.eduMathematics & Statistics Dept.Lederle Graduate Research Tower phone 413 549-1020 (H)University of Massachusetts 413 545-2859 (W)710 North Pleasant StreetAmherst, MA 01375 ==== =PlayTone[F_, dur_] := Play[Sin[2*Pi*F*t], {t, 0, dur}]allows me to play a sine wave of frequency F and duration durPlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur], {i, Length[L]}]should allow me to play a sequence of toneswith a given list of frequencies Land all the same duration dur.It does not work at least in 4.1all tones but the last one are much shorter than dur.any help?-- --Erich Neuwirth, Computer Supported Didactics Working GroupVisit 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:51An: mathgroup@smc.vnet.netBetreff: Strange ReplaceAll behaviorFor 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 getf[c] = b+xand notf[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 clickwithin the part I want and double-click until the part is selected.(Each double-click expands the selection by one level of nesting.) Thenpush 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 forfurther processing. Mathematica and the other CAS I'm familiar with arestillpretty much stuck with a command line interface. They need a trueGUI with extensive interaction. When I can see on the screen exactly what I want to do, whyshould 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 tothis ML.What happens is the following. When Mathematica 4.1 installed in HDDis 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, mathematicalexpressins are totally broken.What is strange is that when I start Mathematica 4.1 by double clickingMathematica in CDROM, it works without any problem. Further more,Once Mathematica 4.1 is correctly started in this way, I can restart Mathematicadirectly 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 someoneknow 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 tothis ML.What happens is the following. When Mathematica 4.1installed in HDDis 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, mathematicalexpressins are totally broken.What is strange is that when I start Mathematica 4.1 by double clickingMathematica in CDROM, it works without any problem. Further more,Once Mathematica 4.1 is correctly started in this way, I can restartMathematicadirectly from double clicking Mathematica in HDD, which is theinstalled one.Once CDROM is ejected, the error appears again.It is clearly font related problem but I do not know how to solve. Ifsomeoneknow 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 >= 0This is fine. However:In[2]:=FullSimplify[x > 0 && x < 2 || x == 0 && x < 2]Out[2]=x == 0 || 0 < x < 2Of 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 < 2There 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 < 2However, 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]=TrueHowever: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]=FalseThat 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]=TruewhileIn[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 + y6On 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]=TrueIn[11]:=FullSimplify[y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6, y4 == -1 && y6 >= -1 && y5 == y6 ]Out[11]=TrueIn 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]=TrueIn[13] :=FullSimplify[C,LogicalExpand[(A||B)&&(C)]]Out[13]=CThis 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]=Truebut 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]=TrueThis seems to me a possible worthwhile improvement in FullSimplify, though of course not really helpful for your problem.Andrzej KozlowskiToyama International UniversityJAPAN> 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 KozlowskiToyama International UniversityJAPAN> 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 theevaluation sequence, when the definition for f[c] is applied, no x appearsat rhs i.e.(a + b) /. ru[a] and such c cannot be inserted. The result is the same asdirectly executingIn[11]:= (a + b) /. ru[a]Out[11]= b + xIf you don't like this, you have to make explicit the Value of ru[a] in thedefiniton 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 + xIn[10]:= f[c]Out[10]= b + cThe drawback of this that not only the value of ru[a] is inserted but alsothe whole expression including ReplaceAll is evaluated. If this is notwanted, you have to insert the value of ru[a] into the unevaluated rhs atthe definition. The general means for this are function application, With orReplace:In[7]:= (g[x_] := (a + b) /. #) &[ru[a]]In[8]:= g[c]Out[8]= b + cIn[16]:= Clear[g]In[20]:=Unevaluated[g[x_] := (a + b) /. rule] /. rule -> ru[a]In[21]:= g[c]Out[21]= b + cHere we have to prevent evaluation of the defintion before our rule isinserted, this is achieved by Unevaluated.With is a bit more complicated, since the scoping rules for SetDelayed wouldnot allow the substition of an expression at rhs containing a patternvariable (the pattern variable is renamed in this case). A simple answer tothis 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 + cWhy is arg = x_ needed?Without it we get Clear[g]; With[{rule=ru[a]}, g[x_]:=a+b/.rule]; g [c] b+xThe reason for this shows in ?g Global`g g[x$_] := a + b /. a -> xThe 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 HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +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] inthe> 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, Withor> 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 SetDelayedwould> not allow the substition of an expression at rhs containing a pattern> variable (the pattern variable is renamed in this case). A simple answerto> 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 ==== =TryIn[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 usuallyreserved for Mathematica functions.Tomas GarzaMexico 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 forexample a matrix in TableForm as a space-delimited ASCII file inMathematica 3.0.for example:M={{1,2,3},{4,5,6},{7,8,9}};TableForm[M]1 2 34 5 67 8 9The commands like Put or Write create files with a standard Mathematicamatrix notation with braces, I get the the same result with Save As/CopyRobert ==== =Much longer. At least 10 times as long. Not sure because I quit. As I readBobby Treat's response, one of my processors had been laboring for more thanthree days to generate all the digits. (I had not considered to display orprint 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 allthe statements and paste them into a Mathematica notebook. All the statementnumbers have to be edited out and if there are many statement definitionsthis is an extended task for any responder. This, of course, decreases thechances for a response. A better method is for the poster to just copy andpaste the CONTENTS of each cell. This is more work for the poster, but itmay pay off in better responses.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ ==== = David,I agree with you that it makes responding and using easier if the In and Outnumbers are not included.An easier way to do this, rather than copying the contents of the cells, isUsually a little manual reformating is needed to distinguish text, input andoutput --- I try to use one tab indent for input and two tabs indent foroutput, plus some blank line adjustment.I wonder if anyone has a way of automatically achieving this reformating.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +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 outall> the statements and paste them into a Mathematica notebook. All thestatement> 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 muchbeyond 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 outall> the statements and paste them into a Mathematica notebook. All thestatement> 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 GoyderThis 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 ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== = Actually, the reason why ImpliesQ (and FullSimplify) fail toprove the implication is not that the hypothesis is a disjunction.To use the cylindrical algebraic decomposition algorithm theyneed to know that the assumptions imply that all variables arereal. The assumptions mechanism infers variable domains in a purelysyntactical 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 figureout that, say y6 >= -1 implies that y6 is real, and then ifwe have y5 == y6 then y5 must be real too. Doing such an analysisin general would require solving the assumptions over complexnumbers, 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 possiblefuture improvement.ImpliesQ cannot prove the implication here, because it knows onlythat 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 StrzebonskiWolfram 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 ruleImpliesQ[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 KozlowskiToyama International UniversityJAPAN> 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 file1. 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 definedclasses in the sense, that it helps to define the behaviour of thecomponent.In this case, each differential equation should be stored in one of thesesclasses as textstring in a form appropriate for the execution inMathematica.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 representthe> 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 SimulationPackage.> 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 ßexible) 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 willbe> 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 frommain> 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 beable> 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 tochange> 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 runwill> 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 ofthe> input values supplied by the package user ?> > And @@ (NumericQ /@ {aListOfAllYourNumericParameters})> > Jens> ==== =I agree with Mr. Kuska, that the system Mr Nagesh describes is notuserfriendly. But I think, the suggestions of Mr. Kuska do not make it moreuserfriendly, rather the opposite is true.Mr. Nagesh asksIs any body here have expertise or information about the capability ofMathematica as a system simulation tool?Mr. Kuska answers:Since the most system simulation tools are simply solving a system ofordinary differntial equations it is simple to do this with NDSolve[].My comment:That is: He sees the simulation system merely as a set of differentialequations.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 arenumerical?Additionally I think, it is not userfriendly to see the input merely as aset of 200-250 numbers.My suggestion is, that JLink is used, a suggestion Mr. Kusk takes intoconsideration, too.But further I suggest, that classes are defined in Java, which represent theparts of the system.Constructors of the classes should build objects with default values.Graphical user interfacesshould give the opportunity to change the data fields in the objects andcheck 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 lastone> year. I don't have any programming experience before this. I havefollowing> querries:-> 1. Is any body here have expertise or information about the capabilityof> 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 othersoftware? 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 ßexible) 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 fulfillfrom> coding out of my main input file> > 1. Example from Main Input File ( this will contain about 200-250variables> 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 othersuch> 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 frommain> input file will be used in other files.> > I hope that this short information will be useful for guiding me tosolve> the following problems that I am facing. I am facing follwing problemsor> objectives:-> > 1. My 1st Objective:- The user of this package must be able to changeonly> the value of the variable in the main input file but he must not be ableto> 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 changethe> name of this variable itself.> Here our problem is how to achieve or program it so that our objectivewill> 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 itwill> 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 useropens> up this file. If user want to change the values of some variables thenhe> can change them and run the simulation otherwise the simulation run willbe> 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 writeMy 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 ofof 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 tomake 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 ofa model are valid. But for this checks one needs more knowlege about the meaning of the parameters. And one needs the knowlege aboutthe 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 besolved with Mathematica, the parts can't be Java classes. Mathematica'sNDSolve[] need a explicit expression to integrate the equations.OK you can call a Java class member from Mathematica but this willbe incredible slow when the right hand side is evaluated 200-300times and every evaluation make several callbacks to the Java source.Event handler of the Java main program (without some modification inthe 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, onealwaysneed the full listing of the Java source to find the actual parametersettings. > 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 parametersare fixed and it make no sense to change, for example, materialconstants 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 thatask How can I build a simulation system with Mathematica ?You *can* say Don't use Mathematica, use Java! but this has nothingto 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/Scriptinterface 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 ßexible) 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 ofordinary 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 youshould keepin 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 toinclude one of the excelent ode-solvers from netlib in your C-codethan to call Mathematica to do that. As long as you dont wish to changethe ode's very often (than Mathematica is more ßexible) you shouldnot 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 functionand 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 ondifferent regions, for different values of x. So, you have to break itup. The assumption x > 0 implies that x is real, so Im[x]==0 isunnecessary.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 // FullSimplifyPlot[{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.08Reply-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 ßashes on and off spoiling theanimation and if there is anything in the cell below this jumps up anddown.Is there a proper way of doing this?Hugh Goyder ==== =>>So would it take about the same amont of time for the completeprintoutof digits? Of course it would take a few additional seconds to formatthe output...I think it would take FAR more time for a complete printout, and mightcrash the Front End. I was thinking about the fact that I calculatedall those digits and then threw them away. I could save them with Saveor DumpSave, and read them in with Get the next time I wanted any ofthem, although the file would be close to 70 MB (if not more). I may dothat, in fact -- I have plenty of disk space.The next step would be to somehow reuse the stored digits if I wantedMORE digits. But how?The Bailey-Borwein-Plouffe Pi algorithm is an avenue of attack, since itcan calculate digits far from the decimal point, without calculatingthose in between. Unfortunately, it calculates hexadecimal digits inthat 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 convertback to decimal. In both conversions, I'd have to be very cognizant ofhow 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 decimaldigits, to eliminate one of those conversions at each increase in thenumber of digits.The next step would be to set up an application that allowed anyone toping for digits across the Internet, and would return them if they'restored.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 withthe> 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,^LReply-To: kuska@informatik.uni-leipzig.de ==== =I expect that the Helvetica request comes from theFrontend menues and this is lited I your X resources$TopDirectory/SystemFiles/FontEnd/SystemResources/X/ XMathematicarequest 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/ KeyEventTranslations.trI 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 windowand type >maththe delete key work perfect, due to your terminal settings anda 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/ KeyEventTranslations.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? ==== =Dear friendsI 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.GuillermoSanchez---------------------------------------- -----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: 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 thecurrent Mathematica session, please try:?`*which should return a list of all variables that have been defined for thecurrent 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 sessionQuitMake some entries, notice that b, x and y have no definitions - they aresimply 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, awould 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 anattribute 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 symbolsInformation/@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*xI have assumed that you are interested only in the symbols in the symbols inthe default context Global`.Other context can be provided for.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 ==== =There are several ways (note that newly defined things are by default inGlobal` 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 theBerndt-Hall-Hall-Hausman method, if the option Method->QuasiNewton is specified. I am pretty convinced that there is no way to tellmathematica to produce as an output the Jacobian vector and the Hessianmatrix at every step. In addition, I have not found a way to specify theDavidon-Fletcher-Powell algorithm to be used.Before I start to program it myself, I was wondering if anybody has writtensome [non-commercial] code that produces such an output for BFGS and evenbetter for DFP optimization.Kyriakos _____+**+____+**+___+**+__+**+_Kyriakos ChourdakisLecturer in Financial EconomicsURL: http://www.qmw.ac.uk/~te9001tel: (++44) (+20) 7882 5086Dept of EconomicsUniversity of London, QMLondon E1 4NSU.K. ==== =Both Simplify and ImpliesQ need the assumption that all variablesare real in order to use the CAD algorithm. However, Simplifyuses many other methods trying to simplify each subexpressionof the input, while ImpliesQ only tries to prove that the wholeinput is implied by the assumptions.Here is the series of simplifications that Simplify does in thisexample.- An inequality simplification heuristic using the inequality assumption y6 >= -1 is applied to the whole system. We getsimplification: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 thesesimplifications using reduction modulo a GroebnerBasis ofequation assumptions y4 == -1 and y5 == y6 (Simplify keepsthe result of this transformation even if it has the samecomplexity as the original expression.)1 + y4 -> 0y5 -> y61 + y4 + y6 -> y6y5 -> y6- As the result of subexpression simplifications the three inequalities become then:1 + y4 >= 0 -> 0 >= 0y5 >= y6 -> y6 >= y61 + y4 + y6 >= y5 -> y6 >= y6- 0 >= 0 evaluates to True, y6 >= y6 is simplified to True using transformation x >= y -> x - y >= 0.Adam StrzebonskiWolfram 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]=TrueIn[3]:=ImpliesQ[y4 == -1 && y6 >= -1 && y5 == y6, y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6]Out[3]=FalseI 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 KozlowskiToyama International UniversityJAPAN ==== =inside a program I need to solve this linear equation in terms of p1.However something odds happens. Sometimes the solution is computed andsometimes the result is empty [I mean no output...]. Is this a bug of thesolve command or am I doing something wrong? The problem is robust to:changing name to the variables and other makeups..Davidps: 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 +