A40 === Original Message----->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 ==== I'm woking on a kind of a Mathematica cheat-sheet. So I don't have to repeatthe same learning process if I get pulled away for another 6 months.I've attempted to get my domain name to resolve to my IP address, but it seems Verisign and I have different ideas about what 24 hours is.The site is supposed to be www.globalsymmetry.com, but that will not currently resolve. Here's the IP and path:http://66.92.149.152/proprietary/com/wri/index.htmlThis is not a literary masterpiece. It's probably proof that giving just anybody the power to publish is, perhaps, not a guaranty that more quality publication will take place.If anybody has answers to the questions I've come up with, or comments about the answeres, etc. I'd be happy to know. ==== >>I believe the complexity is O(n log n), so this should be good enough.Umm ...good enough? I understand the words individually, but thephrase makes no sense to me.Bobby Treat-----Original Message-----> crash the Front End. I was thinking about the fact that I calculated> all those digits and then threw them away. I could save them withSave> or DumpSave, and read them in with Get the next time I wanted any of> them, although the file would be close to 70 MB (if not more). I maydo> that, in fact -- I have plenty of disk space.>> The next step would be to somehow reuse the stored digits if I wanted> MORE digits. But how?>> The Bailey-Borwein-Plouffe Pi algorithm is an avenue of attack, sinceit> can calculate digits far from the decimal point, without calculating> those in between. Unfortunately, it calculates hexadecimal digits in> that way, not decimal digits. (That's true for the version I've seen,> anyway.) Still, I could take the stored digits, convert tohexadecimal,> add more hexadecimal digits with the B-B-P algorithm, and then convert> back to decimal. In both conversions, I'd have to be very cognizantof> how much precision I end up with, but that shouldn't be too difficult.> It might go faster if I store hexadecimal digits, as well as decimal> digits, to eliminate one of those conversions at each increase in the> number of digits.>> The next step would be to set up an application that allowed anyone to> ping for digits across the Internet, and would return them if they're> stored.>> Hasn't someone already done that? It seems as if someone would have.>> Bobby TreatIf you're interested in decimal digits, I don't think the BBP algorithmis theway to go. In order to get the nth decimal digit of Pi you need tocompute theprevious n-1 digits, since base conversion is global, not local. ThealgorithmMathematica uses for computing Pi is quite fast - I believe thecomplexity is O(nlog n), so this should be good enough.David> -----Original Message-----calculation in>> So would it take about the same amont of time for the completeprintout> 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 amcurious,performance> to> other programs out there.>> > I used one processor of a dual 1GH Mac and got the same answer with> the> following speed:>> 4.2 for Mac OS X (June 4, 2002)> oldmax = $MaxPrecision> 6> 1. 10> $MaxPrecision = Infinity> Infinity> With[{n = 2^26}, Timing[> pd = RealDigits[N[Pi, n + 1], 10, 20,> 19 - n]; ]]> {28794.1 Second, Null}> MaxMemoryUsed[]> 512055204> > pd> {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3,>> 4, 0, 9, 8, 0, 3}, -67108844}>> Tom Burton ==== Edit ->Preferences -> Font OptionsIn Preferences you will find everything you need to configure yourMathematica environment. Also you may want to look up Style Sheets in thebook or the on line help.Yas> I've been trying to get my Mathematica 4.1 properly configured.>> I set:> ############################################################# ######> /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/X/ Specific.tr:> @@resource maxForXListFonts> 10000>> # xlsfonts | wc -l> 5572>> /etc/X11/XF86Config:> FontPath /usr/X11R6/lib/X11/fonts/100dpi:unscaled> FontPath /usr/X11R6/lib/X11/fonts/75dpi:unscaled> FontPath /usr/X11R6/lib/X11/fonts/CID> FontPath /usr/X11R6/lib/X11/fonts/Speedo> FontPath /usr/X11R6/lib/X11/fonts/Type1> FontPath /usr/X11R6/lib/X11/fonts/URW> FontPath /usr/X11R6/lib/X11/fonts/kwintv:unscaled> FontPath /usr/X11R6/lib/X11/fonts/latin2/Type1> FontPath /usr/X11R6/lib/X11/fonts/local/mma/Type1> FontPath /usr/X11R6/lib/X11/fonts/local/mma/X:unscaled> FontPath /usr/X11R6/lib/X11/fonts/misc:unscaled> FontPath /usr/X11R6/lib/X11/fonts/misc/sgi:unscaled> FontPath /usr/X11R6/lib/X11/fonts/truetype> FontPath /usr/X11R6/lib/X11/fonts/uni:unscaled>> # ls -R /usr/X11R6/lib/X11/fonts/ | grep /> /usr/X11R6/lib/X11/fonts/:> /usr/X11R6/lib/X11/fonts/100dpi:> /usr/X11R6/lib/X11/fonts/75dpi:> /usr/X11R6/lib/X11/fonts/CID:> /usr/X11R6/lib/X11/fonts/Speedo:> /usr/X11R6/lib/X11/fonts/Type1:> /usr/X11R6/lib/X11/fonts/URW:> /usr/X11R6/lib/X11/fonts/encodings:> /usr/X11R6/lib/X11/fonts/encodings/large:> /usr/X11R6/lib/X11/fonts/kwintv:> /usr/X11R6/lib/X11/fonts/latin2:> /usr/X11R6/lib/X11/fonts/latin2/Type1:> /usr/X11R6/lib/X11/fonts/local:> /usr/X11R6/lib/X11/fonts/local/mma:> /usr/X11R6/lib/X11/fonts/local/mma/Type1:> /usr/X11R6/lib/X11/fonts/local/mma/X:> /usr/X11R6/lib/X11/fonts/misc:> /usr/X11R6/lib/X11/fonts/misc/sgi:> /usr/X11R6/lib/X11/fonts/truetype:> /usr/X11R6/lib/X11/fonts/uni:> /usr/X11R6/lib/X11/fonts/util:>> ########################################################>> When I open the Mathematica Book Reference Guide in the Help Browser, I get> a beep and the message says:>> Unable to find font with family Helvetica, weight Bold, slant Plain, and> size 26. Substituting Courier.>> Compared to the things which *were* broken, this is a minor problem. I can> live with the beep. What I would now like to know is how to tell Mathematica what> fonts to use by default. This seemingly simple question seems to have no> simple answer.>> Could someone please help me.>> TIA,>> ^L>> ==== > Edit ->Preferences -> Font Options> In Preferences you will find everything you need to configure your> Mathematica environment. Also you may want to look up Style Sheets in the> book or the on line help.> Yas> I went into the preferences browser, and it was not clear to me what I was modifying. At one point I clicked on a field filled with text. I had inteded to edit it, and all the text vanished. It didn't bother me as much as such things use to, because I believe I know a backout strategy. It's been a while since I looked at this stuff, and I have to admit it seems far more tractible than it did a year ago. I'll look at the discussion again, and see if it makes more sence to me now.STH ==== > As an example, I spent several hours trying to figure out how to tell> Mathematica to understand the delete key in the way most contemporary> systems understand it. I wanted to avoid modifying system> configuration files such as:> /usr/local/mathematica/SystemFiles/FrontEnd/TextResources/ 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.If you could post a precise description of what you expect the Delete keyto do when depressed, we could probably provide you with a clear cutanswer of what needs to be done.> I want to adjust the font size used in the widgets, but again, I see> no ovbious means of modifying these attributes. I suspect it can be> accomplished by modifying the ~/.Mathematica/4.1/FrontEnd/init.m.> Perhaps to an experienced Mathematica user, the syntax and semantics> of this file are obvious. They aren't to me.The size of fonts in user interface elements is not specified through theMathemtica init.m file. It is set through an X resource. If you are notfamiliar with resources, you may want to track down an introductory texton the X Window System. Information on application-specific resourcesettings can be found in the Mathematica Getting Started Guide:http://documents.wolfram.com/v4/GettingStarted/ TroubleshootingUnixX.htmlThe setting that you would need to adjust is XMathematica*fontList. Thevalue of the resource is an X Logical Font Description field.> I also find the overall look & feel of the interface to be archaic.That's because Mathematica relies on the Motif library for user interfaceelements.http://www.opengroup.org/desktop/ motif.htmlThe appearance of these elements, such as the menu and scroll bars, wouldbe the same for any other Motif application, such as the DDD debugger orreleases of Netscape prior to verison 4.-- User Interface Programmer paulh@wolfram.comWolfram Research, Inc. ==== hi,> I sholdn't have to. If I start messing with X resource settings for my> user environment, I am sure to break something else which is configured> based on the current settings. There should either be a GUI interface, or a> clearly documented, and easily accessible configuration file to modify such> properties as the size of the fonts in the GUI widgets. This is> functionality which is rightfully expected of a modern desktop UI.[snip]> And I'm sure there is some configuration file in which I could place that,> and hope that what you think will be read by my system *will* in fact be> read, and not subsequently overridden during xsession startup. Things> aren't the way they used to be back in the 1980s. The modern Unix desktop> has moved beyond the paradigm of openlook and motif. See for example> http://www.trolltech.com, http://www.gnome.org, and http://www.kde.org>moving the frontend over to QT would have some neat side effects: consistent look & feel with the modern linux gui, themeability, source code truetype fonts as QT supports Xrender and Xft (looks great - see KDE3). i think all of those points are of value, but the most important might be source compatibility. ONE frontend for MOST (or ALL) platforms - sounds like a dream :-))gerald -- *************************************Gerald RothM@th Desktop Development************************************* ==== > If you could post a precise description of what you expect the Delete key> to do when depressed, we could probably provide you with a clear cut> answer of what needs to be done.Item[KeyEvent[Delete], DeleteNext]'Most' means Ômore than half.' >> I want to adjust the font size used in the widgets, but again, I see>> no ovbious means of modifying these attributes. I suspect it can be>> accomplished by modifying the ~/.Mathematica/4.1/FrontEnd/init.m.>> Perhaps to an experienced Mathematica user, the syntax and semantics>> of this file are obvious. They aren't to me.> The size of fonts in user interface elements is not specified through the> Mathemtica init.m file. It is set through an X resource. If you are not> familiar with resources, you may want to track down an introductory text> on the X Window System. I sholdn't have to. If I start messing with X resource settings for my user environment, I am sure to break something else which is configured based on the current settings. There should either be a GUI interface, or a clearly documented, and easily accessible configuration file to modify such properties as the size of the fonts in the GUI widgets. This is functionality which is rightfully expected of a modern desktop UI.> Information on application-specific resource> settings can be found in the Mathematica Getting Started Guide:> http://documents.wolfram.com/v4/GettingStarted/ TroubleshootingUnixX.htmlIt should be in a clear and easy to access configuraton interface, or at least be redily available through the help system in such a way that reasonable queries will locate it. Changing fonts does not belong in a section on trouble shooting, unless this is an acknowledgement that the UI is broken.> The setting that you would need to adjust is XMathematica*fontList. The> value of the resource is an X Logical Font Description field.And I'm sure there is some configuration file in which I could place that, and hope that what you think will be read by my system *will* in fact be read, and not subsequently overridden during xsession startup. Things aren't the way they used to be back in the 1980s. The modern Unix desktop has moved beyond the paradigm of openlook and motif. See for example http://www.trolltech.com, http://www.gnome.org, and http://www.kde.org >> I also find the overall look & feel of the interface to be archaic.> That's because Mathematica relies on the Motif library for user interface> elements.> http://www.opengroup.org/desktop/motif.html> The appearance of these elements, such as the menu and scroll bars, would> be the same for any other Motif application, such as the DDD debugger or> releases of Netscape prior to verison 4.My point exactly. ==== Awk! Legends!Basically, the answer to your question is that the PlotLegend option worksONLY for the Plot command and does not work for other types of plots. Forother types of plots you have to use ShowLegend. And ShowLegend is not allthat easy to use, especially since WRI does not give an example for multiplecurves in the Help.Needs[Graphics`Graphics`]Needs[Graphics`Legend`]{q1[ t_], q2[t_], q3[t_]} = {0.1 Exp[-0.02 t], 0.2 Exp[-0.025 t], 0.4 Exp[-0.028 t]};Let's look at your first plot.Plot[{q1[t], q2[t], q3[t]}, {t, 0, 100}, PlotStyle -> {{AbsoluteThickness[0.5], AbsoluteDashing[{4, 4}]}, AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1, 8}]}}, AxesLabel -> {Y, X}, PlotLabel -> Title, PlotLegend -> {1, 3, 5}, LegendPosition -> {0.5, 0}, ImageSize -> 500];The legend is almost as big as the plot. It distracts from the realinformation you are trying to convey. Furthermore, the order of the curvesin the legend is the reverse of their order in the plot.The following shows how to put the legend in a LogLogPlot, or other types ofplots. I defined the plot styles independently because they are used inseveral places. I made the legend much smaller and put it in an empty areaof the plot. I also reversed the order of the keys so they would match theorder of the curves in the plot.styles={{AbsoluteThickness[0.5], AbsoluteDashing[{4,4}]},{AbsoluteThickness[1.5]},{ AbsoluteThickness[ 2],AbsoluteDashing[{1,8}]}};ShowLegend[ LogLogPlot[{q1[t], q2[t], q3[t]}, {t, 0, 100}, PlotStyle -> styles, AxesLabel -> {Y, X}, PlotLabel -> Title, ImageSize -> 500, DisplayFunction -> Identity], {MapThread[{Graphics[{Sequence @@ #1, Line[{{0, 0}, {1, 0}}]}], #2} &, {styles, {1, 3, 5}}] // Reverse, LegendPosition -> {-0.7, -0.4}, LegendSize -> {0.2, 0.3}, LegendShadow -> {0.02, -0.02}, LegendSpacing -> 0.5} ];But why use a legend at all? After all, a legend is nothing but another plotin which you have put labels on the curves. Why not put the labels directlyon the curves in the real plot in the first place?LogLogPlot[{q1[t], q2[t], q3[t]}, {t, 0, 100}, PlotStyle -> styles, AxesLabel -> {Y, X}, PlotLabel -> Title, ImageSize -> 500, Epilog -> MapThread[ Text[SequenceForm[Case , #1], {Log[10, 0.01], Log[10, #2[0.01]]}, {0, -1}] &, {{1, 2, 3}, {q1, q2, q3}}]];In the legend you have keyed the curves to numbers 1, 3 and 5. (Perhaps youjust used these as examples and meant to use something different in the realplots?) But these don't seem to have any obvious relation to your functions.I suppose the reader will have to look at another table or look into thetext of your paper or notebook to find out what 1, 3 and 5 mean. So thereader has to go from the graph to the legend then to the text and thenmentally transfer the meaning of the curve back to the main plot. It is somuch nicer to put the meaning right on the curve if you can.For the most part, legends are just computer junk and not even easy tonicely construct. When the legend urge comes over you - try to resist.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1,8}]}}, AxesLabel[Rule]{Y, X}, PlotLabel[Rule]Title, PlotLegend[Rule]{1,3,5}, LegendPosition[Rule] {0.5,0}](*However with LogPlot or LogLogPlot the legend desappear*)LogLogPlot[{q1[t],q2[t],q3[t]}, {t, 0, 100},PlotStyle[Rule]{ {AbsoluteThickness[0.5], AbsoluteDashing[{4,4}]}, AbsoluteThickness[1.5], {AbsoluteThickness[2], AbsoluteDashing[{1,8}]}}, AxesLabel[Rule]{Y, X}, PlotLabel[Rule]Title, PlotLegend[Rule]{1,3,5}, LegendPosition[Rule] {0.5,0}]I have shown a particular case, but I has this problem always with LegendandLogPlot and LogPlotPlot. I will appreciate any help.GuillermoSanchez---------------------------------------- -----This message was sent using Endymion MailMan. ==== Using the Front End as a interface with the kernel I was running some calulations when suddenly pressing Shift+Enter causes the contents of the cell being evaluated to transform to the next text underlined with a red line: NotebookObject[FrontEndObject[LinkObject[dd8,1,1]],8] foollowed by the next messages:An unknown box name (NotebookObject) was sent as the BoxForm for the expression. Check the format rules for the expression.An unknown box name (FrontEndObject) was sent as the BoxForm for the expression. Check the format rules for the expression.An unknown box name (LinkObject) was sent as the BoxForm for the expression. Check the format rules for the expression.An invalid typeset structure was generated: Missing BoxFormData.Any suggestions will be very aprreciated.Cesar ==== I have an odd problem. I need to use and simplify functions that havebeen provided by a piece of software that insists on outputing thefunctional results of a data mining proceedure, using e whenoutputing numbers in scientific notation.I'm having difficultly using Replace, Hold, etc. to correctly evaluatethese types of function formats. For example, y = 5e+5x1+2e-1x2,should be transcribed into 5 10^5 x1 + 0.2 x2.ChuckReply-To: kuska@informatik.uni-leipzig.de ==== str = 5e+5x1+2e-1x2;StringJoin[Characters[str] /. e -> *10^] // ToExpression??Work fine for me.But this type of output is typical generated by a C/FORTRANProgram and you should rewrite the formating rules inthe code that produce this output. Jens> I have an odd problem. I need to use and simplify functions that have> been provided by a piece of software that insists on outputing the> functional results of a data mining proceedure, using e when> outputing numbers in scientific notation.> I'm having difficultly using Replace, Hold, etc. to correctly evaluate> these types of function formats. For example, y = 5e+5x1+2e-1x2,> should be transcribed into 5 10^5 x1 + 0.2 x2.> Chuck ==== RB> I am considering the following integralRB> W[m_,n_]:=Integrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}]RB> where m,n are reals >=0. With Mathematica 4.1 I obtain:RB> If[Re[m+n]>-1, -Cos[(m-n)Pi/2]/(2 Pi)*RB> (2 EulerGamma + Log[4] +RB> PolyGamma[0, 1/2(1 + m - n)] +RB> PolyGamma[0, 1/2(1 - m + n)] +RB> 2PolyGamma[0, 1/2(1 + m + n)])RB> Any explanation about the analytical expression will beRB> gratefully accepteed.The expression for W[m_,n_] returned by Mathematica is wrong.To prove, just substitute m = n = 0 which is exactly what you had doneand observe that the output you had hadW[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi)= 0.84564was incorrect. The correct answer is 1/2.Mathematica can handle the numeric integration successfullyIn[1] := NIntegrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}, Method -> Oscillatory] (* The warnings are skipped *)Out[1] = 0.5Using NIntegrate[BesselJ[0, x]*BesselJ[0, x], {x, 0, Infinity}]without Method -> Oscillatory is not the optimal choice asthe integrand oscillates fairly rapidly over the integrationregion.RB> I suspect that these integrals are divergent (*).In fact, not exactly.Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}]is equal to 1/2, and Mathematica 4.1 for Microsoft Windows(November 2, 2000) does it correctly, while Mathematica 4.2for Microsoft Windows (February 28, 2002) concocts a strangemixture of a wrong divergence message and the warning thatit cannot check the convergence [should I trust to the secondwarning? or the first?]As a matter of fact,Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}]converges because the integrand is regular at x=0, bounded overthe whole right semi-axis, and decays as2*Cos[Pi/4 - x]*Cos[(3*Pi)/4 - x]/(Pi*x) + o(1/x)at x -> Infinity .Say, calculateNormal[Series[BesselJ[1, x], {x, Infinity, 1}]] Normal[Series[BesselJ[0, x], {x, Infinity, 1}]] // InputForm->(2*(Cos[Pi/4 - x] - Sin[Pi/4 - x]/(8*x))*(Cos[(3*Pi)/4 - x] +(3*Sin[(3*Pi)/4 - x])/(8*x)))/(Pi*x)then Plot[%,{x,1,10}]and Plot[BesselJ[1,x]*BesselJ[0,x],{x,1,10}]and you could hardly see the difference.Generally, to get to the convergence domain for W in terms ofm and n is easy via the asymtotics of the Bessel functions(use something likeExpand[Normal[Series[BesselJ[m, x], {x, Infinity, 1}]]Normal[Series[BesselJ[n, x], {x, Infinity, 1}]]]then analyze the main term).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) http://www.beautyriot.com/ (teamwork) http://www.ohaha.com/ (teamwork) Voice: (380)-652-447325 Mon-Fri 9 a.m. - 6 p.m.Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== > inside a program I need to solve this linear equation in terms of p1.> However something odds happens. Sometimes the solution is computed and> sometimes the result is empty [I mean no output...]. Is this a bug of the> solve command or am I doing something wrong? The problem is robust to:> changing name to the variables and other makeups..> DavidThat's the weirdest bug I've seen in weeks. As it happens, it's mine. Atleast the inconsistent behavior, that is. I'll fix it, and maybe alsotry to address the issue of how to handle approximate numbers in testingsubexpressions for zero.I've excised your code and put in place a substantially smaller examplethat I believe is responsible. The table will tend to give erraticresults.zz = (-1.*x^7*(-1. + p - 7.*x^6 + p*x^6 + 6.*x^7)* (7.000000000000002 - 7.000000000000002*x + 14.000000000000004*x^6 - 14.000000000000004*x^7 + 7.000000000000002*x^12 -6.999999999999998*x^13))/ (p^2*(1. + 0.9*x^6)^2*(1. + x^6)^5);One workaround would be to use exact input, say by preprocessing withRationalize.Daniel LichtblauWolfram Research ==== >inside a program I need to solve this linear equation in terms of p1.>However something odds happens. Sometimes the solution is computed and>sometimes the result is empty [I mean no output...]. Is this a bug of the>solve command or am I doing something wrong? The problem is robust to:>changing name to the variables and other makeups..>David>>ps: Sorry for the stupid way in which I copied the command...>>Solve[(x^2*((-0.9*x^7*(p^2*(-1 - 5.8*x^6 - 14.010000000000002*x^12 -> 18.04*x^18 - 13.06*x^24 -> 5.040000000000001*x^30 - 0.81*x^36) +> x*(7.777777777777779 - 9.074074074074076*x +> 30.333333333333336*x^6 -> 21.51851851851852*x^7 -> 16.333333333333336*x^8 +> 44.33333333333334*x^12 +> 3.188888888888883*x^13 -> 65.68333333333332*x^14 +> 28.777777777777786*x^18 +> 47.937037037037044*x^19 -> 100.10000000000002*x^20 + 7.*x^24 +> 45.6037037037037*x^25 -> 69.53333333333333*x^26 +> 13.299999999999999*x^31 -> 19.833333333333332*x^32 -> 1.0499999999999996*x^38) +> p*(-6 + 8.296296296296296*x -> 28.799999999999997*x^6 +> 32.785185185185185*x^7 +> 9.333333333333336*x^8 -> 55.260000000000005*x^12 +> 49.04777777777776*x^13 +> 38.38333333333334*x^14 -> 52.980000000000004*x^18 +> 34.20518518518518*x^19 +> 60.20000000000001*x^20 -> 25.380000000000003*x^24 +> 11.736296296296294*x^25 +> 43.63333333333334*x^26 - 4.86*x^30 +> 2.8999999999999986*x^31 +> 13.533333333333333*x^32 + 0.81*x^37 +> 1.0499999999999996*x^38)))/(x + 1.9*x^7 +> 0.9*x^13)^2 - ((-1 + p - 7*x^6 + p*x^6 +> 6*x^7)*(1.2962962962962965 - 3.111111111111112*x^6>+> 9.333333333333336*x^7 - 10.111111111111114*x^12>+> 22.05*x^13 - 5.703703703703705*x^18 + 17.15*x^19>+> 5.483333333333331*x^25 + 1.0499999999999996*x^31>+> p1*x^5*(7.000000000000002 - 7.000000000000002*x>+> 14.000000000000004*x^6 -> 14.000000000000004*x^7 +> 7.000000000000002*x^12 -> 6.999999999999998*x^13) -> 1.166666666666667*p*x^4*x1 -> 3.500000000000001*p*x^10*x1 -> 1.0500000000000003*p*x^11*x1 -> 3.500000000000001*p*x^16*x1 -> 3.150000000000001*p*x^17*x1 -> 1.166666666666667*p*x^22*x1 -> 3.150000000000001*p*x^23*x1 -> 1.0500000000000003*p*x^29*x1))/((1 + 0.9*x^6)^2*(1>+> x^6)^2)))/(p^2*(1 + x^6)^3) == 0, p1]>You might find it more robust (and the results cleaner) if you Simplify the equation prior to using Solve. Such asSolve[eqn // Rationalize // Simplify, p1]However, if you are assigning values to p or x prior to using Solve, there may not be a solution. That is, for whenever the numerator of the expression for p1 would be zero, e.g., p = (-6 x^7 + 7 x^6 +1)/(x^6 + 1).Bob Hanlon ==== I prefer to delete all output and then Copy As>Notebook expression. ItBobby-----Original Message-----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 thisreformating.--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 cellexpression,> including the In and Out numbers, when posting to MathGroup.>> I wonder if this is the best method because one can't then just copyoutall> the statements and paste them into a Mathematica notebook. All thestatement> numbers have to be edited out and if there are many statementdefinitions> this is an extended task for any responder. This, of course, decreasesthe> chances for a response. A better method is for the poster to just copyand> paste the CONTENTS of each cell. This is more work for the poster, butit> may pay off in better responses.>> David Park> djmp@earthlink.net> http://home.earthlink.net/~djmp/>> ==== Could someone explain what is going on here, please?In[1]:= a = 77617.; b = 33096.; In[2]:=SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; In[4]:=f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b)In[5]:=SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; In[6]:=fOut[6]=-1.1805916207174113*^21In[7]:=a = 77617; b = 33096; In[8]:=g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + (55/10)*b^8 + a/(2*b)In[9]:=gOut[9]=-(54767/66192)In[10]:=N[%]Out[10]=- 0.8273960599468214PK ==== Peter,I hope that the following example will help - it is a matter or when thingsevaluate.The a in SetAccuracy[a, Infinity], below, evaluates before SetAccuracy acts,so we getSetAccuracy[2.3, Infinity]. The value of a is not changed. a = 2.3; aa = SetAccuracy[a, Infinity] 2589569785738035/1125899906842624But, a 2.3Whereas aa 2589569785738035/1125899906842624--Allan--------------------- Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + (55/10)*b^8+ a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)>> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214> PK> ==== In receiving notebooks from many different people I have noticed thatbeginners often do not know how to use Text cells and write all of theircomments as Input cells. I have even run across some extremely advancedusers who did not know the easy method for entering Text cells. A goodnotebook is usually a blend of Text cells, Input/Output cells and graphicscells. Text cells are very useful for documenting what you are doing andpassing information to other people. Since many people do not know how touse Text cells, I thought I would write a little explanation for beginnerswho are followers of MathGroup.The very easiest method for entering a Text cell is to put the insertionpoint where you want the new cell to be (at the end of the notebook orbetween two existing cells) and then type Alt-7. Then just start typing andyou will have a Text cell.Alternatively you can use MenuFormatStyleText to start a new Text cell.Often, it is useful to put the ToolBar at the top of the notebook. UseMenuFormatShow ToolBar. The drop-down menu on the ToolBar has the variouskinds of cells available for the current style of the notebook. You canselect Text (or any other style) from there.Some users may hesitate to use Text cells because they want to include amathematical expression in the comments. However, that is also very easy.Just use an Inline cell within the text cell. At the point within the textcell where you want to include a mathematical expression, start an Inlinecell by typing Ctrl-(. A selection placeholder will appear on a pinkbackground. You can type a Mathematica expression there just as in an Inputcell. Use Ctrl-) to complete the Inline cell, or Shift-Space. You can evenselect an Inline cell and evaluate it with Shift-Ctrl-Enter.Putting comments in Text cells is far better than using Input cells (or cellgroup header cells). Mathematica won't try to evaluate Text cells, the textwill wrap properly and adjust better to the notebook width if you change it.You can also check the spelling of words by putting the cursor after a wordand using Ctrl-K. (In an Input cell Mathematica doesn't use the dictionary,but uses the table of symbols instead and hence it won't check spelling.)David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ ==== This is because inline cells are not in StandardForm by default, but TraditionalForm.Use the menu item Cell -> Default Inline Format Type -> StandardForm.>David Park's posting reminded me of a frequent annoyance when I am>trying to include some Mathematica expressions within text cells -- a>Mathematica input expression in Standard Form that involves use of a>Control-key combination to form a superscript, square-root, or built-up>fraction:>>For example, suppose I want to include within a text cell a Standard>Form expression for the square of x, with the exponent 2 raised. If I>type the x first, even if I immediately highlight it and change it to>Courier (to match the default font for Input cells in Standard Form), as>soon as I press the Control-^ key combination, an Inline cell is created>beginning with the x, and then when I type the exponent 2 everything in>that Inline cell is now in Times, and the x is Italic. To change both>characters to Courier is not so easy: it seems to require separately>the entire Inline cell and selecting Courier does not change the exponent!)>>So to avoid this annoyance I normally must first type the desired>expression in a separate Input cell, then copy the contents of that cell>to the desired point in the Text cell.>>Any suggestions on a more efficient method for handling this?> In receiving notebooks from many different people I have noticed that> beginners often do not know how to use Text cells ....>> Some users may hesitate to use Text cells because they want to include a> mathematical expression in the comments....> > Just use an Inline cell within the text cell....>>-->Murray Eisenberg murray@math.umass.edu>Mathematics & Statistics Dept.>Lederle Graduate Research Tower phone 413 549-1020 (H)>University of Massachusetts 413 545-2859 (W)>710 North Pleasant Street>Amherst, MA 01375-------------------------------------------------------- ------Omega ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.htmlReply-To: murray@math.umass.edu ==== David Park's posting reminded me of a frequent annoyance when I am trying to include some Mathematica expressions within text cells -- a Mathematica input expression in Standard Form that involves use of a Control-key combination to form a superscript, square-root, or built-up fraction:For example, suppose I want to include within a text cell a Standard Form expression for the square of x, with the exponent 2 raised. If I type the x first, even if I immediately highlight it and change it to Courier (to match the default font for Input cells in Standard Form), as soon as I press the Control-^ key combination, an Inline cell is created beginning with the x, and then when I type the exponent 2 everything in that Inline cell is now in Times, and the x is Italic. To change both characters to Courier is not so easy: it seems to require separately the entire Inline cell and selecting Courier does not change the exponent!)So to avoid this annoyance I normally must first type the desired expression in a separate Input cell, then copy the contents of that cell to the desired point in the Text cell.Any suggestions on a more efficient method for handling this?> In receiving notebooks from many different people I have noticed that> beginners often do not know how to use Text cells ....> > Some users may hesitate to use Text cells because they want to include a> mathematical expression in the comments....> Just use an Inline cell within the text cell....-- Murray Eisenberg murray@math.umass.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 ==== correctly, all you need to do is to make sure the default inline cell formatis StandardForm. Go to the menu item Cell, select Default Inline FormatType,and change it to StandardForm.Carl WollPhysics DeptU of Washington----- Original Message -----> type the x first, even if I immediately highlight it and change it to> Courier (to match the default font for Input cells in Standard Form), as> soon as I press the Control-^ key combination, an Inline cell is created> beginning with the x, and then when I type the exponent 2 everything in> that Inline cell is now in Times, and the x is Italic. To change both> characters to Courier is not so easy: it seems to require separately> the entire Inline cell and selecting Courier does not change theexponent!)>> So to avoid this annoyance I normally must first type the desired> expression in a separate Input cell, then copy the contents of that cell> to the desired point in the Text cell.>> Any suggestions on a more efficient method for handling this?> In receiving notebooks from many different people I have noticed that> beginners often do not know how to use Text cells ....>> Some users may hesitate to use Text cells because they want to include a> mathematical expression in the comments....> > Just use an Inline cell within the text cell....>> --> Murray Eisenberg murray@math.umass.edu> Mathematics & Statistics Dept.> Lederle Graduate Research Tower phone 413 549-1020 (H)> University of Massachusetts 413 545-2859 (W)> 710 North Pleasant Street> Amherst, MA 01375>>Reply-To: kuska@informatik.uni-leipzig.de ==== just one comment: the meaning of the Alt-7 key depend on the style sheet that is in use.The TMJ style use Alt-8 for text and one hasto learn new key short-cuts for every style sheet ! Jens> In receiving notebooks from many different people I have noticed that> beginners often do not know how to use Text cells and write all of their> comments as Input cells. I have even run across some extremely advanced> users who did not know the easy method for entering Text cells. A good> notebook is usually a blend of Text cells, Input/Output cells and graphics> cells. Text cells are very useful for documenting what you are doing and> passing information to other people. Since many people do not know how to> use Text cells, I thought I would write a little explanation for beginners> who are followers of MathGroup.> The very easiest method for entering a Text cell is to put the insertion> point where you want the new cell to be (at the end of the notebook or> between two existing cells) and then type Alt-7. Then just start typing and> you will have a Text cell.> Alternatively you can use MenuFormatStyleText to start a new Text cell.> Often, it is useful to put the ToolBar at the top of the notebook. Use> MenuFormatShow ToolBar. The drop-down menu on the ToolBar has the various> kinds of cells available for the current style of the notebook. You can> select Text (or any other style) from there.> Some users may hesitate to use Text cells because they want to include a> mathematical expression in the comments. However, that is also very easy.> Just use an Inline cell within the text cell. At the point within the text> cell where you want to include a mathematical expression, start an Inline> cell by typing Ctrl-(. A selection placeholder will appear on a pink> background. You can type a Mathematica expression there just as in an Input> cell. Use Ctrl-) to complete the Inline cell, or Shift-Space. You can even> select an Inline cell and evaluate it with Shift-Ctrl-Enter.> Putting comments in Text cells is far better than using Input cells (or cell> group header cells). Mathematica won't try to evaluate Text cells, the text> will wrap properly and adjust better to the notebook width if you change it.> You can also check the spelling of words by putting the cursor after a word> and using Ctrl-K. (In an Input cell Mathematica doesn't use the dictionary,> but uses the table of symbols instead and hence it won't check spelling.)> David Park> djmp@earthlink.net> http://home.earthlink.net/~djmp/ ==== Solve[youre equation, p1, VerifySolutions->True] will return a solution. So willSolve[Rationalize[your equation],p1].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 and> sometimes the result is empty [I mean no output...]. Is this a bug of > the> solve command or am I doing something wrong? The problem is robust to:> changing name to the variables and other makeups..> David>> ps: Sorry for the stupid way in which I copied the command...>> Solve[(x^2*((-0.9*x^7*(p^2*(-1 - 5.8*x^6 - 14.010000000000002*x^12 -> 18.04*x^18 - 13.06*x^24 -> 5.040000000000001*x^30 - 0.81*x^36) +> x*(7.777777777777779 - 9.074074074074076*x +> 30.333333333333336*x^6 -> 21.51851851851852*x^7 -> 16.333333333333336*x^8 +> 44.33333333333334*x^12 +> 3.188888888888883*x^13 -> 65.68333333333332*x^14 +> 28.777777777777786*x^18 +> 47.937037037037044*x^19 -> 100.10000000000002*x^20 + 7.*x^24 +> 45.6037037037037*x^25 -> 69.53333333333333*x^26 +> 13.299999999999999*x^31 -> 19.833333333333332*x^32 -> 1.0499999999999996*x^38) +> p*(-6 + 8.296296296296296*x -> 28.799999999999997*x^6 +> 32.785185185185185*x^7 +> 9.333333333333336*x^8 -> 55.260000000000005*x^12 +> 49.04777777777776*x^13 +> 38.38333333333334*x^14 -> 52.980000000000004*x^18 +> 34.20518518518518*x^19 +> 60.20000000000001*x^20 -> 25.380000000000003*x^24 +> 11.736296296296294*x^25 +> 43.63333333333334*x^26 - 4.86*x^30 +> 2.8999999999999986*x^31 +> 13.533333333333333*x^32 + 0.81*x^37 +> 1.0499999999999996*x^38)))/(x + 1.9*x^7 +> 0.9*x^13)^2 - ((-1 + p - 7*x^6 + p*x^6 +> 6*x^7)*(1.2962962962962965 - > 3.111111111111112*x^6 +> 9.333333333333336*x^7 - > 10.111111111111114*x^12 +> 22.05*x^13 - 5.703703703703705*x^18 + > 17.15*x^19 +> 5.483333333333331*x^25 + > 1.0499999999999996*x^31 +> p1*x^5*(7.000000000000002 - > 7.000000000000002*x +> 14.000000000000004*x^6 -> 14.000000000000004*x^7 +> 7.000000000000002*x^12 -> 6.999999999999998*x^13) -> 1.166666666666667*p*x^4*x1 -> 3.500000000000001*p*x^10*x1 -> 1.0500000000000003*p*x^11*x1 -> 3.500000000000001*p*x^16*x1 -> 3.150000000000001*p*x^17*x1 -> 1.166666666666667*p*x^22*x1 -> 3.150000000000001*p*x^23*x1 -> 1.0500000000000003*p*x^29*x1))/((1 + > 0.9*x^6)^2*(1 +> x^6)^2)))/(p^2*(1 + x^6)^3) == 0, p1]>>>Reply-To: murray@math.umass.edu ==== For all names, perhaps: Names[*`*]For names you defined at a normal session (without changing to some other context than the default Global`): Names[Global`*]> IIRC, there is a way to get a list of all the symbols defined in the > currently running session. I can't seem to find the reference to that > command. Could somone point me in the direction of documentation which > will tell me how to get information about the current session?> TIA,> -- Murray Eisenberg murray@math.umass.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 ==== > For all names, perhaps:> Names[*`*]> For names you defined at a normal session (without changing to some> other context than the default Global`):> Names[Global`*]>> IIRC, there is a way to get a list of all the symbols defined in the>> currently running session. I can't seem to find the reference to that>> command. Could somone point me in the direction of documentation which>> will tell me how to get information about the current session?>>>> TIA,>>>> I think I asked the wrong question. I'll have to look at things some more. What you gave me resulted in far more than I was looking for.http://public.globalsymmetry.com/proprietary/com/wri/ system-symbols.htmlhttp://66.92.149.152/proprietary/com/wri/ system-symbols.htmlI think I really hosed the code for generating that table. I used 5 lines. I probably didn't need more than two, but I'm too tired right now to think about it. Mathematica is totaly awesome when it comes to what it was intended for. They really need to rent a Troll for a few months and fix this interface. Qt will run on just about anything. Heck, my Win-XP partition runs XFree86, with the KDE, or it did when I booted into XP a month ago.STH ==== ?*does the trick. You can limit it to Global variables with?Global`*Bobby-----Original Message-----Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Well, first of of all, your using SetAccuracy and SetPrecision does nothing at all here, since they do not change the value of a or b. You should use a = SetAccuracy[a, Infinity] etc. But even then you won't get the same answer as when you use exact numbers because of the way you evaluate f. Here is the order of evaluation that will give you the same answer, and should explain what is going on:f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121* b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];a = 77617.; b = 33096.;a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];f 54767-(-----) 66192Andrzej KozlowskiToyama International UniversityJAPAN> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + > a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + > (55/10)*b^8 + a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)>> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214> PK> ==== Andrzej, Bobby, PeterIt looks as if using SetAccuracy succeeds here because the inexact numbersthat occur have finite binary representations. If we change them slightly toavoid this then we have to use Rationalize:1) Using SetAccuracy Clear[a,b,f] f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4* b^8+a/(2*b), Infinity]; a=77617.1; b=33096.1; a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ]; f - 15640321149084868351974949239896188679725401538739519428131155 149493891236234 52500771916869370459119776018798804630436149786919912931962574 3010292363124675/ 10867106143970760551000357827554793888198143135975649579607989 867743572824016 06539536129829321813712324363677397376040962) Rewriting as fractions a=776171/10; b=330961/10; f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b) -(5954133808997234115690303589909929091649391296257/ 41370125000000)3) Using Rationalize Clear[a,b,f]f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121* b^4-2)+5.4*b^8+a/(2*b),0]; a=77617.1; b=33096.1; a=Rationalize[a,0];b=Rationalize[b,0]; f -(5954133808997234115690303589909929091649391296257/ 41370125000000)I use Rationalize[. , 0] besause of results like Rationalize[3.1415959] 3.1416 Rationalize[3.1415959,0] 31415959/10000000--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> Well, first of of all, your using SetAccuracy and SetPrecision does> nothing at all here, since they do not change the value of a or b. You> should use a = SetAccuracy[a, Infinity] etc. But even then you won't> get the same answer as when you use exact numbers because of the way> you evaluate f. Here is the order of evaluation that will give you the> same answer, and should explain what is going on:>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>> a = 77617.;> b = 33096.;>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>> f>> 54767> -(-----)> 66192>> Andrzej Kozlowski> Toyama International University> JAPAN>>> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> > SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +> a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> (55/10)*b^8 + a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)> >> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214> >>> PK>>> ==== > Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}]>> is equal to 1/2, and Mathematica 4.1 for Microsoft Windows> (November 2, 2000) does it correctly, while Mathematica 4.2> for Microsoft Windows (February 28, 2002) concocts a strange> mixture of a wrong divergence message and the warning that> it cannot check the convergence [should I trust to the second> warning? or the first?]In[6]:=Integrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity}]Out[6]=1/2In[7]:=Out[7]=4.2 for Mac OS X (June 4, 2002)Andrzej KozlowskiToyama International UniversityJAPAN ==== That should read ...denominator of the expression for p1... Bob>You might find it more robust (and the results cleaner) if you Simplify>the >equation prior to using Solve. Such as>>Solve[eqn // Rationalize // Simplify, p1]>>However, if you are assigning values to p or x prior to using Solve, there>>may not be a solution. That is, for whenever the numerator of the expression>>for p1 would be zero, e.g., >>p = (-6 x^7 + 7 x^6 +1)/(x^6 + 1).>Bob Hanlon ==== > The expression for W[m_,n_] returned by Mathematica is wrong.>> To prove, just substitute m = n = 0 which is exactly what you had done> and observe that the output you had had> W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi)> = 0.84564> was incorrect. The correct answer is 1/2.> Mathematica can handle the numeric integration successfully> In[1] := NIntegrate[BesselJ[1, x]*BesselJ[0, x], {x, 0, Infinity},> Method -> Oscillatory]> (* The warnings are skipped *)> Out[1] = 0.5You'll find that W[m=1,n=0]=1/2, so Mathematica gets that right. W[0,0]diverges. Mathematica gets that wrong.I note that Mathematica yields a result forIntegrate[BesselJ[m, a*x]*BesselJ[n, b*x], {x, 0, Infinity}]that appears to agree with formula 6.512(1) of Gradshteyn and Ryshik (4thed., 1965), including the condition b True]If the zi's need to be scaled, then you can do something like this:colorfn = Hue[.67#]&;With[{ m = {Min[#],Max[#]}&@vals }, Show[Graphics[ {colorfn[#[[3]]], PointSize[.01], Point[{#[[1]],#[[2]]}]}]& /@ (data /. {x_,y_,z_} -> {x, y, (z-m[[1]])/(m[[2]]-m[[1]])}), Axes -> True]]---Selwyn Hollis> I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of > ==== John,It is easier to do without ListPlot:Make some data,dat= Table[Random[],{10},{3}];Show[Graphics[{PointSize[.05],{Hue[2 /3#3],Point[{#1,#2}]}&@@@dat} ], Frame->True ];If the points need to be joined then something likeShow[Graphics[{ Line /@Partition[dat[[All,{1,2}]],2,1], PointSize[.05],{Hue[2/3#3],Point[{#1,#2}]}&@@@dat } ], Frame->True ];--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of>> ==== A few years ago we made a package that do just this. Seehttp://cern.ch/jowett/Mathematica/Graphics/ ColorListPlot.htmlThe type of plot you want is covered in the section Examples thenThree-dimensional data. The Introduction gives links for downloading thepackage.JMJ> I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of>> ==== Your problem can be solved in numerous ways of course, try something like .:Module[ { data=Flatten[Table[{x,y,Random[]},{x,10},{y,10}],1] }, Show[ Graphics[ { AbsolutePointSize[10], data/.{x_,y_,z_}[Rule]{Hue[z],Point[{x,y}]} } ] ,AspectRatio[Rule]Automatic ] ]Note that you can replace the main part, ie the transforming rule from pointlists to colored point directives with a function for example .:{Hue[#3],Point[{#1,#2}]}&@@@databye,Borut| I have a list of points l1={xi,yi,zi} how can I make a 2D list plot ofReply-To: kuska@informatik.uni-leipzig.de ==== data = Table[{Random[], Random[], Random[]}, {20}];Show[Graphics[ {Hue[Last[#]], Point[Take[#, 2]]} & /@ data, Axes -> True ] ] Jens> I have a list of points l1={xi,yi,zi} how can I make a 2D list plot of ==== input = 5e+5x1+2e-1x2;StringJoin[Characters[input] //. e -> *10^]5*10^+5x1+2*10^-1x2ToExpression[%]500000*x1 + x2/5Bobby Treat-----Original Message-----should be transcribed into 5 10^5 x1 + 0.2 x2.Chuck ==== Neither SetAccuracy[expr,n] nor SetPrecisions[expr,n] modify expr. These functions modify the prinout not the internal representation. So, the first computation of f is done with approximate numbers and doesn't result in a correct answer due to approximate arithmetic.By assigning a rational expression to each of the variables, you have made them exact numbers and Mathematica responds with an exact solution.>Could someone explain what is going on here, please?>>In[1]:= a = 77617.; b = 33096.;>>In[2]:= SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];>SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>>In[4]:= f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>5.5*b^8 + a/(2*b)>>In[5]:= SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>>In[6]:= f>>Out[6]= -1.1805916207174113*^21>>In[7]:= a = 77617; b = 33096;>>In[8]:= g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>(55/10)*b^8 + a/(2*b)>>In[9]:= g>>Out[9]= -(54767/66192)>>In[10]:= N[%]>>Out[10]= -0.8273960599468214>PK> ==== SetAccuracy. However, I still don't understand why the order in which we set the accuracies for f, a, and b matters.In[1]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]; a = SetAccuracy[77617., Infinity]; b = SetAccuracy[33096., Infinity]; In[4]:=fOut[4]=-(54767/66192)In[5]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity] Out[5]=1180591620717411303424Similarily:In[1]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50]; a = SetAccuracy[77617., 100]; b = SetAccuracy[33096., 100]; In[4]:=fOut[4]=-0.8273960599468212641107299556`11.4133In[5]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; Out[5]=1.180591620717411303424`121.0721*^21-PK ==== Hallo,I have the problem, that I want to determine the numerical solution of a double integral, like e.g. the following:<< Statistics`ContinuousDistributions`ndist = NormalDistribution[0, 1];N[Sigma^2/(Abs[Mu_1^2 - Mu_2^2]) Integrate[(Integrate[1/y_1 1/(y - y_1) PDF[ndist, d*Log[y_1] + c*Log[y - y_1] + f]*PDF[ndist, Sigma*(c*Log[y_1] + d*Log[y - y_1] + g)], {y_1,0,y}]), {y,0,Lambda}]]wherebyLambda := 3;Mu_1 := 4;Mu_2 := 5;Sigma := 0.25;a = 1/2 (Mu_1^2 + Mu_2^2/Sigma^2)b = 1/2 (Mu_2^2 + Mu_1^2/Sigma^2)c = -Mu_2/(Mu_1^2 - Mu_2^2)d = -Mu_1/(Mu_2^2 - Mu_1^2)f = d*a + c*bg = c*a + d*bSorry for the poor code... The problem is, that Mathematica doesn't give me a result (after waiting 2 hours I turned my machine off).Thus, the question is, if there is still a possibility of solving such complicated expressions...TIA,Sven. ==== I am trying to solve a system of simultaneous equations with 26 variablesand 14 equations (the 12 free variables can be any of the 26 from the eqns..preferably ones that will minimize the computation time for the other 14).These equation are not linearly related.. the highest degree in any one eqnis degree 4 i believe.. and there are some cross terms in the equations butnot every equation depends on every variable.. (some are actually rathersimple eqns). Any ideas on how to get started with this using mathematica (any ideas for algorithms)..Anything will be helpful..I can be reached at ngupta2@seas.upenn.eduMany thanks,Nachi ==== I should add that the solution is over natural numbers.. this willprobably make a big difference..Nachi> I am trying to solve a system of simultaneous equations with 26 variables> and 14 equations (the 12 free variables can be any of the 26 from the eqns..> preferably ones that will minimize the computation time for the other 14).> These equation are not linearly related.. the highest degree in any one eqn> is degree 4 i believe.. and there are some cross terms in the equations but> not every equation depends on every variable.. (some are actually rather> simple eqns). Any ideas on how to get started with this using> mathematica (any ideas for algorithms)..>> Anything will be helpful..>> I can be reached at ngupta2@seas.upenn.edu>> Many thanks,>> Nachi>> ==== This may seem like a trivial issue, but I find it very frustrating. I use variety of intellectual domains. In every package (JBuilder, KMail, Emacs, XEmacs, Mozilla, xterm, Konsole, etc.) the keyboar mapping is a bit differnt from the other. There are certain idioms which I find to be fairly invaraint between these different packages. I tend to use this common subset more than the package specific idioms.Switching from one package to the next can be a very disorienting experience. It can be even trickier to try and copy and paste from one to the next. I also use Ôspecial' characters in certain domains, .8d,?,.81,?,[CapitalYAcute],fi, §, ø, etc. Add to all of this, that I run beta code for just about everything. The function of my keyboard changed like the weather. I have spent hours trying to figure out why I can no longer type Ô.9a'. This doesn't even address the problems of switching between character encodings, or keyboard compose modes. The last thing I want to start doing is messing with the key mappings in my user environment. I want to control the way my keyboard works with Mathematica from within the Mathematica runtime environment. That is, the configuration should be loaded when Mathematica loads, and should not impact the rest of my X environment.If I have come across as a bit jaded regarding this issue, there are reasons. There is a history. I don't find keyboard configuration issues interesting. I want my fine keyboard to just work, the way I want it to Shift+point movement = select text.Ctrl+Insert = copyShift+Insert = pasteCtrl+c = copyCtrl+x = cutCtrl+v = pasteShift+End = select to end of line.etc.Yes, I said I use XEmacs, and Emacs. Yes (X)Emacs is different, but adding yet another alteration with Mathematica is just too much. Is there a way around this?STH ==== >FrontEndExecute[{> FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[],> [LeftDoubleBracket][RightDoubleBracket],After]}] FrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][RightDoubleBracket],After], FrontEnd`SelectionMove[FrontEnd`SelectedNotebook[], Previous, Character]}]orFrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][SelectionPlaceholder][ RightDoubleBracket], Placeholder]}]----------------------------------------------- ---------------Omega ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== I'm trying to address the special issues related to using Mathematica on the would not if I used a Windows system. These are typically not all that big if a problem _once I figure out what's going on_. What I hope to do is collect all such matters and document them effectively in something like a haven't discussed here http://66.92.149.152/proprietary/com/wri/index.html I'm interested in hearing what you have to say. Of particular interest are the issues faced by a person who is not familiar with the technical aspects would help make this less painful?STH ==== particular, the y-axis label is typically rotated by 90deg so that it readsup the y-axis. This works fine on macs and windoze, but under linux thelabel runs up the y-axis; however, the letters are rotated so that they arethe same orientation as that for the x-axis. Printouts of the NB are fine,but it looks really stupid when using a video projector to teach or give atalk. I have mentioned this before, and the stock answer is that ... it isMathematica. I personally don't care why the label looks peculiar, just thatit does and that there is no easy workaround.--Kevin J. McCannJoint Center for Earth Systems Technology (JCET)Department of PhysicsUMBCBaltimore MD 21250> I'm trying to address the special issues related to using Mathematica onthe> would not if I used a Windows system. These are typically not all thatbig> if a problem _once I figure out what's going on_. What I hope to do is> collect all such matters and document them effectively in something like awhich I> haven't discussed here http://66.92.149.152/proprietary/com/wri/index.html> I'm interested in hearing what you have to say. Of particular interestare> the issues faced by a person who is not familiar with the technicalaspects> would help make this less painful?>> STH>Reply-To: jmt@dxdydz.net ==== See the MathLink API for C, or the JLink API for java.JLink is easier to use, MathLink is a lower level but native interface. JLink is built on MathLink.As far as I know, the perl API Math::ematica has not been upgraded to Mathematica 4.> Is it possible to get a document of the description of how to> interface with the kernel? Kind of what should an interface say to the> kernel and how to connect to it.> Paulo> ==== Is it possible to get a document of the description of how tointerface with the kernel? Kind of what should an interface say to thekernel and how to connect to it.Paulo ==== for your extensive answer but I still have some doubts about convergence of the following integral (m,nintegrers>=0)W[m_,n_]:=Integrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}]for wich Mathematica gives the close form W[m_,n_]:= -Cos[(m-n)Pi/2]/(2 Pi)* ( 2 EulerGamma + Log[4] + PolyGamma[0, 1/2(1 + m - n)] + PolyGamma[0, 1/2(1 - m + n)] + 2PolyGamma[0, 1/2(1 + m + n)] )You say this integral is convergent to 1/2 for m=0 and n=1.Also Mathematica agrees to you since for m>=0W[m,m+1]=1/2W[m,m+3]=-1/2Numerically we haveNIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, Infinity}]NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy....0.597973NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, Infinity}, Method ->Oscillatory]NIntegrate::ploss : ....0.5So I define also the corresponding numeric definitionNW[m_, n_] := NIntegrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity},Method -> Oscillatory]THEORYThe integral is the critical case of Weber-Schafheitlin integral(see Watson book on Bessel function p.402, or Ryzhik-Gradshteyn 6.574(2)).According to this theoryWS[m_,n_,p_]:=Integrate[BesselJ[m, x]*BesselJ[n, x] x^-p, {x, 0, Infinity}]= A/BwhereA=Gamma[p]*Gamma[(n+m-p+1)/2]B=2^p Gamma[(n-m+p+1)/2]Gamma[(n+m+p+1)/2]Gamma[(m-n+p+1)/2]By the presence of Gamma[p] in numerator A, in the case p=0 as in W[m,n]all these integrals are divergent since Gamma[0]=Infinity.The integral exist if m+n+1 > p > 0.ASYMPTOTICSThe Watson theory is in conßict with Mathematica and your notes accordingwhichthe asyntotic trend 1/x of the integrand in W[m,n] is enough forconvergernce. I divide the integral in two partsWasy[m_,n_,a_]=NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, 0, a]+ NIntegrate[BesselJ[0, x]*BesselJ[1, x], {x, a, Infinity}]and if a>>1 I use asyntotic expansion of Bessel function in the secondintegralso that I can writeWasy[m_,n_,a_]= int1[m,n,a]+int2[m,n,a]whereint1[m_,n_,a_]:=NIntegrate[ BesselJ[0, x]*BesselJ[1, x], {x, 0, a]+int2[m_,n_,a_]:=(2/Pi)Integrate[Cos[x-(2m+1)Pi/4]*Cos[x-( 2n+1)Pi/4], {x, a,Infinity}]The first integral is a quite normal finite integral. The second (int2) issingularand according to Mathematica 4.1 int2[m_, n_, a_] := -(1/Pi)*Log[a]*Cos[1/2(m - n)Pi]*]Log[a] + (1/Pi)*CosIntegral[2 a]*Sin[1/2(m+n)Pi] + 1/(2*Pi)*Cos[1/2(m+n)Pi]*(Pi-SinIntegral[2*a]) RESULTSm=1;n=0;a=20.;WS[m,n,0]=divergentW[m,n]=1/2NW[m,n]= 0.5Wasy[m,n,a]=.49816m=2;n=0;a=20.;WS[m,n,0]=divergentW[m,n]= 0.427599NW[m,n]=-2.43818Wasy[m,n,a]=-1.48052m=3;n=1;a=20.;WS[ m,n,0]=divergentW[m,n]=0.639806NW[m,n]=-2.31957Wasy[m,n,a]=- 1.26822m=4;n=0;a=20.;WS[m,n,0]=divergentW[m,n]=-.852012NW[m,n ]=1.45786Wasy[m,n,a]=1.06835The cases W[m,m+1],W[m,m+3] well agrre with the numerical counterpart.Other case are doubtfully.I think the main problem is the convergence of this kind of integrals.Any suggestion will be well considerd.RobertRoberto BrambillaCESIVia Rubattino 5420134 Milanotel +39.02.2125.5875fax +39.02.2125.5492rlbrambilla@cesi.it ==== On Sun, 29 Sep 2002 09:35:41, in the message Re: A Bessel integral,VB>> The expression for W[m_,n_] returned by Mathematica is wrong.VB>>VB>> To prove, just substitute m = n = 0 which is exactly what you had doneVB>>VB>> and observe that the output you had hadVB>>VB>> W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi)VB>>VB>> = 0.84564VB>>VB>> was incorrect. The correct answer is 1/2. ^^^^^^^^^^^^^^^^^^^^^^^^^^TB> W[0,0]diverges. Mathematica gets that wrong.(That my terrible bug shows how it is dangerous to do severalposting to the MathGroup before sending them ;-)Why sure, you are right, the integral Integrate[BesselJ[0, z]^2, {z, 0, Infinity}]diverges because the integrand is bounded everywhereover the integration region and decays at z -> Infinityas Cos[Pi/4 - z]^2/z + o(z), that is as In[1] := Expand[TrigExpand[Cos[Pi/4 - z]^2/z]] // InputForm Out[1] = 1/(2*z) + (Cos[z]*Sin[z])/zwhich means that the integral Integrate[BesselJ[0, z]^2, {z, 0, x}]diverges logarithmically in x.By the way, the main term of Expand[Normal[Series[BesselJ[0, z], {z, Infinity, 1}]]^2]is (2*Cos[Pi/4 - z]^2)/(Pi*z) which conveys the suggestion thatwe should try it, too.This reveals us another integral which Mathematica 4.1 fails to calculate In[1] := Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}] // N Out[1]= -0.0173083 Out[2]= 4.1 for Microsoft Windows (November 2, 2000)but Mathematica 4.2 handles correctly In[1] := Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}] Out[1] = Integrate::idiv: Integral of... does not converge on {1, Infinity). Out[2]= 4.2 for Microsoft Windows (February 28, 2002)Even simpler, In[1] := Integrate[Cos[z]^2/z, {z, 1, Infinity}] Out[1] = -EulerGamma/2 - Log[2]/2 + (EulerGamma - CosIntegral[2] + Log[2])/2 Out[2]= 4.1 for Microsoft Windows (November 2, 2000)which is wrong while Mathematica 4.2 works excellent In[1] := Integrate[Cos[z]^2/z, {z, 1, Infinity}] Out[1] = Integrate::idiv: Integral of...does not converge on {1, Infinity). Out[2]= 4.2 for Microsoft Windows (February 28, 2002)Best wishes,Vladimir 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) http://www.beautyriot.com/ (teamwork) http://www.ohaha.com/ (teamwork) Voice: (380)-652-447325 Mon-Fri 9 a.m. - 6 p.m.Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== John,You could do something like this.points = With[{del = 2Pi/24}, Table[{Cos[t], Sin[t], t/(2Pi)}, {t, 0, 2Pi - del, del}]];Show[Graphics[ {AbsolutePointSize[7], {Hue[Last[#]], Point[#[[{1, 2}]]]} & /@ points, Line[Drop[#, -1] & /@ points]}], AspectRatio -> Automatic, Background -> GrayLevel[0.4], ImageSize -> 400];When I made the point list I made certain the z values were between 0 and 1.Otherwise you will have to define a color function that will associate aproper color with each value of z.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ Approved: Steven M. Christensen , Moderator ==== Many thanks to all who replied.The original problem was as follows:In a presentation I wish to use Plot to generate a sequence of frames 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?There were two main solutions which I now apply to my real problem and notthe simple, generic, problem in the original post. The real problem was how to build up a probably density function (PDF) inreal time. In the examples below I redraw the PDF every time I add 10points.Initialise<500] ], {500}]; NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs, Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}] ]This solution works but it generates 500 frames and sometimes exceeds thememory. The paradigm here is generate all frames, then animate all frames. Wereally need a loop that does: generate next frame, delete last frame, show next frameIs it possible to do this?Bobby Treat also offered a solution involving SelectionMove.The second solution was from Jerry Blimbaum and uses JAVAInstallJava[];UseFrontEndForRendering = False;createWindow[] := Module[{frame}, frame = JavaNew[com.wolfram.jlink.MathFrame, Probability DensityFunction]; drawArea = JavaNew[com.wolfram.jlink.MathCanvas]; drawArea@setUsesFE[UseFrontEndForRendering]; drawArea@setSize[800, 600];JavaBlock[frame@setLayout[JavaNew[java.awt.BorderLayout ]]; frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]]; frame@pack[]; frame@setSize[800, 600]; frame@setLocation[100, 100]; JavaShow[frame]];frame]ClearAll[drawString]; drawString[] :=( data=Flatten[Join[data,RandomArray[wb,10]]]; freq=BinCounts[data,{0,50,1}]; BarChart[Transpose[{freq,midpts}],ImageSize ->500, DisplayFunction -> Identity]) LoadJavaClass[java.lang.Thread]; AnimationPlot[n_] := JavaBlock[ Block[{frm}, frm = createWindow[]; Do[(obj = drawString[]; drawArea@setMathCommand[obj]; drawArea@repaintNow[]; Thread@sleep[];) ,{n} ]]]data={}; AnimationPlot[500];This solution works and does not use significant memory. However, we havenot managed to control the speed of this animation. The JAVA code sleep doesnot work nor does the use of a Mathematica Pause which always rounds up toan integer (is this a bug?).Hugh Goyder ==== >>I need a loop that goes generate next frame, delete old frame, shownew frame so that the number of frames does not become excessive.I'm pinging the group for that. I'm just following along in this, otherthan the trick of taking advantage of the half-period.I'll be very interested in a solution myself, as I frequently run out ofmemory in animations of fairly modest size -- despite having 1024MB ofRAM.Bobby-----Original Message-----need a loop that goes generate next frame, delete old frame, show new frameso that the number of frames does not become excessive.Any ideas?Hugh Goyder-----Original Message----- graphs = Rest@Join[half, Rest@Reverse@half]; NotebookWrite[EvaluationNotebook[], Cell[CellGroupData[graphs,Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], SelectionAnimate]}]]Bobby-----Original Message----->showing during generation is enough (but uncontrolled).>>Hugh 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, we don't know whether SetAccuracy succeeds, because we don'tknow how inexact those numbers really are. If they are known to moredigits than shown in the original post, they should be entered with asmuch precision as they deserve. If not, there's no trick or algorithmthat will give the result precision, because the value of f really isin the noise. That is, we have no idea what the value of f should be.Mathematica's failing is in returning a value without pointing out thatit has no precision.Bobby-----Original Message----- f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/(2*b), Infinity]; a=77617.1; b=33096.1; a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ]; f - 15640321149084868351974949239896188679725401538739519428131155 149493891236234 52500771916869370459119776018798804630436149786919912931962574 3010292363124675/ 10867106143970760551000357827554793888198143135975649579607989 867743572824016 06539536129829321813712324363677397376040962) Rewriting as fractions a=776171/10; b=330961/10; f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b) -(5954133808997234115690303589909929091649391296257/ 41370125000000)3) Using Rationalize Clear[a,b,f]f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121* b^4-2)+5.4*b^8+a/(2*b),0]; a=77617.1; b=33096.1; a=Rationalize[a,0];b=Rationalize[b,0]; f -(5954133808997234115690303589909929091649391296257/ 41370125000000)I use Rationalize[. , 0] besause of results like Rationalize[3.1415959] 3.1416 Rationalize[3.1415959,0] 31415959/10000000--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> Well, first of of all, your using SetAccuracy and SetPrecision does> nothing at all here, since they do not change the value of a or b. You> should use a = SetAccuracy[a, Infinity] etc. But even then you won't> get the same answer as when you use exact numbers because of the way> you evaluate f. Here is the order of evaluation that will give you the> same answer, and should explain what is going on:>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>> a = 77617.;> b = 33096.;>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>> f>> 54767> -(-----)> 66192>> Andrzej Kozlowski> Toyama International University> JAPAN>>> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> > SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +> a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> (55/10)*b^8 + a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)> >> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214> >>> PK>>> ==== It seems clear to me that what Allan and what you mean by succeeds here refer to quite different things and your objection is therefore beside the point. There are obviously two ways in which one can interpret the original posting. The first interpretation, which Allan and myself adopted, was that the question concerned purely the computational mechanism of Mathematica. Or, to put it in other words, it was why are the results of these two computations not the same?. In this sense success means no more than making Mathematica return the same answer using the two different routes the original poster used.You on the other hand choose to assume that the posting shows that its author does not understand not just the mechanism of significance arithmetic used by Mathematica but also computations with inexact numbers in general. I do not think this is necessarily the correct assumption. I also don't see that Mathematica is doing anything wrong. After all, one can always check the accuracy of your answer:In[1]:=a = 77617.; b = 33096.;In[2]:=f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b)In[3]:=fOut[3]=-1.1805916207174113*^21In[4]:=Accuracy[ %]Out[4]=-5which tells you that it can't be very reliable. What more do you demand?AndrzejAndrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> Actually, we don't know whether SetAccuracy succeeds, because we > don't> know how inexact those numbers really are. If they are known to more> digits than shown in the original post, they should be entered with as> much precision as they deserve. If not, there's no trick or algorithm> that will give the result precision, because the value of f really is> in the noise. That is, we have no idea what the value of f should > be.>> Mathematica's failing is in returning a value without pointing out that> it has no precision.>> Bobby>> -----Original Message-----> Sent: Monday, September 30, 2002 11:59 AM>> Andrzej, Bobby, Peter>> It looks as if using SetAccuracy succeeds here because the inexact> numbers> that occur have finite binary representations. If we change them> slightly to> avoid this then we have to use Rationalize:>> 1) Using SetAccuracy>> Clear[a,b,f]> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/ > (2*b),> Infinity];>> a=77617.1;> b=33096.1;>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>> f> - 15640321149084868351974949239896188679725401538739519428131155 14949> 3891236234>> 52500771916869370459119776018798804630436149786919912931962574 301029236 > 3> 1246> 75>> / > 10867106143970760551000357827554793888198143135975649579607989 867743572> 8240> 16> 0653953612982932181371232436367739737604096>> 2) Rewriting as fractions>> a=776171/10;> b=330961/10;>> f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)>> 3) Using Rationalize>> Clear[a,b,f]> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/ > (2*b),> 0];>> a=77617.1;> b=33096.1;>> a=Rationalize[a,0];b=Rationalize[b,0];>> f>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)> I use Rationalize[. , 0] besause of results like>> Rationalize[3.1415959]>> 3.1416>> Rationalize[3.1415959,0]>> 31415959/10000000> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>> Well, first of of all, your using SetAccuracy and SetPrecision does>> nothing at all here, since they do not change the value of a or b. You>> should use a = SetAccuracy[a, Infinity] etc. But even then you won't>> get the same answer as when you use exact numbers because of the way>> you evaluate f. Here is the order of evaluation that will give you the>> same answer, and should explain what is going on:>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>> a = 77617.;>> b = 33096.;>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>> f>> 54767>> -(-----)>> 66192>> Andrzej Kozlowski>> Toyama International University>> JAPAN>>>>> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +> a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> (55/10)*b^8 + a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)>> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214>>> PK>>>>>>> ==== > It seems clear to me that what Allan and what you mean by succeeds > here refer to quite different things and your objection is therefore > beside the point. There are obviously two ways in which one can > interpret the original posting. The first interpretation, which Allan > and myself adopted, was that the question concerned purely the > computational mechanism of Mathematica. Or, to put it in other words, > it was why are the results of these two computations not the same?. > In this sense success means no more than making Mathematica return > the same answer using the two different routes the original poster used.> You on the other hand choose to assume that the posting shows that its > author does not understand not just the mechanism of significance > arithmetic used by Mathematica but also computations with inexact > numbers in general. I do not think this is necessarily the correct > assumption. I also don't see that Mathematica is doing anything wrong. > After all, one can always check the accuracy of your answer:> In[1]:=> a = 77617.; b = 33096.;> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)> > In[3]:=> f> Out[3]=> -1.1805916207174113*^21> In[4]:=> Accuracy[%]> Out[4]=> -5> which tells you that it can't be very reliable. What more do you demand?> As you are dealing here only with machine-precision numbers, yourWhen you do calculations with arbitrary-precision numbers, asdiscussed in the previous section, Mathematica always keeps track ofthe precision of your results, and gives only those digits which areknown to be correct, given the precision of your input. When you docalculations with machine-precision numbers, however, Mathematicaalways gives you a machine-[CapitalEth]precision result, whether or not all thedigits in the result can, in fact, be determined to be correct on thebasis of your input. In practice, to rely on a numerical result, you ALWAYS have to checkits accuracy. How reliable is Accuracy anyway?In[1]:=a = SetAccuracy[77617., Infinity]; b = SetAccuracy[33096., Infinity]; In[3]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]Out[3]=1180591620717411303424In[4]:=Accuracy[f]Out[4] =InfinityWe got completely wrong result with Infinite accuracy. In conclusion,one can not rely on Accuracy. Checking numerical results inMathematica sounds like a tough task.:-)--PK> Andrzej> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/> [...]> > ==== AndrzejYes, like you I took the original question to be about how to get the resultof using the naive rational versions in place of the inexact numbers.Bobby raises the question of how we might know accuracy of the result.You answer this with> a = 77617.; b = 33096.;>> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)>> In[3]:=> f>> Out[3]=> -1.1805916207174113*^21>> In[4]:=> Accuracy[%]>> Out[4]=> -5However this computation is done in machine arithmetic, which means thatMathematica keeps no check on the accuracy and precision of the computation,and Mathematica gives the default accuracy value without any realsignifcance: $MachinePrecision - Log[10,Abs[f]]//Round -5To get meaningful accuracy and precision values we need to force thecomputation to be in bignums (bigßoat, arbitrary precision) arithmetic.Mathematica then keeps track of the accuracy and precision that it canguarantee. Clear[f,a,b,k] k=50;f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+ 5.5*b^8+a/(2*b),k]; a=77617.;b=33096.; a=SetAccuracy[a,k]; b=SetAccuracy[b,k]; f -0.82739605995 Accuracy[f] 11 Precision[f] 11Which tells us that the error in the computed value of f is not more than 10^-11The above results are rounded. More accurately we get Accuracy[f, Round->False] 11.4956 Precision[f, Round->False] 11.4133There are several related issues here:- is the precision (accuracy) of rhe input known?- how does Mathematica interpret what one gives it?- how does Mathematica go about the calculation?--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> It seems clear to me that what Allan and what you mean by succeeds> here refer to quite different things and your objection is therefore> beside the point. There are obviously two ways in which one can> interpret the original posting. The first interpretation, which Allan> and myself adopted, was that the question concerned purely the> computational mechanism of Mathematica. Or, to put it in other words,> it was why are the results of these two computations not the same?.> In this sense success means no more than making Mathematica return> the same answer using the two different routes the original poster used.> You on the other hand choose to assume that the posting shows that its> author does not understand not just the mechanism of significance> arithmetic used by Mathematica but also computations with inexact> numbers in general. I do not think this is necessarily the correct> assumption. I also don't see that Mathematica is doing anything wrong.> After all, one can always check the accuracy of your answer:>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)>> In[3]:=> f>> Out[3]=> -1.1805916207174113*^21>> In[4]:=> Accuracy[%]>> Out[4]=> -5>> which tells you that it can't be very reliable. What more do you demand?>> Andrzej> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/> Actually, we don't know whether SetAccuracy succeeds, because we> don't> know how inexact those numbers really are. If they are known to more> digits than shown in the original post, they should be entered with as> much precision as they deserve. If not, there's no trick or algorithm> that will give the result precision, because the value of f really is> > in the noise. That is, we have no idea what the value of f should> be.>> Mathematica's failing is in returning a value without pointing out that> it has no precision.>> Bobby>> -----Original Message-----> Sent: Monday, September 30, 2002 11:59 AM>> Andrzej, Bobby, Peter>> It looks as if using SetAccuracy succeeds here because the inexact> numbers> that occur have finite binary representations. If we change them> slightly to> avoid this then we have to use Rationalize:>> 1) Using SetAccuracy>> Clear[a,b,f]>>> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/> (2*b),> Infinity];>> a=77617.1;> b=33096.1;> >> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity] ;>> f>>> - 15640321149084868351974949239896188679725401538739519428131155 14949> 3891236234>> 52500771916869370459119776018798804630436149786919912931962574 301029236> 3> 1246> 75>> /> 10867106143970760551000357827554793888198143135975649579607989 867743572> 8240> 16> 0653953612982932181371232436367739737604096>> 2) Rewriting as fractions>> a=776171/10;> b=330961/10;>> > f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)>> 3) Using Rationalize>> Clear[a,b,f]>>> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/> (2*b),> 0];>> a=77617.1;> b=33096.1;>> a=Rationalize[a,0];b=Rationalize[b,0];>> f>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)>>> I use Rationalize[. , 0] besause of results like>> Rationalize[3.1415959]>> 3.1416>> Rationalize[3.1415959,0]>> 31415959/10000000> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>>>> Well, first of of all, your using SetAccuracy and SetPrecision does>> nothing at all here, since they do not change the value of a or b. You> >> should use a = SetAccuracy[a, Infinity] etc. But even then you won't>> get the same answer as when you use exact numbers because of the way>> you evaluate f. Here is the order of evaluation that will give you the>> same answer, and should explain what is going on:>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>> a = 77617.;> >> b = 33096.;>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>> f>> 54767>> -(-----)>> 66192>> Andrzej Kozlowski>> Toyama International University>> JAPAN> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +> a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> (55/10)*b^8 + a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)>> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214>>> PK>> >>>>>>>>>>> ==== These expressions are condensation of larger ones(about 700 lines or so each) but they illustrate randomsubstitution failures in 4.2. Question: how can thesubstitution Sqrt[...]->Q always be made to work? The help file under ReplaceAll, ReplaceRepeated, etc, does not address this problem.f=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]/4*F^2);Print[(f/. Sqrt[X+Y+Z]->Q)//InputForm]; B*(A + Q) + (4*C)/(F^2*Sqrt[X + Y + Z]) (* fails *)g=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]*4*F^2);Print[(g/.Sqrt[X+ Y+Z]->Q)//InputForm];B*(A + Q) + C/(4*F^2*Sqrt[X + Y + Z]) (* fails *)h=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]+4*F^2);Print[(h/.Sqrt[X+ Y+Z]->Q)//InputForm];B*(A + Q) + C/(4*F^2 + Q) (* works *)Reply-To: kuska@informatik.uni-leipzig.de ==== Sqrt[a] is internal Power[a,Rational[1,2]] and1/Sqrt[a] is interal Power[a,Rational[-1,2]] and so a rule Sqrt[a]->q will not match with1/Sqrt[a]. You needf = B*(A + Sqrt[X + Y + Z]) + C/(Sqrt[X + Y + Z]/4*F^2);(f /. (X + Y + Z)^Rational[n_, 2] -> Q^n) Jens> These expressions are condensation of larger ones> (about 700 lines or so each) but they illustrate random> substitution failures in 4.2. Question: how can the> substitution Sqrt[...]->Q always be made to work?> The help file under ReplaceAll, ReplaceRepeated, etc,> does not address this problem.> f=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]/4*F^2);> Print[(f/.Sqrt[X+Y+Z]->Q)//InputForm];> B*(A + Q) + (4*C)/(F^2*Sqrt[X + Y + Z]) (* fails *)> g=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]*4*F^2);> Print[(g/.Sqrt[X+Y+Z]->Q)//InputForm];> B*(A + Q) + C/(4*F^2*Sqrt[X + Y + Z]) (* fails *)> h=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]+4*F^2);> Print[(h/.Sqrt[X+Y+Z]->Q)//InputForm];> B*(A + Q) + C/(4*F^2 + Q) (* works *) ==== > Sqrt[a] is internal Power[a,Rational[1,2]] and> 1/Sqrt[a] is interal Power[a,Rational[-1,2]] > and so a rule Sqrt[a]->q will not match with> 1/Sqrt[a]. You need> f = B*(A + Sqrt[X + Y + Z]) + C/(Sqrt[X + Y + Z]/4*F^2);> (f /. (X + Y + Z)^Rational[n_, 2] -> Q^n)> Jensought to be in the help Examples under . and .I should clarify three things. First, why use of FullForm is impractical. The source expressions I am dealing with are highly complex, with thousands of terms. The subexpressions to be replaced appear in hundreds of places, in many nested combinations. Detailed eye examination after each run would take a long time.Second, the operation subexpression->letter is used as preparationfor conversion of those expressions to C. The letters will be namesof temps (temporary variables) in C code. Upon replacing all subexpressions the source contracts to about 1-5% of original size.Third, there is a brute force replacement method which can be used (and was): output in InputForm, save cell as text, use a smart text editor that ignores blanks and CRs (e.g. emacs), and re-input for C conversion. This is cumbersome (the text has to be telnet'd to a Unix machine and back) and error prone but available as last resort.Perhaps a future version of Mathematica may incorporate a <- operatorfor this kind of reverse expansion to extract common subexpressions.The output would be the contracted expression and a temps list. ==== Dear Colleagues,I calculated:Sum[1/Prime[n], {n, 15000}] // NResult: 2.74716Now I wonder if this sum will converge or keep on growing, albeit veryslowly.Matthias BodeSal. Oppenheim jr. & Cie. KGaAKoenigsberger Strasse 29D-60487 Frankfurt am MainGERMANYMobile: +49(0)172 6 74 95 77Internet: http://www.oppenheim.de ==== > I calculated:>> Sum[1/Prime[n], {n, 15000}] // N>> Result: 2.74716>> Now I wonder if this sum will converge or keep on growing, albeit very> slowly.The latter. It is a well known fact that the series diverges (which, bythe way, shows that there are infinitely many primes :-).David-- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service ==== Hm, I wonder whose failures are you referring to when write substitution failures in 4.2?When using Mathematica's pattern matching there is one fundamental rule (very frequently restated on this list) you should adhere to: check the FullForm of the expression you are trying to match. So taking just your first case:In[1]:=FullForm[f = B*(A + Sqrt[X + Y + Z]) + C/((Sqrt[X + Y + Z]/4)*F^2)]Out[2]//FullForm=Plus[Times[4,C,Power[ F,-2],Power[Plus[X,Y,Z],Rational[-1,2]]],Times[B,Plus[A,Power [Plus[X, Y,Z],Rational[1,2]]]]]This ought to make the reason for the failure of your substitution clear. To make it work you must find a way to much the right pattern and not forget that the matching is purely syntactic.In[2]:=f /. (X + Y + Z)^(Rational[x_, 2]) -> Q^xOut[2]=(4*C)/(F^2*Q) + B*(A + Q)There are of course other ways you can get this to work, e.g.In[3]:=PowerExpand[f /. X + Y + Z -> Q^2]Out[3]=(4*C)/(F^2*Q) + B*(A + Q)There is even a rather crazy method that sometimes actually works:In[4]:=ToExpression[StringReplace[ToString[Evaluate[ InputForm[f]]], Sqrt[X + Y + Z] -> Q]]Out[4]=(4*C)/(F^2*Q) + B*(A + Q)Andrzej KozlowskiToyama International UniversityJAPANhttp://sigma.tuins.ac.jp/~andrzej/> These expressions are condensation of larger ones> (about 700 lines or so each) but they illustrate random> substitution failures in 4.2. Question: how can the> substitution Sqrt[...]->Q always be made to work?> The help file under ReplaceAll, ReplaceRepeated, etc,> does not address this problem.>> f=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]/4*F^2);> Print[(f/.Sqrt[X+Y+Z]->Q)//InputForm];>> B*(A + Q) + (4*C)/(F^2*Sqrt[X + Y + Z]) (* fails *)>> g=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]*4*F^2);> Print[(g/.Sqrt[X+Y+Z]->Q)//InputForm];>> B*(A + Q) + C/(4*F^2*Sqrt[X + Y + Z]) (* fails *)>> h=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]+4*F^2);> Print[(h/.Sqrt[X+Y+Z]->Q)//InputForm];>> B*(A + Q) + C/(4*F^2 + Q) (* works *)> ==== I was trying to run one of the Mathematica Book -> Graphics Gallery -> Animations -> Rolling Square. I don't recall the exact sequence of actions I took. I believe I selected the cell with the square (the only cell in the notebook) and from the menu, Cell -> Animate Selected Graphics. This resulted in a set of animation control buttons appearing in the bottom frame of the window. I clicked on one of these buttons, but nothing happened. I looke back in the menu and saw M-y as a keyboard shorcut to run an animation. I tried that with no result. I clicked another button in graphics control set, and my X windows locked up. This included the keyboard's ability to give me another display by using Ctl+Alt+F1. I went to another system and ssh-ed in and found Mathematica had over 50% of my user resources, and was climbing. The same was true for VM. I have a gig of physical RAM. Once I killed Mathematica, my X came back to life.I've had several bad experiences with Mathematica and X. I honestly believe there isolate and fix these. Have others had such problems?STH ==== > XFree86 4.0.2. I was trying to run one of the Mathematica Book -> Graphics> Gallery ->> Animations -> Rolling Square. I don't recall the exact sequence of> actions> I took. I never had these problems. But I'm not longer able to export gif's etc.-- Hendrik van Hees Fakult.8at f.9fr Physik http://theory.gsi.de/~vanhees/ D-33615 Bielefeld ==== Dear MathGroup Members,I want to minimize a function which returns theminimizing value (arg min) of another function.For a simple example consider the followingfunction opt which returns the arg min of x-2.5(1+Erf[x-s]).opt[s_]:=Block[{x}, x/. Last[ FindMinimum[x-2.5(1+Erf[x-s]), {x,1,3}]]]Now in a second step I want (again this is onlya simple example for illustrative purposes) to minimize(opt[s]-2)^2 with respect to s.FindMininum has no problems with this.FindMinimum[(opt[s]-2)^2,{s,0.9,1.1}]{3.18689*^-23, {s -> 0.9816}})However, NMinimize surrenders(!!!). Typing <<><><><><><><><><><><>Johannes LudsteckEconomics DepartmentUniversity of RegensburgUniversitaetsstrasse 3193053 RegensburgReply-To: kuska@informatik.uni-leipzig.de ==== you guess right andif you hinder Mathematica toevaluate opt[] for symbolicarguments, withopt[s_?NumericQ] := Block[{x}, x /. Last[FindMinimum[x - 2.5(1 + Erf[x - s]), {x, 1, 3}]]]NMinimize[] works as expected. Jens> Dear MathGroup Members,> I want to minimize a function which returns the> minimizing value (arg min) of another function.> For a simple example consider the following> function opt which returns the arg min of x-2.5(1+Erf[x-s]).> opt[s_]:=Block[{x}, x/. Last[> FindMinimum[x-2.5(1+Erf[x-s]), {x,1,3}]]]> Now in a second step I want (again this is only> a simple example for illustrative purposes) to minimize> (opt[s]-2)^2 with respect to s.> FindMininum has no problems with this.> FindMinimum[(opt[s]-2)^2,{s,0.9,1.1}]> {3.18689*^-23, {s -> 0.9816}})> However, NMinimize surrenders(!!!). Typing> < NMinimize[(opt[s]-2)^2,{s,0.9,1.1}]> only leads to the error message> FindMinimum::fmnum: Objective function> 0.1 - 2.5 (1. +Erf[0.1 - 1. s]) is not real at {x} = {1.}.> There is nothing wrong with minimand. It has exactly> one minimum in the Interval[{0.9,1.1}].> I guess the reason is that NMinimize calls opt[s]> not with a numerical value for s. This causes the> problem, since opt again calls FindMinimum.> Why? Can someone explain the failure and tell me> how to avoid this drawback? Wolfram Research boasts> that NMinimize can handle any function...> I hope that nobody will recommend me to use FindMinimum> here instead. I know that the example here could of> course be solved by FindMinimum, but my real world> application can not.> Johannes Ludsteck> <><><><><><><><><><><><>> Johannes Ludsteck> Economics Department> University of Regensburg> Universitaetsstrasse 31> 93053 Regensburg ==== Your Mathematica 4.2 is certainly not like the one most of us have:> This reveals us another integral which Mathematica 4.1 fails to > calculate>> In[1] := Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}] // N> Out[1]= -0.0173083>> Out[2]= 4.1 for Microsoft Windows (November 2, 2000)>> but Mathematica 4.2 handles correctly>> In[1] := Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}]> Out[1] = Integrate::idiv: Integral of... does not converge on > {1, Infinity).>> Out[2]= 4.2 for Microsoft Windows (February 28, 2002)Well, actually with my 4.2 we get:In[1]:=Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}]Out[1]=(1/4)*(Pi - 2*SinIntegral[2])> Even simpler,>> In[1] := Integrate[Cos[z]^2/z, {z, 1, Infinity}]> Out[1] = -EulerGamma/2 - Log[2]/2 + (EulerGamma - CosIntegral[2] + > Log[2])/2>> Out[2]= 4.1 for Microsoft Windows (November 2, 2000)>> which is wrong while Mathematica 4.2 works excellent>> In[1] := Integrate[Cos[z]^2/z, {z, 1, Infinity}]> Out[1] = Integrate::idiv: Integral of...does not converge on > {1, Infinity).>> Out[2]= 4.2 for Microsoft Windows (February 28, 2002)Not so fast:In[2]:=Integrate[Cos[z]^2/z, {z, 1, Infinity}]Out[2]=-(EulerGamma/2) - Log[2]/2 + (1/2)*(EulerGamma - CosIntegral[2] + Log[2])I'd speculate that fixing these two integrals in the beta stage some more important ones, so the original way of doing things was restored in the released version.However, it gets even more interesting if we load:<< Calculus`Limit`In[4]:=Integrate[Cos[Pi/4-z]^2/z,{z,1,Infinity} ]ReplaceRepeated:: rrlim :Exiting after Interval[{-1,1}]/z + Interval[{0, 1}]/z scanned 65536 times.Integrate:: idiv :Integral of Cos[Pi]/4 - z^2/z does not converge on {1, Infinity].Out[4]=Integrate[Cos[Pi/4 - z]^2/z, {z, 1, Infinity}]In[5]:=Integrate[Cos[z]^2/z, {z, 1, Infinity}]ReplaceRepeated::rrlim:Exiting after Interval[{0,1}] scanned 65536 times.Integrate::idiv:Integral of Cos[z]^2/z does not converge on {1, Infinity}Out[5]=Integrate[Cos[z]^2/z, {z, 1, Infinity}]In[6]:=Out[6]=4.2 for Mac OS X (June 4, 2002)>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== Murray,I don't like TraditionalForm for Inline cells either. I just useMenuCellDefault Inline Format TypeStandard Form. Also, when I design myown style sheets I often define a bolder font for Inline cells so they standout better.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/soon as I press the Control-^ key combination, an Inline cell is createdbeginning with the x, and then when I type the exponent 2 everything inthat Inline cell is now in Times, and the x is Italic. To change bothcharacters to Courier is not so easy: it seems to require separatelythe entire Inline cell and selecting Courier does not change the exponent!)So to avoid this annoyance I normally must first type the desiredexpression in a separate Input cell, then copy the contents of that cellto the desired point in the Text cell.Any suggestions on a more efficient method for handling this?> In receiving notebooks from many different people I have noticed that> beginners often do not know how to use Text cells ....>> Some users may hesitate to use Text cells because they want to include a> mathematical expression in the comments....> Just use an Inline cell within the text cell....--Murray Eisenberg murray@math.umass.eduMathematics & Statistics Dept.Lederle Graduate Research Tower phone 413 549-1020 (H)University of Massachusetts 413 545-2859 (W)710 North Pleasant StreetAmherst, MA 01375Reply-To: murray@math.umass.edu ==== That approach wouldn't work for me, since I often DO have to include within text cells some expressions in traditional mathematical notation and others in Mathematica's Standard Form. (The reason is that I'm often writing exposition as to how to express mathematical ideas and procedures in terms of Mathematica.)So probably the best way -- I'm not sure yet how to do it nicely -- would be a palette that more quickly allows me to change the format of a highlighted Inline cell to one or the other.Which reminds me of a related formatting matter. Often I need to include several paragraphs within a text cell, including displayed Inline cells on their own, separate lines. (No separate text cells would NOT meet my needs here.)The thing I usually do is to select the whole cell and from the Options Inspector sucessively select Formatting Options > Text Layout Options > ParagraphSpacing and then change the setting multiply from its default value 0 to 0.5. That provides just the right amount of inter-paragraph space. One of these days I'll figure out how to program a button on a palette to do that.General observation: It's stuff like this that makes Mathematica so much harder than a traditional tool, such as TeX/LaTeX, for typesetting mathematical exposition. Nothing beats a markup language for speed of entry. At least a sufficiently generous supply of formatting buttons would be the next best thing (far superior to having to burrow down through a nested menu in the Options Inspector). For example, I always keep open the palette FormattingTools.nb that allows changing the text face, size, or font (Courier, Times, Helvetica) at a click. (Not sure where I got the FormattingTools.nb palette from; it's not part of the standard Mathematica distribution. Perhaps it was from Publicon?)> Murray,> I don't like TraditionalForm for Inline cells either. I just use> MenuCellDefault Inline Format TypeStandard Form....-- 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 ==== What is the TMJ style sheet? In any case, when people design new stylesheets they would be well advised to keep Alt-7 as the key for Text style,and maintain the keys for other common styles also. Mathematica assigns keysin the order that the cell definitions appear in the style sheet. That meansthat new cell styles should be moved lower in the style sheet, even if thatwould not be their natural order. It would be nice if WRI allowed us toexplicitly assign the keys for the styles.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Here's a better version of DotPlot that is improved by Borut's and Allan's idea:Needs[Utilities`FilterOptions`];DotPlot[data_?MatrixQ, opts___Rule] :=Module[{colorfn, scale, dotsize, m, scalefn}, colorfn = ColorFunction/.{opts}/.{ColorFunction->Hue}; scale = ColorFunctionScaling/.{opts}/.{ColorFunctionScaling->True}; dotsize = DotSize/.{opts}/.{DotSize->0.01}; m = If[scale, {Min[#],Max[#]}& @ Last[Transpose[data]], {0,1}]; scalefn = (# - m[[1]])/(m[[2]]-m[[1]])& ; Show[ Graphics[ {PointSize[dotsize],colorfn[scalefn[#3]],Point[{#1,#2}]}&@@@ data], FilterOptions[Graphics, opts] ] ]--Selwyn ==== Here's a refinement of my previous post. Everything is wrapped up in a function named DotPlot, which takes the following options:ColorFunction (default: Hue)ColorFunctionScaling (default: True)DotSize (default: 0.01)You can also provide other options such as Axes, Frame, Background, etc. Needs[Utilities`FilterOptions`]; DotPlot[data_?MatrixQ, opts___Rule] := Module[{colorfn, scale, dotsize}, colorfn = ColorFunction/.{opts}/.{ColorFunction->Hue}; scale = ColorFunctionScaling/.{opts}/.{ColorFunctionScaling->True}; dotsize = DotSize/.{opts}/.{DotSize->.01}; With[{m = If[scale,{Min[#],Max[#]}&@Transpose[data][[3]], {0,1}]}, Show[(Graphics[ {colorfn[#[[3]]],PointSize[dotsize],Point[{#[[1]],#[[2]]}]}]& )/@ (data /. {x_,y_,z_}-> {x,y,(z-m[[1]])/(m[[2]]-m[[1]])}), FilterOptions[Graphics, opts] ] ] ]Example: vals = Table[{Random[], Random[], .5 Random[]}, {100}]; DotPlot[vals, ColorFunction -> (Hue[#, 1, 1-#] & ), ColorFunctionScaling -> False, DotSize -> 0.02, Frame -> True]---Selwyn Hollis ==== With verision 3.0 on a machine running Windows NT the following codeproduces rotated text with each of the charaters rotated as welldegstr[th_]:=StringJoin[ToString[th], Degrees]str[th_,offset_]:={Point[{th,1}], Text[degstr[th],{th,1},offset,{Cos[th Degree],Sin[th Degree]}]}pic[offset_,plotrange_,angles_]:= Show[ Graphics[{PointSize[.015],str[#,offset]&/@angles},PlotRange-> plotrange, AspectRati->.2,Frame[Rule]True,FrameTick->None, DefaultFon->{Courier,10}]];pic[{0,0},{{-10,95},{-.1,2.1}}, Range[0,90,10]];With version 4.2 on a machine running Mac OS 10.2.1 the text is rotated butthe characters in the text are not. That is the position of the chactersrelative to each other changes but their orientation remains constant.I would like to have the character orientation change as it does when thiscode is run under Windows NT. Does anyone know if there is a settingsomewhere that controls character orientation when text is rotated? ==== Andrzej, observe:a = 77617; b = 33096;f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +a/(2*b)fAccuracy[f]Precision[f]Accuracy[10.^21]Precision[10. ^21]1.1805916207174113*^21-516-516The two numbers supposedly have the same accuracy and precision, yet thefirst is in doubt by about 22 ORDERS OF MAGNITUDE -- never mind thedigits! Mathematica computed this beast without giving any indicationit was just noise -- without REALIZING it was noise.>>What more do you demand?I'm not demanding, objecting, or criticizing. I'm pointing out theproblem. On the one hand, the poster is computing something that'ssimply not well-behaved. Unless he knows the coefficients with VERYhigh precision, he can't know even the magnitude of the result -- andthat's not Mathematica's fault at all. On the other hand, Mathematicadoesn't notice that precision is lost in the computation, and perhaps itshould. You thought it DID notice, after all -- but it didn't.Bobby-----Original Message-----the same answer using the two different routes the original poster used.You on the other hand choose to assume that the posting shows that its author does not understand not just the mechanism of significance arithmetic used by Mathematica but also computations with inexact numbers in general. I do not think this is necessarily the correct assumption. I also don't see that Mathematica is doing anything wrong. After all, one can always check the accuracy of your answer:In[1]:=a = 77617.; b = 33096.;In[2]:=f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b)In[3]:=fOut[3]=-1.1805916207174113*^21In[4]:=Accuracy[ %]Out[4]=-5which tells you that it can't be very reliable. What more do you demand?AndrzejAndrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> Actually, we don't know whether SetAccuracy succeeds, because we > don't> know how inexact those numbers really are. If they are known to more> digits than shown in the original post, they should be entered with as> much precision as they deserve. If not, there's no trick or algorithm> that will give the result precision, because the value of f really is> in the noise. That is, we have no idea what the value of f should > be.>> Mathematica's failing is in returning a value without pointing outthat> it has no precision.>> Bobby>> -----Original Message-----> Sent: Monday, September 30, 2002 11:59 AM>> Andrzej, Bobby, Peter>> It looks as if using SetAccuracy succeeds here because the inexact> numbers> that occur have finite binary representations. If we change them> slightly to> avoid this then we have to use Rationalize:>> 1) Using SetAccuracy>> Clear[a,b,f]> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/ > (2*b),> Infinity];>> a=77617.1;> b=33096.1;>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>> f> - 15640321149084868351974949239896188679725401538739519428131155 14949> 3891236234>> 52500771916869370459119776018798804630436149786919912931962574 301029236 > 3> 1246> 75>> / > 10867106143970760551000357827554793888198143135975649579607989 867743572> 8240> 16> 0653953612982932181371232436367739737604096>> 2) Rewriting as fractions>> a=776171/10;> b=330961/10;>> f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)>> 3) Using Rationalize>> Clear[a,b,f]> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/ > (2*b),> 0];>> a=77617.1;> b=33096.1;>> a=Rationalize[a,0];b=Rationalize[b,0];>> f>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)> I use Rationalize[. , 0] besause of results like>> Rationalize[3.1415959]>> 3.1416>> Rationalize[3.1415959,0]>> 31415959/10000000> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>> Well, first of of all, your using SetAccuracy and SetPrecision does>> nothing at all here, since they do not change the value of a or b.You>> should use a = SetAccuracy[a, Infinity] etc. But even then you won't>> get the same answer as when you use exact numbers because of the way>> you evaluate f. Here is the order of evaluation that will give youthe>> same answer, and should explain what is going on:>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>> a = 77617.;>> b = 33096.;>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>> f>> 54767>> -(-----)>> 66192>> Andrzej Kozlowski>> Toyama International University>> JAPAN>>>>> Could someone explain what is going on here, please?>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>> In[4]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +> a/(2*b)>> In[5]:=> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>> In[6]:=> f>> Out[6]=> -1.1805916207174113*^21>> In[7]:=> a = 77617; b = 33096;>> In[8]:=> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> (55/10)*b^8 + a/(2*b)>> In[9]:=> g>> Out[9]=> -(54767/66192)>> In[10]:=> N[%]>> Out[10]=> -0.8273960599468214>>> PK>>>>>>> ==== Consider the total differential of f, with respect to the inexactnumbers:Clear[a, b, x, y, f]f[a_, b_, x_, y_] := x*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + y*b^8 + a/(2*b)Simplify[Dt[f[a, b, x, y]] /. {Dt[a] -> da, Dt[b] -> db, Dt[x] -> dx, Dt[y] -> dy} /. {a -> 77617, b -> 33096, x -> 333.75, y -> 5.5}]-2.0400456966858126*^32*da + 4.784331242850472*^32*db + 1.3141745343712155*^27*dx + 1.4394747892125385*^36*dyf is sensitive to inaccuracy in the various numbers to widely varyingdegrees. Since the correct answer is small, we need a LOT ofprecision in the inputs to get there. If any of the inputs are merelymachine precision numbers, we have NO precision in the result.The second and third terms are nearly the same magnitude with differentsigns. Even worse, the first term almost perfectly fills the gap:a = 77617; b = 33096;(33375/100)*b^6438605750846393161930703831040a^2*(11*a^ 2*b^2 - b^6 - 121*b^4 - 2)-7917111779274712207494296632228773890(55/10)*b^ 87917111340668961361101134701524942848% + %% + %%%-2Bobby Treat-----Original Message-----b = SetAccuracy[33096., Infinity]; In[4]:=fOut[4]=-(54767/66192)In[5]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity] Out[5]=1180591620717411303424Similarily:In[1]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50]; a = SetAccuracy[77617., 100]; b = SetAccuracy[33096., 100]; In[4]:=fOut[4]=-0.8273960599468212641107299556`11.4133In[5]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; Out[5]=1.180591620717411303424`121.0721*^21-PK ==== To Technical Support and the Mathematica User community,I'm writing to report what I consider to be a bug. First, I want to show asimplified example of the problem. Consider the following expression:expr=0.22 + x[0] + (3*(-0.16+ x[1]))/4 + (9*(0.546 + x[2]))/16;When simplified I expected to get some real number plusx[0]+3x[1]/4+9x[2]/16, but instead I get the following:Simplify[expr]0.407125 + x[0] + 0.75 x[1] + 0.5625 x[2]As you can see, for some reason Mathematica converted the fractions 3/4 and9/16 to real machine numbers. I consider this to be a bug.Now, for an example more representative of the situation that I've beencoming across.expr12 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 12}];expr13 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 13}];expr55 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 55}];As you can see, I have replaced the real numbers by extended precisionnumbers. The simplified example above demonstrates that the problem existswhen using machine numbers. Now, we'll see what happens when we usearbitrary precision numbers. First, let's simplify the expression with 12terms.Simplify[expr12](1.0010000000000 + 2048 x[1] + 1024 x[2] + 512 x[3] + 256 x[4] + 128 x[5] + 64 x[6] + 32 x[7] + 16 x[8] + 8 x[9] + 4 x[10] + 2 x[11] + x[12]) / 4096As you can see, a sum with 12 terms upon simplification has coefficientswhich are still integers as they should be. However, increasing the numberof terms to 13 yieldsSimplify[expr13]0.0001221923828125 + 0.500000000000 x[1] + 0.250000000000 x[2] + 0.1250000000000 x[3] + 0.0625000000000 x[4] + 0.0312500000000 x[5] + 0.01562500000000 x[6] + 0.00781250000000 x[7] + 0.00390625000000 x[8] + 0.001953125000000 x[9] + 0.000976562500000 x[10] + 0.000488281250000 x[11]+ 0.000244140625000 x[12] + 0.0001220703125000 x[13]Now, all of the coefficients are converted to real numbers, replicating thebug from the simplified example. Finally, let's see what happens when wehave 55 terms. Rather than putting the resulting expression here, I willjust leave it at the end of the post. The result though is somewhatsurprising. Each of the coefficients of the x[i] are again real numbers, butnow their precision is only 0! The proper result of course is the sum ofsome real number (with a precision close to 0 due to numerical cancellation)and an expression consisting of rational numbers multiplied by x[i]. Theloss of precision of the coefficients of the x[i] is precisely what occurredto me. Of course, in this simple example, simply using Expand instead ofSimplify produces the expected result, and is my workaround. I hope youagree with me that this is a bug, and one that Wolfram needs to correct.Carl WollPhysics DeptU of WashingtonSimplify[expr55] -16 -1 -1 -10. 10 + 0. x[1] + 0. x[2] + 0. 10 x[3] + 0. 10 x[4] + 0. 10 x[5] + -2 -2 -2 -3 -3 0. 10 x[6] + 0. 10 x[7] + 0. 10 x[8] + 0. 10 x[9] + 0. 10 x[10]+ -3 -3 -4 -4 -4 0. 10 x[11] + 0. 10 x[12] + 0. 10 x[13] + 0. 10 x[14] + 0. 10x[15] + -5 -5 -5 -6 -6 0. 10 x[16] + 0. 10 x[17] + 0. 10 x[18] + 0. 10 x[19] + 0. 10x[20] + -6 -6 -7 -7 -7 0. 10 x[21] + 0. 10 x[22] + 0. 10 x[23] + 0. 10 x[24] + 0. 10x[25] + -8 -8 -8 -9 -9 0. 10 x[26] + 0. 10 x[27] + 0. 10 x[28] + 0. 10 x[29] + 0. 10x[30] + -9 -9 -10 -10 0. 10 x[31] + 0. 10 x[32] + 0. 10 x[33] + 0. 10 x[34] + -10 -11 -11 -11 0. 10 x[35] + 0. 10 x[36] + 0. 10 x[37] + 0. 10 x[38] + -12 -12 -12 -12 0. 10 x[39] + 0. 10 x[40] + 0. 10 x[41] + 0. 10 x[42] + -13 -13 -13 -14 0. 10 x[43] + 0. 10 x[44] + 0. 10 x[45] + 0. 10 x[46] + -14 -14 -15 -15 0. 10 x[47] + 0. 10 x[48] + 0. 10 x[49] + 0. 10 x[50] + -15 -15 -16 -16 -16 0. 10 x[51] + 0. 10 x[52] + 0. 10 x[53] + 0. 10 x[54] + 0. 10x[55] ==== Look at the FullForm of your expressions:FullForm[Sqrt[X + Y + Z]]Power[Plus[X, Y, Z], Rational[1, 2]]FullForm[f]Plus[Times[Rational[1, 4], C, Power[F, -2], Power[Plus[X, Y, Z], Rational[-1, 2]]], Times[B, Plus[A, Power[Plus[X, Y, Z], Rational[1, 2]]]]]FullForm[h]Plus[Times[B, Plus[A, Power[Plus[X, Y, Z], Rational[1, 2]]]], Times[C, Power[Plus[Times[4, Power[F, 2]], Power[Plus[X, Y, Z], Rational[1, 2]]], -1]]]The square root appears in two different forms! A solution is toreplace both patterns:f = B*(A + Sqrt[X + Y + Z]) + C/(Sqrt[X + Y + Z]/4*F^2);f /. {Sqrt[X + Y + Z] -> Q, 1/Sqrt[X + Y + Z] -> 1/Q}(4*C)/(F^2*Q) + B*(A + Q)This is very annoying, of course, and it may not take care of everycase. Looking at the FullForm should help, when it fails.Bobby-----Original Message-----Print[(f/.Sqrt[X+Y+Z]->Q)//InputForm]; B*(A + Q) + (4*C)/(F^2*Sqrt[X + Y + Z]) (* fails *)g=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]*4*F^2);Print[(g/.Sqrt[X+ Y+Z]->Q)//InputForm];B*(A + Q) + C/(4*F^2*Sqrt[X + Y + Z]) (* fails *)h=B*(A+Sqrt[X+Y+Z])+C/(Sqrt[X+Y+Z]+4*F^2);Print[(h/.Sqrt[X+ Y+Z]->Q)//InputForm];B*(A + Q) + C/(4*F^2 + Q) (* works *) ==== >>I should add that the solution is over natural numbers.. this willprobably make a big difference..Yes, that probably removes the nearly from nearly impossible.I'd be curious to see the actual problem.Bobby-----Original Message-----eqns..> preferably ones that will minimize the computation time for the other14).> These equation are not linearly related.. the highest degree in anyone eqn> is degree 4 i believe.. and there are some cross terms in theequations but> not every equation depends on every variable.. (some are actuallyrather> simple eqns). Any ideas on how to get started with this using> mathematica (any ideas for algorithms)..>> Anything will be helpful..>> I can be reached at ngupta2@seas.upenn.edu>> Many thanks,>> Nachi>> ==== Group,in the help browser (V4.2) there is the following about Return[]:(* Return [expr] returns the value expr, existing all procedures and loops in a function *).Besides, from 2.5.9 Loops and control structures (also in Help browser) we can conclude that While, Do, Module, With, etc. must be understood as loops and/or control structures.But let us have a look at these two function definitions:yes[a_]:=With[{Ever=True},While[Ever,If[a==7, Return[Terminate] ];Print[loop]]],In (*yes[]*), Return[] exits the function breaking all loops and control structures, and yields Terminate as expected.not[a_]:=With[{Ever=True},While[Ever,While[Ever,If[a ==7,Do[Return[Terminate];Print[foo] ]];Print[loop]]]],However, in (*not[]*), Return[] only breaks the Do[] construct and keeps looping inside While[].To my understanding, this contradicts that Return [expr] returns the value expr, existing all procedures and loops in a function as stated executing Return[] anywhere at any deep of nested looping constructs inside the function.I would appreciate any feedback.Emilio Martin-Serrano ==== You are of course right, I forgot that Mathematica does not try to keep precision or accuracy of machine arithmetic computations. But I think the actual precision you set need not be higher than machine precision, it just has to be set explicitely (is that right?). For example:In[1]:=Clear[f,a,b,k]In[2]:=k = $MachinePrecision;In[3]:=f=SetAccuracy[333.75*b^6+a^2*(11*a^2 *b^2-b^6-121*b^4-2)+5.5*b^8+a/ (2*b),k];In[4]:=a=77617.;b=33096.;In[5]:=a=SetAccuracy[a,k]; In[6]:=b=SetAccuracy[b,k];In[7]:=fOut[7]=!((- 5.51716400890319`-2.8311*^19))In[8]:=Accuracy[f]Accuracy: :mnprec: Value -23 would be inconsistent with $MinPrecision; bounding by $MinPrecision instead.Out[8]=-20Andrzej> Andrzej>> Yes, like you I took the original question to be about how to get the > result> of using the naive rational versions in place of the inexact numbers.> Bobby raises the question of how we might know accuracy of the result.>> You answer this with>> a = 77617.; b = 33096.;>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>> In[3]:=>> f>> Out[3]=>> -1.1805916207174113*^21>> In[4]:=>> Accuracy[%]>> Out[4]=>> -5>> However this computation is done in machine arithmetic, which means > that> Mathematica keeps no check on the accuracy and precision of the > computation,> and Mathematica gives the default accuracy value without any real> signifcance:>> $MachinePrecision - Log[10,Abs[f]]//Round>> -5>> To get meaningful accuracy and precision values we need to force the> computation to be in bignums (bigßoat, arbitrary precision) > arithmetic.> Mathematica then keeps track of the accuracy and precision that it can> guarantee.>> Clear[f,a,b,k]> k=50;>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/ > (2*b),k];> a=77617.;b=33096.;> a=SetAccuracy[a,k];> b=SetAccuracy[b,k];> f>> -0.82739605995>> Accuracy[f]>> 11>> Precision[f]>> 11>> Which tells us that the error in the computed value of f is not more > than>> 10^-11> The above results are rounded. More accurately we get>> Accuracy[f, Round->False]>> 11.4956>> Precision[f, Round->False]>> 11.4133>> There are several related issues here:> - is the precision (accuracy) of rhe input known?> - how does Mathematica interpret what one gives it?> - how does Mathematica go about the calculation?>> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>> It seems clear to me that what Allan and what you mean by succeeds>> here refer to quite different things and your objection is therefore>> beside the point. There are obviously two ways in which one can>> interpret the original posting. The first interpretation, which Allan>> and myself adopted, was that the question concerned purely the>> computational mechanism of Mathematica. Or, to put it in other words,>> it was why are the results of these two computations not the same?.>> In this sense success means no more than making Mathematica return>> the same answer using the two different routes the original poster >> used.>> You on the other hand choose to assume that the posting shows that its>> author does not understand not just the mechanism of significance>> arithmetic used by Mathematica but also computations with inexact>> numbers in general. I do not think this is necessarily the correct>> assumption. I also don't see that Mathematica is doing anything wrong.>> After all, one can always check the accuracy of your answer:>> In[1]:=>> a = 77617.; b = 33096.;>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>> In[3]:=>> f>> Out[3]=>> -1.1805916207174113*^21>> In[4]:=>> Accuracy[%]>> Out[4]=>> -5>> which tells you that it can't be very reliable. What more do you >> demand?>> Andrzej>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>>> Actually, we don't know whether SetAccuracy succeeds, because we> don't> know how inexact those numbers really are. If they are known to more> digits than shown in the original post, they should be entered with > as> much precision as they deserve. If not, there's no trick or > algorithm> that will give the result precision, because the value of f really is> in the noise. That is, we have no idea what the value of f should> be.>> Mathematica's failing is in returning a value without pointing out > that> it has no precision.>> Bobby>> -----Original Message-----> Sent: Monday, September 30, 2002 11:59 AM>> Andrzej, Bobby, Peter>> It looks as if using SetAccuracy succeeds here because the inexact> numbers> that occur have finite binary representations. If we change them> slightly to> avoid this then we have to use Rationalize:>> 1) Using SetAccuracy>> Clear[a,b,f]>>> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/> (2*b),> Infinity];>> a=77617.1;> b=33096.1;>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>> f>>> - 15640321149084868351974949239896188679725401538739519428131155 14949> 3891236234>> 52500771916869370459119776018798804630436149786919912931962574 3010292 > 36> 3> 1246> 75>> /> 10867106143970760551000357827554793888198143135975649579607989 8677435 > 72> 8240> 16> 0653953612982932181371232436367739737604096>> 2) Rewriting as fractions>> a=776171/10;> b=330961/10;>> f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)>> 3) Using Rationalize>> Clear[a,b,f]>>> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/> (2*b),> 0];>> a=77617.1;> b=33096.1;>> a=Rationalize[a,0];b=Rationalize[b,0];>> f>> -(5954133808997234115690303589909929091649391296257/> 41370125000000)>>> I use Rationalize[. , 0] besause of results like>> Rationalize[3.1415959]>> 3.1416>> Rationalize[3.1415959,0]>> 31415959/10000000> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>>>> Well, first of of all, your using SetAccuracy and SetPrecision does>> nothing at all here, since they do not change the value of a or b. >> You>> should use a = SetAccuracy[a, Infinity] etc. But even then you won't>> get the same answer as when you use exact numbers because of the >> way>> you evaluate f. Here is the order of evaluation that will give you >> the>> same answer, and should explain what is going on:>>>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>>>> a = 77617.;>>>> b = 33096.;>>>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>>>> f>>>> 54767>> -(-----)>> 66192>>>> Andrzej Kozlowski>> Toyama International University>> JAPAN>>>>>>> Could someone explain what is going on here, please?>>>> In[1]:=>>> a = 77617.; b = 33096.;>>>> In[2]:=>>> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];>>> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>>>> In[4]:=>>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +>>> a/(2*b)>>>> In[5]:=>>> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>>>> In[6]:=>>> f>>>> Out[6]=>>> -1.1805916207174113*^21>>>> In[7]:=>>> a = 77617; b = 33096;>>>> In[8]:=>>> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>>> (55/10)*b^8 + a/(2*b)>>>> In[9]:=>>> g>>>> Out[9]=>>> -(54767/66192)>>>> In[10]:=>>> N[%]>>>> Out[10]=>>> -0.8273960599468214>>>>> PK>>>>>>>>>>>>>>>>>>>>> >>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== So? It's just as it should be, isn't it?AndrzejAndrzej KozlowskiToyama International UniversityJAPANhttp://sigma.tuins.ac.jp/~andrzej/> Go one step further:>> Clear[f, a, b, k]> k = $MachinePrecision;> f = SetAccuracy[333.75*b^6 +> a^2*(11*a^2*b^2 - b^6 -> 121*b^4 - 2) +> 5.5*b^8 + a/(2*b), k];> a = 77617.; b = 33096.;> a = SetAccuracy[a, k];> b = SetAccuracy[b, k];> f> Accuracy[f]> Precision[f]>> -5.517164009`0*^19>> Accuracy::mnprec:Value -23 would be inconsistent with $MinPrecision;> bounding by $MinPrecision instead.>> -20>> 0>> Accuracy::mnprec:Value !(-23) would be inconsistent with> $MinPrecision; > bounding by $MinPrecision instead.>> See that? NO precision.>> Bobby>> -----Original Message-----> Sent: Tuesday, October 01, 2002 5:53 PM> Cc: drbob@bigfoot.com>> You are of course right, I forgot that Mathematica does not try to keep>> precision or accuracy of machine arithmetic computations. But I think> the actual precision you set need not be higher than machine precision,>> it just has to be set explicitely (is that right?). For example:>> In[1]:=> Clear[f,a,b,k]>> In[2]:=> k = $MachinePrecision;>> In[3]:=> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/> (2*b),k];>> In[4]:=> a=77617.;b=33096.;>> In[5]:=> a=SetAccuracy[a,k];>> In[6]:=> b=SetAccuracy[b,k];> In[7]:=> f>> Out[7]=> !((-5.51716400890319`-2.8311*^19))>> In[8]:=> Accuracy[f]>> Accuracy::mnprec: Value -23 would be inconsistent with $MinPrecision; > bounding by $MinPrecision instead.>> Out[8]=> -20> Andrzej>>> Andrzej>> Yes, like you I took the original question to be about how to get the> result>> of using the naive rational versions in place of the inexact numbers.>> Bobby raises the question of how we might know accuracy of the result.>> You answer this with> a = 77617.; b = 33096.;>> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)>> In[3]:=> f>> Out[3]=> -1.1805916207174113*^21>> In[4]:=> Accuracy[%]>> Out[4]=> -5>> However this computation is done in machine arithmetic, which means>> that>> Mathematica keeps no check on the accuracy and precision of the>> computation,>> and Mathematica gives the default accuracy value without any real>> signifcance:>> $MachinePrecision - Log[10,Abs[f]]//Round>> -5>> To get meaningful accuracy and precision values we need to force the>> computation to be in bignums (bigßoat, arbitrary precision)>> arithmetic.>> Mathematica then keeps track of the accuracy and precision that it can>> guarantee.>> Clear[f,a,b,k]>> k=50;>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/>> (2*b),k];>> a=77617.;b=33096.;>> a=SetAccuracy[a,k];>> b=SetAccuracy[b,k];>> f>> -0.82739605995>> Accuracy[f]>> 11>> Precision[f]>> 11>> Which tells us that the error in the computed value of f is not more> than>> 10^-11>> The above results are rounded. More accurately we get>> Accuracy[f, Round->False]>> 11.4956>> Precision[f, Round->False]>> 11.4133>> There are several related issues here:>> - is the precision (accuracy) of rhe input known?>> - how does Mathematica interpret what one gives it?>> - how does Mathematica go about the calculation?>> -->> Allan>> --------------------->> Allan Hayes>> Mathematica Training and Consulting>> Leicester UK>> www.haystack.demon.co.uk>> hay@haystack.demon.co.uk>> Voice: +44 (0)116 271 4198>>> It seems clear to me that what Allan and what you mean by succeeds> here refer to quite different things and your objection is therefore> beside the point. There are obviously two ways in which one can> interpret the original posting. The first interpretation, which Allan> and myself adopted, was that the question concerned purely the> computational mechanism of Mathematica. Or, to put it in other words,> it was why are the results of these two computations not the same?.> In this sense success means no more than making Mathematica return> the same answer using the two different routes the original poster> used.> You on the other hand choose to assume that the posting shows that> its> author does not understand not just the mechanism of significance> arithmetic used by Mathematica but also computations with inexact> numbers in general. I do not think this is necessarily the correct> assumption. I also don't see that Mathematica is doing anything> wrong.> After all, one can always check the accuracy of your answer:>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)>> In[3]:=> f>> Out[3]=> -1.1805916207174113*^21>> In[4]:=> Accuracy[%]>> Out[4]=> -5>> which tells you that it can't be very reliable. What more do you> demand?>> Andrzej>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>>>> Actually, we don't know whether SetAccuracy succeeds, because we>> don't>> know how inexact those numbers really are. If they are known to> more>> digits than shown in the original post, they should be entered with>>> as>> much precision as they deserve. If not, there's no trick or>> algorithm>> that will give the result precision, because the value of f really> is>> in the noise. That is, we have no idea what the value of f should>> be.>>>> Mathematica's failing is in returning a value without pointing out>> that>> it has no precision.>>>> Bobby>>>> -----Original Message----->> Sent: Monday, September 30, 2002 11:59 AM>>>> Andrzej, Bobby, Peter>>>> It looks as if using SetAccuracy succeeds here because the inexact>> numbers>> that occur have finite binary representations. If we change them>> slightly to>> avoid this then we have to use Rationalize:>>>> 1) Using SetAccuracy>>>> Clear[a,b,f]>>>> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>> (2*b),>> Infinity];>>>> a=77617.1;>> b=33096.1;>>>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>>>> f>>>> - 15640321149084868351974949239896188679725401538739519428131155 14949>> 3891236234>>> 52500771916869370459119776018798804630436149786919912931962574 3010292>> 36>> 3>> 1246>> 75>>>> />>> 10867106143970760551000357827554793888198143135975649579607989 8677435>> 72>> 8240>> 16>> 0653953612982932181371232436367739737604096>>>> 2) Rewriting as fractions>>>> a=776171/10;>> b=330961/10;>>>> f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>>>> -(5954133808997234115690303589909929091649391296257/>> 41370125000000)>>>> 3) Using Rationalize>>>> Clear[a,b,f]>>>> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>> (2*b),>> 0];>>>> a=77617.1;>> b=33096.1;>>>> a=Rationalize[a,0];b=Rationalize[b,0];>>>> f>>>> -(5954133808997234115690303589909929091649391296257/>> 41370125000000)>>>> I use Rationalize[. , 0] besause of results like>>>> Rationalize[3.1415959]>>>> 3.1416>>>> Rationalize[3.1415959,0]>>>> 31415959/10000000>> -->> Allan>>>> --------------------->> Allan Hayes>> Mathematica Training and Consulting>> Leicester UK>> www.haystack.demon.co.uk>> hay@haystack.demon.co.uk>> Voice: +44 (0)116 271 4198>>>>> Well, first of of all, your using SetAccuracy and SetPrecision does>>> nothing at all here, since they do not change the value of a or b.>> You>>> should use a = SetAccuracy[a, Infinity] etc. But even then you> won't>>> get the same answer as when you use exact numbers because of the>>> way>>> you evaluate f. Here is the order of evaluation that will give you>> the>>> same answer, and should explain what is going on:>>>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>>>> a = 77617.;>>>>> b = 33096.;>>>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>>>> f>>>> 54767>>> -(-----)>>> 66192>>>> Andrzej Kozlowski>>> Toyama International University>>> JAPAN>>>>>>>>>> Could someone explain what is going on here, please?>>>> In[1]:=>> a = 77617.; b = 33096.;>>>> In[2]:=>> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];>> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>>>> In[4]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +>> a/(2*b)>>>> In[5]:=>> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>>>> In[6]:=>> f>>>> Out[6]=>> -1.1805916207174113*^21>>>> In[7]:=>> a = 77617; b = 33096;>>>> In[8]:=>> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> (55/10)*b^8 + a/(2*b)>>>> In[9]:=>> g>>>> Out[9]=>> -(54767/66192)>>>> In[10]:=>> N[%]>>>> Out[10]=>> -0.8273960599468214>>>>>> PK>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>> ==== I think I'd prefer that Mathematica gave me a clue -- without beingasked explicitly in JUST the right way that only you know and hadforgotten -- that there's a precision problem.Oddly enough, when you DO ask it nicely, you get error messages, but ifyou're not aware there's a problem, it lets you go on your merry way,working with noise.Bobby-----Original Message----->> Clear[f, a, b, k]> k = $MachinePrecision;> f = SetAccuracy[333.75*b^6 +> a^2*(11*a^2*b^2 - b^6 -> 121*b^4 - 2) +> 5.5*b^8 + a/(2*b), k];> a = 77617.; b = 33096.;> a = SetAccuracy[a, k];> b = SetAccuracy[b, k];> f> Accuracy[f]> Precision[f]>> -5.517164009`0*^19>> Accuracy::mnprec:Value -23 would be inconsistent with $MinPrecision;> bounding by $MinPrecision instead.>> -20>> 0>> Accuracy::mnprec:Value !(-23) would be inconsistent with> $MinPrecision; > bounding by $MinPrecision instead.>> See that? NO precision.>> Bobby>> -----Original Message-----> Sent: Tuesday, October 01, 2002 5:53 PM> Cc: drbob@bigfoot.com>> You are of course right, I forgot that Mathematica does not try tokeep>> precision or accuracy of machine arithmetic computations. But I think> the actual precision you set need not be higher than machineprecision,>> it just has to be set explicitely (is that right?). For example:>> In[1]:=> Clear[f,a,b,k]>> In[2]:=> k = $MachinePrecision;>> In[3]:=> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/> (2*b),k];>> In[4]:=> a=77617.;b=33096.;>> In[5]:=> a=SetAccuracy[a,k];>> In[6]:=> b=SetAccuracy[b,k];> In[7]:=> f>> Out[7]=> !((-5.51716400890319`-2.8311*^19))>> In[8]:=> Accuracy[f]>> Accuracy::mnprec: Value -23 would be inconsistent with $MinPrecision;> bounding by $MinPrecision instead.>> Out[8]=> -20> Andrzej>>> Andrzej>> Yes, like you I took the original question to be about how to get the> result>> of using the naive rational versions in place of the inexact numbers.>> Bobby raises the question of how we might know accuracy of theresult.>> You answer this with> a = 77617.; b = 33096.;>> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)>> In[3]:=> f>> Out[3]=> -1.1805916207174113*^21>> In[4]:=> Accuracy[%]>> Out[4]=> -5>> However this computation is done in machine arithmetic, which means>> that>> Mathematica keeps no check on the accuracy and precision of the>> computation,>> and Mathematica gives the default accuracy value without any real>> signifcance:>> $MachinePrecision - Log[10,Abs[f]]//Round>> -5>> To get meaningful accuracy and precision values we need to force the>> computation to be in bignums (bigßoat, arbitrary precision)>> arithmetic.>> Mathematica then keeps track of the accuracy and precision that itcan>> guarantee.>> Clear[f,a,b,k]>> k=50;>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/>> (2*b),k];>> a=77617.;b=33096.;>> a=SetAccuracy[a,k];>> b=SetAccuracy[b,k];>> f>> -0.82739605995>> Accuracy[f]>> 11>> Precision[f]>> 11>> Which tells us that the error in the computed value of f is not more> than>> 10^-11>> The above results are rounded. More accurately we get>> Accuracy[f, Round->False]>> 11.4956>> Precision[f, Round->False]>> 11.4133>> There are several related issues here:>> - is the precision (accuracy) of rhe input known?>> - how does Mathematica interpret what one gives it?>> - how does Mathematica go about the calculation?>> -->> Allan>> --------------------->> Allan Hayes>> Mathematica Training and Consulting>> Leicester UK>> www.haystack.demon.co.uk>> hay@haystack.demon.co.uk>> Voice: +44 (0)116 271 4198>>> It seems clear to me that what Allan and what you mean by succeeds> here refer to quite different things and your objection is therefore> beside the point. There are obviously two ways in which one can> interpret the original posting. The first interpretation, whichAllan> and myself adopted, was that the question concerned purely the> computational mechanism of Mathematica. Or, to put it in otherwords,> it was why are the results of these two computations not thesame?.> In this sense success means no more than making Mathematica return> the same answer using the two different routes the original poster> used.> You on the other hand choose to assume that the posting shows that> its> author does not understand not just the mechanism of significance> arithmetic used by Mathematica but also computations with inexact> numbers in general. I do not think this is necessarily the correct> assumption. I also don't see that Mathematica is doing anything> wrong.> After all, one can always check the accuracy of your answer:>> In[1]:=> a = 77617.; b = 33096.;>> In[2]:=> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +> 5.5*b^8 + a/(2*b)>> In[3]:=> f>> Out[3]=> -1.1805916207174113*^21>> In[4]:=> Accuracy[%]>> Out[4]=> -5>> which tells you that it can't be very reliable. What more do you> demand?>> Andrzej>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>>>> Actually, we don't know whether SetAccuracy succeeds, because we>> don't>> know how inexact those numbers really are. If they are known to> more>> digits than shown in the original post, they should be entered with>>> as>> much precision as they deserve. If not, there's no trick or>> algorithm>> that will give the result precision, because the value of f really> is>> in the noise. That is, we have no idea what the value of fshould>> be.>>>> Mathematica's failing is in returning a value without pointing out>> that>> it has no precision.>>>> Bobby>>>> -----Original Message----->> Sent: Monday, September 30, 2002 11:59 AM>>>> Andrzej, Bobby, Peter>>>> It looks as if using SetAccuracy succeeds here because the inexact>> numbers>> that occur have finite binary representations. If we change them>> slightly to>> avoid this then we have to use Rationalize:>>>> 1) Using SetAccuracy>>>> Clear[a,b,f]>>>> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>> (2*b),>> Infinity];>>>> a=77617.1;>> b=33096.1;>>>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>>>> f>>>>- 15640321149084868351974949239896188679725401538739519428131155 14949>> 3891236234>>> 52500771916869370459119776018798804630436149786919912931962574 3010292>> 36>> 3>> 1246>> 75>>>> />>> 10867106143970760551000357827554793888198143135975649579607989 8677435>> 72>> 8240>> 16>> 0653953612982932181371232436367739737604096>>>> 2) Rewriting as fractions>>>> a=776171/10;>> b=330961/10;>>>>f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b ^4-2)+54/10*b^8+a/(2*b)>>>> -(5954133808997234115690303589909929091649391296257/>> 41370125000000)>>>> 3) Using Rationalize>>>> Clear[a,b,f]>>>> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>> (2*b),>> 0];>>>> a=77617.1;>> b=33096.1;>>>> a=Rationalize[a,0];b=Rationalize[b,0];>>>> f>>>> -(5954133808997234115690303589909929091649391296257/>> 41370125000000)>>>> I use Rationalize[. , 0] besause of results like>>>> Rationalize[3.1415959]>>>> 3.1416>>>> Rationalize[3.1415959,0]>>>> 31415959/10000000>> -->> Allan>>>> --------------------->> Allan Hayes>> Mathematica Training and Consulting>> Leicester UK>> www.haystack.demon.co.uk>> hay@haystack.demon.co.uk>> Voice: +44 (0)116 271 4198>>>>> Well, first of of all, your using SetAccuracy and SetPrecisiondoes>>> nothing at all here, since they do not change the value of a or b.>> You>>> should use a = SetAccuracy[a, Infinity] etc. But even then you> won't>>> get the same answer as when you use exact numbers because of the>>> way>>> you evaluate f. Here is the order of evaluation that will give you>> the>>> same answer, and should explain what is going on:>>>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>>>> a = 77617.;>>>>> b = 33096.;>>>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>>>> f>>>> 54767>>> -(-----)>>> 66192>>>> Andrzej Kozlowski>>> Toyama International University>>> JAPAN>>>>>>>>>> Could someone explain what is going on here, please?>>>> In[1]:=>> a = 77617.; b = 33096.;>>>> In[2]:=>> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];>> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>>>> In[4]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8+>> a/(2*b)>>>> In[5]:=>> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>>>> In[6]:=>> f>>>> Out[6]=>> -1.1805916207174113*^21>>>> In[7]:=>> a = 77617; b = 33096;>>>> In[8]:=>> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> (55/10)*b^8 + a/(2*b)>>>> In[9]:=>> g>>>> Out[9]=>> -(54767/66192)>>>> In[10]:=>> N[%]>>>> Out[10]=>> -0.8273960599468214>>>>>> PK>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>> ==== I've been looking over the file and directory manipulation functions in Mathematica 4.1, and I'm not finding good examples of how to test for the existence of a file or directory before I attempt to create, access, or delete it. Are there any good examples of this somewhere?STH ==== FileNames[] does what you want.Steve Luttrell> I've been looking over the file and directory manipulation functions inMathematica> 4.1, and I'm not finding good examples of how to test for the existence of> a file or directory before I attempt to create, access, or delete it. Are> there any good examples of this somewhere?>> STH>Reply-To: kuska@informatik.uni-leipzig.de ==== FileNames[] returns an empty list if there are nofiles. SoFileNames[blub.txt]will return {} if the file does not exist. Jens> I've been looking over the file and directory manipulation functions in Mathematica> 4.1, and I'm not finding good examples of how to test for the existence of> a file or directory before I attempt to create, access, or delete it. Are> there any good examples of this somewhere?> STH ==== If you don't wont error messages all you need to do is to set MinPrecision low enough:In[1]:=$MinPrecision = -3;In[2]:=k = $MachinePrecision;In[3]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), k];In[4]:=a = 77617.; b = 33096.;In[5]:=a = SetAccuracy[a, k];In[6]:=b = SetAccuracy[b, k];In[7]:=fOut[7]=-5.517164009`-2.8311*^19In[8]:=Accuracy[f] Out[8]=-23In[9]:=Precision[f]Out[9]=-3In any case the answer you get is meaningless.> I think I'd prefer that Mathematica gave me a clue -- without being> asked explicitly in JUST the right way that only you know and had> forgotten -- that there's a precision problem.>> Oddly enough, when you DO ask it nicely, you get error messages, but if> you're not aware there's a problem, it lets you go on your merry way,> working with noise.>> Bobby>> -----Original Message-----> Sent: Tuesday, October 01, 2002 8:05 PM> Cc: ÔAllan Hayes'; mathgroup@smc.vnet.net>> So? It's just as it should be, isn't it?>> Andrzej>> Andrzej Kozlowski> Toyama International University> JAPAN> http://sigma.tuins.ac.jp/~andrzej/>> Go one step further:>> Clear[f, a, b, k]>> k = $MachinePrecision;>> f = SetAccuracy[333.75*b^6 +>> a^2*(11*a^2*b^2 - b^6 ->> 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b), k];>> a = 77617.; b = 33096.;>> a = SetAccuracy[a, k];>> b = SetAccuracy[b, k];>> f>> Accuracy[f]>> Precision[f]>> -5.517164009`0*^19>> Accuracy::mnprec:Value -23 would be inconsistent with $MinPrecision;>> bounding by $MinPrecision instead.>> -20>> 0>> Accuracy::mnprec:Value !(-23) would be inconsistent with>> $MinPrecision; >> bounding by $MinPrecision instead.>> See that? NO precision.>> Bobby>> -----Original Message----->> Sent: Tuesday, October 01, 2002 5:53 PM>> Cc: drbob@bigfoot.com>> You are of course right, I forgot that Mathematica does not try to> keep>> precision or accuracy of machine arithmetic computations. But I think>> the actual precision you set need not be higher than machine> precision,>> it just has to be set explicitely (is that right?). For example:>> In[1]:=>> Clear[f,a,b,k]>> In[2]:=>> k = $MachinePrecision;>> In[3]:=>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/>> (2*b),k];>> In[4]:=>> a=77617.;b=33096.;>> In[5]:=>> a=SetAccuracy[a,k];>> In[6]:=>> b=SetAccuracy[b,k];>> In[7]:=>> f>> Out[7]=>> !((-5.51716400890319`-2.8311*^19))>> In[8]:=>> Accuracy[f]>> Accuracy::mnprec: Value -23 would be inconsistent with $MinPrecision;>> bounding by $MinPrecision instead.>> Out[8]=>> -20>> Andrzej>>> Andrzej>> Yes, like you I took the original question to be about how to get the>>> result> of using the naive rational versions in place of the inexact numbers.> Bobby raises the question of how we might know accuracy of the> result.>> You answer this with>> a = 77617.; b = 33096.;>>>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>>>> In[3]:=>> f>>>> Out[3]=>> -1.1805916207174113*^21>>>> In[4]:=>> Accuracy[%]>>>> Out[4]=>> -5>> However this computation is done in machine arithmetic, which means> that> Mathematica keeps no check on the accuracy and precision of the> computation,> and Mathematica gives the default accuracy value without any real> signifcance:>> $MachinePrecision - Log[10,Abs[f]]//Round>> -5>> To get meaningful accuracy and precision values we need to force the> computation to be in bignums (bigßoat, arbitrary precision)> arithmetic.> Mathematica then keeps track of the accuracy and precision that it> can> guarantee.>> Clear[f,a,b,k]> k=50;>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/> (2*b),k];> a=77617.;b=33096.;> a=SetAccuracy[a,k];> b=SetAccuracy[b,k];> f>> -0.82739605995>> Accuracy[f]>> 11>> Precision[f]>> 11>> Which tells us that the error in the computed value of f is not more>>> than>> 10^-11>>> The above results are rounded. More accurately we get>> Accuracy[f, Round->False]>> 11.4956>> Precision[f, Round->False]>> 11.4133>> There are several related issues here:> - is the precision (accuracy) of rhe input known?> - how does Mathematica interpret what one gives it?> - how does Mathematica go about the calculation?>> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>>>> It seems clear to me that what Allan and what you mean by succeeds>> here refer to quite different things and your objection is therefore>> beside the point. There are obviously two ways in which one can>> interpret the original posting. The first interpretation, which> Allan>> and myself adopted, was that the question concerned purely the>> computational mechanism of Mathematica. Or, to put it in other> words,>> it was why are the results of these two computations not the> same?.>> In this sense success means no more than making Mathematica return>> the same answer using the two different routes the original poster>> used.>> You on the other hand choose to assume that the posting shows that>> its>> author does not understand not just the mechanism of significance>> arithmetic used by Mathematica but also computations with inexact>> numbers in general. I do not think this is necessarily the correct>> assumption. I also don't see that Mathematica is doing anything>> wrong.>> After all, one can always check the accuracy of your answer:>>>> In[1]:=>> a = 77617.; b = 33096.;>>>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>>>> In[3]:=>> f>>>> Out[3]=>> -1.1805916207174113*^21>>>> In[4]:=>> Accuracy[%]>>>> Out[4]=>> -5>>>> which tells you that it can't be very reliable. What more do you>> demand?>>>> Andrzej>>>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>>>>> Actually, we don't know whether SetAccuracy succeeds, because we>>> don't>>> know how inexact those numbers really are. If they are known to>> more>>> digits than shown in the original post, they should be entered with>>> as>>> much precision as they deserve. If not, there's no trick or>>> algorithm>>> that will give the result precision, because the value of f really>> is>>> in the noise. That is, we have no idea what the value of f> should>>> be.>>>> Mathematica's failing is in returning a value without pointing out>>> that>>> it has no precision.>>>> Bobby>>>> -----Original Message----->>> Sent: Monday, September 30, 2002 11:59 AM>>>> Andrzej, Bobby, Peter>>>> It looks as if using SetAccuracy succeeds here because the inexact>>> numbers>>> that occur have finite binary representations. If we change them>>> slightly to>>> avoid this then we have to use Rationalize:>>>> 1) Using SetAccuracy>>>> Clear[a,b,f]>>>>> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>>> (2*b),>>> Infinity];>>>> a=77617.1;>>> b=33096.1;>>>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>>>> f>>>>>> - 15640321149084868351974949239896188679725401538739519428131155 14949>>> 3891236234>>>> 52500771916869370459119776018798804630436149786919912931962574 3010292>>> 36>>> 3>>> 1246>>> 75>>>> />>> 108671061439707605510003578275547938881981431359756495796079898 677435>>> 72>>> 8240>>> 16>>> 0653953612982932181371232436367739737604096>>>> 2) Rewriting as fractions>>>> a=776171/10;>>> b=330961/10;>>>>> f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>>>> -(5954133808997234115690303589909929091649391296257/>>> 41370125000000)>>>> 3) Using Rationalize>>>> Clear[a,b,f]>>>>> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>>> (2*b),>>> 0];>>>> a=77617.1;>>> b=33096.1;>>>> a=Rationalize[a,0];b=Rationalize[b,0];>>>> f>>>> -(5954133808997234115690303589909929091649391296257/>>> 41370125000000)>>>>> I use Rationalize[. , 0] besause of results like>>>> Rationalize[3.1415959]>>>> 3.1416>>>> Rationalize[3.1415959,0]>>>> 31415959/10000000>>> -->>> Allan>>>> --------------------->>> Allan Hayes>>> Mathematica Training and Consulting>>> Leicester UK>>> www.haystack.demon.co.uk>>> hay@haystack.demon.co.uk>>> Voice: +44 (0)116 271 4198>>>>>> Well, first of of all, your using SetAccuracy and SetPrecision> does>> nothing at all here, since they do not change the value of a or b.>>>> You>> should use a = SetAccuracy[a, Infinity] etc. But even then you>> won't>> get the same answer as when you use exact numbers because of the>> way>> you evaluate f. Here is the order of evaluation that will give you>>>> the>> same answer, and should explain what is going on:>>>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>>>> a = 77617.;>>>>>> b = 33096.;>>>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>>>> f>>>> 54767>> -(-----)>> 66192>>>> Andrzej Kozlowski>> Toyama International University>> JAPAN>>>>>>>>>>> Could someone explain what is going on here, please?>>>>>> In[1]:=>>> a = 77617.; b = 33096.;>>>>>> In[2]:=>>> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];>>> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>>>>>> In[4]:=>>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8> +>>> a/(2*b)>>>>>> In[5]:=>>> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>>>>>> In[6]:=>>> f>>>>>> Out[6]=>>> -1.1805916207174113*^21>>>>>> In[7]:=>>> a = 77617; b = 33096;>>>>>> In[8]:=>>> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>>> (55/10)*b^8 + a/(2*b)>>>>>> In[9]:=>>> g>>>>>> Out[9]=>>> -(54767/66192)>>>>>> In[10]:=>>> N[%]>>>>>> Out[10]=>>> -0.8273960599468214>>>>>>> PK>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>>>>>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== >>In any case the answer you get is meaningless.Precisely.Bobby-----Original Message----- 121*b^4 - 2) + 5.5*b^8 + a/(2*b), k];In[4]:=a = 77617.; b = 33096.;In[5]:=a = SetAccuracy[a, k];In[6]:=b = SetAccuracy[b, k];In[7]:=fOut[7]=-5.517164009`-2.8311*^19In[8]:=Accuracy[f] Out[8]=-23In[9]:=Precision[f]Out[9]=-3In any case the answer you get is meaningless.> I think I'd prefer that Mathematica gave me a clue -- without being> asked explicitly in JUST the right way that only you know and had> forgotten -- that there's a precision problem.>> Oddly enough, when you DO ask it nicely, you get error messages, butif> you're not aware there's a problem, it lets you go on your merry way,> working with noise.>> Bobby>> -----Original Message-----> Sent: Tuesday, October 01, 2002 8:05 PM> Cc: ÔAllan Hayes'; mathgroup@smc.vnet.net>> So? It's just as it should be, isn't it?>> Andrzej>> Andrzej Kozlowski> Toyama International University> JAPAN> http://sigma.tuins.ac.jp/~andrzej/>> Go one step further:>> Clear[f, a, b, k]>> k = $MachinePrecision;>> f = SetAccuracy[333.75*b^6 +>> a^2*(11*a^2*b^2 - b^6 ->> 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b), k];>> a = 77617.; b = 33096.;>> a = SetAccuracy[a, k];>> b = SetAccuracy[b, k];>> f>> Accuracy[f]>> Precision[f]>> -5.517164009`0*^19>> Accuracy::mnprec:Value -23 would be inconsistent with $MinPrecision;>> bounding by $MinPrecision instead.>> -20>> 0>> Accuracy::mnprec:Value !(-23) would be inconsistent with>> $MinPrecision; >> bounding by $MinPrecision instead.>> See that? NO precision.>> Bobby>> -----Original Message----->> Sent: Tuesday, October 01, 2002 5:53 PM>> Cc: drbob@bigfoot.com>> You are of course right, I forgot that Mathematica does not try to> keep>> precision or accuracy of machine arithmetic computations. But I think>> the actual precision you set need not be higher than machine> precision,>> it just has to be set explicitely (is that right?). For example:>> In[1]:=>> Clear[f,a,b,k]>> In[2]:=>> k = $MachinePrecision;>> In[3]:=>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/>> (2*b),k];>> In[4]:=>> a=77617.;b=33096.;>> In[5]:=>> a=SetAccuracy[a,k];>> In[6]:=>> b=SetAccuracy[b,k];>> In[7]:=>> f>> Out[7]=>> !((-5.51716400890319`-2.8311*^19))>> In[8]:=>> Accuracy[f]>> Accuracy::mnprec: Value -23 would be inconsistent with $MinPrecision;>> bounding by $MinPrecision instead.>> Out[8]=>> -20>> Andrzej>>> Andrzej>> Yes, like you I took the original question to be about how to getthe>>> result> of using the naive rational versions in place of the inexactnumbers.> Bobby raises the question of how we might know accuracy of the> result.>> You answer this with>> a = 77617.; b = 33096.;>>>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>>>> In[3]:=>> f>>>> Out[3]=>> -1.1805916207174113*^21>>>> In[4]:=>> Accuracy[%]>>>> Out[4]=>> -5>> However this computation is done in machine arithmetic, which means> that> Mathematica keeps no check on the accuracy and precision of the> computation,> and Mathematica gives the default accuracy value without any real> signifcance:>> $MachinePrecision - Log[10,Abs[f]]//Round>> -5>> To get meaningful accuracy and precision values we need to force the> computation to be in bignums (bigßoat, arbitrary precision)> arithmetic.> Mathematica then keeps track of the accuracy and precision that it> can> guarantee.>> Clear[f,a,b,k]> k=50;>> f=SetAccuracy[333.75*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.5*b ^8+a/> (2*b),k];> a=77617.;b=33096.;> a=SetAccuracy[a,k];> b=SetAccuracy[b,k];> f>> -0.82739605995>> Accuracy[f]>> 11>> Precision[f]>> 11>> Which tells us that the error in the computed value of f is notmore>>> than>> 10^-11>>> The above results are rounded. More accurately we get>> Accuracy[f, Round->False]>> 11.4956>> Precision[f, Round->False]>> 11.4133>> There are several related issues here:> - is the precision (accuracy) of rhe input known?> - how does Mathematica interpret what one gives it?> - how does Mathematica go about the calculation?>> --> Allan>> ---------------------> Allan Hayes> Mathematica Training and Consulting> Leicester UK> www.haystack.demon.co.uk> hay@haystack.demon.co.uk> Voice: +44 (0)116 271 4198>>message>> It seems clear to me that what Allan and what you mean bysucceeds>> here refer to quite different things and your objection istherefore>> beside the point. There are obviously two ways in which one can>> interpret the original posting. The first interpretation, which> Allan>> and myself adopted, was that the question concerned purely the>> computational mechanism of Mathematica. Or, to put it in other> words,>> it was why are the results of these two computations not the> same?.>> In this sense success means no more than making Mathematicareturn>> the same answer using the two different routes the original poster>> used.>> You on the other hand choose to assume that the posting shows that>> its>> author does not understand not just the mechanism of significance>> arithmetic used by Mathematica but also computations with inexact>> numbers in general. I do not think this is necessarily the correct>> assumption. I also don't see that Mathematica is doing anything>> wrong.>> After all, one can always check the accuracy of your answer:>>>> In[1]:=>> a = 77617.; b = 33096.;>>>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>>>> In[3]:=>> f>>>> Out[3]=>> -1.1805916207174113*^21>>>> In[4]:=>> Accuracy[%]>>>> Out[4]=>> -5>>>> which tells you that it can't be very reliable. What more do you>> demand?>>>> Andrzej>>>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>>>>> Actually, we don't know whether SetAccuracy succeeds, because we>>> don't>>> know how inexact those numbers really are. If they are known to>> more>>> digits than shown in the original post, they should be enteredwith>>> as>>> much precision as they deserve. If not, there's no trick or>>> algorithm>>> that will give the result precision, because the value of f really>> is>>> in the noise. That is, we have no idea what the value of f> should>>> be.>>>> Mathematica's failing is in returning a value without pointing out>>> that>>> it has no precision.>>>> Bobby>>>> -----Original Message----->>> Sent: Monday, September 30, 2002 11:59 AM>>>> Andrzej, Bobby, Peter>>>> It looks as if using SetAccuracy succeeds here because the inexact>>> numbers>>> that occur have finite binary representations. If we change them>>> slightly to>>> avoid this then we have to use Rationalize:>>>> 1) Using SetAccuracy>>>> Clear[a,b,f]>>>>> f=SetAccuracy[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>>> (2*b),>>> Infinity];>>>> a=77617.1;>>> b=33096.1;>>>> a=SetAccuracy[a,Infinity];b=SetAccuracy[b,Infinity ];>>>> f>>>>>> - 15640321149084868351974949239896188679725401538739519428131155 14949>>> 3891236234>>>> 52500771916869370459119776018798804630436149786919912931962574 3010292>>> 36>>> 3>>> 1246>>> 75>>>> />>> 108671061439707605510003578275547938881981431359756495796079898 677435>>> 72>>> 8240>>> 16>>> 0653953612982932181371232436367739737604096>>>> 2) Rewriting as fractions>>>> a=776171/10;>>> b=330961/10;>>>>> f=33374/100*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+54/10*b^8+a/(2 *b)>>>> -(5954133808997234115690303589909929091649391296257/>>> 41370125000000)>>>> 3) Using Rationalize>>>> Clear[a,b,f]>>>>> f=Rationalize[333.74*b^6+a^2*(11*a^2*b^2-b^6-121*b^4-2)+5.4*b ^8+a/>>> (2*b),>>> 0];>>>> a=77617.1;>>> b=33096.1;>>>> a=Rationalize[a,0];b=Rationalize[b,0];>>>> f>>>> -(5954133808997234115690303589909929091649391296257/>>> 41370125000000)>>>>> I use Rationalize[. , 0] besause of results like>>>> Rationalize[3.1415959]>>>> 3.1416>>>> Rationalize[3.1415959,0]>>>> 31415959/10000000>>> -->>> Allan>>>> --------------------->>> Allan Hayes>>> Mathematica Training and Consulting>>> Leicester UK>>> www.haystack.demon.co.uk>>> hay@haystack.demon.co.uk>>> Voice: +44 (0)116 271 4198>>>>>> Well, first of of all, your using SetAccuracy and SetPrecision> does>> nothing at all here, since they do not change the value of a orb.>>>> You>> should use a = SetAccuracy[a, Infinity] etc. But even then you>> won't>> get the same answer as when you use exact numbers because of the>> way>> you evaluate f. Here is the order of evaluation that will giveyou>>>> the>> same answer, and should explain what is going on:>>>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*>> b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity];>>>> a = 77617.;>>>>>> b = 33096.;>>>> a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];>>>> f>>>> 54767>> -(-----)>> 66192>>>> Andrzej Kozlowski>> Toyama International University>> JAPAN>>>>>>>>>>> Could someone explain what is going on here, please?>>>>>> In[1]:=>>> a = 77617.; b = 33096.;>>>>>> In[2]:=>>> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];>>> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];>>>>>> In[4]:=>>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8> +>>> a/(2*b)>>>>>> In[5]:=>>> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];>>>>>> In[6]:=>>> f>>>>>> Out[6]=>>> -1.1805916207174113*^21>>>>>> In[7]:=>>> a = 77617; b = 33096;>>>>>> In[8]:=>>> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>>> (55/10)*b^8 + a/(2*b)>>>>>> In[9]:=>>> g>>>>>> Out[9]=>>> -(54767/66192)>>>>>> In[10]:=>>> N[%]>>>>>> Out[10]=>>> -0.8273960599468214>>>>>>> PK>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>>>>>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== >Many thanks to all who replied.>>The original problem was as follows:>>In a presentation I wish to use Plot to generate a sequence of frames and>then animate them. The problem is that the audience sees the animation>twice. Once when the frames are being generated and then again after I have>closed the group and double clicked on the top graphic. However, the first>showing during generation is enough (but uncontrolled).>>Is it possible to tidy up the generation of the graphic so that it becomes>the animation?>There were two main solutions which I now apply to my real problem and not>the simple, generic, problem in the original post.>The real problem was how to build up a probably density function (PDF) in>real time. In the examples below I redraw the PDF every time I add 10>points.>>Initialise>><<<<< JLink`;>wb=WeibullDistribution[ 2.101349094155377,22.58126779173235`];>midpts=Table[i,{i, 0.5,50,1}];>>Solution from Omega Consulting>>GraphicCell[graphics_] :=> Cell[GraphicsData[PostScript, DisplayString[graphics]],Graphics]>>Block[{$ DisplayFunction=Identity, graphs},> data={};> graphs => Table[data=Flatten[Join[data,RandomArray[wb,10]]];> freq=BinCounts[data,{0,50,1}];> GraphicCell[> BarChart[Transpose[{freq,midpts}],ImageSize ->500] ], {500}];> NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs ,Closed]]];> SelectionMove[EvaluationNotebook[], All, GeneratedCell];> FrontEndExecute[{FrontEndToken[EvaluationNotebook[],> SelectionAnimate]}]> ]>>This solution works but it generates 500 frames and sometimes exceeds the>memory.>The paradigm here is generate all frames, then animate all frames. We>really need a loop that does:>> generate next frame, delete last frame, show next frame>>Is it possible to do this?Yes, however, I thought you didn't want to see the selection bar moving around during the animation. That's why I chose to generate the whole animation in one shot. Also, when you write the new cell over the old cell there is a ßash between frames as the old frame is deleted. Here's an example of a frame-by-frame method.GraphicCell[graphics_] := Cell[GraphicsData[PostScript, DisplayString[graphics]],Graphics]CellPrint[Cell[, Graphics]];Block[{$DisplayFunction=Identity}, Do[ SelectionMove[EvaluationNotebook[], All, GeneratedCell]; NotebookWrite[EvaluationNotebook[], GraphicCell[Plot[x y,{x,0,1}, PlotRange->{0,50}]]], {y,50} ] ]Also, if you add ShowCellBracket->False to GraphicCell and a Pause to the loop, then things get much better visually.---------------------------------------------------- ----------Omega ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== I am trying to use FindRoot in mathematica 4.0 to find the zeros of a complex-valued function of one complex variable. In particular, I am looking for the one root with a positive imaginary part. I have a rough approximation for where the root should be, and this is good enough to give a reasonable guess.However, there are always two other roots near the one I want - one with 0 imaginary part and another with negative imag part. (For those who are interested, the zeros are the roots of the dispersion relation for a plasma interacting with a laser). Sometimes FindRoot picks up one of these instead of the one I want.So, I'd like to tell mathematica to look for a root only in a certain rectangular region of the complex plane. Well, if I could tell it, Ôlook for roots with imag. part > something', I'd be happy too.I tried specifying complex values for the start and stop points of an interval, hoping mathematica would interpret these as the corners of a rectangle. No such luck.Any help would be greatly appreciated.I'd also like to point out that this and other issues about complex roots are not clearly addressed in the built-in help files. ==== Just a shot: Try using the DampingFactor option to force FindRoot to take smaller steps.---Selwyn Hollis ==== > I am trying to use FindRoot in mathematica 4.0 to find the zeros of a> complex-valued function of one complex variable. In particular, I am> looking for the one root with a positive imaginary part. I have a rough> approximation for where the root should be, and this is good enough to> give a reasonable guess.> However, there are always two other roots near the one I want - one with> 0 imaginary part and another with negative imag part. (For those who> are interested, the zeros are the roots of the dispersion relation for a> plasma interacting with a laser). Sometimes FindRoot picks up one of> these instead of the one I want.> So, I'd like to tell mathematica to look for a root only in a certain> rectangular region of the complex plane. Well, if I could tell it,> Ôlook for roots with imag. part > something', I'd be happy too.> I tried specifying complex values for the start and stop points of an> interval, hoping mathematica would interpret these as the corners of a> rectangle. No such luck.> Any help would be greatly appreciated.> I'd also like to point out that this and other issues about complex> roots are not clearly addressed in the built-in help files.> I believe it is difficult to restrict FindRoot. Below are severalsuggestions. (1) You might tryrigging the function, say withg[x_?NumberQ] := f[x] + If[Im[x]<=0,1000,0](2) If you have version 4.2 a related approach would be to takeadvantage of constrained optimization and doNMinimize[{Re[f[x,y]]^2 + Im[f[x,y]]^2, rectangle range constraints},{x,y}]or something along those lines.(3) If proximity of the other roots is the main problem it might bealleviated by rescaling your variable.(4) Alternatively you could write your function as a pair of real valuedfunctions of two real valued arguments. Then you can use Interval tosplit the rectangle into parts, keeping subrectangles for which {0,0}lives in f[Interval[x],Interval[y]] where Interval[x], for example, is ashorthand for an interval for the x part of the rectangle being split.Daniel LichtblauWolfram ResearchReply-To: kuska@informatik.uni-leipzig.de ==== and solving the real and imaginary part for for z->x+I*y withFindRoot[Evaluate[({Re[#] == 0, Im[#] == 0} &[ z^3 - 1]) /. z -> x + I y], {x, -3/2, 0}, {y, 0.5, 0.9}]helps not ? Jens> I am trying to use FindRoot in mathematica 4.0 to find the zeros of a> complex-valued function of one complex variable. In particular, I am> looking for the one root with a positive imaginary part. I have a rough> approximation for where the root should be, and this is good enough to> give a reasonable guess.> However, there are always two other roots near the one I want - one with> 0 imaginary part and another with negative imag part. (For those who> are interested, the zeros are the roots of the dispersion relation for a> plasma interacting with a laser). Sometimes FindRoot picks up one of> these instead of the one I want.> So, I'd like to tell mathematica to look for a root only in a certain> rectangular region of the complex plane. Well, if I could tell it,> Ôlook for roots with imag. part > something', I'd be happy too.> I tried specifying complex values for the start and stop points of an> interval, hoping mathematica would interpret these as the corners of a> rectangle. No such luck.> Any help would be greatly appreciated.> I'd also like to point out that this and other issues about complex> roots are not clearly addressed in the built-in help files.> ==== The last part of my message you are quoting was completely wrong, as was pointed out by Allan Hayes. Mathematica does not track precision of machine arithmetic computations. In order for Mathematica to give reliable information about the precision of a computation you have to explicitly set the precision of all the numerical quantities.Your own example at the bottom simply shows you have not understood the evaluation mechanism of Mathematica. What you are doing is this:In[1]:=a = SetAccuracy[77617., Infinity];b = SetAccuracy[33096., Infinity];At this point you have converted a and be to have the following exact values:In[3]:=aOut[3]=77617In[4]:=bOut[4]=33096Next you evaluate:f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), Infinity]but this is a two step process (which is what you seem not to have grasped). First Mathematica computes:In[5]:=333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b)Out[5]=1.1805916207174113*^21Now, because there were machine ßoats in the formula (333.75 and 5.5 ) the whole expression was computed using machine arithmetic without keeping track of precision. The answer is therefore completely inacurate. Mathematica returns the purely formal accuracy:In[6]:=Accuracy[%]Out[6]=-5But the second part of your evaluation tells it to take this inaccurate answer and convert it to an exact number.In[7]:=SetAccuracy[%%, Infinity]Out[7]=1180591620717411303424In[8]:=Accuracy[%]Out[8] =InfinityBut of course doing this is meaningless, after converting an inexact answer to an exact number does not make it a an exact answer!Of course had you evaluated f before you assigned the values to a and b you would not have encountered the problem because no machine reals would have appeared in the computation. ALternatively you might have used:f = SetAccuracy[333.75, Infinity]*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + SetAccuracy[5.5, Infinity]*b^8 + a/(2*b)Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/>> It seems clear to me that what Allan and what you mean by succeeds>> here refer to quite different things and your objection is therefore>> beside the point. There are obviously two ways in which one can>> interpret the original posting. The first interpretation, which Allan>> and myself adopted, was that the question concerned purely the>> computational mechanism of Mathematica. Or, to put it in other words,>> it was why are the results of these two computations not the same?.>> In this sense success means no more than making Mathematica return>> the same answer using the two different routes the original poster >> used.>> You on the other hand choose to assume that the posting shows that its>> author does not understand not just the mechanism of significance>> arithmetic used by Mathematica but also computations with inexact>> numbers in general. I do not think this is necessarily the correct>> assumption. I also don't see that Mathematica is doing anything wrong.>> After all, one can always check the accuracy of your answer:>> In[1]:=>> a = 77617.; b = 33096.;>> In[2]:=>> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +>> 5.5*b^8 + a/(2*b)>> In[3]:=>> f>> Out[3]=>> -1.1805916207174113*^21>> In[4]:=>> Accuracy[%]>> Out[4]=>> -5>> which tells you that it can't be very reliable. What more do you >> demand?>> As you are dealing here only with machine-precision numbers, your>> When you do calculations with arbitrary-precision numbers, as> discussed in the previous section, Mathematica always keeps track of> the precision of your results, and gives only those digits which are> known to be correct, given the precision of your input. When you do> calculations with machine-precision numbers, however, Mathematica> always gives you a machine-ç.8dprecision result, whether or not all the> digits in the result can, in fact, be determined to be correct on the> basis of your input. >> In practice, to rely on a numerical result, you ALWAYS have to check> its accuracy. How reliable is Accuracy anyway?>> In[1]:=> a = SetAccuracy[77617., Infinity];> b = SetAccuracy[33096., Infinity];>> In[3]:=> f = SetAccuracy[333.75*b^6 +> a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 +> a/(2*b), Infinity]>> Out[3]=> 1180591620717411303424>> In[4]:=> Accuracy[f]>> Out[4]=> Infinity>> We got completely wrong result with Infinite accuracy. In conclusion,> one can not rely on Accuracy. Checking numerical results in> Mathematica sounds like a tough task.:-)>> --PK> Andrzej>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/> [...]>>> ==== leap to MathGroup so I'll respond there as well to some of the issuesraised herein.> Daniel,>>The precision/accuracy tracking mechanism will generally let you know,>>in some fashion, that you have no trustworthy digits. But it is up to>>the user to check that sort of thing.> In this case Mathematica did NOT let us know, in any fashion, that we> had no trustworthy digits. Precision and Accuracy outputs were> completely misleading. (16 and -5 respectively.) Precision, in this case, is itself a bit misleading. As I recall machinearithmetic was in use. For that domain just regard 16 as the definitionof precision. Moreover no tracking is done. It is only when bignums areused that significance arithmetic will be at play.By the way, the distinction between precision for machine numbers vs.bignums will be more clear with our next big release. At present onedoes not know if 16 refers to a machine number or a bignum of that sameprecision.> Even Andrzej> Kozlowski, who's adept in Mathematica, thought that would be meaningful,> and never came up with a better way to check (other than using infinite> precision for numbers that probably aren't known that exactly). Peter> Kosta demonstrated that he could get a completely erroneous answer with> Infinite precision.> I blame the problem primarily, and I don't think there's any way to make> the answer meaningful. That's not Mathematica's fault at all, and users> need to be aware of that old maxim: garbage in, garbage out.Right. One cannot artificially raise precision or accuracy after thefact and expect a meaningful result. Again, had significance arithmeticbeen used, I think there would have been adequate information to assessthe problem.> comes up with a 22-digit result, it doesn't take much sophistication to> realize the answer can't have 16-digit precision.> Here's an even more extreme result:> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 -> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50];> a = 77617.; b = 33096.;> f> Precision[f]> -1.180591620717411303424`71.0721*^21> 71> 71.0721 digits of precision? I don't think so!! It's correct, albeit the number is garbage. You start with a number thatis, in your words, all noise. (I assume you had set a and b before f,because otherwise I get a different result for Precision[f]). Nowf ~ 10^21, and so has accuracy of around 71 digits. Garbagenotwithstanding, this behavior is entirely correct and as it should be.> We can do the following instead:> x = Interval[333.75];> y = Interval[5.5];> a = Interval[77617.];> b = Interval[33096.];> x*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + y*b^8 + a/(2*b)> Interval[{-4.486248158726164*^22, 4.2501298345826815*^22}]> and that looks like the right answer, finally!! I like that method.Yes, it's a useful way to show that the result has no digits to trust.Actually you can achieve a similar effect using significance arithmetic,as below.x = SetPrecision[33375/100, 16];y = SetPrecision[11/2, 16];a = SetPrecision[77617, 16];b = SetPrecision[33096, 16];In[18]:= InputForm[x*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + y*b^8+ a/(2*b)]Out[18]//InputForm= -1.1339143158169`0*^14This tells you there are NO reliable digits. The advantage to this isthat is is more ßexible than interval arithmetic in Mathematica whichwill not, for example, deal well with complex-valued functions orcomplex domains. Also significance arithmetic (aka arbitrary precisionarithmetic) is much faster than interval arithmetic for large problems.> However, that doesn't change the fact that Accuracy, Precision, and> SetAccuracy appear to be completely useless.My own experience is that they are quite useful. But only if used withcare and in appropriate ways. Raising accuracy after the fact does notfall into that category.> I haven't seen an example> in which they did what anyone (but you) thought they should do.> > BobbyMaybe. But, curiously enough, I am a user rather than developer when itcomes to that stuff. I used the precision mechanism alot in polynomialNSolve, and it did indeed work to my liking. Which counts for somethingfrom the ordinary users' perspective, because now NSolve works betterthan it otherwise might.> -----Original Message----->> I think I'd prefer that Mathematica gave me a clue -- without being> asked explicitly in JUST the right way that only you know and had> > forgotten -- that there's a precision problem.>> Oddly enough, when you DO ask it nicely, you get error messages, but> if> you're not aware there's a problem, it lets you go on your merry way,> working with noise.>> Bobby> Mathematica is not a mind reader. But the evaluation sequence, while> complicated, is reasonably well documented. If you perform machine> arithmetic, or for that matter significance arithmetic, and there is> massive cancellation error, no use of SetAccuracy after the fact will> fix it.> The precision/accuracy tracking mechanism will generally let you know,> in some fashion, that you have no trustworthy digits. But it is up to> the user to check that sort of thing. It is not obvious to me what sort> of error the software might notice to report. If you have a concise> example of input, and expected output, I can look further. I've not seen> anything in this thread that struck me as a failure of the software to> warn the user, but maybe I missed something.> DanielDaniel LichtblauWolfram Research ==== > The more I play with the example the more depressing it gets. Start> with ßoating point numbers but explicitely arbitrary-precision ones.> In[1]:=> a=77617.00000000000000000000000000000;> b=33095.00000000000000000000000000000;> In[3]:=> !(333.7500000000000000000000000000000 b^6 + a^2 ((11 a^2> b^2 - > b^6 - 121 b^4 - 2)) + 5.500000000000000000000000000000 b^8 +> a/(2> b))> Out[3]=> !((-4.78339168666055402578083604864320577443814`26.6715 *^32))> In[4]:=> Accuracy[%]> Out[4]=> -6> Due to the manual section 3.1.6:> When you do calculations with arbitrary-precision numbers, as> discussed in the previous section, Mathematica always keeps track of> the precision of your results, and gives only those digits which are> known to be correct, given the precision of your input. When you do> calculations with machine-precision numbers, however, Mathematica> always gives you a machine[CapitalEth]precision result, whether or not all the> digits in the result can, in fact, be determined to be correct on the> basis of your input. > Because I started with arbitrary-precision numbers Mathematica should display> only those digits that are correct, that is none.No, 26 digits are correct (check Precision instead of Accuracy to seethis).You appear to be showing output in InputForm. If you use OutputForm orStandardForm only 26 digits will be shown. 32Out[3]= -4.7833916866605540257808360 10InputForm is showing more because it exposes bad digits as well asgood ones.> To relax a bit, set a new input cell to StandardForm and type> 77617.000000000000000000000000000000000> Convert it to InputForm. You get> 77616.999999999999999999999999999999999999999999952771` 37.9031> Convert back to StandardForm> 77616.99999999999999999999999999999999999999999976637`37.9031 > Again to InputForm> 77616.99999999999999999999999999999999999999999963735`37.9031 > Back to StandardForm> 77616.99999999999999999999999999999999999999999951376`37.9031 > See what you can get if you have enough patience or a small program.> PKAgreed, it's not very pretty. I am uncertain as to whether thisindicates a bug in StandardForm or elsewhere in the underlying numericscode, and will defer to our numerics experts on that issue. My guess isit is a bug if only because it violates the spirit of IEEE arithmeticwherein ßoats that have integer values should be representable as such(or something to that effect). I will point out, however, that the twonumbers in question are equal to the specified precision. Also itappears to be improved in our development kernel.Daniel LichtblauWolfram Research ==== The more I play with the example the more depressing it gets. Startwith ßoating point numbers but explicitely arbitrary-precision ones.In[1]:=a=77617.00000000000000000000000000000;b= 33095.00000000000000000000000000000;In[3]:=!( 333.7500000000000000000000000000000 b^6 + a^2 ((11 a^2b^2 - b^6 - 121 b^4 - 2)) + 5.500000000000000000000000000000 b^8 +a/(2 b))Out[3]=!((- 4.78339168666055402578083604864320577443814`26.6715*^32)) In[4]:=Accuracy[%]Out[4]=-6Due to the manual section 3.1.6:When you do calculations with arbitrary-precision numbers, asdiscussed in the previous section, Mathematica always keeps track ofthe precision of your results, and gives only those digits which areknown to be correct, given the precision of your input. When you docalculations with machine-precision numbers, however, Mathematicaalways gives you a machine[CapitalEth]precision result, whether or not all thedigits in the result can, in fact, be determined to be correct on thebasis of your input. Because I started with arbitrary-precision numbers Mathematica should displayonly those digits that are correct, that is none.To relax a bit, set a new input cell to StandardForm and type 77617.000000000000000000000000000000000Convert it to InputForm. You get77616.999999999999999999999999999999999999999999952771` 37.9031Convert back to StandardForm77616.99999999999999999999999999999999999999999976 637`37.9031Again to InputForm77616.99999999999999999999999999999999999999999963735 `37.9031Back to StandardForm77616.99999999999999999999999999999999999999999951 376`37.9031See what you can get if you have enough patience or a small program.PK ==== > The more I play with the example the more depressing it gets. Start> with ßoating point numbers but explicitely arbitrary-precision ones.> In[1]:=> a=77617.00000000000000000000000000000;> b=33095.00000000000000000000000000000;> In[3]:=> !(333.7500000000000000000000000000000 b^6 + a^2 ((11 a^2> b^2 - > b^6 - 121 b^4 - 2)) + 5.500000000000000000000000000000 b^8 +> a/(2> b))> Out[3]=> !((-4.78339168666055402578083604864320577443814`26.6715 *^32))> In[4]:=> Accuracy[%]> Out[4]=> -6> Due to the manual section 3.1.6:> When you do calculations with arbitrary-precision numbers, as> discussed in the previous section, Mathematica always keeps track of> the precision of your results, and gives only those digits which are> known to be correct, given the precision of your input. When you do> calculations with machine-precision numbers, however, Mathematica> always gives you a machine[CapitalEth]precision result, whether or not all the> digits in the result can, in fact, be determined to be correct on the> basis of your input. > Because I started with arbitrary-precision numbers Mathematica should display> only those digits that are correct, that is none.I retract the above comment. I did not notice that was an error in the input. b=33095.00000000000000000000000000000intstead of intended b=33096.00000000000000000000000000000I am sorry for the mistake.PK> To relax a bit, set a new input cell to StandardForm and type > 77617.000000000000000000000000000000000> Convert it to InputForm. You get> 77616.999999999999999999999999999999999999999999952771` 37.9031> Convert back to StandardForm> 77616.99999999999999999999999999999999999999999976637`37.9031 > Again to InputForm> 77616.99999999999999999999999999999999999999999963735`37.9031 > Back to StandardForm> 77616.99999999999999999999999999999999999999999951376`37.9031 > See what you can get if you have enough patience or a small program.> PK ==== > The last part of my message you are quoting was completely wrong, as > was pointed out by Allan Hayes. Mathematica does not track precision of > machine arithmetic computations. In order for Mathematica to give > reliable information about the precision of a computation you have to > explicitly set the precision of all the numerical quantities.> Your own example at the bottom simply shows you have not understood the > evaluation mechanism of Mathematica. Just opposite, thanks to you and other participants, I completelyunderstood it. SetAccuracy just takes anything and calls it accurate.This behavior is useless if not stupid. It was apparently intended byMathematica developers but that doesn't make it right.On a side note, I hate the argument It is descibed in the manual,therefore it is correct. Legal doesn't mean right. Besides there isno supreme court here to overrule some stupid law. :-)PK> [...] ==== >Dear Colleagues,>>I calculated:>>Sum[1/Prime[n], {n, 15000}] // N>>Result: 2.74716>>Now I wonder if this sum will converge or keep on growing, albeit very>slowly.>Matthias Bode>Sal. Oppenheim jr. & Cie. KGaA>Koenigsberger Strasse 29>D-60487 Frankfurt am Main>GERMANY>Mobile: +49(0)172 6 74 95 77>Internet: http://www.oppenheim.de>The serie is divergent!I suggest you to look at this beautiful introduction to primes distributionhttp://www.maths.ex.ac.uk/%7Emwatkins/zeta/ vardi.htmlBye, robRoberto BrambillaCESIVia Rubattino 5420134 Milanotel +39.02.2125.5875fax +39.02.2125.5492rlbrambilla@cesi.it ==== > I've been looking over the file and directory manipulation functions in Mathematica> 4.1, and I'm not finding good examples of how to test for the existence of> a file or directory before I attempt to create, access, or delete it. Are> there any good examples of this somewhere?>> STH>>Steven,Directory[]returns the current directory$Pathreturns the directories in your path where files can be found.SetDirectory[]changes to the specified directory and makes it the current directory.FileNames[]returns a list of all the file names (text documents, picture documentsetc) and subdirectory (folder) names in the current directory.Since FileNames returns a list of elements, you can use all sorts of teststo see if a file you're looking for is in a said directory or not orwhether it is a subdirectory or not.I hope that this will get you started.Yas ==== has anybody tried to modify the classes.m package in the way, it wouldbe possible to have several superclasses?Oleg. ==== What does this page say, auf Englisch? I only pretend to understand German.http://www.mertig.com/neu/HTMLLinks/index_6.htmlSTH=== =The sum diverges. See Elementary Number Theory, 5th edition by David M.Burton, pages 355-356.-----Original Message-----Sal. Oppenheim jr. & Cie. KGaAKoenigsberger Strasse 29D-60487 Frankfurt am MainGERMANYMobile: +49(0)172 6 74 95 77Internet: http://www.oppenheim.de ==== Technical support has responded to my query. They say that one of thesimplifications that Mathematica does when using Simplify is to Factor theexpression, and factoring an expression consisting of inexact numbers leadsto the type of behavior I observed. They stated that changing the behaviorof Simplify to avoid the problems I noticed would make Simplify lesscapable, and that the majority of users would prefer to have Simplify behavethe way it currently does.Of course, that doesn't answer the question about why the number of terms inthe expression would cause the coefficients to go from rational to inexactto rational again.At any rate, I have another lesson learned. When using Simplify, check theresult if you are mixing infinite precision and inexact numbers, as theresult may not be what you wanted. In the past I always assumed that theresult of using Simplify on an expression produced a result equivalent tothe original expression, but now I discover that this is not true.Carl WollPhysics DeptU of Washington----- Original Message -----> {i, > n}]], x[1]]>> Now lets try CW for the first 100 values of n:> In[30]:=> Table[CW[n], {n, 100}]>> Out[30]=> {1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2,> 0.5`12.3085, 0.5`12.0074, 0.5`11.7064, 0.5`11.4054,> 0.5`11.1043, 0.5`10.8033, 0.5`10.5023, 0.5`10.2012,> 0.5`9.9002, 0.5`9.5992, 0.5`9.2982, 0.5`8.9971,> 0.5`8.6961, 0.5`8.3951, 0.5`8.094, 0.5`7.793, 0.5`7.492,> 0.5`7.1909, 0.5`6.8899, 0.5`6.5889, 0.5`6.2879,> 0.5`5.9868, 0.5`5.6858, 0.5`5.3848, 0.5`5.0837,> 0.5`4.7827, 0.5`4.4817, 0.5`4.1806, 0.5`3.8796,> 0.5`3.5786, 0.5`3.2776, 0.5`2.9765, 0.5`2.6755,> 0.5`2.3745, 0.5`2.3745, 0.5`1.7724, 0.5`1.7724,> 0.5`1.1703, 0.5`1.1703, 0.5`0.5683, 0``0.1423, 0``0.1423,> 0``0.1423, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2,> 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2,> 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2,> 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2,> 1/2, 1/2, 1/2}>> In[31]:= Map[Length,Split[#]]>> Out[31]=> {12,43,45}>> This is indeed curious.The problem seems to occur for values between 13> and 55 and then go away (for good???) At first I thought it maybe in> some fascinating way related to some properties of the integer n, but> now I am not sure. It certainly worth a careful examination. I hope> whoever discovers the cause of this will let us know.>> Andrzej>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>> To Technical Support and the Mathematica User community,>> I'm writing to report what I consider to be a bug. First, I want to> show a> simplified example of the problem. Consider the following expression:>> expr=0.22 + x[0] + (3*(-0.16+ x[1]))/4 + (9*(0.546 + x[2]))/16;>> When simplified I expected to get some real number plus> x[0]+3x[1]/4+9x[2]/16, but instead I get the following:>> Simplify[expr]> 0.407125 + x[0] + 0.75 x[1] + 0.5625 x[2]> >> As you can see, for some reason Mathematica converted the fractions> 3/4 and> 9/16 to real machine numbers. I consider this to be a bug.>> Now, for an example more representative of the situation that I've been> coming across.>> expr12 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 12}];> expr13 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 13}];> expr55 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 55}];>> As you can see, I have replaced the real numbers by extended precision> numbers. The simplified example above demonstrates that the problem> exists> when using machine numbers. Now, we'll see what happens when we use> arbitrary precision numbers. First, let's simplify the expression with> 12> terms.>> Simplify[expr12]> (1.0010000000000 + 2048 x[1] + 1024 x[2] + 512 x[3] + 256 x[4] + 128> x[5] +>> 64 x[6] + 32 x[7] + 16 x[8] + 8 x[9] + 4 x[10] + 2 x[11] + x[12])> / 4096>> As you can see, a sum with 12 terms upon simplification has> coefficients> which are still integers as they should be. However, increasing the> number> of terms to 13 yields> >> Simplify[expr13]> 0.0001221923828125 + 0.500000000000 x[1] + 0.250000000000 x[2] +>> 0.1250000000000 x[3] + 0.0625000000000 x[4] + 0.0312500000000 x[5] +>> 0.01562500000000 x[6] + 0.00781250000000 x[7] + 0.00390625000000> x[8] +>> 0.001953125000000 x[9] + 0.000976562500000 x[10] + 0.000488281250000> x[11]> +>> > 0.000244140625000 x[12] + 0.0001220703125000 x[13]>> Now, all of the coefficients are converted to real numbers,> replicating the> bug from the simplified example. Finally, let's see what happens when> we> have 55 terms. Rather than putting the resulting expression here, I> will> just leave it at the end of the post. The result though is somewhat> surprising. Each of the coefficients of the x[i] are again real> numbers, but> now their precision is only 0! The proper result of course is the sum> of> some real number (with a precision close to 0 due to numerical> cancellation)> and an expression consisting of rational numbers multiplied by x[i].> The> loss of precision of the coefficients of the x[i] is precisely what> occurred> to me. Of course, in this simple example, simply using Expand instead> of> Simplify produces the expected result, and is my workaround. I hope you> agree with me that this is a bug, and one that Wolfram needs to> correct.>> Carl Woll> Physics Dept> U of Washington>> Simplify[expr55]> -16 -1 -1 -1> 0. 10 + 0. x[1] + 0. x[2] + 0. 10 x[3] + 0. 10 x[4] + 0. 10> x[5] +>> -2 -2 -2 -3 -3> 0. 10 x[6] + 0. 10 x[7] + 0. 10 x[8] + 0. 10 x[9] + 0. 10> x[10]> +> >> -3 -3 -4 -4> -4> 0. 10 x[11] + 0. 10 x[12] + 0. 10 x[13] + 0. 10 x[14] + 0. 10> x[15] +>> -5 -5 -5 -6> -6> 0. 10 x[16] + 0. 10 x[17] + 0. 10 x[18] + 0. 10 x[19] + 0. 10> x[20] +>> -6 -6 -7 -7> -7> 0. 10 x[21] + 0. 10 x[22] + 0. 10 x[23] + 0. 10 x[24] + 0. 10> x[25] +>> -8 -8 -8 -9> -9> 0. 10 x[26] + 0. 10 x[27] + 0. 10 x[28] + 0. 10 x[29] + 0. 10> x[30] +>> -9 -9 -10 -10> 0. 10 x[31] + 0. 10 x[32] + 0. 10 x[33] + 0. 10 x[34] +>> -10 -11 -11 -11> 0. 10 x[35] + 0. 10 x[36] + 0. 10 x[37] + 0. 10 x[38] +>> -12 -12 -12 -12> 0. 10 x[39] + 0. 10 x[40] + 0. 10 x[41] + 0. 10 x[42] +>> -13 -13 -13 -14> 0. 10 x[43] + 0. 10 x[44] + 0. 10 x[45] + 0. 10 x[46] +>> -14 -14 -15 -15> 0. 10 x[47] + 0. 10 x[48] + 0. 10 x[49] + 0. 10 x[50] +>> -15 -15 -16 -16> -> 16> 0. 10 x[51] + 0. 10 x[52] + 0. 10 x[53] + 0. 10 x[54] +> 0. 10> x[55]> >>>>>>>> ==== Dear CarlYou have discovered what is perhaps a bug but maybe something even mor einteresting . However, I think you stopped your investigation a little prematurely. Here is a function that just computes the coefficient of x[1] in your Simplified expression for various values of n:CW[n_] := Coefficient[Simplify[1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, n}]], x[1]]Now lets try CW for the first 100 values of n:In[30]:=Table[CW[n], {n, 100}]Out[30]={1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 0.5`12.3085, 0.5`12.0074, 0.5`11.7064, 0.5`11.4054, 0.5`11.1043, 0.5`10.8033, 0.5`10.5023, 0.5`10.2012, 0.5`9.9002, 0.5`9.5992, 0.5`9.2982, 0.5`8.9971, 0.5`8.6961, 0.5`8.3951, 0.5`8.094, 0.5`7.793, 0.5`7.492, 0.5`7.1909, 0.5`6.8899, 0.5`6.5889, 0.5`6.2879, 0.5`5.9868, 0.5`5.6858, 0.5`5.3848, 0.5`5.0837, 0.5`4.7827, 0.5`4.4817, 0.5`4.1806, 0.5`3.8796, 0.5`3.5786, 0.5`3.2776, 0.5`2.9765, 0.5`2.6755, 0.5`2.3745, 0.5`2.3745, 0.5`1.7724, 0.5`1.7724, 0.5`1.1703, 0.5`1.1703, 0.5`0.5683, 0``0.1423, 0``0.1423, 0``0.1423, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2}In[31]:= Map[Length,Split[#]]Out[31]={12,43,45}This is indeed curious.The problem seems to occur for values between 13 and 55 and then go away (for good???) At first I thought it maybe in some fascinating way related to some properties of the integer n, but now I am not sure. It certainly worth a careful examination. I hope whoever discovers the cause of this will let us know.AndrzejAndrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> To Technical Support and the Mathematica User community,>> I'm writing to report what I consider to be a bug. First, I want to > show a> simplified example of the problem. Consider the following expression:>> expr=0.22 + x[0] + (3*(-0.16+ x[1]))/4 + (9*(0.546 + x[2]))/16;>> When simplified I expected to get some real number plus> x[0]+3x[1]/4+9x[2]/16, but instead I get the following:>> Simplify[expr]> 0.407125 + x[0] + 0.75 x[1] + 0.5625 x[2]>> As you can see, for some reason Mathematica converted the fractions > 3/4 and> 9/16 to real machine numbers. I consider this to be a bug.>> Now, for an example more representative of the situation that I've been> coming across.>> expr12 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 12}];> expr13 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 13}];> expr55 = 1.001`17 + Sum[(x[i] - 1.001`17)/2^i, {i, 55}];>> As you can see, I have replaced the real numbers by extended precision> numbers. The simplified example above demonstrates that the problem > exists> when using machine numbers. Now, we'll see what happens when we use> arbitrary precision numbers. First, let's simplify the expression with > 12> terms.>> Simplify[expr12]> (1.0010000000000 + 2048 x[1] + 1024 x[2] + 512 x[3] + 256 x[4] + 128 > x[5] +>> 64 x[6] + 32 x[7] + 16 x[8] + 8 x[9] + 4 x[10] + 2 x[11] + x[12]) > / 4096>> As you can see, a sum with 12 terms upon simplification has > coefficients> which are still integers as they should be. However, increasing the > number> of terms to 13 yields>> Simplify[expr13]> 0.0001221923828125 + 0.500000000000 x[1] + 0.250000000000 x[2] +>> 0.1250000000000 x[3] + 0.0625000000000 x[4] + 0.0312500000000 x[5] +>> 0.01562500000000 x[6] + 0.00781250000000 x[7] + 0.00390625000000 > x[8] +>> 0.001953125000000 x[9] + 0.000976562500000 x[10] + 0.000488281250000 > x[11]> +>> 0.000244140625000 x[12] + 0.0001220703125000 x[13]>> Now, all of the coefficients are converted to real numbers, > replicating the> bug from the simplified example. Finally, let's see what happens when > we> have 55 terms. Rather than putting the resulting expression here, I > will> just leave it at the end of the post. The result though is somewhat> surprising. Each of the coefficients of the x[i] are again real > numbers, but> now their precision is only 0! The proper result of course is the sum > of> some real number (with a precision close to 0 due to numerical > cancellation)> and an expression consisting of rational numbers multiplied by x[i]. > The> loss of precision of the coefficients of the x[i] is precisely what > occurred> to me. Of course, in this simple example, simply using Expand instead > of> Simplify produces the expected result, and is my workaround. I hope you> agree with me that this is a bug, and one that Wolfram needs to > correct.>> Carl Woll> Physics Dept> U of Washington>> Simplify[expr55]> -16 -1 -1 -1> 0. 10 + 0. x[1] + 0. x[2] + 0. 10 x[3] + 0. 10 x[4] + 0. 10 > x[5] +>> -2 -2 -2 -3 -3> 0. 10 x[6] + 0. 10 x[7] + 0. 10 x[8] + 0. 10 x[9] + 0. 10 > x[10]> +>> -3 -3 -4 -4 > -4> 0. 10 x[11] + 0. 10 x[12] + 0. 10 x[13] + 0. 10 x[14] + 0. 10> x[15] +>> -5 -5 -5 -6 > -6> 0. 10 x[16] + 0. 10 x[17] + 0. 10 x[18] + 0. 10 x[19] + 0. 10> x[20] +>> -6 -6 -7 -7 > -7> 0. 10 x[21] + 0. 10 x[22] + 0. 10 x[23] + 0. 10 x[24] + 0. 10> x[25] +>> -8 -8 -8 -9 > -9> 0. 10 x[26] + 0. 10 x[27] + 0. 10 x[28] + 0. 10 x[29] + 0. 10> x[30] +>> -9 -9 -10 -10> 0. 10 x[31] + 0. 10 x[32] + 0. 10 x[33] + 0. 10 x[34] +>> -10 -11 -11 -11> 0. 10 x[35] + 0. 10 x[36] + 0. 10 x[37] + 0. 10 x[38] +>> -12 -12 -12 -12> 0. 10 x[39] + 0. 10 x[40] + 0. 10 x[41] + 0. 10 x[42] +>> -13 -13 -13 -14> 0. 10 x[43] + 0. 10 x[44] + 0. 10 x[45] + 0. 10 x[46] +>> -14 -14 -15 -15> 0. 10 x[47] + 0. 10 x[48] + 0. 10 x[49] + 0. 10 x[50] +>> -15 -15 -16 -16 > -> 16> 0. 10 x[51] + 0. 10 x[52] + 0. 10 x[53] + 0. 10 x[54] + > 0. 10> x[55]>>> ==== I think, for input of that many numbers (and other inputs), I might usean input file that has textual names or descriptions in the first ten ortwenty columns, followed by values starting at a fixed column afterthat. Mathematica or Java could easily read inputs from that, and ahuman could read it as well. If you're concerned that a human mightjumble the file format -- accidentally deleting lines, etc. -- a programcould key on the names or descriptions rather than trusting them to bein correct order, and point out missing values. A strategy like thatallows you to start with a previous input file (not from scratch) andchange only what needs to change.Also, Mathematica 4.2 adds XML support to the picture, and that might beuseful.Bobby-----Original Message----->> I agree with Mr. Kuska, that the system Mr Nagesh describes is not> userfriendly. But I think, the suggestions of Mr. Kuska do not makeitmore> userfriendly, rather the opposite is true.> >> Mr. Nagesh asks>> Is any body here have expertise or information about the capabilityof> Mathematica as a system simulation tool?> Mr. Kuska answers:> Since the most system simulation tools are simply solving asystem of> ordinary differntial equations it is simple to do this withNDSolve[].>> My comment:>> That is: He sees the simulation system merely as a set ofdifferential> equations.>> hmm, since the original poster write>> My refrigeration system simulation package is likely to have> approximately 60 First order Differential equations.>> it seems not completly wrong to assume that the system consists of> of ode's ..>Yout should not ignore the word merely.It is not enough to have a set 60 differential equations and a set of200-250 numbers. That is not simulation system, which can be used byuserswith the exception, perhaps, of the programmer of the system himself.How does e.g. the user know what meaning a number in the set has, oughthecount the numbers from the beginning?Your nice command shows only, if there is an input, which is not anumber.But I think the user would like to know, which of the 200 elements arenotnumbers.The only good of your command is, that it looks nice and shows yourknowledge!>> The question of Mr. Nagesh:>> My 4th Objective:- How can I program the check for correctness ofthe> 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 doesMr.> Nagesh understand it and is it sufficient to check, if all inputsare> numerical?>> It seems you have a deeper knowlege about the things that Mr. Nagesh> understand. You know him personally ? It is not very polite to> make speculations *what* a other person understand.>> And no it is not sufficent to check that all parameters are numbers.> Typical paramters described by intervals, where the assumptions of> a model are valid. But for this checks one needs more knowlege> about the meaning of the parameters. And one needs the knowlege about> the differntial equations, to find out the eigenvalues of the jacobian> ...>>> Additionally I think, it is not userfriendly to see the input merelyasa> set of 200-250 numbers.>> My suggestion is, that JLink is used, a suggestion Mr. Kusk takesinto> consideration, too.>> That will be fast as lightning !>>> But further I suggest, that classes are defined in Java, whichrepresentthe> parts of the system.>> That is notable nonsense! When the differntial equations should be> solved with Mathematica, the parts can't be Java classes.Mathematica's> NDSolve[] need a explicit expression to integrate the equations.That's not nonsense, the Mathematica program does not fetch the classesbutthe numbers in the classes (or better in the objects).inthe Java classes in textform. They can then be fetched from theMathematicaprogram and transformed into expressions by the Command ToExpression.The aim is, to have a clear separation of the system into components,whichare manageable and understandable.>> OK you can call a Java class member from Mathematica but this will> be incredible slow when the right hand side is evaluated 200-300> times and every evaluation make several callbacks to the Java source.> Event handler of the Java main program (without some modification in> the event loop) while it is evaluating an other command.My idea is to fetch the values once from the Java objects at thebeginning.200-250 numbers is not so much..>>> Constructors of the classes should build objects with defaultvalues.>> That's a great idea. If a simulation run should be documented, one> always> need the full listing of the Java source to find the actual parameter> settings.That is not my opinion. I think not every user of the simulation systemshould have to know Java and Mathematica.The user must look for the values in the objects. And the values are intheobjects, if they come from the constructor or from the graphical userinterface.I think, there should be listings of the objects including names of thevariables. In the objects the values are in an meaningful environment.>> Graphical user interfaces> should give the opportunity to change the data fields in the objectsand> check the input for correctness.>> *and* what has a GUI for 200-250 variables to do with Mathematica ?> BTW one has typical much less variables because many parameters> are fixed and it make no sense to change, for example, material> constants of materials that can't exchanged>>> The system should give the opportunity, to store the objects onharddisk> (serialization).>> accessed directly.> Can you be so kind, to explain *how* your posting help a person that> ask How can I build a simulation system with Mathematica ?>> You *can* say Don't use Mathematica, use Java! but this has nothing> to do with the question or with my reply.It is you, who proposes to solve the problem with C/C++ and not to useMathematica (see below!)My point of view is:Use Mathematica, for what Mathemtica is good, and Java, for what Java isgood.Mathematica is not so good as Java for data entry and Java is betterthanMathematica to represent the simulation system (by objects).>> But I still would suggest to use C/C++ and a numerical> ode-solver, make a fancy GUI/Script> interface and don't use Mathematica for such a simple task.> The ode-solver is the smallest part of such a simulation system.>> Jens>>>>> My name is Nagesh and pursuing research studies inRefrigeration. At> present I am writing a Dynamic Refrigeration System SimulationPackage.> I> am using Mathematica as a programming language for the samesincelast> one> year. I don't have any programming experience before this. Ihave> following> querries:-> 1. Is any body here have expertise or information about thecapability> of> > Mathematica as a system simulation tool?>> Since the most system simulation tools are simply solving asystemof> ordinary differntial equations it is simple to do this withNDSolve[].>> 2. Is is possible to program a user friendly interface for mysystem> simulation package with Mathematica or I have to use some other> software?>> Write a MathLink or J/Link frontend that launch the kernel. Butyou> 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 tochange> > the ode's very often (than Mathematica is more ßexible) youshould> not use Mathematica.>> 3. My refrigeration system simulation package is likely to have> > approximately 60 First order Differential equations. Is ispossibleto> 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 tofulfill> from> coding out of my main input file>> 1. Example from Main Input File ( this will contain about200-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, whichwill be> used in other analysis files for further evaluation.>> 2. Example from other analysis file ( there will be about 20-25other> such> component analysis files ) where the above mentioned variablesfrommain> input file will be used for further evaluations:->> Below is one example from this file explaining how the variablesfrom> main> input file will be used in other files.>> I hope that this short information will be useful for guiding meto> solve> > the following problems that I am facing. I am facing follwingproblems> or> objectives:->> 1. My 1st Objective:- The user of this package must be able tochange> only> the value of the variable in the main input file but he must notbeable> to> change the name of the variable itself. For example he must beableto> 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 ourobjective> 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 sothatit> will> be user friendly in terms of its visuals and satisfying theconstraint> mentioned above in objective1.>> What is *userfiendly* in a file with 250 variables ???>>> 3. My 3rd Objective:- How can I program the optional values foreach> > variable in the main input file ? so that there will be always avalue> assigned to each variable listed in main input file whenever theuser> opens> up this file. If user want to change the values of somevariablesthen> he> > can change them and run the simulation otherwise the simulationrunwill> be> done with optional values assigned to each variable in the inputfile.>> See above.>>> 4. My 4th Objective:- How can I program the check forcorrectness ofthe> input values supplied by the package user ?>> And @@ (NumericQ /@ {aListOfAllYourNumericParameters})>>> Jens> >> ==== hi> AFAIK, Mac OS is now BSD or something like that. That makes it almost> certain that it could support QT. As I pointed out in another post, I can> run the KDE on Windows XP. I haven't been in the trenches with the Qt> impression is, it really is Ôcode once, run everywhere'.i've checked the trolltech hp. qt fully supports the following OS:MS Windows 95/98/Me, NT4, 2000 and XP. Mac OS X. > This is one of the reasons I am such a Mozilla fan. Konqueror works quite> like. But Mozilla runs everywhere with more or less a uniform look and> feel. Yes, Mozilla is written with Gtk and not with Qt, but that just> shows that WRI has options.i'm not sure if it is allowed to create a closed-source product like the mathematica fronend based on a gpl'ed library like gtk. with qt you have the possibility to buy licenses for the commercial version of qt, allowing you to create closed-source apps. > I'm a KDE fan. I've used the KDE since it was in alpha 0.4. I remember> back when it would compile in a few minutes on a pentium II. Now it takes> several hours on a P4. i started with beta1 (if i remember correctly) - sure it is really big now, but i think kde is still far away from being bloated..... imagine the mathematica frontend being seamlessly integrated into the linux ui's look and feel.... > I've always hated motif. The file chooser simply stinks. And that's just a> start.the whole motif ui stinks....:-)gerald************************************* Gerald RothM@th Desktop Development************************************* ==== > hi,> moving the frontend over to QT would have some neat side effects:> consistent look & feel with the modern linux gui, themeability, source> antialiased> truetype fonts as QT supports Xrender and Xft (looks great - see KDE3). i> think all of those points are of value, but the most important might be> source compatibility. ONE frontend for MOST (or ALL) platforms - sounds> like a dream :-))AFAIK, Mac OS is now BSD or something like that. That makes it almost certain that it could support QT. As I pointed out in another post, I can run the KDE on Windows XP. I haven't been in the trenches with the Qt impression is, it really is Ôcode once, run everywhere'.This is one of the reasons I am such a Mozilla fan. Konqueror works quite like. But Mozilla runs everywhere with more or less a uniform look and feel. Yes, Mozilla is written with Gtk and not with Qt, but that just shows that WRI has options. I'm a KDE fan. I've used the KDE since it was in alpha 0.4. I remember back when it would compile in a few minutes on a pentium II. Now it takes several hours on a P4. But if WRI wanted to go the Gtk route, they could achieve the same ends.I've always hated motif. The file chooser simply stinks. And that's just a start.> gerald> STH ==== Can I solve this inequality with Mathematica?Log[x,a]+Log[a x,a]>0I've tried all know, but I get get any good result.CeZaR ==== > First thanks to all, and in particular Bobby Treat, for your help with> this question.> The best solution was as follows:> lst = ReadList[c:data.txt, {Number, Number}]> adjacenceMatrix[> x:{{_, _}..}] := Module[{actors, events},> {actors, events} = Union /@ Transpose[x];> Array[If[MemberQ[x, {actors[[#1]], events[[#2]]}], 1, 0] & ,> {Length[actors], Length[events]}]]> a = adjacenceMatrix[lst];> b = a . Transpose[a];> c = b (1 - IdentityMatrix[Length[b]])> C is the desired symmetric matrix with off diagonal values of >=0,> indicating the number of times two actors participate in the same event.> The diagonal is set to 0.> A few items in response to Bobby's message, below. While c is, in fact,> a huge matrix with lots of cells equal to zero, that is exactly how we> need it structured for our analysis and research question (not relevant> to the list, but I'd be happy to discuss off list). Processing time is> actually not too bad!! I'm running a PIII 900 with 512 SDRAM, and the> code ran a 177 x 3669 matrix in under 90 seconds. MatrixForm [c]> presented no problems in viewing in the front end, but then it's only> 177 x 177.> Tom> **********************************************> Thomas P. Moliterno> Graduate School of Management> University of California, Irvine> tmoliter@uci.edu> **********************************************> [...]There are several ways to go about this and which is best will varybased on relative number of events vs. number of actors. Below I showthree variations. The first is a minor recoding of the one above. Thesecond iterates over all pairs of actors. The third looks at all eventsfor common actors. I then show three examples. The first two methodshave the advantage that they do not require that events be positiveintegers. With some extra work the third method could also get aroundthis restriction.toAdjacency0[data:{{_, _}..}] := Module[ {actors, events, mat1, mat2}, {actors, events} = Union /@ Transpose[data]; mat1 = Array[If[MemberQ[data, {actors[[#1]], events[[#2]]}], 1, 0] &, {Length[actors], Length[events]}]; mat2 = mat1 . Transpose[mat1]; mat2 * (1-IdentityMatrix[Length[mat2]]) ]toAdjacency1[origdata_] := Module[ {data=Union[origdata], mat}, data = Map[Last, Split[data,#1[[1]]===#2[[1]]&], {2}]; mat = Table [If [j>k, Length[Intersection[data[[j]],data[[k]]]], 0], {j,Length[data]}, {k,Length[data]}]; mat+Transpose[mat] ]toAdjacency2[origdata_] := Module[ {data=Sort[Map[Reverse,Union[origdata]]], mat, len, event}, data = Map[Last, Split[data,#1[[1]]===#2[[1]]&], {2}]; dim = Length[Union[Flatten[data]]]; len = Length[data]; mat = Table[0, {dim}, {dim}]; Do [ event = data[[j]]; Do [ Do [ mat[[event[[m]],event[[k]]]] += 1; mat[[event[[k]],event[[m]]]] += 1, {m,k-1}], {k,Length[event]}], {j,len}]; mat ]data1 = Table[{Random[Integer,{1,1000}], Random[Integer,50]}, {10000}];data2 = Table[{Random[Integer,{1,1000}], Random[Integer,100]}, {10000}];data3 = Table[{Random[Integer,{1,1000}], Random[Integer,200]}, {10000}];Timings are on a 1.5 GHz machine running the Mathematica 4.2 kernelIn[107]:= Timing[m0 = toAdjacency0[data1];]Out[107]= {5.44 Second, Null}In[108]:= Timing[m1 = toAdjacency1[data1];]Out[108]= {10.5 Second, Null}In[109]:= Timing[m2 = toAdjacency2[data1];]Out[109]= {16.24 Second, Null}In[110]:= m0 === m1 === m2Out[110]= TrueNote that for this example the result is not terrible sparse (less than20%).In[112]:= Count[Flatten[m0], 0]Out[112]= 191374In[115]:= Timing[m0 = toAdjacency0[data2];]Out[115]= {11.51 Second, Null}In[116]:= Timing[m1 = toAdjacency1[data2];]Out[116]= {10.92 Second, Null}In[117]:= Timing[m2 = toAdjacency2[data2];]Out[117]= {9.07 Second, Null}Curiously this was the first example I tried, and all three methodsperform about the same in this case. The result, not suprisingly, ismore sparse (40%) because we have the same number of actors and pairs aspreviously, but now with more events to spread out over the pairs.In[118]:= Count[Flatten[m0], 0]Out[118]= 403232When we get sparser still, the third method begins to dominate and thefirst is relatively slower.In[119]:= Timing[m0 = toAdjacency0[data3];]Out[119]= {22.73 Second, Null}In[120]:= Timing[m1 = toAdjacency1[data3];]Out[120]= {10.88 Second, Null}In[121]:= Timing[m2 = toAdjacency2[data3];]Out[121]= {4.96 Second, Null}Now sparsity is over 60%.In[122]:= Count[Flatten[m0], 0]Out[122]= 624350The relative speed of this last method, in this instance, is derivedfrom the fact that individual event lists are on average half the sizeof the previous case. Hence the main loop is expected to improve onaverage by a factor of 2 (you get a factor of 4 for iterating over allpairs in each event, but lose a factor of 2 because there are twice asmany event lists).My guess is that a preprocessor that assesses number of actors vs.number of events would be the best way to choose between the first andthird methods (which, inexplicably, are labelled as methods 0 and 2). Itis not clear to me whether the middle approach will ever dominate. Ihave not given much thought to concocting examples where it wouldbecause offhand I suspect they would be pathological as in dense andwith large intersections.As a last remark I'll note that these might run significantly faster ifcoded with Compile. Whether that is viable depends on the form of thedata. In the above example where everything is a machine integer thatapproach would certainly work.Daniel LichtblauWolfram Research ==== First thanks to all, and in particular Bobby Treat, for your help withthis question.The best solution was as follows:lst = ReadList[c:data.txt, {Number, Number}]adjacenceMatrix[ x:{{_, _}..}] := Module[{actors, events}, {actors, events} = Union /@ Transpose[x]; Array[If[MemberQ[x, {actors[[#1]], events[[#2]]}], 1, 0] & , {Length[actors], Length[events]}]]a = adjacenceMatrix[lst];b = a . Transpose[a];c = b (1 - IdentityMatrix[Length[b]])C is the desired symmetric matrix with off diagonal values of >=0,indicating the number of times two actors participate in the same event.The diagonal is set to 0. A few items in response to Bobby's message, below. While c is, in fact,a huge matrix with lots of cells equal to zero, that is exactly how weneed it structured for our analysis and research question (not relevantto the list, but I'd be happy to discuss off list). Processing time isactually not too bad!! I'm running a PIII 900 with 512 SDRAM, and thecode ran a 177 x 3669 matrix in under 90 seconds. MatrixForm [c]presented no problems in viewing in the front end, but then it's only177 x 177.Tom**********************************************Thomas P. MoliternoGraduate School of ManagementUniversity of California, Irvinetmoliter@uci.edu*************************************** *******-----Original Message-----columns will be numbered from 1 to the number of observed actors orevents, and will correspond to actors and events in sorted order.That said, you're asking for a VERY large matrix, and most of itsentries will be zero. I'll suggest another way, later.The following indicates AT MOST 13.4% of the entries could be non-zero:lst = ReadList[moliterno-test1996.txt, {Number, Number}]; {actors, events} = Union /@ Transpose[lst]; N[Length[lst]/(Length[actors]*Length[actors])] 0.13350994338800987However, a random sample shows that less than 1% will be non-zero:Timing[ Count[(MemberQ[lst, {actors[[Random[Integer, Length[actors]]]], events[[Random[Integer, Length[events]]]]}] & ) /@ Range[10000], True]/ 10000.]{7.515999999999998*Second, 0.008}Nevertheless, the following code should build the matrices you want.I'm using a 2.2GHz P4 and 1024MB RDRAM, so if you have a slower machine,be warned.adjacenceMatrix[ x:{{_, _}..}] := Module[{actors, events}, {actors, events} = Union /@ Transpose[x]; Array[If[MemberQ[x, {actors[[#1]], events[[#2]]}], 1, 0] & , {Length[actors], Length[events]}]]Timing[a = adjacenceMatrix[lst]; ]Dimensions[a]{5.671999999999997*Second, Null}{166, 1778}Timing[b = a . Transpose[a]; ]{0.5309999999999988*Second, Null}You don't want to display a or b in MatrixForm. It will crash youranything at all from the result, and use something likeb[[Range[20],Range[4]]]//MatrixForm{{47, 0, 0, 0}, {0, 3, 0, 0}, {0, 0, 7, 1}, {0, 0, 1, 59}, {0, 0, 0, 3}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}, {2, 0, 0, 1}, {0, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}, {0, 0, 0, 2}, {0, 0, 0, 0}, {0, 0, 0, 0}}to get a glimpse at some of it. It's the Ôa' matrix that's terriblysparse -- the Ôb' matrix isn't unreasonable. Elements of the Ôa' matrixcan be quickly computed by the functionaFunction = If[MemberQ[lst, {actors[[#1]], events[[#2]]}], 1, 0] &;That stores a line of code rather than all those ones and zeroes. The bmatrix (call it bb this time) can be computed as:Timing[bb = (#1 . Transpose[#1] & ) [Array[aFunction, {Length[actors], Length[events]}]]; ]bb == b{6.1569999999999965*Second, Null}TrueBobby Treat-----Original Message-----posting a this was the most helpful solution message to the list, butfirst I hoped to ask you a follow up question, if I may (and I'llcapture your off-line response here in my final posting to the list).I've run the code (copied from you) below, and get the correct outputfor made-up data, but when I import in real data, I get an errormessage. Here's the input I'm running:lst = ReadList[c:test1996.txt, {Number, Number}]AdjacenceMatrix[lst : {{_, _} ..}] := Module[{actors, events, adj}, {actors, events} = Union /@ Transpose[lst]; adj = Table[0, {Length[actors]}, {Length[events]}]; Scan[(Part[adj, Sequence @@ #] = 1) &, lst /. MapIndexed[Rule[#1, First[#2]] &, events]]; adj]MatrixForm[a = AdjacenceMatrix[lst]]MatrixForm[b = a.Transpose[a]]And here's what I get for output:Set::partw : Part 300007 of <<1>> does not exist.Set::partw : Part 300007 of <<1>> does not exist.Set::partw : Part 300007 of <<1>> does not exist.General::stop : Further output of Set::partw will be suppressed duringthis calculation.Then I get the two matrices (a & b as per your code), but they are justfilled with zeros. So it gets to about the 4th line of your code, butthen doesn't fill-in from my data. Finally, I should note that30007 is one of the actors in the data that I've read in. In caseyou want to run this yourself, I've attached the raw data file. Thereare 166 actors and 1778 events: both actors and events are coded with6-digit numbers, actors begin with 3's, events with 2's.I'm sure this is a silly question, and that there is an easy answer... But I sure can't find it. So I really appreciate your help andinterest!!!!Tom******************************************* ***Thomas P. MoliternoGraduate School of ManagementUniversity of California, Irvinetmoliter@uci.edu*************************************** *******-----Original Message-----If you multiply it by its transpose, you get something else that'suseful:lst = {{1, A}, {1, B}, {2, B}, {3, C}, {3, D}, {1, D}, {1, C}};AdjacenceMatrix[lst : {{_, _} ..}] := Module[{actors, events, adj}, {actors, events} = Union /@ Transpose[lst]; adj = Table[0, {Length[actors]}, {Length[events]}]; Scan[(Part[adj, Sequence @@ #] = 1) &, lst /. MapIndexed[Rule[#1, First[#2]] &, events]]; adj]MatrixForm[a = AdjacenceMatrix[lst]]MatrixForm[b = a.Transpose[a]]Matrix Ôb' records how many events two actors have in common. On thediagonal, it shows the total number of events each actor is connectedto.It's easy to put zeroes on the diagonal:MatrixForm[c = b (1 - IdentityMatrix[Length[b]])]To get the originally intended incidence matrix, this works:d = c /. {_?Positive -> 1}However, I think matrices Ôa' and Ôb' are actually more useful, and Ôa'easily leads to all the others.Bobby-----Original Message-----AdjacenceMatrix[lst : {{_, _} ..}] := Module[ {actors,events adj}, {events, actors} = Union /@ Transpose[lst]; adj = Table[0, {Length[events]}, {Length[actors]}]; Scan[(Part[adj, Sequence @@ #] = 1) &, lst /. MapIndexed[Rule[#1, First[#2]] &, actors]]; adj ]you getIn[]:=AdjacenceMatrix[lst]Out[]={{1, 1, 0, 1}, {0, 1, 0, 0}, {0, 0, 1, 1}} Jens> I need to create an adjacency matrix from my data, which is currentlyin> the form of a .txt file and is basically a two column incidence list.> For example:> 1 A> 1 B> 2 B> 3 C> . .> . .> . .> m n> Where 1 to m represent actors and A to n represent events. My goal isto> have an (m x m) matrix where cell i,j equals 1 if two actors are> incident to the same event (in the sample above, 1 and 2 are both> incident to B) and 0 otherwise (w/ zeros on the diagonal).> I'm new to Mathmatica, and so I'm on the steep part of the learning> curve ... All I've been able to figure out so far is how to get my> incidence list into the program using Import[filename.txt]. But then> what? How do I convert to the adjacency matrix? I've found the> ToAdjacencyMatrix[] command in DiscreteMath`Combinatorica`, but Ican't> seem to get it to work ...> Tom> **********************************************> Thomas P. Moliterno> Graduate School of Management> University of California, Irvine> tmoliter@uci.edu> ********************************************** ==== These are working for me. If anybody wants to try this modified keymapping http://66.92.149.152/proprietary/com/wri/proprietary/com/wri /ch05.htmlhttp://public.globalsymmetry.com/proprietary/com/ wri/KeyEventTranslations.tr.txtSTH ==== > These are working for me. If anybody wants to try this modified> keymapping> http://66.92.149.152/proprietary/com/wri/proprietary/com/wri/ ch05.html> http://public.globalsymmetry.com/proprietary/com/wri/ KeyEventTranslations.tr.txt> STHI found a bug in my hack of the KeyEventTranslations.tr file which didn't manifest itself in 4.1, but did in 4.2. I had a trailing Ô,' which was causing Mathematica to hang on startup after the chched KeyEventTranslations.m was created (second launch with the buggy file.) I also discovered that the file I was trying to share had been chmod'ed to 400. I am not sure if that is a daemon running, or scp which did it. It's open now, and I'll keep an eye on it.I'm attaching it as well, just in case.I put it here on my box:~/.Mathematica/SystemFiles/FrontEnd/TextResourcesSTH@@ resource KeyEventTranslations(* Modifiers can be Shift, Control, Command, Option For Macintosh: Command = Command Key, Option = Option Key For X11: Command = Mod1, Option = Mod2 For Windows: Command = Alt, Option = AltNOTE: I Hacked this for my purposes. I find it more natural. Theremay be problems. It comes with all the warranty that GNU software does.*)EventTranslations[{(* Evaluation *) Item[KeyEvent[Enter], EvaluateCells], Item[KeyEvent[KeypadEnter], EvaluateCells], Item[KeyEvent[Return, Modifiers -> {Shift}], EvaluateCells], Item[KeyEvent[KP_Enter], EvaluateCells], Item[KeyEvent[KeypadEnter, Modifiers -> {Shift}], EvaluateNextCell], Item[KeyEvent[KP_Enter, Modifiers -> {Shift}], EvaluateNextCell], Item[KeyEvent[Enter, Modifiers -> {Shift}], EvaluateNextCell], Item[KeyEvent[Return, Modifiers -> {Command}], Evaluate[All]], Item[KeyEvent[Return, Modifiers -> {Option}], SimilarCellBelow], Item[KeyEvent[Escape], ShortNameDelimiter], (* Cursor control *) Item[KeyEvent[Up], MovePreviousLine], Item[KeyEvent[Down], MoveNextLine], Item[KeyEvent[Left], MovePrevious], Item[KeyEvent[Right], MoveNext], Item[KeyEvent[Up, Modifiers -> {Option}], MovePreviousLine], Item[KeyEvent[Down, Modifiers -> {Option}], MoveNextLine], Item[KeyEvent[Right, Modifiers -> {Option}], MoveNextWord], Item[KeyEvent[Left, Modifiers -> {Option}], MovePreviousWord], Item[KeyEvent[Right, Modifiers->{Control}], MoveNextWord], Item[KeyEvent[Left, Modifiers->{Control}], MovePreviousWord], Item[KeyEvent[End], MoveLineEnd], Item[KeyEvent[Home], MoveLineBeginning], (* Selection *) Item[KeyEvent[Right, Modifiers -> {Shift}], SelectNext], Item[KeyEvent[Left, Modifiers -> {Shift}], SelectPrevious], Item[KeyEvent[Right, Modifiers -> {Control, Shift}], SelectNextWord], Item[KeyEvent[Left, Modifiers -> {Control, Shift}], SelectPreviousWord], Item[KeyEvent[Down, Modifiers -> {Shift}], SelectNextLine], Item[KeyEvent[Up, Modifiers -> {Shift}], SelectPreviousLine], Item[KeyEvent[Home, Modifiers -> {Shift}], SelectLineBeginning], Item[KeyEvent[End, Modifiers -> {Shift}], SelectLineEnd], Item[KeyEvent[., Modifiers -> {Control}], ExpandSelection], (* Notebook window control *) Item[KeyEvent[PageUp], ScrollPageUp], Item[KeyEvent[PageDown], ScrollPageDown], Item[KeyEvent[Prior], ScrollPageUp], Item[KeyEvent[Next], ScrollPageDown], Item[KeyEvent[Home, Modifiers -> {Control}], ScrollNotebookStart], Item[KeyEvent[End, Modifiers -> {Control}], ScrollNotebookEnd], (* Input *) Item[KeyEvent[Return], Linebreak], Item[KeyEvent[Tab], Tab], Item[KeyEvent[i, Modifiers -> {Control}], Tab], Item[KeyEvent[Backspace], DeletePrevious], Item[KeyEvent[Delete], DeleteNext], Item[KeyEvent[ForwardDelete], DeleteNext], (* Typesetting input *) Item[KeyEvent[6, Modifiers -> {Control}], Superscript], Item[KeyEvent[Keypad6, Modifiers -> {Control}], Superscript], Item[KeyEvent[^, Modifiers -> {Control}], Superscript], Item[KeyEvent[-, Modifiers -> {Control}], Subscript], Item[KeyEvent[_, Modifiers ->{Control}], Subscript], Item[KeyEvent[/, Modifiers -> {Control}], Fraction], Item[KeyEvent[KP_Divide, Modifiers -> {Control}], Fraction], Item[KeyEvent[2, Modifiers -> {Control}], Radical], Item[KeyEvent[Keypad2, Modifiers -> {Control}], Radical], Item[KeyEvent[@, Modifiers -> {Control}], Radical], Item[KeyEvent[7, Modifiers -> {Control}], Above], Item[KeyEvent[&, Modifiers -> {Control}], Above], Item[KeyEvent[Keypad7, Modifiers -> {Control}], Above], Item[KeyEvent[=, Modifiers -> {Control}], Below], Item[KeyEvent[+, Modifiers -> {Control}], Below], Item[KeyEvent[,, Modifiers -> {Control}], NewColumn], Item[KeyEvent[Return, Modifiers -> {Control}], NewRow], Item[KeyEvent[9, Modifiers -> {Control}], CreateInlineCell], Item[KeyEvent[(, Modifiers -> {Control}], CreateInlineCell], Item[KeyEvent[Keypad9, Modifiers -> {Control}], CreateInlineCell], Item[KeyEvent[), Modifiers -> {Control}], MoveNextCell], Item[KeyEvent[0, Modifiers -> {Control}], MoveNextCell], Item[KeyEvent[Keypad0, Modifiers -> {Control}], MoveNextCell], Item[KeyEvent[Left, Modifiers -> {Control}, CellClass -> BoxFormData], NudgeLeft], Item[KeyEvent[Right, Modifiers -> {Control}, CellClass -> BoxFormData], NudgeRight], Item[KeyEvent[Down, Modifiers -> {Control}, CellClass -> BoxFormData], NudgeDown], Item[KeyEvent[Up, Modifiers -> {Control}, CellClass -> BoxFormData], NudgeUp], Item[KeyEvent[8, Modifiers -> {Control}], InsertRawExpression], Item[KeyEvent[*, Modifiers -> {Control}], InsertRawExpression], Item[KeyEvent[Keypad8, Modifiers -> {Control}], InsertRawExpression], Item[KeyEvent[5, Modifiers -> {Control}, CellClass -> BoxFormData], Otherscript], Item[KeyEvent[Keypad5, Modifiers -> {Control}, CellClass -> BoxFormData], Otherscript], Item[KeyEvent[%, Modifiers -> {Control}, CellClass -> BoxFormData], Otherscript], (* Typesetting motion commands *) Item[KeyEvent[ , Modifiers -> {Control}], MoveExpressionEnd], Item[KeyEvent[Tab, Modifiers -> {Shift}, CellClass -> BoxFormData], MovePreviousPlaceHolder], Item[KeyEvent[s, Modifiers -> {Command, Control}, CellClass -> BoxFormData], MovePreviousExpression], Item[KeyEvent[S, Modifiers -> {Control, Command, Shift}, CellClass -> BoxFormData], MoveNextExpression], Item[KeyEvent[S, Modifiers -> {Control, Shift}, CellClass -> BoxFormData], DeleteNextExpression], Item[KeyEvent[s, Modifiers -> {Control}, CellClass -> BoxFormData], DeletePreviousExpression], Item[KeyEvent[k, Modifiers -> {Control}], CompleteSelection[True]], (* Miscellaneous menu commands *) Item[KeyEvent[Delete, Modifiers -> {Control}], Cut], Item[KeyEvent[Insert, Modifiers -> {Control}], Copy], Item[KeyEvent[Insert, Modifiers -> {Shift}], Paste[After]], Item[KeyEvent[z, Modifiers -> {Control}], Undo], Item[KeyEvent[c, Modifiers -> {Control}], Copy], Item[KeyEvent[x, Modifiers -> {Control}], Cut], Item[KeyEvent[v, Modifiers -> {Control}], Paste[After]], Item[KeyEvent[F1], SelectionHelpDialog] (* Unsupported features and examples *)(* Item[KeyEvent[v, Modifiers -> {Control}], SelectionSpeakSummary], *)(* Item[KeyEvent[v, Modifiers -> {Control, Shift}], SelectionSpeak] *)}] ==== >particular, the y-axis label is typically rotated by 90deg so that it>reads up the y-axis. This works fine on macs and windoze, but under>linux the label runs up the y-axis; however, the letters are rotated>so that they are the same orientation as that for the x-axis.>Printouts of the NB are fine, but it looks really stupid when using a>video projector to teach or give a talk. I have mentioned this before,>perhaps, but it is also a real problem with Mathematica. I personally>don't care why the label looks peculiar, just that it does and that>there is no easy workaround. ==== >I'm writing to report what I consider to be a bug. First, I want to>show a simplified example of the problem. Consider the following>expression:>>expr=0.22 + x[0] + (3*(-0.16+ x[1]))/4 + (9*(0.546 + x[2]))/16;>>When simplified I expected to get some real number plus>x[0]+3x[1]/4+9x[2]/16, but instead I get the following:>>Simplify[expr] 0.407125 + x[0] + 0.75 x[1] + 0.5625 x[2]>>As you can see, for some reason Mathematica converted the fractions>3/4 and 9/16 to real machine numbers. I consider this to be a bug.You really are not seeing a loss of precision here. When simplify carries out the indicated multiplication such as 9*.546/16 a machine precision number is returned because on of the arguments only has machine precision. It would be incorrect for Mathematica to return a result with greater precision than the arguements. It would also be incorrect for Mathematica to refuse to preform the required multiplications when simplifying this expression.Or said differently, if you want an exact result from Mathematica *all* of the information you supply Mathematica must also be exact. It is not sensible for Mathematica to do otherwise. ==== Bill,See my comments below.>> There is no logical reason to insist part of the expression to be exactwhen another part is inexact. You cannot gain more precision than the leastprecise portion of the expression. Further, there is extra processingoverhead associated with maintaining exact epressions as well as additionalstorage requirements. For a simple expression such as your example theadditional overhead is insignificant. But it increases for every exact termin the expression. It doesn't take all that many terms until the overheadassociate with exact computation becomes noticeable.>It seems to me that you are arguing that if you have an expressionconsisting of one term which is very inprecise and another term which isvery precise or exact, then the total expression is only as precise as theleast precise portion of the expression. This is total nonsense. Consideradding the following terms:1.234567890123456`16 + 0.00000000000000001`1consisting of one term with precision 16 and another term with precision 1.By your argument, Mathematica should return an answer with only a singledigit of precision. Of course, Mathematica does no such thing.> >Even more troubling (to me, at least) is the>following:> >>x[0]+3x[1]/4+9x[2]/16+.4//Simplify>>0.4 + x[0] + 0.75 x[1] + 0.5625 x[2]>>I don't want Simplify to change my nice rational numbers to machine>number approximations.>> If you want exact answers you *must* have *all* terms in the expresssionexact. Simply put either an expression is exact or not. No expression can beexact unless *all* of the terms within it are exact.When did I ever say that I wanted exact answers? In the example above, Iwanted Simplify to do nothing, that is, leave the expression as a sum of aninexact quantity with some exact quantities.In the work where this situation arose, the inexact quantities are typicallyvery small and the exact quantities are large, so that the precision of theoverall expression when extended precision numbers are substituted for thex[i] is typically the same as the precision of the numbers beingsubstituted. For example, suppose x[0] and x[2] are zero, and x[1] is 1`2510^25. Substituting these numbers into the original expression will yield aresult with a precision of 25, whereas substituting these numbers into thesimplified expression will only have a precision of 16. I've worked veryhard to keep the precision of my numbers as high as possible, and I don'twant Mathematica to arbitrarily turn those very high precision numbers intomuch lower precision numbers.Carl WollPhysics DeptU of Washington ==== Bill,Let's step through the expansion here.9*(0.546+x[2]))/16can be expanded to9*0.546/16 + 9*x[2]/16which becomes.307125 + 9*x[2]/16My question was why the 9/16 gets converted to .5625, as I see no reason todo so. Even more troubling (to me, at least) is the following:x[0]+3x[1]/4+9x[2]/16+.4//Simplify0.4 + x[0] + 0.75 x[1] + 0.5625 x[2]I don't want Simplify to change my nice rational numbers to machine numberapproximations.Carl WollPhysics DeptU of Washington>>I'm writing to report what I consider to be a bug. First, I want to>show a simplified example of the problem. Consider the following>expression:> >>expr=0.22 + x[0] + (3*(-0.16+ x[1]))/4 + (9*(0.546 + x[2]))/16;>>When simplified I expected to get some real number plus>x[0]+3x[1]/4+9x[2]/16, but instead I get the following:>>Simplify[expr] 0.407125 + x[0] + 0.75 x[1] + 0.5625 x[2]>>As you can see, for some reason Mathematica converted the fractions>3/4 and 9/16 to real machine numbers. I consider this to be a bug.>> You really are not seeing a loss of precision here. When simplify carriesout the indicated multiplication such as 9*.546/16 a machine precisionnumber is returned because on of the arguments only has machine precision.It would be incorrect for Mathematica to return a result with greaterprecision than the arguements. It would also be incorrect for Mathematica torefuse to preform the required multiplications when simplifying thisexpression.>> Or said differently, if you want an exact result from Mathematica *all* ofthe information you supply Mathematica must also be exact. It is notsensible for Mathematica to do otherwise.> ==== No, Euler proved that series divergent in 1737. It's the usual theoremused to show that while the primes are sparse, they're not as sparse asthe squares (as the sum of THEIR inverses converges).Bobby-----Original Message-----Sal. Oppenheim jr. & Cie. KGaAKoenigsberger Strasse 29D-60487 Frankfurt am MainGERMANYMobile: +49(0)172 6 74 95 77Internet: http://www.oppenheim.de ==== Timing[Sum[1./Prime[n], {n, 1000000}]]{13.860000000000001*Second, 3.0682190480544405}Bobby-----Original Message-----Sal. Oppenheim jr. & Cie. KGaAKoenigsberger Strasse 29D-60487 Frankfurt am MainGERMANYMobile: +49(0)172 6 74 95 77Internet: http://www.oppenheim.de ==== That makes about twenty posts this week detailing nothing but problemsthe FrontEnd).I had been really considering it.Bobby-----Original Message-----resulted in a set of animation control buttons appearing in the bottom frame of the window. I clicked on one of these buttons, but nothing happened. I looke back in the menu and saw M-y as a keyboard shorcut torun an animation. I tried that with no result. I clicked anotherbutton in graphics control set, and my X windows locked up. This included the keyboard's ability to give me another display by using Ctl+Alt+F1. Iwent to another system and ssh-ed in and found Mathematica had over 50% of myuser resources, and was climbing. The same was true for VM. I have a gig ofphysical RAM. Once I killed Mathematica, my X came back to life.I've had several bad experiences with Mathematica and X. I honestlybelieve there help isolate and fix these. Have others had such problems?STH ==== > That makes about twenty posts this week detailing nothing but problems> the FrontEnd).> I had been really considering it.> Bobby> A few other points on this topic, if I may. I've found solutions to a lot of the problems I was having, and documented them. For example, I have the keyboard working the way I want it. C-x, C-v, C-c, C-z, all do what I expect them to, as does Delete. I used to have X restarts after extended periods of running Mathematica. That I haven't had recently. I may simply have thrashed X when I clicked too many buttons in sequence. I just wanted to report that it happened. The same thing might happen on XP. I've had my problems there as well. Not with Mathematica, but with other programs. I haven't even attempted Mathematica on XP. I'm sure it is a bit smoother to use.I guess I was just a bit upset at the sense that WRI are still stuck in the just completing my download of KDE 3.1 Beta 2. Things have changed. Gotta go install a few rpms and restart X. Bye,STH ==== > That makes about twenty posts this week detailing nothing but problems> the FrontEnd).> I had been really considering it.> BobbyPlease keep in mind that this was on Mathematica 4.1, I'll have 4.2 tomorrow, and we'll see how that goes. This isn't really the result I had hoped for by I very much wish WRI would give us a dual boot license. That way, we can use Mathematica in either environment the current situation dictates as the best. with Windows. I just don't do that as a matter of course. I've been related issuse, either because they aren't sure if the problem is their that second reason one bit. Hey, if it locks up my X, I want to know if that happens to others, and I want to identify the source of the problem.What I really would like to gain from all my negative statements is solutions to what I perceive as problems. If not that, then perhaps the perspective which makes me understand that what I see as problems are really just my unfamiliarity with the product. I also want to get others platform. That's how open source works.All that being said, if you are in a situation where an X lockup would really do harm to your project, I would say that I cannot claim it won't happen to you. OTOH, I am able to break just about any system. I can't swear to you that Mathematica won't lock up your Windows system. I can say you will not have as easy a time shelling into it and trying to recover your system without rebooting.STHReply-To: jmt@dxdydz.net ==== Sorry, I thought I had seen a demonstration, some years ago !> This sum converges, see a math text book !> Dear Colleagues,> I calculated:> Sum[1/Prime[n], {n, 15000}] // N> Result: 2.74716> Now I wonder if this sum will converge or keep on growing, albeit very> slowly.> Matthias Bode> Sal. Oppenheim jr. & Cie. KGaA> Koenigsberger Strasse 29> D-60487 Frankfurt am Main> GERMANY> Mobile: +49(0)172 6 74 95 77> Internet: http://www.oppenheim.de> > Reply-To: murray@math.umass.edu ==== It is well known that the infinite series of reciprocals of the primes DIVERGES!See, for example: http://www.utm.edu/research/primes/infinity.shtml> Dear Colleagues,> I calculated:> Sum[1/Prime[n], {n, 15000}] // N> Result: 2.74716> Now I wonder if this sum will converge or keep on growing, albeit very> slowly.> Matthias Bode> Sal. Oppenheim jr. & Cie. KGaA> Koenigsberger Strasse 29> D-60487 Frankfurt am Main> GERMANY> Mobile: +49(0)172 6 74 95 77> Internet: http://www.oppenheim.de> > -- 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 01375Reply-To: jmt@dxdydz.net ==== This sum converges, see a math text book !> Dear Colleagues,> I calculated:> Sum[1/Prime[n], {n, 15000}] // N> Result: 2.74716> Now I wonder if this sum will converge or keep on growing, albeit very> slowly.> Matthias Bode> Sal. Oppenheim jr. & Cie. KGaA> Koenigsberger Strasse 29> D-60487 Frankfurt am Main> GERMANY> Mobile: +49(0)172 6 74 95 77> Internet: http://www.oppenheim.de> ==== The fact that Sum[1/Prime[n], {n, 1,Infinity}]==Infinity is a rather famous theorem of Euler. It implies that there must be infinitely many primes (otherwise the sum would be finite), and was the beginning of a vast area of mathematics, which includes such concepts as Dirichlet series, Riemann's zeta function etc.Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/On Wednesday, October 2, 2002, at 04:31 PM, Matthias.Bode@oppenheim.de > Dear Colleagues,>> I calculated:>> Sum[1/Prime[n], {n, 15000}] // N>> Result: 2.74716>> Now I wonder if this sum will converge or keep on growing, albeit very> slowly.> Matthias Bode> Sal. Oppenheim jr. & Cie. KGaA> Koenigsberger Strasse 29> D-60487 Frankfurt am Main> GERMANY> Mobile: +49(0)172 6 74 95 77> Internet: http://www.oppenheim.de>> ==== Here's a start. If you want the thing to be greater than zero, set itequal to z (which we'll assume is greater than zero) and solve forLog[x]:Log[x, a] + Log[a*x, a] == z /. Log[a_*b_] -> Log[a] + Log[b]{f, g} = Log[x] /. Simplify[Solve[%, Log[x]]]Log[a]/Log[x] + Log[a]/(Log[a] + Log[x]) == z{-(((-2 + z + Sqrt[4 + z^2])*Log[a])/(2*z)), ((2 - z + Sqrt[4 + z^2])* Log[a])/(2*z)}Neither solution appears to be extraneous.Now the task is to find the range of these functions over positive z.Take a look at their derivatives:D[f, z] // SimplifyD[g, z] // Simplify((-1 + 2/Sqrt[4 + z^2])* Log[a])/z^2((-1 - 2/Sqrt[4 + z^2])*Log[a])/z^2A little study shows that f' and g' have their signs opposite to Log[a].Both functions are monotone. The following limits:Outer[Limit[#1, z -> #2] &, {f, g}, {0, Infinity}]Exp@%{{-(Log[a]/2), -Log[a]}, {Infinity*Log[a], 0}}{{1/Sqrt[a], 1/a}, {Indeterminate, 1}}show that f varies from -Log[a]/2 to -Log[a] and g varies from 0 toInfinity if Log[a]>0 and 0 to -Infinity if Log[a]<0. Exponentiationgives ranges for x: -1/Sqrt[a] to 1/a for f, for instance. But whatdoes all this mean?When a>1, either x>1 or 1/a < x < 1/Sqrt[a].When a<1, either 0, ModeratorReply-To: ==== Try this:To the original function, add a function that's (a) zero when theimaginary part is larger than some epsilon value you choose, (b) fairlylarge when the imaginary part is 0 or negative, and (c) as smooth aspossible. For instance, something like:f=Max[(1 - x/epsilon)^5, 0]This function has four continuous derivatives in the real components --though not in the complex variable!If it doesn't penalize the real root enough, multiply f by a constantbigger than 1 and try again.Bobby Treat-----Original Message-----are interested, the zeros are the roots of the dispersion relation for aplasma interacting with a laser). Sometimes FindRoot picks up one of these instead of the one I want.So, I'd like to tell mathematica to look for a root only in a certain rectangular region of the complex plane. Well, if I could tell it, Ôlook for roots with imag. part > something', I'd be happy too.I tried specifying complex values for the start and stop points of an interval, hoping mathematica would interpret these as the corners of a rectangle. No such luck.Any help would be greatly appreciated.I'd also like to point out that this and other issues about complex roots are not clearly addressed in the built-in help files. ==== > This sum converges, see a math text book !That's nonsensehttp://mathworld.wolfram.com/PrimeSums.html Jens> Dear Colleagues,>> I calculated:>> Sum[1/Prime[n], {n, 15000}] // N>> Result: 2.74716>> Now I wonder if this sum will converge or keep on growing, albeit very> slowly.> >>> Matthias Bode> Sal. Oppenheim jr. & Cie. KGaA> Koenigsberger Strasse 29> D-60487 Frankfurt am Main> GERMANY> Mobile: +49(0)172 6 74 95 77> Internet: http://www.oppenheim.de>>> ==== I have updated my package Biokmod. It can be downloaded from:http://web.usal.es/~guillerm/biokmod.htmI developped this package thinking in biokinetic application andinternal dosimetry, but it can be also applied for other kind ofproblems envolving System of ODE with many variables.I will appreciate any comentsGuillermo Sanchezhttp://web.usal.es/~guillerm ==== I use BinaryImport to read a file as follows:BinaryImport[file,{Byte..}] then I use Partition to rebuild the data of dimensions 252 x 253 x 255....This works but it takes about half an hour to read the file....it's a 16MByte file.....any way to improve this?thanks....jerry blimbaumReply-To: kuska@informatik.uni-leipzig.de ==== BinaryImport[] is complet unusable for this task.I tryed the same with similar data sets and runout of kernel memory (with 1.5 GByte RAM) & 3GB swap). The WRI support respondet, that BinaryImport[] isnot for reading *large* binary data. You can have the beta version of MathGL3d 3.1 thathas an extra C-Function for that task.Since it also include excelent volume rendering functionsand a native format for reading and writing compressedvolume data files you should use MathGL3d 3.1b.Contact me direct if you wish to beta test the newversion. Jens> I use BinaryImport to read a file as follows:> BinaryImport[file,{Byte..}]> then I use Partition to rebuild the data of dimensions 252 x 253 x 255....> This works but it takes about half an hour to read the file....it's a 16> MByte file.....any way to improve this?> thanks....jerry blimbaum ==== Does any one know of a way to produce Phase PlaneDiagrams in mathematica? I need to draw a couple of direction field andanalyse the stability of critical points for mysystems of equations . Ajadi__________________________________________________Do You Yahoo!?Everything you'll ever need on one web pagehttp://uk.my.yahoo.comReply-To: kuska@informatik.uni-leipzig.de ==== if you don't like PlotField[] you shouldtry to get a copy of the book Visual DSolvehttp://store.wolfram.com/view/book/D0706.strand the book package. Jens> Does any one know of a way to produce Phase Plane> Diagrams in mathematica?> I need to draw a couple of direction field and> analyse the stability of critical points for my> systems of equations .> Ajadi> __________________________________________________> Do You Yahoo!?> Everything you'll ever need on one web page> http://uk.my.yahoo.com ==== Please ignore a similar question I just posted about BinaryImport...I forgotan hour to import 16 MByte file, whereas this technique took less then 5seconds...special thanks to Mariusz...jerry blimbaum NSWC panama city, ß-----Original Message-----Mariusz JankowskiUniversity of Southern Mainemjkcc@usm.maine.edu207-780-5580> The question:> What is the fastest way to read binary files in Mathematica 4.0 ?> I think the fastest is with ReadList (indeed ReadSounFile that use it,seems> to be better than BinaryImport), but when i use this command...> data = ReadList[filePath, Byte]> ....it doesn't read whole file; can somebody tell me the reason?>> Raf.>> P.S.:> I made some simple tests (@ 16 bit):>> << Experimental`> data = BinaryImport[fileRawPath, Table[Integer16, {4000}],> ByteOrdering -> -1]; => 10 seconds>> data = ReadListBinary[fileRawPath, SignedInt16, ByteOrder ->> LeastSignificantByteFirst]; = > 26 seconds>> << Miscellaneous`Audio`> data = ReadSoundfile[fileWavPath] => 1.54 seconds>> ==== I came across this, and thought I would share. This may be OBE if the font selection is better in 4.2. I'll that installed by this time tomorrow...I hope.http://cgm.cs.mcgill.ca/~luc/math.htmlI started reading through this list, and had visions of recursively downloading the entire internet looking for the font's I really need. Anybody know what fonts I should have installed on my SuSE box to satisfy Mathematica's default expectations?STH ==== In: DSolve[y*D[u[x, y],x] == x*D[u[x, y],y], u[x,y], {x, y}]Out: {{u[x, y] -> C[1][(1/2)*(x^2 + y^2)]}}Square brackets are used as grouping symbols in the result!?? :^OSomebody say it isn't so.---Selwyn Hollis ==== It isn't so. C[1] is an arbitrary (smooth) function. After all, what you have got is a partial differential equation. For example, you can take C[1] to be Sin:In[1]:=v[x_, y_] = u[x, y] /. DSolve[y*D[u[x, y], x] == x*D[u[x, y], y], u[x, y], {x, y}] /. C[1] -> SinOut[1]={Sin[(1/2)*(x^2 + y^2)]}In[2]:=y*D[v[x, y], x] == x*D[v[x, y], y]Out[2]=TrueAndrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/>> In: DSolve[y*D[u[x, y],x] == x*D[u[x, y],y], u[x,y], {x, y}]>> Out: {{u[x, y] -> C[1][(1/2)*(x^2 + y^2)]}}>> Square brackets are used as grouping symbols in the result!?? :^O>> Somebody say it isn't so.>> ---> Selwyn Hollis>>Reply-To: ==== My OPINION is that extra graphics RAM is useful primarily for 3D games(which are themselves completely useless). A static 3D plot doesn'tneed that much graphics RAM -- it's the rapid transformation of it, tosimulate live action, that may require it.On the other hand, if the manufacturer's limits are that low forgraphics RAM, I would get another manufacturer. Who knows what otherlimitations and compromises they'll saddle you with? I would be verysuspicious.Bobby-----Original Message-----Is 32 MB adequate not just now, but likely to be adequate as well for the near future (say, a 3- to 5-year equipment lifetime)?-- Murray Eisenberg murray@math.umass.eduMathematics & Statistics Dept.Lederle Graduate Research Tower phone 413 549-1020 (H)University of Massachusetts 413 545-2859 (W)710 North Pleasant StreetAmherst, MA 01375Reply-To: kuska@informatik.uni-leipzig.de ==== > My OPINION is that extra graphics RAM is useful primarily for 3D gamesOr complex 3d scientific visualizations ? Textures ?Try to render the skull from a 256^3 CT scan or the output of a 3dplasmasimulation and you will know *what* can be done with extra 3d RAM> (which are themselves completely useless). The major effect is, that 3d Games make 3d graphics hardware lessexpensive.Five years ago a SGI cost 20-30 000 $ and today you can have more 3dpowerfor 400 $ Jens> A static 3D plot doesn't> need that much graphics RAM -- it's the rapid transformation of it, to> simulate live action, that may require it.> On the other hand, if the manufacturer's limits are that low for> graphics RAM, I would get another manufacturer. Who knows what other> limitations and compromises they'll saddle you with? I would be very> suspicious.> Bobby> -----Original Message-----> We are about to order new PCs for a university student lab in which> Mathematica will be installed. Of course they will be using 2D and 3D> graphics -- plots of surfaces, e.g. Sooner or later students will want> to rotate such plots, too.> An unresolved issue is how much graphics RAM to get. On existing> machines we typically have 64MB. But for the PCs we are looking at,> manufacturer's limits on graphics RAM, rather than cost, seems to limit> us to 32 MB.> Is 32 MB adequate not just now, but likely to be adequate as well for> the near future (say, a 3- to 5-year equipment lifetime)?> --> Murray Eisenberg murray@math.umass.edu> Mathematics & Statistics Dept.> Lederle Graduate Research Tower phone 413 549-1020 (H)> University of Massachusetts 413 545-2859 (W)> 710 North Pleasant Street> Amherst, MA 01375 ==== Greetings MathGroup,My name is Steve Earth, and I am a new subscriber to this list and also anew user of Mathematica; so please forgive this rather simple question...I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into Mathematicaand have it be able to tell me that it factors into(x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)What instructions do I need to execute to achieve this output?-Steve EarthHarker Schoolhttp://www.harker.org/ ==== SteveThe notebook given after NOTEBOOK below contains functions for factoring andpartial fractioning.Here is an application to your problem: the first stage avoids our needingto know anything about the answer.fc=FactorR[x^4+x^3+x^2+x+1,x](1 - (1/2)*(-1 - Sqrt[5])*x + x^2)* (1 - (1/2)*(-1 + Sqrt[5])*x + x^2)Now we need to get rid of Sqrt[5] in terms of GoldenRatio.This is rather messy:Simplify/@(fc/. Sqrt[5][Rule]2 GoldenRatio-1)(1 + x - GoldenRatio*x + x^2)*(1 + GoldenRatio*x + x^2)Simplify/@(%/.-GoldenRatio[Rule] 1/GoldenRatio -1)(1 + x/GoldenRatio + x^2)*(1 + GoldenRatio*x + x^2)Another examplePartialFractionsR[(1 + x)x/(1 - 3*x + x^2), x]1 - (2*(-1 + 4*x))/((3 + Sqrt[5] - 2*x)*(-3 + 2*x)) + (2*(-1 + 4*x))/((-3 + 2*x)*(-3 + Sqrt[5] + 2*x))Simplify[%](x*(1 + x))/(1 - 3*x + x^2)NOTEBOOK: to make a notebook from the following, copy from the next line tothe line preceding XXX and paste into a new Mathematica notebook.Notebook[{Cell[CellGroupData[{Cell[Factors and PartialFractions, Subtitle],Cell[Allan Hayes, 16 August 2001, Text],Cell[, Text],Cell[BoxData[ (Quit)], Input],Cell[BoxData[{ (Off[General::spell1, General::spell]), n, ((FactorC::usage = ;)n), n, ((FactorR::usage = ;)n), n, ((PartialFractionsC::usage = ;)n), n, ((PartialFractionsR::usage = ;)), n, (On[General::spell1, General::spell])}], Input, InitializationCell->True],Cell[TextData[{ FactorC[p_, x_] := , StyleBox[(*over complex numbers*), FontFamily->Arial, FontWeight->Plain], nTimes @@ Cases[Roots[p == 0, x, n Cubics -> False], u_ == v_ -> x - v]n nFactorR[p_, x_] := , StyleBox[(*over reals, coefficients must be real*), FontFamily->Arial, FontWeight->Plain], n (Times @@ Join[Cases[#1, u_ == v_ /; Im[v] == 0 :> n x - v], Cases[#1, u_ == v_ /; Im[v] > 0 :> n x^2 - x*2*Re[v] + Abs[v]^2]] & )[n Roots[p == 0, x, Cubics -> False]]}], Input, InitializationCell->True],Cell[TextData[{ PartialFractionsC[p_, x_] := , StyleBox[(*over complex numbers*), FontFamily->Arial, FontWeight->Plain], n(#+Apart[#2/FactorC[#3,x]])&@@Flatten[{PolynomialReduce[# ,#2], #2}]&[Numerator[#],Denominator[#]]&[Together[p]]n nPartialFractionsR[p_, x_] := , StyleBox[(*over reals, coefficients must be real*), FontFamily->Arial, FontWeight->Plain], n(#+Apart[#2/FactorR[#3,x]])&@@Flatten[{PolynomialReduce[# ,#2], #2}]&[Numerator[#],Denominator[#]]&[Together[p]]}], Input, InitializationCell->True],Cell[CellGroupData[{Cell[ PROGRAMMING NOTES, Subsubsection],Cell[TextData[{ The option , StyleBox[Cubics->False, FontFamily->Courier], is used to keep the roots of cubics in , StyleBox[Root[....], FontFamily->Courier], form. This is better for computation.n, StyleBox[Re[v], FontFamily->Courier], and , StyleBox[Abs[v]^2, FontFamily->Courier], are used rather than , StyleBox[v+Conjugate[v] , FontFamily->Courier], and , StyleBox[v*Conjugate[v], FontFamily->Courier], to prevent , StyleBox[Apart, FontFamily->Courier], from factorising , StyleBox[x^2 - x*2*Re[v] + Abs[v]^2], FontFamily->Courier], back to complex form.}], Text]}, Closed]],Cell[CellGroupData[{Cell[EXAMPLES, Subsubsection],Cell[pol = Expand[(x - 1)*(x + 1)^2*(x^2 + x + 1)^2*(x^2 + 4)]; , Input],Cell[CellGroupData[{Cell[f1 = FactorC[pol, x], Input],Cell[BoxData[ ((((-1) + x)) (((-2) [ImaginaryI] + x)) ((2 [ImaginaryI] + x)) ((1 + x))^2 (((((-1)))^(1/3) + x))^2 (((-(((-1)))^(2/3)) + x))^2)], Output]}, Open ]],Cell[CellGroupData[{Cell[f2 = FactorR[pol, x], Input],Cell[BoxData[ ((((-1) + x)) ((1 + x))^2 ((4 + x^2)) ((1 + x + x^2))^2)], Output]}, Open ]],Cell[CellGroupData[{Cell[f3 = FactorR[x^3 + x + 1, x], Input],Cell[BoxData[ (((x - Root[1 + #1 + #1^3 &, 1])) ((x^2 - 2 x Root[(-1) + 2 #1 + 8 #1^3 &, 1] + Root[(-1) - #1^4 + #1^6 &, 2]^2)))], Output]}, Open ]],Cell[False in Roots.We can sometimes get radical forms, but notice the complication.>, Text],Cell[CellGroupData[{Cell[ToRadicals[f3], Input],Cell[BoxData[ (((((2/(3 (((-9) + @93)))))^(1/3) - ((1/2 (((-9) + @93))))^(1/3)/3^(2/3) + x)) ((1/3 + 1/3 ((29/2 - (3 @93)/2))^(1/3) + 1/3 ((1/2 ((29 + 3 @93))))^(1/3) - 2 ((((1/2 ((9 + @93))))^(1/3)/(2 3^(2/3)) - 1/(2^(2/3) ((3 ((9 + @93))))^(1/3)))) x + x^2)))], Output]}, Open ]],Cell[Inexact forms can be found, from f3 :, Text],Cell[CellGroupData[{Cell[N[f3], Input],Cell[BoxData[ (((((0.6823278038280193`)([InvisibleSpace]) ) + x)) ((((1.4655712318767682`)([InvisibleSpace])) - 0.6823278038280193` x + x^2)))], Output]}, Open ]],Cell[or directly, Text],Cell[CellGroupData[{Cell[f3 = FactorR[x^3 + x + 1//N, x], Input],Cell[BoxData[ (((((0.6823278038280193`)([InvisibleSpace]) ) + x)) ((((1.4655712318767682`)([InvisibleSpace])) - 0.6823278038280193` x + x^2)))], Output]}, Open ]],Cell[Partial fractions, Text],Cell[CellGroupData[{Cell[pf1 = PartialFractionsR[(2 + x)/pol, x], Input],Cell[BoxData[ (1/(60 (((-1) + x))) - 1/(10 ((1 + x))^2) - 39/(100 ((1 + x))) + ((-54) - 31 x)/(4225 ((4 + x^2))) + ((-1) + 3 x)/(13 ((1 + x + x^2))^2) + (44 + 193 x)/(507 ((1 + x + x^2))))], Output]}, Open ]],Cell[CellGroupData[{Cell[pf2 = PartialFractionsR[(1 + x)x/(1 - 3*x + x^2), x], Input],Cell[<1 - (2*(-1 + 4*x))/((3 + Sqrt[5] - 2*x)*(-3 + 2*x)) + (2*(-1 + 4*x))/((-3 + 2*x)*(-3 + Sqrt[5] + 2*x))>, Output]}, Open ]],Cell[CellGroupData[{Cell[BoxData[ (Simplify[%])], Input],Cell[(x*(1 + x))/(1 - 3*x + x^2), Output]}, Open ]],Cell[Partial fractions will often involve Root objects , Text],Cell[CellGroupData[{Cell[pf3 = PartialFractionsR[(1 + x)/(x^3 - x + 1), x], Input],Cell[BoxData[ (((1 + Root[1 - #1 + #1^3 &, 1]))/((((x - Root[1 - #1 + #1^3 &, 1])) ((Root[1 - #1 + #1^3 &, 1]^2 - 2 Root[1 - #1 + #1^3 &, 1] Root[(-1) - 2 #1 + 8 #1^3 &, 1] + Root[(-1) + #1^4 + #1^6 &, 2]^2)))) + ((x + Root[1 - #1 + #1^3 &, 1] + x Root[1 - #1 + #1^3 &, 1] - 2 Root[(-1) - 2 #1 + 8 #1^3 &, 1] - Root[(-1) + #1^4 + #1^6 &, 2]^2))/(((((-x^2) + 2 x Root[(-1) - 2 #1 + 8 #1^3 &, 1] - Root[(-1) + #1^4 + #1^6 &, 2]^2)) ((Root[1 - #1 + #1^3 &, 1]^2 - 2 Root[1 - #1 + #1^3 &, 1] Root[(-1) - 2 #1 + 8 #1^3 &, 1] + Root[(-1) + #1^4 + #1^6 &, 2]^2)))))], Output]}, Open ]],Cell[This can in fact be put in radical form:, Text],Cell[CellGroupData[{Cell[ToRadicals[pf3], Input],Cell[BoxData[ (((1 - ((2/(3 ((9 - @69)))))^(1/3) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3)))/(((((-( 1/3)) + 1/3 ((25/2 - (3 @69)/2))^(1/3) + 1/3 ((1/2 ((25 + 3 @69))))^(1/3) + (((-((2/(3 ((9 - @69)))))^(1/3)) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3)))^2 - 2 (((-((2/(3 ((9 - @69)))))^(1/3)) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3))) ((1/24 ((864 - 96 @69))^(1/3) + ((1/2 ((9 + @69))))^(1/3)/(2 3^(2/3)))))) ((((2/(3 ((9 - @69)))))^(1/3) + ((1/2 ((9 - @69))))^(1/3)/3^(2/3) + x)))) + ((1/3 - 1/3 ((25/2 - (3 @69)/2))^(1/3) - ((2/(3 ((9 - @69)))))^(1/3) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3) - 1/3 ((1/2 ((25 + 3 @69))))^(1/3) - 2 ((1/24 ((864 - 96 @69))^(1/3) + ((1/2 ((9 + @69))))^(1/3)/(2 3^(2/3)))) + x + (((-((2/(3 ((9 - @69)))))^(1/3)) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3))) x))/(((((-(1/3)) + 1/3 ((25/2 - (3 @69)/2))^(1/3) + 1/3 ((1/2 ((25 + 3 @69))))^(1/3) + (((-((2/(3 ((9 - @69)))))^(1/3)) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3)))^2 - 2 (((-((2/(3 ((9 - @69)))))^(1/3)) - ((1/2 ((9 - @69))))^(1/3)/3^(2/3))) ((1/24 ((864 - 96 @69))^(1/3) + ((1/2 ((9 + @69))))^(1/3)/(2 3^(2/3)))))) ((1/3 - 1/3 ((25/2 - (3 @69)/2))^(1/3) - 1/3 ((1/2 ((25 + 3 @69))))^(1/3) + 2 ((1/24 ((864 - 96 @69))^(1/3) + ((1/2 ((9 + @69))))^(1/3)/(2 3^(2/3)))) x - x^2)))))], Output]}, Closed]],Cell[We could have found the inexact form directly., Text],Cell[CellGroupData[{Cell[BoxData[ (PartialFractionsR[((1 + x))/((x^3 - x + 1)) // N, x])], Input],Cell[BoxData[ ((-(0.07614206365252976`/(((1.324717957244746` )([InvisibleSpace])) + 1.` x))) + (((0.7982664819556426`)([InvisibleSpace])) + 0.07614206365252976` x)/(((0.754877666246693`)([InvisibleSpace] )) - 1.324717957244746` x + 1.` x^2))], Output]}, Open ]]}, Closed]]}, Open ]]},ScreenRectangle->{{0, 1024}, {0, 709}},AutoGeneratedPackage->None,WindowSize->{534, 628},WindowMargins->{{199, Automatic}, {0, Automatic}},ShowCellLabel->False,StyleDefinitions -> Default.nb]XXX--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> Greetings MathGroup,>> My name is Steve Earth, and I am a new subscriber to this list and also a> new user of Mathematica; so please forgive this rather simple question...>> I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into Mathematica> and have it be able to tell me that it factors into>> (x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)>> What instructions do I need to execute to achieve this output?>> -Steve Earth> Harker School> http://www.harker.org/>Reply-To: kuska@informatik.uni-leipzig.de ==== In[]:=Factor[x^4 + x^3 + x^2 + x + 1, Extension -> {GoldenRatio,1/GoldenRatio}]Out[]=-((-3 - 2*x + Sqrt[5]*x + GoldenRatio*x - 3*x^2)* (3 + x + Sqrt[5]*x + GoldenRatio*x + 3*x^2))/9 Jens> Greetings MathGroup,> My name is Steve Earth, and I am a new subscriber to this list and also a> new user of Mathematica; so please forgive this rather simple question...> I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into Mathematica> and have it be able to tell me that it factors into> (x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)> What instructions do I need to execute to achieve this output?> -Steve Earth> Harker School> http://www.harker.org/ ==== > The last part of my message you are quoting was completely wrong, as> was pointed out by Allan Hayes. Mathematica does not track precision of> machine arithmetic computations. In order for Mathematica to give> reliable information about the precision of a computation you have to> explicitly set the precision of all the numerical quantities.>> Your own example at the bottom simply shows you have not understood the> evaluation mechanism of Mathematica.>> Just opposite, thanks to you and other participants, I completely> understood it. SetAccuracy just takes anything and calls it accurate.> This behavior is useless if not stupid.I am not sure I understand what you are referring to as uselessif not stupid.The main purpose of SetAccuracy is to allow people who have donetheir own error analysis to specify the numerical error in aninput or in a result. It is often possible through carefulnumerical analysis, for example, to come up with a better errorestimate than can be given by generic rules for propogation of error.Another common use of SetAccuracy is for converting machine numbersor exact numbers into variable-precision numbers in situations whenit is desired that a calculation be done using variable-precisionarithmetic.Is there some aspect of this that you think is useless if not stupid,or was that remark referring to something else?Dave WithoffWolfram Research ==== > The more I play with the example the more depressing it gets. Start> with ßoating point numbers but explicitely arbitrary-precision ones.> In[1]:=> a=77617.00000000000000000000000000000;> b=33095.00000000000000000000000000000;> In[3]:=> !(333.7500000000000000000000000000000 b^6 + a^2 ((11 a^2> b^2 - > b^6 - 121 b^4 - 2)) + 5.500000000000000000000000000000 b^8 +> a/(2> b))> Out[3]=> !((-4.78339168666055402578083604864320577443814`26.6715 *^32))> In[4]:=> Accuracy[%]> Out[4]=> -6> Due to the manual section 3.1.6:> When you do calculations with arbitrary-precision numbers, as> discussed in the previous section, Mathematica always keeps track of> the precision of your results, and gives only those digits which are> known to be correct, given the precision of your input. When you do> calculations with machine-precision numbers, however, Mathematica> always gives you a machine?precision result, whether or not all the> digits in the result can, in fact, be determined to be correct on the> basis of your input. > Because I started with arbitrary-precision numbers Mathematica should display> only those digits that are correct, that is none.An accuracy of -6 means that the least significant correct digit is 6digits to the left of the decimal point. The result Out[3] in theexample above has 26 significant digits to the left of that (the mostsigificant digit is 26+6=32 digits to the left of the decimal point),so there are 26 correct digits to display.Was there some other result you were referring to as a result inwhich the number of correct digits is none?Dave WithoffWolfram Research ==== > I came across this, and thought I would share. This may be OBE if the font > selection is better in 4.2. I'll that installed by this time tomorrow...I > hope.> http://cgm.cs.mcgill.ca/~luc/math.html> I started reading through this list, and had visions of recursively > downloading the entire internet looking for the font's I really need. > Anybody know what fonts I should have installed on my SuSE box to satisfy > Mathematica's default expectations?The contents of the page at this URL are interesting, but probably not relevant for your purposes.The only fonts which are absolutely needed by the front end are the fontsthat supply the special glyphs for mathematical notation, groupingcharacters, Greek letters, etc. These fonts were developed by Wolfram Research and are installed as part of the Mathematica installation. There are two generations of these fonts. The first generation wasintroduced in Mathematica 3.0 in the fall of 1996 and were used throughthe release of Mathematica 4.1. There were five families known as Math1 - Math5. Each familiy had four variants: a proportionaly-spaced medium face, a monospaced medium, a proportional bold, and a monospaced bold. The second generation is used by Mathematica 4.2. There are seven families named Mathematica1 - Mathematica7.Aside from the math fonts, the front end should be able to functionproperly provided that you have a font that supports the encoding for yourchosen locale. The style sheets bundled with the front end use onlyTimes, Helvetica, and Courier. Should these fonts not be available onyour system, the front end has some substitution rules. For example, the Windows front end knows to use the fonts Times New Roman,Arial, and Courier New. The X Window System ships with bitmap versions ofTimes, Helvetica, and Courier as well as an outline of Courier. If one ofthese fonts must be drawn at a size for which there are no bitmaps, outline fonts provided with Mathematica are used. Helvetica is aliased to Swiss721, and Times is aliased to Utopia through a fonts.alias file in the Mathematica fonts directory.Under MacOS and Windows, you should be albe to use whatever fonts areavailable on your system. Under X, things are a little more complicated. The front end can display whatever fonts are made available to your Xserver, but it can generate PostScript only for those fonts where an AdobeFont Metric (AFM) file is available. If you wish to display or print thePostScript, you must also make the Type 1 font file available to therendering device.Note also that the X front end has an adjustable setting for the amount of memory to reserve for storing font data. If your system has a large number of fonts, you may need to increase this setting per this FAQ page:http://support.wolfram.com/mathematica/systems/linux/ interface/fonterrors.html-- User Interface Programmer paulh@wolfram.comWolfram Research, Inc. ==== >> I came across this, and thought I would share. This may be OBE if the>> font>> selection is better in 4.2. I'll that installed by this time>> tomorrow...I hope.>>> http://cgm.cs.mcgill.ca/~luc/math.html>>> I started reading through this list, and had visions of recursively>> downloading the entire internet looking for the font's I really need.>> Anybody know what fonts I should have installed on my SuSE box to satisfy>> Mathematica's default expectations?> The contents of the page at this URL are interesting, but probably not> relevant for your purposes.That's kind'o' what I thought.[snip - history lesson - thanks]> The second generation is used by Mathematica 4.2. There are seven> families named Mathematica1 - Mathematica7.Where is the documentation for installing these?This is dated:http://support.wolfram.com/mathematica/systems/linux/ interface/fonterrors.htmlI grabbed these off the net:http://support.wolfram.com/mathematica/systems/linux/ general/latestfonts.htmlhttp://support.wolfram.com/ mathematica/systems/linux/general/MathBDF_42.tar.gzhttp:// support.wolfram.com/mathematica/systems/linux/general/MathPCF _42.tar.gzhttp://support.wolfram.com/mathematica/systems/ linux/general/MathT1_42.tar.gz> su -******# cd /usr/X11/lib/X11/fonts/# mkdir -p local/mma# cd local/mma# tar xvfz /download/com/wri/MathBDF_42.tar.gz# tar xvfz /download/com/wri/MathPCF_42.tar.gz# tar xvfz /download/com/wri/MathT1_42.tar.gz# xemacs /etc/X11/XF86Config ....# grep FontPath /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/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 FontPath /usr/X11R6/lib/X11/fonts/local/mma/BDF FontPath /usr/X11R6/lib/X11/fonts/local/mma/PCF FontPath /usr/X11R6/lib/X11/fonts/local/mma/T1# SuSEconfig....# init 3 [assuming you are already at a TTY console]# init 5> Aside from the math fonts, the front end should be able to function> properly provided that you have a font that supports the encoding for your> chosen locale. The style sheets bundled with the front end use only> Times, Helvetica, and Courier. Should these fonts not be available on> your system, the front end has some substitution rules.> For example, the Windows front end knows to use the fonts Times New Roman,> Arial, and Courier New. The X Window System ships with bitmap versions of> Times, Helvetica, and Courier as well as an outline of Courier. If one of> these fonts must be drawn at a size for which there are no bitmaps,> outline fonts provided with Mathematica are used. Helvetica is aliased to> Swiss721, and Times is aliased to Utopia through a fonts.alias file in the> Mathematica fonts directory.This is what I find anoying. Every time Mathematica does one of these substitutions, it beeps. This is what I'm calling a font fault. It's like the boy who cried wolf. I start ignoring beeps. It also bothers me that I am not seeing what the author had intended. I *believe* it is the author of the notebook or help document who determines what fonts should be used. This is a point of confusion. When I opened a help page, and didn't like the size of the fonts, I tried to adjust them without the desired result. I now believe the proper remedy is to use magnification, not a font adjustment.I have far fewer chirps (beeps) in 4.2, but I do get them when changing the magnification. > Under MacOS and Windows, you should be albe to use whatever fonts are> available on your system. Under X, things are a little more complicated.> The front end can display whatever fonts are made available to your X> server, but it can generate PostScript only for those fonts where an Adobe> Font Metric (AFM) file is available. If you wish to display or print the> PostScript, you must also make the Type 1 font file available to the> rendering device.This is for another day. I believe I have done this in years gone by, but, for now, I just want to get the optimal behavior form the crt.[snip]Here's my question in a nutshell. When I do xlsfonts, what should be listed in order to run Mathematica 4.2 and not experiece font faults generated by content provided on the CD?Please note that I *just* finished installing the fonts off the web, so I'm not sure what, if any problems still remain. I suspect the helvetica faults will still occur.STH. ==== Bobby,One point:>.... bigßoats ... [are] the result of using N[expr,k] or SetAccuracy[expr,k] where k is bigger than machine precision. If k <=> machine > precision, the result is a machine precision number.We get bigßoats with k<=machine precision with SetAccuracy and SetPrecision but not with N:Example a=SetPrecision[2.3,5] 2.3000 Precision[a] 5. Precision[a^2000] 1.69897Also, of course, when more than machine precision significant digits are given a=1.01234567891234500; Precision[a] 17.301Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198Reply-To: ==== Please allow me to summarize what I've learned in the recent discussion,and retract my claim that Accuracy, Precision, and SetAccuracy areuseless. Numbers come in three varieties - machine precision, Infinite precision,and bignum or bigßoat. Bignums and bigßoats (synonymous?) aren'tcalled that in the Help Browser, but they're the result of usingN[expr,k] or SetAccuracy[expr,k] where k is bigger than machineprecision. If k <= machine precision, the result is a machine precisionnumber, even if you know the expression isn't that precise. If, when you use N or SetAccuracy as described above, the expressioncontains undefined symbols, you get an expression with all its numericsreplaced by bignums of the indicated precision. When the symbols aredefined later, if ANY of them are machine precision, the expression iscomputed with machine arithmetic - with the side-effect thatcoefficients that originally were Infinite-precision are now onlymachine precision. That is, x^2 might have becomex^2.0000000000000000000000000000000000 but later became x^2., forinstance. If all the symbols have been set to bignum or Infinite precisionvalues, the computation will be done taking precision into account, andthe result has a Precision or Accuracy that makes sense. In all othercases, Precision returns Infinity for entirely Infinite-precisionexpressions and 16 for everything else. When one of the experts says significance arithmetic that's what theymean - using SetAccuracy or N to give things more than 16 digits,leaving no machine precision numbers anywhere in the expression, andusing Accuracy or Precision, which ARE meaningful in that case, to judgethe result. (It's meaningful if all your inputs really have more than16 digits of precision, that is.) You can't use significance arithmetic to determine how much precisiona result has if your inputs have 16 or 15 or 2 digits of precision. Inthe example we've been looking at, you can give the inputs MORE accuracythan you really believe they have, and still get back 0 digits fromPrecision at the end, so there are clearly no trustworthy digits whenyou use the original inputs either. If an expression is on the razor'sedge, and has lost only a few digits of precision, that wouldn't work sowell. Oddly enough, significance arithmetic in the Browser doesn't take youto any of that. Instead, it takes you to Interval arithmetic, a moresophisticated method, which may give a more accurate gauge of how muchprecision you really have, and WILL deal with machine precision numbersand numbers with even less precision. It does a very good job on theexample. However, it isn't very suitable for Complex numbers,matrices, etc. NSolve and NIntegrate probably can't handle it, either. Daniel Lichtblau promises that all this will be clearer in the nextrelease. DrBob ==== I'm a newbie and, of course, the first thing I want to do is apparently one of the most complicated...I have an expression that looks like this:A + B/C + D*Sqrt[E]/C = 0A,B,C,D, & E are all polynomials in xI want it to look like this(D^2)*E = (A*C + B)^2At that point, I'll have polynomials in x on both sides. Finally, I want the equation to be written out with terms grouped by powers of x, but I think I can do that part :)I'll be very grateful to anyone who can give me some pointers. Or, at least point me to some tutorial in the Mathematica documentation. I've been looking over the documentation and I found Appendix A.5 in The Mathematica Book, but that doesn't help me. I _need_ some examples. I did find a couple of well-written posts in this newsgroup, but not quite close enough to what I want.Troy.=-=-=-=-=-=-=-=-=-=FYI, here's the expression I'm working with.denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]cnu = (2*b^2 - B^2 + r^2)/denomsnu = -2*b*Sqrt[B^2 - b^2]/denomsif = 2*r*b/denomcif = (r^2 - B^2)/denompdr = -Cos[ds]*Sin[q]*(snu*cif + cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/( r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w* r)^2 - (w*r*pdr)^2)*(Cos[qr])^2 Although I said it's a polynomial in x, it's really a polynomial in b that I'm after. ==== Troy,True, interactive manipulation can be difficult.However, here is one way to do what you want.We have to do the same thing to both sides of the equation. (# - D*Sqrt[K]/C)&/@(A+B/C+D*Sqrt[K]/C[Equal]0 A + B/C == -((D*Sqrt[K])/C) Together/@% (B + A*C)/C == -((D*Sqrt[K])/C) #C&/@% B + A*C == (-D)*Sqrt[K] #^2&/@% (B + A*C)^2 == D^2*KNOTES.Here is how #C&/@ (lhs ==rhs) works:#C&/@ (lhs ==rhs) --> #C&[lhs]==#C&[rhs] --> lhs C == rhs C --> ... f/@( expr) is special for for Map[f, expr]expr& is special for Function[expr]Please look up Map and Function in the Help Browser.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> I'm a newbie and, of course, the first thing I want to do is apparently> one of the most complicated...>> I have an expression that looks like this:>> A + B/C + D*Sqrt[E]/C = 0>> A,B,C,D, & E are all polynomials in x> I want it to look like this>> (D^2)*E = (A*C + B)^2>> At that point, I'll have polynomials in x on both sides. Finally, I> want the equation to be written out with terms grouped by powers of x,> but I think I can do that part :)>> I'll be very grateful to anyone who can give me some pointers. Or, at> least point me to some tutorial in the Mathematica documentation. I've> been looking over the documentation and I found Appendix A.5 in The> Mathematica Book, but that doesn't help me. I _need_ some examples. I> did find a couple of well-written posts in this newsgroup, but not quite> close enough to what I want.> Troy.>> =-=-=-=-=-=-=-=-=-=>> FYI, here's the expression I'm working with.> denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]> cnu = (2*b^2 - B^2 + r^2)/denom> snu = -2*b*Sqrt[B^2 - b^2]/denom> sif = 2*r*b/denom> cif = (r^2 - B^2)/denom>> pdr = -Cos[ds]*Sin[q]*(snu*cif +> cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)>> 0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/(> r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w*> r)^2 - (w*r*pdr)^2)*(Cos[qr])^2>> Although I said it's a polynomial in x, it's really a polynomial in b> that I'm after.> ==== > Troy,> True, interactive manipulation can be difficult.> However, here is one way to do what you want.> We have to do the same thing to both sides of the equation.> (# - D*Sqrt[K]/C)&/@(A+B/C+D*Sqrt[K]/C[Equal]0> A + B/C == -((D*Sqrt[K])/C)I think I have to apologize for the lack of clarity in my original post. I had tried to word it carefully, but I deceived myself. I should have said:I have an expression that can be put into this form: A + B/C + D*Sqrt[K]/C = 0 A,B,C,D, & K are all polynomials in xI need to get it into that form and, in the end, I want it to look like this(D^2)*K = (A*C + B)^2I think I gave the impression that I have polynomials A,B,C,D, & K at my fingertips. I don't. The expression I have is given at the end of this message. I'm still trying to digest the respones I've garned so far. In the meantime, I decided to post this clarification.>> I'm a newbie and, of course, the first thing I want to do is >> apparently one of the most complicated...>> I have an expression that looks like this:>> A + B/C + D*Sqrt[K]/C = 0>> A,B,C,D, & K are all polynomials in x>> I want it to look like this>> (D^2)*K = (A*C + B)^2>> At that point, I'll have polynomials in x on both sides. Finally, I>> want the equation to be written out with terms grouped by powers of x,>> but I think I can do that part :)>> I'll be very grateful to anyone who can give me some pointers. Or, >> at least point me to some tutorial in the Mathematica documentation. >> I've been looking over the documentation and I found Appendix A.5 in >> The Mathematica Book, but that doesn't help me. I _need_ some >> examples. I did find a couple of well-written posts in this newsgroup, >> but not quite close enough to what I want.>> Troy.>> =-=-=-=-=-=-=-=-=-=>> FYI, here's the expression I'm working with.>> denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]>> cnu = (2*b^2 - B^2 + r^2)/denom>> snu = -2*b*Sqrt[B^2 - b^2]/denom>> sif = 2*r*b/denom>> cif = (r^2 - B^2)/denom>> pdr = -Cos[ds]*Sin[q]*(snu*cif +>> cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)>> 0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/(>> r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w*>> r)^2 - (w*r*pdr)^2)*(Cos[qr])^2>> Although I said it's a polynomial in x, it's really a polynomial in >> b that I'm after.> ==== I'm only a little embarassed for not having realized what was happening. (Perhaps I should have slept on it.)Surely I'm not alone in thinking this symbolism is highly nonintuitive. But of course, for it to be otherwise would require another protected symbol...---Selwyn>>In: DSolve[y*D[u[x, y],x] == x*D[u[x, y],y], u[x,y], {x, y}]>>Out: {{u[x, y] -> C[1][(1/2)*(x^2 + y^2)]}}>>Square brackets are used as grouping symbols in the result!?? :^O>>Somebody say it isn't so.> It isn't so> The square bracket is not delineating a factor it is enclosing the argument > to an arbitrary function named C[1]. While the function is dependent on both > x and y the dependence only occurs in the combination (x^2+y^2).> Bob Hanlon> Reply-To: ==== It isn't so. The solution is an arbitrary function of (1/2)*(x^2 +y^2)]}}.Bobby-----Original Message----- ==== Does anyone know what happened to the < Does anyone know what happened to the < in Mathematica 4.x? In some version I know I used it, but it seems to> have gone away. It allowed for real time manipulation of 3D graphics.> > Ray Gittings ==== > The more I play with the example the more> depressing it gets. Start> with ßoating point numbers but explicitly> arbitrary-precision ones.> In[1]:=> a=77617.00000000000000000000000000000;> b=33095.00000000000000000000000000000;> In[3]:=> !(333.7500000000000000000000000000000 b^6 +> a^2 ((11 a^2> b^2 - > b^6 - 121 b^4 - 2)) +> 5.500000000000000000000000000000 b^8 +> a/(2> b))> Out[3]=> >>!((-4.78339168666055402578083604864320577443814` 26.6715*^32))> In[4]:=> Accuracy[%]> Out[4]=> -6> Due to the manual section 3.1.6:> When you do calculations with arbitrary-precision> numbers, as> discussed in the previous section, Mathematica> always keeps track of> the precision of your results, and gives only> those digits which are> known to be correct, given the precision of your> input. When you do> calculations with machine-precision numbers,> however, Mathematica> always gives you a machine[CapitalEth]precision result,> whether or not all the> digits in the result can, in fact, be determined> to be correct on the> basis of your input. > Because I started with arbitrary-precision numbers> Mathematica should display> only those digits that are correct, that is none.> No, 26 digits are correct Here is the number:-0.8273960599468213681Here is the same number computed by Mathematica with 26correct digits:-4.78339168666055402578083604864320577443814[Times]10 ^32It looks like I have been using some wrong definitionof correct.:-)You just proved that Precision is useless as a measurehow good your numerical result is. > (check Precision instead> of Accuracy to see> this).> You appear to be showing output in InputForm. If you> use OutputForm or> StandardForm only 26 digits will be shown.> 32> Out[3]= -4.7833916866605540257808360 10> InputForm is showing more because it exposes bad> digits as well as> good ones.> > To relax a bit, set a new input cell to> StandardForm and type> 77617.000000000000000000000000000000000> Convert it to InputForm. You get> >>77616.999999999999999999999999999999999999999999952771` 37.9031> Convert back to StandardForm> >>77616.99999999999999999999999999999999999999999976637` 37.9031> Again to InputForm> >>77616.99999999999999999999999999999999999999999963735` 37.9031> Back to StandardForm> >>77616.99999999999999999999999999999999999999999951376` 37.9031> See what you can get if you have enough patience> or a small program.> PK> Agreed, it's not very pretty. I am uncertain as to> whether this> indicates a bug in StandardForm or elsewhere in the> underlying numerics> code, and will defer to our numerics experts on that> issue. My guess is> it is a bug if only because it violates the spirit> of IEEE arithmetic> wherein ßoats that have integer values should be> representable as such> (or something to that effect). I will point out,> however, that the two> numbers in question are equal to the specified> precision. Also it> appears to be improved in our development kernel.> > Daniel Lichtblau> Wolfram Research__________________________________________________Do you Yahoo!?http://faith.yahoo.com ==== >Yes, there seems to be a lot of people who have a visceral hatred for>Microsoft and Windows. They are even willing to shed blood to avoid>Windows. But why? Windows works and you don't have to become a systems>programmer.>>Furthermore, I think that Steven Wolfram uses some version of Windows.>So guess which system Mathematica will be best tuned up for?If it is true Wolfram uses Mathematica on a Windows based machine my experience is it doesn't translate to Mathematica running better on Windows. I use Mathematica on WindowsNT and on a Mac (currently Mac OS X). I have found Mathematica to be more stable on a Mac than on Windows. On more than one occassion I've seen errors I made Mathematica code to crash the entire machine under WindowsNT. I've never had this happen running things on a Mac. ==== >>Yes, there seems to be a lot of people who have a visceral hatred for>>Microsoft and Windows. They are even willing to shed blood to avoid>>Windows. But why? Windows works and you don't have to become a systems>>programmer.>>Furthermore, I think that Steven Wolfram uses some version of Windows.>>So guess which system Mathematica will be best tuned up for?> If it is true Wolfram uses Mathematica on a Windows based machine my> experience is it doesn't translate to Mathematica running better on> Windows. I use Mathematica on WindowsNT and on a Mac (currently Mac OS X).> I have found Mathematica to be more stable on a Mac than on Windows. On> more than one occassion I've seen errors I made Mathematica code to crash> the entire machine under WindowsNT. I've never had this happen running> things on a Mac.I believe you hit the nail on the head. I suspect Dr. Wolfram is running on Mac. I have the feeling WRI is a clandestine Mac holdout.STH. ==== I ran Turbo XML http://www.tibco.com/solutions/products/extensibility/turbo_ xml.jsp on ToFileName[{$TopDirectory, SystemFiles, IncludeFiles, XML}, notebookml1.dtd ]It gave me an error saying: There is more than one attribute named class. My guess is this was the intention:hattons@ljosalfr:~/.Mathematica/SystemFiles/ IncludeFiles/XML/NotebookML1> diff /opt/Wolfram/Mathematica/4.2/SystemFiles/IncludeFiles/XML/ NotebookML1/notebookml.dtd /home/hattons/.Mathematica/SystemFiles/IncludeFiles/XML/ NotebookML1/notebookml.dtd91c91Comments?STH. ==== I've posted Mathematica notebooks and packages illustrating most of theneural networks discussed in James Anderson's book An Introduction toNeural Networks to the Brainstage Research web site (www.brainstage.com).Have fun!DonDonald Doherty, Ph.D.Brainstage Research, Inc.donald.doherty@brainstage.com ==== can I have mathematica solver things like a(over)b, (in how many ways can you pick b items from a items)?I have mathematica 4.Stefan ==== StefanYou certainly can - try Binomial[a,b].Mark Westwood> can I have mathematica solver things like a(over)b, (in how many ways> can you pick b items from a items)?> I have mathematica 4.> Stefan ==== There are two basic ways, the second of which has two forms. The basic ways are:1. Using the built in function ContourPlot, e.g.:ContourPlot[x^3y + y^3 - 9, {x, -9, 9}, {y, -27, 27}, Contours -> {0}, ContourShading -> False, Axes -> True, Frame -> False, PlotPoints -> 50, AxesOrigin -> {0, 0}]alternatively you can use a Standard package:<{0,0}]or ImplicitPlot[x^3y+y^3-==9,{x,-9,9},{y,-27,27},AxesOrigin->{ 0,0}]The difference between these two is that the first one gives you a smoother picture but requires the equation to be solvable (by Mathematica) for y. The second will give a picture very similar to that produced by the first method.Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> How can I plot functions like:>> (x-2)^2 + 2(y-3)^2 = 6>> and>> x^3y + y^3 = 9>> using Mathematica?>> ==== Since you already know the answer, the simplest way is:In[51]:=Factor[x^4 + x^3 + x^2 + x + 1, Extension -> {GoldenRatio}]Out[51]=(-(-1 - x + GoldenRatio*x - x^2))*(1 + GoldenRatio*x + x^2)Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> Greetings MathGroup,>> My name is Steve Earth, and I am a new subscriber to this list and > also a> new user of Mathematica; so please forgive this rather simple > question...>> I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into > Mathematica> and have it be able to tell me that it factors into>> (x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)>> What instructions do I need to execute to achieve this output?>> -Steve Earth> Harker School> http://www.harker.org/>> Greetings MathGroup,>> My name is Steve Earth, and I am a new subscriber to this list and > also a> new user of Mathematica; so please forgive this rather simple > question...>> I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into > Mathematica> and have it be able to tell me that it factors into>> (x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)>> What instructions do I need to execute to achieve this output?>> -Steve Earth> Harker School> http://www.harker.org/>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== I confess I am not 100% sure what you mean. Would you like to do this in steps, like you would do it by hand?In[1]:=a + b/c + d*(Sqrt[e]/c) == 0;In[2]:=Thread[(#1 - a - b/c & )[%], Equal]Out[2]=(d*Sqrt[e])/c == -a - b/cIn[3]:=Thread[(#1*c & )[%], Equal]Out[3]=d*Sqrt[e] == (-a - b/c)*cIn[4]:=Thread[(#1^2 & )[%], Equal]Out[4]=d^2*e == (-a - b/c)^2*c^2In[5]:=Simplify[%]Out[5]=d^2*e == (b + a*c)^2Of course you can combine all the steps into a single function, but I think it will be fairly complicated.My own favourite way to do this sort of thing is:In[1]:=Simplify[d^2*e == (d^2*e /. AlgebraicRules[ a + b/c + d*(Sqrt[e]/c) == 0, e])]Out[1]=d^2*e == (b + a*c)^2However, AlgebraicRules has not been documented since version 4. It should be possible to do this using PolynomialReduce but it seems to require the sort of skill only Daniel Lichtblau possesses;)Andrzej KozlowskiToyama International UniversityJAPANhttp://sigma.tuins.ac.jp/~andrzej/> I'm a newbie and, of course, the first thing I want to do is apparently> one of the most complicated...>> I have an expression that looks like this:>> A + B/C + D*Sqrt[E]/C = 0>> A,B,C,D, & E are all polynomials in x> I want it to look like this>> (D^2)*E = (A*C + B)^2>> At that point, I'll have polynomials in x on both sides. Finally, I> want the equation to be written out with terms grouped by powers of x,> but I think I can do that part :)>> I'll be very grateful to anyone who can give me some pointers. Or, at> least point me to some tutorial in the Mathematica documentation. I've> been looking over the documentation and I found Appendix A.5 in The> Mathematica Book, but that doesn't help me. I _need_ some examples. I> did find a couple of well-written posts in this newsgroup, but not > quite> close enough to what I want.> Troy.>> =-=-=-=-=-=-=-=-=-=>> FYI, here's the expression I'm working with.> denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]> cnu = (2*b^2 - B^2 + r^2)/denom> snu = -2*b*Sqrt[B^2 - b^2]/denom> sif = 2*r*b/denom> cif = (r^2 - B^2)/denom>> pdr = -Cos[ds]*Sin[q]*(snu*cif +> cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)>> 0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/(> r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w*> r)^2 - (w*r*pdr)^2)*(Cos[qr])^2>> Although I said it's a polynomial in x, it's really a polynomial in b> that I'm after.>> ==== Only on second reading I noticed the part about a,b,c,d being polynomials in x. Both methods will still work if first perform the same operation as below and finally use the replacement rule%/.{a->p[x],b->q[x],c->r[x],d->u[x],e->v[x]}, where p[x] etc are the given polynomials. Of course collecting of terms can be done with Collect[%,x].Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> I confess I am not 100% sure what you mean. Would you like to do this > in steps, like you would do it by hand?>> In[1]:=> a + b/c + d*(Sqrt[e]/c) == 0;>> In[2]:=> Thread[(#1 - a - b/c & )[%], Equal]>> Out[2]=> (d*Sqrt[e])/c == -a - b/c>> In[3]:=> Thread[(#1*c & )[%], Equal]>> Out[3]=> d*Sqrt[e] == (-a - b/c)*c>> In[4]:=> Thread[(#1^2 & )[%], Equal]>> Out[4]=> d^2*e == (-a - b/c)^2*c^2>> In[5]:=> Simplify[%]>> Out[5]=> d^2*e == (b + a*c)^2>> Of course you can combine all the steps into a single function, but I > think it will be fairly complicated.>> My own favourite way to do this sort of thing is:>> In[1]:=> Simplify[d^2*e == (d^2*e /. AlgebraicRules[> a + b/c + d*(Sqrt[e]/c) == 0, e])]>> Out[1]=> d^2*e == (b + a*c)^2>> However, AlgebraicRules has not been documented since version 4. It > should be possible to do this using PolynomialReduce but it seems to > require the sort of skill only Daniel Lichtblau possesses;)>> Andrzej Kozlowski> Toyama International University> JAPAN> http://sigma.tuins.ac.jp/~andrzej/>>> I'm a newbie and, of course, the first thing I want to do is >> apparently>> one of the most complicated...>> I have an expression that looks like this:>> A + B/C + D*Sqrt[E]/C = 0>> A,B,C,D, & E are all polynomials in x>> I want it to look like this>> (D^2)*E = (A*C + B)^2>> At that point, I'll have polynomials in x on both sides. Finally, I>> want the equation to be written out with terms grouped by powers of x,>> but I think I can do that part :)>> I'll be very grateful to anyone who can give me some pointers. Or, at>> least point me to some tutorial in the Mathematica documentation. >> I've>> been looking over the documentation and I found Appendix A.5 in The>> Mathematica Book, but that doesn't help me. I _need_ some examples. I>> did find a couple of well-written posts in this newsgroup, but not >> quite>> close enough to what I want.>> Troy.>> =-=-=-=-=-=-=-=-=-=>> FYI, here's the expression I'm working with.>> denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]>> cnu = (2*b^2 - B^2 + r^2)/denom>> snu = -2*b*Sqrt[B^2 - b^2]/denom>> sif = 2*r*b/denom>> cif = (r^2 - B^2)/denom>> pdr = -Cos[ds]*Sin[q]*(snu*cif +>> cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)>> 0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/(>> r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w*>> r)^2 - (w*r*pdr)^2)*(Cos[qr])^2>> Although I said it's a polynomial in x, it's really a polynomial in >> b>> that I'm after.>>>> ==== <{-1,5}]ImplicitPlot[x^ 3y + y^3 == 9, {x, -10, 10}]Meilleures salutationsFlorian Jaccard-----Message d'origine-----Envoy.8e : dim., 6. octobre 2002 11:34è : mathgroup@smc.vnet.netObjet : Plotting ellipses and other functionsHow can I plot functions like:(x-2)^2 + 2(y-3)^2 = 6andx^3y + y^3 = 9using Mathematica? ==== >How can I plot functions like:>>(x-2)^2 + 2(y-3)^2 = 6>>and>>x^3y + y^3 = 9>>using Mathematica?>Needs[Graphics`ImplicitPlot`];ImplicitPlot[(x - 2)^2 + 2(y - 3)^2 == 6, {x, -1, 5}, {y, 1, 5}];ImplicitPlot[x^3 y + y^3 == 9, {x, -6, 6}, {y, -6, 6}];Bob Hanlon ==== >Could somebody please inform me how to Round numbers to a>certain Accuracy using Mathematica 4.2. This is not as easy as it>sounds.>Every function that I have read Rounds the Display, and not the actual>number.myRound[x_, n_] := Round[10^n*x]/10.^n;Table[myRound[Random[], 3], {10}]{0.044, 0.019, 0.738, 0.298, 0.917, 0.171, 0.021, 0.314, 0.658, 0.153}Bob HanlonReply-To: tgarza01@prodigy.net.mx ==== You might use ImplicitPlot:In[1]:=<< Graphics`ImplicitPlot`In[2]:=eqn1 = (x - 2)^2 + 2*(y - 3)^2 == 6; In[3]:=ImplicitPlot[eqn1, {x, -2, 6}]; In[4]:=eqn2 = x^3*y + y^3 == 9; In[5]:=ImplicitPlot[eqn2, {x, -8, 8}]; Tomas GarzaMexico CityOriginal Message:----------------- ==== You may use Binomial. It could also be useful to look at the AddOn packageDiscreteMath`Combinatorica`, where you will find a wealth of interestingthings related to that.In[1]:=Binomial[6,2]Out[1]=15Tomas GarzaMexico CityOriginal Message:----------------- ==== I feel as if I've finally had the breakthrough in intuitively understanding the Mathematica editor, or at least the basics. I want to explain to others what they really need to know about the editor to use it for basic purposes. Part of the reason I now understand the editor better is that I've since worked with LyX http://www.devel.lyx.org and XEmacs http://www.xemacs.org, and I've also become proficient with DocBook XML.When I first started using the editor, reading the Mathematica Help didn't seem to help. It seemed to tell me a whole lot more than I needed to know, and didn't tell me what I really needed to know. Now I'm in the position of being able to use it, but not being able to explain exactly what it is I've learned. Is there any documentation directed toward the beginner, which tells him or her what to do, what to expect, what quirks to be aware of, and etc.? I'm looking for something along the lines of click here to make this happen. If you see this, it may seem weird, but that's normal. Those brackedt on the left really mean... . STH. ==== >I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into Mathematica>and have it be able to tell me that it factors into>>(x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)>>What instructions do I need to execute to achieve this output?>soln = Factor[x^4 + x^3 + x^2 + x + 1, Extension -> GoldenRatio] // Simplify(x^2 - GoldenRatio*x + x + 1)*(x^2 + GoldenRatio*x + 1)soln = Simplify /@ (soln /. -GoldenRatio -> -1 - 1/GoldenRatio)(x^2 - x/GoldenRatio + 1)*(x^2 + GoldenRatio*x + 1)soln // FunctionExpand // FullSimplifyx^4 + x^3 + x^2 + x + 1Bob Hanlon ==== Stefan,I don't think I completely understand your question, but I think you arelooking for the Binomial function in Mathematica.Binomial[4, 2]6David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Steve,You could use the Extension feature of Factor as documented in Help.expr = x^4 + x^3 + x^2 + x + 1ans = Factor[expr, Extension -> {1/GoldenRatio}](-(1/4))*(-2 - x + Sqrt[5]*x - 2*x^2)* (2 + x + Sqrt[5]*x + 2*x^2)You could also use...Factor[expr, Extension -> {Sqrt[5]}]It took me some effort to figure out how to manipulate the answer into yourform.ans /. {x + Sqrt[5]*x -> (2*GoldenRatio)*x, -x + Sqrt[5]*x -> (2/GoldenRatio)*x}% /. (-4^(-1))*a_*b_ :> Simplify[-a/2]*Simplify[b/2](-(1/4))*(-2 + (2*x)/GoldenRatio - 2*x^2)* (2 + 2*GoldenRatio*x + 2*x^2)(1 - x/GoldenRatio + x^2)*(1 + GoldenRatio*x + x^2)David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/http:// www.harker.org/ ==== David,To plot equations like that, simply use ImplicitPlot.Needs[Graphics`ImplicitPlot`]ImplicitPlot[(x - 2)^2 + 2(y - 3)^2 == 6, {x, -1, 5}, {y, 1, 5}];ImplicitPlot[x^3*y + y^3 == 9, {x, -10, 10}, {y, -10, 10}];You may have to fish a little to obtain the appropriate x and y ranges.Start by making them larger and then narrow down to the region that youwant.I have put a new package at my web site for solving conic section problemsin the plane. You can solve for complete information on any conic sectionand obtain a parametric representation for plotting it. The package alsocomes with complete Help documentation and examples.Using your first example (the second is not a conic).Needs[ConicSections`ConicSections`]eqn = (x - 2)^2 + 2(y - 3)^2 == 6;The routine ParseConic will take any quadratic equation and return the scalea, eccentricity e, a parametrization, and rotation matrix P, translation Tand reßection matrix R that transforms the conic from standard position toits actual position. (In standard position the conic has its foci andverticies on the x-axis with the center at zero.){{a, e}, curve[t_], {P, T, R}} = ParseConic[eqn]{{Sqrt[6], 1/Sqrt[2]}, {2 + Sqrt[6]*Cos[t], 3 + Sqrt[3]*Sin[t]}, {{{1, 0}, {0, 1}}, {2, 3}, {{1, 0}, {0, 1}}}}We could then plot the curve using ParametricPlot, which is more efficientand controllable.ParametricPlot[Evaluate[curve[t]], {t, -Pi, Pi}, AspectRatio -> Automatic, Frame -> True, Axes -> None, PlotLabel -> eqn];Knowing a and e we can use the StandardConic routine to obtain all theinformation about the conic in standard position as a set of rules.standarddata = StandardConic[{a, e}]{conictype -> Ellipse, conicequation -> x^2/6 + y^2/3 == 1, coniccurve -> {Sqrt[6]*Cos[t], Sqrt[3]*Sin[t]}, coniccurvedomain -> {-Pi, Pi}, coniccenter -> {0, 0}, conicfocus -> {{Sqrt[3], 0}, {-Sqrt[3], 0}}, conicdirectrix -> {x == -2*Sqrt[3], x == 2*Sqrt[3]}, conicvertex -> {{Sqrt[6], 0}, {-Sqrt[6], 0}}}routine to obtain the same information for the conic in its actual position.standarddata // TransformEllipseRules[P, T, R]{conictype -> Ellipse, conicequation -> (1/6)*((-2 + x)^2 + 2*(-3 + y)^2) == 1, coniccurve -> {2 + Sqrt[6]*Cos[t], 3 + Sqrt[3]*Sin[t]}, coniccurvedomain -> {-Pi, Pi}, coniccenter -> {2, 3}, conicfocus -> {{2 + Sqrt[3], 3}, {2 - Sqrt[3], 3}}, conicdirectrix -> {2*Sqrt[3] + x == 2, x == 2*(1 + Sqrt[3])}, conicvertex -> {{2 + Sqrt[6], 3}, {2 - Sqrt[6], 3}}}David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , ModeratorReply-To: ==== Try this:A + B/C + D*(Sqrt[E]/C) == 0(#1 - %[[1,{1, 2}]] & ) /@ %(C*#1 & ) /@ %(#1^2 & ) /@ %Simplify[%]Also, be aware that E is the natural logarithm base, reserved for thatpurpose.DrBob-----Original Message-----want the equation to be written out with terms grouped by powers of x, but I think I can do that part :)I'll be very grateful to anyone who can give me some pointers. Or, at least point me to some tutorial in the Mathematica documentation. I've been looking over the documentation and I found Appendix A.5 in The Mathematica Book, but that doesn't help me. I _need_ some examples. I did find a couple of well-written posts in this newsgroup, but not quiteclose enough to what I want.Troy.=-=-=-=-=-=-=-=-=-=FYI, here's the expression I'm working with.denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]cnu = (2*b^2 - B^2 + r^2)/denomsnu = -2*b*Sqrt[B^2 - b^2]/denomsif = 2*r*b/denomcif = (r^2 - B^2)/denompdr = -Cos[ds]*Sin[q]*(snu*cif + cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/( r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w* r)^2 - (w*r*pdr)^2)*(Cos[qr])^2 Although I said it's a polynomial in x, it's really a polynomial in b that I'm after.Reply-To: ==== It's a little ugly, but here's my solution:x^4 + x^3 + x^2 + x + 1Simplify@Factor[%, Extension -> {GoldenRatio, 1/GoldenRatio}]Collect[%[[2]]/3, x]Collect[%[[3]]/3, x]% /. Sqrt[5] -> 2GoldenRatio - 1% // SimplifyCollect[#, x] & /@ %% /. {1 - GoldenRatio -> -1/GoldenRatio}FullSimplify@Expand@%(The last line is a check.)Bobby-----Original Message-----(x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)What instructions do I need to execute to achieve this output?-Steve EarthHarker Schoolhttp://www.harker.org/ ==== >How can I plot functions like:>>(x-2)^2 + 2(y-3)^2 = 6>>and>>x^3y + y^3 = 9>>using Mathematica?Use ImplicitPlot in the package Graphics`ImplicitPlot` ==== David,<{0,0} ]-----Original Message-----Sender: steve@smc.vnet.netApproved: Steven M. Christensen , ModeratorReply-To: jcd@q-e-d.org ==== I look for a way to right align entries output by MatrixForm. There is an adhoc option, but I haven't figured out how it is supposed to work in Mathematica 4.0(if it works at all).m={{MatrixForm[{0,0,0}],-123456789},{123456789,1}}; MatrixForm[m,TableAlignments->{Right,Top}]appears identical toMatrixForm[m] (with no SetOptions override)Strangely, Mathematica doesn't complain if you input ill options like:MatrixForm[m,TableAlignments->{WhateverIsIllegal,Right, Top,MakeSomeSpiralOfIt}]In Mathematica 2.2x, the behavior is rather strange: one option alone works, butwhen two are given (e.g. {Right,Top}), only the last seems to be acted upon.I didn't bother to try hard with the older version, so don't ßame me if I'mwrong.At the other hand, when a TableAlignments->Right is given to TableForm,entries are right-aligned correctly.Can someone provide a way out (even a slow external module) or tell me howto use this option.I apologize for using a phony address in an attempt ==== I decided to export one of my notebooks to html/mathmlhttp://baldur.globalsymmetry.com/proprietary/com/ wri/notebooks/essential/66.92.149.152 baldur.globalsymmetry.comWhen I try to view it with Mozilla, I get a Ô?' in place of the imaginary number symbol. When I first load the page with Mozilla, I get an error telling meTo properly display the MathML on this page you need to install the following fonts: CMSY 10, CMEX 10, Math1, Math2, Math4.For further infromation see:http://www.mozilla.org/projects/mathml/fontsI did what the instructions at the URL told me, and I still get the error. I looked through the fonts in the Mathematica font directory, and I found:Mathematica1Mono.9.bdf -wri-mathematica1mono-medium-r-normal--9-90-75-75-m-50- adobe-fontspecificMathematica3.12.bdf -wri-mathematica3-medium-r-normal--12-120-75-75-p-70- adobe-fontspecificMathematica3.24.bdf -wri-mathematica3-medium-r-normal--24-240-75-75-p-130- adobe-fontspecificMathematica3.36.bdf -wri-mathematica3-medium-r-normal--36-360-75-75-p-210- adobe-fontspecific....Mathematica7.12.bdf -wri-mathematica7-medium-r-normal--12-120-75-75-p-40- adobe-fontspecificMathematica7.24.bdf ....-wri-mathematica6-medium-r-normal--12-120-75-75-p-30- adobe-fontspecificMathematica6.24.bdf -wri-mathematica6-medium-r-normal--24-240-75-75-p-70- adobe-fontspecificMathematica6.36.bdf -wri-mathematica6-medium-r-normal--15-150-75-75-p-50- adobe-fontspecificMathematica5.12.bdf -wri-mathematica5-medium-r-normal--12-120-75-75-p-50- adobe-fontspecificMathematica5.24.bdf -wri-mathematica5-medium-r-normal--24-240-75-75-p-110- adobe-fontspecificMathematica5.36.bdf -wri-mathematica5-medium-r-normal--36-360-75-75-p-160- adobe-fontspecificMathematica5.13.bdf -wri-mathematica5-medium-r-normal--13-130-75-75-p-50- adobe-fontspecificMathematica4.18.bdf -wri-mathematica4-medium-r-normal--18-180-75-75-p-130- adobe-fontspecificMathematica5.10.bdf....I suspect this is what mozilla is looking for, but I don't know exactly how to tell it as much. Any ideas?STH.Reply-To: ==== I suppose my silliness is understandable, in light of all the confusion,both here and in the Browser on what significance arithmetic is, whatbignums and bigßoats might be, etc.If many smart people are confused, there's a possibility --- just apossibility, mind you --- that it isn't entirely their fault. Yes? No?>>like 71 above, or -5 for Accuracy in the example that fooled me), butit's not a big dealFor people who don't understand it as well as you, yes, it's a big deal.My purpose in all this is to understand the issue well enough to knowhow to proceed. I think that I do, now, but I doubt everybody on thelist does.Daniel says this will all be clearer in the next release, and that'sgood!Bobby-----Original Message----->> -1.180591620717411303424`71.0721*^21> 71>> 71.0721 digits of precision? I don't think so!!Either I am it altogether or you are just simply beating to death the point that in case of machine arithmetic (only!) Precision and Accuracy are purely formal and essentially meaningless.One can argue whether in this case there is any point of returning any value for Precision, or Accuracy (like 71 above, or -5 for Accuracy in the example that fooled me), but it's not a big deal and it most certainly does not make SetPrecision meaningless. On the contrary, SetPrecision is very useful and in fact it is SetPrecision that can tell you that the answer above is meaningless:In[8]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 50];a=SetPrecision[77617.,$MachinePrecision]; b = SetPrecision[ 33096.,$MachinePrecision];In[10]:={f,Precision[f]}Out[10]={ 1.19801754103509`0*^19, 0}I would say this is correct and show that SetPrecision is very useful indeed. It tells you (what of course you ought to already know in this case anyway) that machine precision will not give you a realiable answer in this case. If you know your numbers with a great deal of accuracy you can get an accurate answer:In[24]:=f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100];In[26]:={f, Precision[f]}Out[26]={- 0.82739605994682136814116509547981629199903311578438481991 781484167246798617832`61.2597, 61}Again you can be pretty sure that you got an accurate answer, provided of course your original setting of precision was valid.Honestly, to say that SetPrecision and SetAccuaracy are useless is one of the silliest thing I have read on this list in years.>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== How can I plot functions like:(x-2)^2 + 2(y-3)^2 = 6andx^3y + y^3 = 9using Mathematica?Reply-To: kuska@informatik.uni-leipzig.de ==== look whatGraphics`ImplicitPlot`does. Jens> How can I plot functions like:> (x-2)^2 + 2(y-3)^2 = 6> and> x^3y + y^3 = 9> using Mathematica? ==== David:For a start you can try the following:Using ContourPlotContourPlot[(x - 2)^2 + 2(y - 3)^2 - 6, {x, -1, 5}, {y, -1, 5}, Contours -> {0}, ContourShading -> False, ContourSmoothing -> 5]Or using ImplicitPlot<< Graphics`ImplicitPlot`ImplicitPlot[(x - 2)^2 + 2(y - 3)^2 == 6, {x, -1, 5}]ImplicitPlot[x^3y + y^3 == 9, {x, -4, 4}]Hans> How can I plot functions like:>> (x-2)^2 + 2(y-3)^2 = 6>> and>> x^3y + y^3 = 9>> using Mathematica?>> ==== Try reading help under the keyword ImplicitPlot| How can I plot functions like:|| (x-2)^2 + 2(y-3)^2 = 6|| and|| x^3y + y^3 = 9|| using Mathematica?|||| ==== DavidEnquire within the Help Browser for the ImplicitPlot package and allwill be revealed. For example, I snipped the following lines from thedocumentation:<< Graphics`ImplicitPlot`ImplicitPlot[x^2 + 2 y^2 == 3, {x, -2, 2}]Hope this is of sufficient help to get you started - post again if youhave any further questions.Mark Westwood> How can I plot functions like:> (x-2)^2 + 2(y-3)^2 = 6> and> x^3y + y^3 = 9> using Mathematica? ==== you can. Use:<>I am facing the problem in starting the link to math kernel from within>Excel.>>Specifically, when I get the message link failed to open when I click>Launch button in the ÔStart Mathematica Link' dialog box. I have triedusing>Multilink too so that I am able to access the kernel from Mathematicaand>Excel simultaneously but I still get the same message.>>I am currently using Mathematica 4.0 and Excel 2002 (Excel XP). Theprograms>Mathematica and Excel otherwise appear to work fine. I am using WindowsXP>home edition on Dell 8100 laptop. I have used the Mathematica Link forMS>Excel for Excel 2000 in my installation as there were no specific filesfor>Excel 2002. Given that I was able to successfully add the menus withinexcel>I think the addin should work fine but it does not?>>All help would be sincerely appreciated.>>Sincerely,>>Tahir Sheikh. ==== I did not request any accuracy for f. I set the accuracy of the numerical components of the expression f. You cannot request the accuracy of the result of your computation in Mathematica, you can only set the accuracy of the input and later check what accuracy of the output results form it. In my last message on this topic I tried to explain this in the plainest and simplest way I could think of. There is nothing more left for me to say. I feel like Sisyphus but unlike him I can at least give up!Andrzej Kozlowski>> [...]>> I would say this is correct and show that SetPrecision is very useful>> indeed. It tells you (what of course you ought to already know in this>> case anyway) that machine precision will not give you a realiable>> answer in this case. If you know your numbers with a great deal of>> accuracy you can get an accurate answer:>> In[24]:=>> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 ->> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];>> a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100];>> In[26]:=>> {f, Precision[f]}>> Out[26]=>> {-0.82739605994682136814116509547981629199903311578438481991 >> 781484167246798617832`61.2597, 61}>> Congratulations! You just requested accuracy of 100 for f and got 61 (> to convince yourself add Accuracy[f] to In[26]). If In[24] one> replaces SetAccuracy by SetPrecision the result is similar.>> PK> Again you can be pretty sure that you got an accurate answer, provided>> of course your original setting of precision was valid.>> Honestly, to say that SetPrecision and SetAccuaracy are useless is one>> of the silliest thing I have read on this list in years.>>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== >>[...]>> I would say this is correct and show that SetPrecision is very useful> indeed. It tells you (what of course you ought to already know in this> case anyway) that machine precision will not give you a realiable> answer in this case. If you know your numbers with a great deal of> accuracy you can get an accurate answer:>> In[24]:=> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 -> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];> a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100];>>> In[26]:=> {f, Precision[f]}>> Out[26]=> {-0.82739605994682136814116509547981629199903311578438481991 > 781484167246798617832`61.2597, 61}>> Congratulations! You just requested accuracy of 100 for f and got 61 (> to convince yourself add Accuracy[f] to In[26]). If In[24] one> replaces SetAccuracy by SetPrecision the result is similar.> PK> [...]One has (initially) an accuracy of 100 for an expression that containsvariables.In[25]:= Clear[a,b,f]In[26]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; In[27]:= Accuracy[f]Out[27]= 100.Now we assign values to some indeterminants in f.In[28]:= a = SetPrecision[77617.,100]; b = SetPrecision[33096.,100];In[29]:= {f, Precision[f], Accuracy[f]}Out[29]={- 0.827396059946821368141165095479816291999033115784384819917814 8, 61.2599, 61.3422}The precision and accuracy has dropped. This is all according tostandard numerical analysis regarding cancellation error. You'll find itin any textbook on the topic.As for what happens when you artificially raise precision (or accuracy)of machine numbers far beyond that guaranteed by their internalrepresentation, that falls into to category of garbage in, garbage out.It is, howoever, valid to use SetPrecision to raise precision in(typically iterative) algorithms where significance arithmetic might beunduly pessimistic due to incorrect assumptions about uncorollatednessof numerical error. Examples of such usage have appeared in this newsgroup.Daniel LichtblauWolfram Research ==== >[...]> I would say this is correct and show that SetPrecision is very useful > indeed. It tells you (what of course you ought to already know in this > case anyway) that machine precision will not give you a realiable > answer in this case. If you know your numbers with a great deal of > accuracy you can get an accurate answer:> In[24]:=> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 -> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];> a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100];> In[26]:=> {f, Precision[f]}> > Out[26]=> {-0.82739605994682136814116509547981629199903311578438481991 > 781484167246798617832`61.2597, 61}> Congratulations! You just requested accuracy of 100 for f and got 61 (to convince yourself add Accuracy[f] to In[26]). If In[24] onereplaces SetAccuracy by SetPrecision the result is similar.PK> Again you can be pretty sure that you got an accurate answer, provided > of course your original setting of precision was valid.> Honestly, to say that SetPrecision and SetAccuaracy are useless is one > of the silliest thing I have read on this list in years.>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/ ==== > You are entitled to your opinion. For my applications> this behavior IS useless.>I agree that Mathematica is probably useless for you. This is however not because it is useless or useless for your application, but because to use its full power you have to study it, understand it, and in particular, for numerical work, understand the model of arithmetic it uses. Lie with mathematics they are really no shortcuts that will lead you to its full power. In addition, since it is a computer program, it has certain conventions, which may not be the same as the conventions of other programs (they all have conventions) but which you have to accept to be able to use it. Now, once you have done that, you may still not like the way Mathematica does things and there are genuine experts in numerics who indeed do not like and are quite vocal about it. But they never say it is useless, because by saying that you are either displaying your own ignorance or engaging in stupid and pointless abuse.On a more serious level, there seem to be two basic approaches to numeric computation relevant to this discussion. It seems to me (though I am no expert in this sort of thing) that there are three types of situations that one may encounter. Firstly, there is the vast majority of rather simple computations for which built-in machine ßoating point arithmetic , which carries no guarantee of precision at all is meant for. It clearly must be sufficient for the majority of purposes, since most general purpose and even technical software available uses not other method. The reason of course is that it is by far the fastest way to do such computations (as well as being sufficient for most situations).The second type of situation is when you actually know the precision of your input and would like the program to give you some idea about the precision of the output you might expect. This is the most likely situation in empirical science and is exactly what SetPrecision is meant for. Most reasonable people would agree that Mathematica works well in this situation.There is finally one more situation, to which the only reasonable criticism that I have read in this thread appears to be directed at. That is the situation when you actually know your input exactly, but working with exact numbers is far too slow. So what you have to do is to replace your exact numbers with inexact ones padded with 0's. In Mathematica you have to take a guess at how much padding you will need, than use SetPrecision to pad the numbers, and then check the Precision of your answer. It may turn out that you did not get as much precision as you needed, in which case you have to use more zeros. Or it may be that you used more than enough, which mans that your computation could have been done faster. I learned from Leszek Sczaniecki that there is an approach due to Oliver Aberth which lets you only specify the desired precision of your answer and the program itself will choose the correct padding for your input. It woudl ertainly be nice to have this ability, but I honestly think that it would be only of marginal advantage over making your own guess. It seems to me that the checking that the Aberth mthod must require will be time consuming and wiht a bit of practice one can probably get better results as far as speed is concerned using the Mathematica approach. But this is just pure speculation and certainly it woudl be nice if such a possibility existed.Andrzej KozlowskiToyama International UniversityJAPANhttp://sigma.tuins.ac.jp/~andrzej/Reply-To: ==== Here's a more intuitive method, perhaps:a + b/c + d*(Sqrt[e]/c) == 0f = %[[1, 3]]%% /. f -> gFirst@Solve[%, g]f^2 == (g^2 /. %)However, it occurs to me you might want a more general method to collecta radical on one side and then square both sides. If so, here's aclumsy first attempt:expr = a + b/c + d*(Sqrt[e]/c) == 0f = First@Cases[expr, Power[a_, Rational[b_, c_]], Infinity]power = First@Cases[f, Rational[b_, c_] -> Rational[c, b], Infinity]coefficient = First@Cases[expr, Times[a_, f] -> a, Infinity]Solve[expr /. coefficient f -> g, g][[1, 1]]g^2 == (g^2 /. %)% /. g -> coefficient fDrBob-----Original Message-----DrBob-----Original Message-----want the equation to be written out with terms grouped by powers of x, but I think I can do that part :)I'll be very grateful to anyone who can give me some pointers. Or, at least point me to some tutorial in the Mathematica documentation. I've been looking over the documentation and I found Appendix A.5 in The Mathematica Book, but that doesn't help me. I _need_ some examples. I did find a couple of well-written posts in this newsgroup, but not quiteclose enough to what I want.Troy.=-=-=-=-=-=-=-=-=-=FYI, here's the expression I'm working with.denom = Sqrt[(B^2 - r^2)^2 + 4*(r^2)*(b^2)]cnu = (2*b^2 - B^2 + r^2)/denomsnu = -2*b*Sqrt[B^2 - b^2]/denomsif = 2*r*b/denomcif = (r^2 - B^2)/denompdr = -Cos[ds]*Sin[q]*(snu*cif + cnu*sif) - Sin[ds]*(cnu*cif - snu*sif)0 == -(B^2 - b^2)*V^2/(r^2) + (((B*V)^2)/( r^2) - 2*w*b*V*Cos[q]*Cos[ds] + (w* r)^2 - (w*r*pdr)^2)*(Cos[qr])^2 Although I said it's a polynomial in x, it's really a polynomial in b that I'm after. ==== > Are there any known issues with simpy treating the JLink.jar as a Java > extension as follows?> cp JLink.jar $JAVA_HOME/jre/lib/ext?> According to my understanding of the discussion in the Java Tutorial on > extensions, that should work:It does;starting with M4.2, J/Link 2.0 gets preinstalled and comes with a 1.4murphee ==== Are there any known issues with simpy treating the JLink.jar as a Java extension as follows?cp JLink.jar $JAVA_HOME/jre/lib/ext?According to my understanding of the discussion in the Java Tutorial on extensions, that should work:http://java.sun.com/docs/books/tutorial/ext/basics/ install.htmlCommants?STH. ==== >Are there any known issues with simpy treating the JLink.jar as a Java>extension as follows?>cp JLink.jar $JAVA_HOME/jre/lib/ext?>>According to my understanding of the discussion in the Java Tutorial on>extensions, that should work:>http://java.sun.com/docs/books/tutorial/ext/basics/ install.html>>Commants?You should not do this. Code from the jre/lib/ext directory is trusted, so this poses a security risk from malicious applets. Leave JLink.jar where it lives in the JLink directory. If you want it to be available to all Java programs on your system, add its location to your CLASSPATH environment variable (this is not a security risk, as remote applets cannot load classes from CLASSPATH).Todd GayleyWolfram Research ==== The key is in using the command Factor with the option Extension:In[1]:=Factor[x^4 + x^3 + x^2 + x + 1, Extension -> {GoldenRatio}]Out[1]=-((-1 - x + GoldenRatio*x - x^2)*(1 + GoldenRatio*x + x^2))For manual verification you should keep in mind that: 1/GoldenRatio = GoldenRatio - 1Germ.87n Buitrago----- Original Message -----> (x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)>> What instructions do I need to execute to achieve this output?>> -Steve Earth> Harker School> http://www.harker.org/> ==== Actually, including 1/GoldenRatio in the extension leads to an unnecessarily complicated formula.In this case there is no real need to so, since by definitionIn[30]:=Unevaluated[1/GoldenRatio==GoldenRatio-1]// FullSimplifyOut[30]=TrueIf one really insists on having the answer in the form proposed in Steve's original posting one can simply do:(Collect[#1, x] & ) /@ Factor[x^4 + x^3 + x^2 + x + 1, Extension -> {GoldenRatio}] /. -1 + GoldenRatio -> 1/GoldenRatio(-(-1 + x/GoldenRatio - x^2))*(1 + GoldenRatio*x + x^2)>> In[]:=Factor[x^4 + x^3 + x^2 + x + 1, Extension -> {GoldenRatio,> 1/GoldenRatio}]> Out[]=-((-3 - 2*x + Sqrt[5]*x + GoldenRatio*x - 3*x^2)*> (3 + x + Sqrt[5]*x + GoldenRatio*x + 3*x^2))/9>> Jens>>> Greetings MathGroup,>> My name is Steve Earth, and I am a new subscriber to this list and >> also a>> new user of Mathematica; so please forgive this rather simple >> question...>> I would like to enter the quartic x^4 + x^3 + x^2 + x + 1 into >> Mathematica>> and have it be able to tell me that it factors into>> (x^2 + GoldenRatio x + 1) ( x^2 - 1/GoldenRatio x + 1)>> What instructions do I need to execute to achieve this output?>> -Steve Earth>> Harker School>> http://www.harker.org/>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== I want to apply a function to every k-th element of a long list and add the result to the k+1 element. [Actually k = 3 and I just want to multiply myList[[k]] by a constant (independent of k) and add the result to myList[[k+1]] for every value of k that's divisible by 3.]Is there a way to do this -- or in general to get at every k-th element of a list -- that's faster and more elegant than writing a brute force Do[] loop or using Mod[] operators, and that will take advantage of native List operators, but still not be too recondite? I've been thinking about multiplying a copy of myList by a mask list {0,0,1,0,0,1,..} to generate a masked copy and approaches like that. Better ways??? ==== >FrontEndExecute[{> FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[],> [LeftDoubleBracket][RightDoubleBracket],After]}] FrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][RightDoubleBracket],After], FrontEnd`SelectionMove[FrontEnd`SelectedNotebook[], Previous, Character]}]orFrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][SelectionPlaceholder][ RightDoubleBracket], Placeholder]}]----------------------------------------------- ---------------Omega ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== I'm trying to address the special issues related to using Mathematica on the would not if I used a Windows system. These are typically not all that big if a problem _once I figure out what's going on_. What I hope to do is collect all such matters and document them effectively in something like a haven't discussed here http://66.92.149.152/proprietary/com/wri/index.html I'm interested in hearing what you have to say. Of particular interest are the issues faced by a person who is not familiar with the technical aspects would help make this less painful?STH ==== >I want to perform this calculation:> >>In[1]:=z1 = a1 + b1 I Out[1]=a1 + [ImaginaryI] b1 In[3]:=z2 = a2 + b2>I Out[3]=a2 + [ImaginaryI] b2 In[19]:=Abs[(z1 - z2)/(1 - z1>Conjugate[z2])]>>This should output 1! But it doesn't work...>>Also, Abs[a1+b1 I] doesn't get the right result. Any ideeas?> What do you mean by doesn't work and doesn't get the right result? Do you mean Mathematica returns an unevaluated expression? If so, have you assigned values to the symbols a1, b1, a2 and b2? If you haven't assigned values, how is Mathematica to know these symbols do not take on complex values?Yes, it returns an unevaluated expression.CeZaR ==== Sorry, my message was nonsense. The reason why it appeared to give the answer 1 is that I forgot to evaluate z1 an z2:In[7]:=z1 = a1 + b1*I;In[8]:=z2 = a2 + b2*I;In[9]:=ComplexExpand[Abs[(z1 - z2)/(z1 - Conjugate[z2])], TargetFunctions -> {Im, Re}]Out[9]=Sqrt[(a1 - a2)^2 + (b1 - b2)^2]/ Sqrt[(a1 - a2)^2 + (b1 + b2)^2]The answer is clearly not unless b2==0. What exactly did you have in mind?> To start with, what you are saying is simply not true. A simple > example:>> In[1]:=> Abs[(z1 - z2)/(1 - z1*Conjugate[z2])] /.> {z1 -> 1 + I, z2 -> 1 - I}>> Out[1]=> 2/Sqrt[5]>> Presumably you meant Abs[(z1 - z2)/(z1 - Conjugate[z2]) in which case:>> In[1]:=> ComplexExpand[Abs[(z1-z2)/(z1- > Conjugate[z2])],TargetFunctions->{Im,Re}]>> Out[1]=> 1>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>>> I want to perform this calculation:>> In[1]:=z1 = a1 + b1 I>> Out[1]=a1 + [ImaginaryI] b1>> In[3]:=z2 = a2 + b2 I>> Out[3]=a2 + [ImaginaryI] b2>> In[19]:=Abs[(z1 - z2)/(1 - z1 Conjugate[z2])]>> This should output 1! But it doesn't work...>> Also, Abs[a1+b1 I] doesn't get the right result.>> Any ideeas?>> CeZaR>>>>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== Dear Listers,I find myself defining functions in terms of differentiation. For example,f[x_,t_]:=Sin[x*t]dfx[x_,t]:=D[Sin[y,t],y]/.y->xThis works well, but it seems to me that there should be a better way to do this. That is, there should be a better way to define a Ôderivative' of a previous function without going through the replacement contortions. I can't find the answer in the archive. Can someone tell me the most straightforward way to do this? Will it work to define a gradient vector or Jacobian matrix? A Hessian matrix?-- Jason Miller, Ph.D.Division of Mathematics and Computer ScienceTruman State University100 East Normal St.Kirksville, MO 63501http://vh216801.truman.edu660.785.7430 ==== Jason,We have dfx[x_,t_]= D[f[x,t],x] t Cos[t x]One advantage of using = rather than := is that it differentiates once, whenthe definition is stored, Definition[dfx] t Cos[t x]With := we get Clear[dfx] dfx[x_,t_]:= D[f[x,t],x] Definition[dfx] dfx[x_, t_] := D[f[x, t], x]So the differentiation is done each time that the function dfx is evaluated.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> Dear Listers,>> I find myself defining functions in terms of differentiation. Forexample,>> f[x_,t_]:=Sin[x*t]> dfx[x_,t]:=D[Sin[y,t],y]/.y->x>> This works well, but it seems to me that there should be a better way> to do this. That is, there should be a better way to define a> Ôderivative' of a previous function without going through the> replacement contortions. I can't find the answer in the archive.> Can someone tell me the most straightforward way to do this? Will it> work to define a gradient vector or Jacobian matrix? A Hessian> matrix?>> --> Jason Miller, Ph.D.> Division of Mathematics and Computer Science> Truman State University> 100 East Normal St.> Kirksville, MO 63501> http://vh216801.truman.edu> 660.785.7430>Reply-To: kuska@informatik.uni-leipzig.de ==== f[x_, t_] := Sin[x*t]dfx[x_, t_] := Module[{y, df}, df = D[f[y, t], y]; Block[{y = x}, df ] ] Jens> Dear Listers,> I find myself defining functions in terms of differentiation. For example,> > f[x_,t_]:=Sin[x*t]> dfx[x_,t]:=D[Sin[y,t],y]/.y->x> This works well, but it seems to me that there should be a better way> to do this. That is, there should be a better way to define a> Ôderivative' of a previous function without going through the> replacement contortions. I can't find the answer in the archive.> Can someone tell me the most straightforward way to do this? Will it> work to define a gradient vector or Jacobian matrix? A Hessian> matrix?> --> Jason Miller, Ph.D.> Division of Mathematics and Computer Science> Truman State University> 100 East Normal St.> Kirksville, MO 63501> http://vh216801.truman.edu> 660.785.7430 ==== I was trying to write a function, when given a list, say, {a,b,c,d}, the output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c * esc ([CircleTimes]) in Mathematica.f[{x_}]:=x;f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]];However, the output was not exactly what I expected, it looked like:((a op b) op c) op dIt seems when doing the Join operation, a pair of parenthesis was added.Can someone let me know how I can get rid of these parenthesis?JT_______________________________________________ __________________Chat with friends online, try MSN Messenger: http://messenger.msn.com ==== JJJ,Try: f[{x_}]:=x; f[{x_,y__}]:=x[CircleTimes]yTest f[{a,b,c,d}] a[CircleTimes]b[CircleTimes]c[CircleTimes]d--Allan----- ----------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> I was trying to write a function, when given a list, say, {a,b,c,d}, the> output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c *> esc ([CircleTimes]) in Mathematica.>> f[{x_}]:=x;> f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]];>> However, the output was not exactly what I expected, it looked like:>> ((a op b) op c) op d>> It seems when doing the Join operation, a pair of parenthesis was added.>> Can someone let me know how I can get rid of these parenthesis?> JT> ==== SetAttributes[CircleTimes, Flat]f[{x_}] := x;f[{x_, y_, z___}] := f[Join[{x[CircleTimes]y}, {z}]]; Jens> I was trying to write a function, when given a list, say, {a,b,c,d}, the> output is a op b op c op d, where op is (in LaTeX) bigotimes, or esc c *> esc ([CircleTimes]) in Mathematica.> f[{x_}]:=x;> f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]];> However, the output was not exactly what I expected, it looked like:> ((a op b) op c) op d> It seems when doing the Join operation, a pair of parenthesis was added.> Can someone let me know how I can get rid of these parenthesis?> JT> > _____________________________________________________________ ____> Chat with friends online, try MSN Messenger: http://messenger.msn.com ==== Try can use ImplicitPlot from the Graphics package.Janusz.> Hey folks,>> I have been working on a problem that seems to not lend itself to a> solution. The following Mathematica code begins with the expression> that I am trying to solve. For the curious, it's a degree 2 zonal and> sectoral harmonics problem where I am trying to calculate and plot the> geoid of earth as compared to an ellipse to see how well the geoid is> approximated as an ellipse. In any case, we have the following relation> ship,>> U =GM/r( 1 - (ae/r)^2 ( J2 (3/2 Sin[t]^2 - 1/2) - 3 Cos[t]^2 (C22> Cos[2 x] + S22 Sin[2 x]));> Ur =1/2 we^2 (r Cos[t])^2;> W[x_] =U + Ur;>> In trying to reorder W to become a function r wrt t, that is r[t_], I> tried, among others,>> Solve[W[t], r]>> which returned>> ({{r ->> Root[ae^2 GM J2 + 6 ae^2 C22 GM Cos[ [t]] ^2 -> 3 ae^2 GM J2 Sin[ [t]] ^2 + 2 GM #1 ^2 -> 2 W0 #1 ^3 + we^2 Cos[ [t]] ^2 #1 ^5 &,> 1]}, {r ->> Root[ae^2 GM J2 + 6 ae^2 C22 GM Cos[ [t]] ^2 -> 3 ae^2 GM J2 Sin[ [t]] ^2 + 2 GM #1 ^2 -> 2 W0 #1 ^3 + we^2 Cos[ [t]] ^2 #1 ^5 &,> 2]}, {r ->> Root[ae^2 GM J2 + 6 ae^2 C22 GM Cos[ [t]] ^2 -> 3 ae^2 GM J2 Sin[ [t]] ^2 + 2 GM #1 ^2 -> 2 W0 #1 ^3 + we^2 Cos[ [t]] ^2 #1 ^5 &,> 3]}, {r ->> Root[ae^2 GM J2 + 6 ae^2 C22 GM Cos[ [t]] ^2 -> 3 ae^2 GM J2 Sin[ [t]] ^2 + 2 GM #1 ^2 -> 2 W0 #1 ^3 + we^2 Cos[ [t]] ^2 #1 ^5 &,> 4]}, {r ->> Root[ae^2 GM J2 + 6 ae^2 C22 GM Cos[ [t]] ^2 -> 3 ae^2 GM J2 Sin[ [t]] ^2 + 2 GM #1 ^2 -> 2 W0 #1 ^3 + we^2 Cos[ [t]] ^2 #1 ^5 &, 5]}} )>> which wasn't too much help, though it is a list of 5 Root functions.> But in order to plot, I need a function r(t) so I can plot r wrt> t...right?>> ParametricPlot[r[t], {t, 0, Pi}]>> So, I guess my questions are as follows:> 1. How do I get Solve[ ] to output numbers, as //N and NSolve did> nothing to Solve[r[t], ...] to get any numbers instead of just r ->> Root[...]?>> 2. Is there a way to use ParametricPlot[ W[t], {t, 0.0, Pi}] instead of> using r[t] and negating the whole issue of solving W[t] for r[t]?>> I have read that Solve only works for up to 4th order polynomials. I> have been unable to find anything that works on my problem, having> tried SolveAlways[ ] and other, and combination of others.>> Any help is welcome. I'll be glad to forward my Notebook if someone>> jdhouse4@mac.com>> Ph.D. Graduate Student> Aerospace Engineering> University of Texas at Austin>> 512-784-3205 ==== the least of which was a power failure. For some strange reason Mathematica stopped producing the pretty html+MathML it had been. I started trouble shooting, and blew away what I had pointed to. I violated Tom Jackson's (IBM & UMUC) first rule of holes: when you're in one, stop digging. Here's the parent directory.http://public.globalsymmetry.com/proprietary/com/ wri/notebooks/As you can see (If I haven't fixed it by the time you look again,) Mathematica is outputting the conversion command, rather than the actual MathML I really don't know what happened. I removed the init.m and deleted the cache, and it still refuses to work correctly. It's kind of frustrating. There are a lot of powerful XML features in Mathematica, but they are not easy to use.STH> cannot access...> thanks,> Steven Taracevicz> PO Box 1752> Santa Monica, CA 90406-1752>> 310.396.4001> 310.388.3265 fax ==== The way I learned XML, XML is for content, and CSS is for display. It seems that MathML violates that separation between style and content. There is little chance that I'm the first one to mention this. Is there a history of discussion on this topic somewhere? I don't want to get too far into MathML on this list, but, since I'm skinning my knuckles trying to learn to work with MathML and Mathematica, I figure a bit of discussion on this topic in this context is in order.STHReply-To: kuska@informatik.uni-leipzig.de ==== Flatten[{{{d, X, Y, Z}}, Flatten[Table[{t, x[t], y[t], z[t]}, Evaluate[{t, Sequence @@ #}]] & /@ {{1, 10}, {20, 100, 10}, {200, 1000, 100}}, 1]}, 1] // TableForm??? Jens> Dear friends,> I have build a table with this pattern:> Flatten[{{{d, X, Y, Z}},> Table[{t, x[t], y[t], z[t]}, {t, 1, 10}],> Table[{t, x[t], y[t], z[t]}, {t, 20, 100, 10}],> Table[{t, x[t], y[t], z[t]}, {t, 200, 1000, 100}]}, 1] // TableForm> I would like obtain the same Output in a more elegant way. In other word, how> Can I avoid write Table[{t, x[t], y[t], z[t]} a few times.> Thans> Guillermo> Sanchez> ---------------------------------------------> This message was sent using Endymion MailMan.Reply-To: kuska@informatik.uni-leipzig.de ==== ff[t_] := {Sin[t], Cos[t]}ParametricPlot[Evaluate[ff[t]], {t, 0, 2Pi}, Epilog -> {PointSize[0.025], (Point[ff[#]] & /@ Table[phi, {phi, 0, 2Pi,Pi/4}])}] Jens> I would like to mark representative samples of t on a parametric plot,> where t is the third parameter. For example, how could I mark the 8> values t=0, t=Pi/4, ..., t=7Pi/4 on the plot generated by:> ParametricPlot[{Sin[t], Cos[t]}, {t, 0, 2Pi}]> ==== >> How can I plot functions like:>> (x-2)^2 + 2(y-3)^2 = 6>> and>> x^3y + y^3 = 9>> using Mathematica?David,x /. Solve[x^3 y + y^3 == 9, x];g=Plot[Sign[(9 - y^3)/y]* Abs[(9 - y^3)/y]^(1/3) , {y, -7, 7} ,AspectRatio -> Automatic];Show[g /. {x_?NumberQ, y_?NumberQ} -> {y, x}, Epilog ->{RGBColor[1,0,0],Line[{{-(3^(7/9)/2^(2/9)), -5}, {-(3^(7/9)/2^(2/9)),5}}]}]; ==== Is there an SGML catalog for the WRI DTDs on the CD? I'm not sure if I should expect psgml with xemacs to handle namespaces correctly. Currently, I'm having problems using the xml generated by Mathematica with psgml. I'm not sure exactly how to set up an sgml catalog to support these. I really don't want to try to reinvent the wheel, if there is already one available. I'm thouroughly preplexed by the overall behavior of the XML support. Things which were working have now stopped working, or have significantly changed their behavior. This is a very exciting area, but it seems very difficult to get started.I believe the dtd to include in a catalog is this:/opt/Wolfram/Mathematica/4.2/SystemFiles/IncludeFiles/ XML/xhtml-math11-f.dtdI'm just not sure what the public identifier should be.STH-- Hatton's Law: There is only One inviolable Law. ==== Yes, there seems to be a lot of people who have a visceral hatred forMicrosoft and Windows. They are even willing to shed blood to avoidWindows. But why? Windows works and you don't have to become a systemsprogrammer.Furthermore, I think that Steven Wolfram uses some version of Windows. Soguess which system Mathematica will be best tuned up for?I have no problems with Mathematica and Windows on my single computer. Theremay be reasons for using a non-Microsoft operating system. But if you aregoing to do it, make certain that they are good reasons.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ ==== > Yes, there seems to be a lot of people who have a visceral hatred for> Microsoft and Windows. They are even willing to shed blood to avoid> Windows. But why? Windows works and you don't have to become a systems> programmer.> Furthermore, I think that Steven Wolfram uses some version of Windows. So> guess which system Mathematica will be best tuned up for?> I have no problems with Mathematica and Windows on my single computer.> There may be reasons for using a non-Microsoft operating system. But if> you are going to do it, make certain that they are good reasons.that of Windows XP by orders of magnitude. I recall when I first started been using Windows NT since October of 1992. (Yes, I know it hadn't been paper on the architecture of NT. In 1997 I was well on my way to being an MCSE. no stinkin' GUI' to Ôhave a look at the KDE project'. I took the latter route. The KDE has gone from a simple graphical desktop with a few more features than the CDE, (and a lot more glitches) to being the best desktop available. It's growth seems to be exponential. Windows seems, at best, to be linear.All of these are usability issues. There is another reason I don't like using Microsoft products. I've also been using Mozilla since 1995. (Yes, it has always been called Mozilla.) I was one of the original beta testers for the Netscape line of internet servers. When I saw what Netscape Communications were aiming for, Windows quickly lost its luster. Netscape products were designed from the ground up with portability in mind. They were striving for uniform functionality across all platforms.I also saw what Microsoft did to undermine Netscape's R & D resources. Microsoft would condescend to having not competition in their market. Where I come from, people don't put up with that. Where do I come from? I was born in Illinois.I'm obviously not of the opinion that closed source is unacceptable. I wouldn't be using Mathematica if I were. I suspect one day Mathematica will face a real open source challeng. Her name is Charolette. She is the mother of Mozilla. That will probably be years from now. WRI need to be prepared to adjust to that eventuality when it comes.> David Park> djmp@earthlink.net> http://home.earthlink.net/~djmp/STH. ==== >In: DSolve[y*D[u[x, y],x] == x*D[u[x, y],y], u[x,y], {x, y}]>>Out: {{u[x, y] -> C[1][(1/2)*(x^2 + y^2)]}}>>Square brackets are used as grouping symbols in the result!?? :^O>>Somebody say it isn't so.>It isn't soThe square bracket is not delineating a factor it is enclosing the argument to an arbitrary function named C[1]. While the function is dependent on both x and y the dependence only occurs in the combination (x^2+y^2).Bob Hanlon ==== [My previous reply seems to have gone astray - at least it has not come backto me.Here is a slightly edited repeat]You have computed f[t_] = {t + Sqrt[3] Sin[t], 2 Cos[t], t Sqrt[3] - Sin[t]};and then found f' {1 + Sqrt[3]*Cos[#1], -2*Sin[#1], Sqrt[3] - Cos[#1]} &To get the function for the norm of the derivative we can use norm = Evaluate/@(Simplify/@(Sqrt[#.#]&/@(f'))) 2*Sqrt[2] &We map the usual functions for calclulating and simplifying the norm insideFunction[.] (which is the full form of (.)& and then map the functionEvaluation to make the result evaluate -- this is needed since Function hasthe attribute HoldAll.Please note that the parentheses are essential.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198>> f[t_] = {t + Sqrt[3] Sin[t], 2 Cos[t], t Sqrt[3] - Sin[t]}>> So It's basically a vector whose coordinates are determined based on the> values you pass in.>> Then I took the derivative by just typing f', which outputs>> {1 + Sqrt[3] Cos[#1], -2 Sin[#1], Sqrt[3] - Cos[#1]}&> What I'd like to do is have Mathematica calculate the norm of this as it> would any vector, so that I can play with the norm function. As it turns> out, the norm in this case is identical to Sqrt[8], so it would be nice if> Mathematica could figure that out. Is it possible to do this?> ==== > f[t_] = {t + Sqrt[3] Sin[t], 2 Cos[t], t Sqrt[3] - Sin[t]}> So It's basically a vector whose coordinates are determined based on the> values you pass in.> > Then I took the derivative by just typing f', which outputs> > {1 + Sqrt[3] Cos[#1], -2 Sin[#1], Sqrt[3] - Cos[#1]}&> What I'd like to do is have Mathematica calculate the norm of this as it> would any vector, so that I can play with the norm function.I don't think whether the definition is prompt (=) or delayed (:=) is asimportant as supplied the argument [t] inIn := Simplify[Sqrt[f'[t] . f'[t]]]Out = 2 Sqrt[2]Or you can construct a new pure function withIn := Evaluate[Simplify[Sqrt[f'[#] . f'[#]]]]&Out = 2 Sqrt[2] &Of course, there is not much left to play with :)Tom BurtonReply-To: Mark Coleman ==== Greetings,I hope this inquiry is not off-topic for the list. I was wondering if anyone knew of Mathematica-based education resources (either for students or teachers) that would be suitable for teaching *elementary school* students (kindergartden - 5th grade) some basic fundamentals of mathematics, e.g., simple algebra, geometry, numbers,etc. I know there is a solid body of work directed towards high school and college students, but I am not sure of resources for younger students.Mark ==== > Greetings,>> I have read with great interest this lively debate on numerical prcesionand> accuracy. As I work in the fields of finance and economics, where we feel> ourselves blessed if we get three digits of accuracy, I'm curious as towhat> scientific endeavors require 50+ digits of precision? As I recall thereare> some areas, such as high energy physics and some elements of astronomy,that> might require so many digits in some circumstances. Are there others?> -MarkMark,There may be occasions when the outcome of a real process is so sensitiveto changes in input that unless we know very precisely what the input isthen we can know very little about the outcome - chaotic processes are ofthis kind. The difficulty is real and no amount of computer power or cleverprogamming will do much about it.Another situation is when the the process is not so sensitive butcalculating with our formula or programme introduces accumulates significanterrors.Here is a very artificial example of the latter (I time the computation andfind the MaximumMemory used in the session as we go through the example): ser=Normal[Series[Cos[#],{#,0,200}]]; MaxMemoryUsed[] 1714248Calculating with machine number does not show much of a pattern ( I havedeleted the graphics - please evaluate the code), pts= With[{ss=ser},Table[ {#,ss}&[x], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True]; MaxMemoryUsed[] {5.11 Second,Null} 1723840Using bigßoat inputs with precision 20 shows some pattern: pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,20]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {17.52 Second,Null} 1759664Precision 40 does very well: pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,40]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {19.38 Second,Null} 1797072Now we might think the correct outcomes are showing up, and use aninterpolating function for further , and faster, calculation. f=Interpolation[pts] InterpolatingFunction[{{50.000000,70.00000}},<>] pts= Table[ f[x],{x,50, 70, .1}];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {0.33 Second,Null}As a matter of interest, this is what happens if we substitute exact numbers(rationals and integers) for reals--the computation takes an excessively long time and quite a bit more memory. pts= With[{ss=ser},Table[ {#,ss}&[SetPrecision[x,Infinity]], {x,50.,70., .1}]];//Timing ListPlot[pts, PlotJoined->True,PlotRange[Rule]All]; MaxMemoryUsed[] {992.28 Second,Null} 2413808This also shows that we may in fact want to replace exact inputs withbigßoats.I should be interested to hear of other example, really real one inparticular. I imagine that there are many situations where trends and shapesare more important than specific values.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> > ==== >> The more I play with the example the more> depressing it gets. Start> with ßoating point numbers but explicitly> arbitrary-precision ones.>> In[1]:=> a=77617.00000000000000000000000000000;> b=33095.00000000000000000000000000000;>> In[3]:=> !(333.7500000000000000000000000000000 b^6 +> a^2 ((11 a^2> b^2 - > b^6 - 121 b^4 - 2)) +> 5.500000000000000000000000000000 b^8 +> a/(2> b))>> Out[3]=>>> !((-4.78339168666055402578083604864320577443814`26.6715 *^32))>> In[4]:=> Accuracy[%]>> Out[4]=> -6>> Due to the manual section 3.1.6:> >> When you do calculations with arbitrary-precision> numbers, as> discussed in the previous section, Mathematica> always keeps track of> the precision of your results, and gives only> those digits which are> known to be correct, given the precision of your> input. When you do> calculations with machine-precision numbers,> however, Mathematica> always gives you a machine[CapitalEth]precision result,> whether or not all the> digits in the result can, in fact, be determined> to be correct on the> basis of your input. >> Because I started with arbitrary-precision numbers> Mathematica should display> only those digits that are correct, that is none.>> No, 26 digits are correct> Here is the number:> -0.8273960599468213681> Here is the same number computed by Mathematica with 26> correct digits:> -4.78339168666055402578083604864320577443814[Times]10^32> It looks like I have been using some wrong definition> of correct.:-)> You just proved that Precision is useless as a measure> how good your numerical result is.> [...]I rather hope I proved nothing of the sort. Also I'm afraid Mathematicakept better track of the numbers than you did. As for definitions ofcorrect, rather than remark on yours I'll just expose what I meantwith specific numerical examples below.You did not actually say why you thought -0.8273960599468213681 would bethe appropriate result. So I'll go through the computation in exactarithmetic (I have to admit I am puzzled as to why you did not do this).First I'll rewrite your expression using more variables.a = 77617.00000000000000000000000000000;b = 33095.00000000000000000000000000000;c = 333.7500000000000000000000000000000;d = 5.500000000000000000000000000000;In[6]:= InputForm[val = c*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + d*b^8 + a/(2*b)]Out[6]//InputForm=- 4.78339168666055402578083604864320577443814`26.6715*^32This is what I got. Now we'll redo in exact arithmetic.rata = Rationalize[a];ratb = Rationalize[b];ratc = Rationalize[c];ratd = Rationalize[d];In[12]:= InputForm[exactval = ratc*ratb^6 + rata^2* (11*rata^2*ratb^2 - ratb^6 -121*ratb^4 - 2) + ratd*ratb^8 +rata/(2*ratb)]Out[12]//InputForm= -63322539148012414193286707611938758031/132380In[13]:= InputForm[N[exactval]]Out[13]//InputForm= -4.783391686660554*^32I think it is reasonable to claim that these agree.I dug through some early posts on the topic and came across a value forb at one time that was one larger (this supports my long-held suspicionthat numbers slowly decay in discrete increments...).In[14]:= b2 = 33096.00000000000000000000000000000;In[15]:= InputForm[val2 = c*b2^6 + a^2*(11*a^2*b2^2 - b2^6 - 121*b2^4 -2) + d*b2^8 + a/(2*b2)]Out[15]//InputForm= -0.827469148`-0.3833What this reveals is a number that Mathematica claims has NO trustwortydigits. The InputForm also reveals the untrustworthy digits, and, sureenough, it comes close to what you have called the correct value, andspecifically they agree to four places. My opinion is that theMathematica significance arithmetic is doing, shall I say, precisely asit ought.Daniel LichtblauWolfram Research ==== > On Friday, October 4, 2002, at 06:01 PM, DrBob>>[...]>> I would say this is correct and show that> SetPrecision is very useful> > indeed. It tells you (what of course you ought> to already know in this> case anyway) that machine precision will not> give you a realiable> answer in this case. If you know your numbers> with a great deal of> accuracy you can get an accurate answer:>> In[24]:=> f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 -> b^6 -> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];> a=SetPrecision[77617.,100]; b => SetPrecision[33096.,100];> >>> In[26]:=> {f, Precision[f]}>> Out[26]=> >>{- 0.82739605994682136814116509547981629199903311578438481991> > 781484167246798617832`61.2597, 61}>> Congratulations! You just requested accuracy of> 100 for f and got 61 (> to convince yourself add Accuracy[f] to In[26]).> If In[24] one> replaces SetAccuracy by SetPrecision the result is> similar.> PK> [...]> One has (initially) an accuracy of 100 for an> expression that contains> variables.> In[25]:= Clear[a,b,f]> In[26]:= f = SetAccuracy[333.75*b^6 +> a^2*(11*a^2*b^2 - b^6 -> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; > In[27]:= Accuracy[f]> Out[27]= 100.> Now we assign values to some indeterminants in f.> In[28]:= a = SetPrecision[77617.,100]; b => SetPrecision[33096.,100];> In[29]:= {f, Precision[f], Accuracy[f]}> Out[29]=>{- 0.827396059946821368141165095479816291999033115784384819917814 8,> 61.2599, 61.3422}> The precision and accuracy has dropped. This is all> according to> standard numerical analysis regarding cancellation> error. You'll find it> in any textbook on the topic.> Assume that I want accuracy and precision of 100 forf. You advice me to make experiments to find out, whatshould be the initial precision and accuracy of a andb to reach the requested accuracy and precision for f.Notice, that you cannot just repeat I[26], we sawalready what happens. I have to re-type I[24], I[25],I[26], I[27], I[28], and I[29] as many times as neededto get f with accuracy and precision 100. Dan, you simply advocate to do MANUAL WORK that shouldbe done by machine.Let's suppose that in the above example I just want 60digits not 61. Precisely, I want 60 digits and nothingor zeros afterwards. Let's see if I could useSetAccuracy.In[30]:=SetAccuracy[%, 60]Out[30]=- 0.82739605994682136814116509547981629199903311578438481991781I n[31]:=% // FullFormOut[30]//FullForm=- 0.827396059946821368141165095479816291999033115784384819917814 841672467988`59.9177Oops, it did not work (as expected). Let's highlightwith mouse the expression in Out[30] and copy to a newcell. Oops, we got - 0.827396059946821368141165095479816291999033115784384819917814 841672467988`59.9177again. Let's change Out[30] to a text cell and thencopy. In[31]:=- 0.82739605994682136814116509547981629199903311578438481991781O ut[31]=- 0.82739605994682136814116509547981629199903311578438481991781S uccess? Not so fast.In[32]:=% // FullFormOut[32]//FullForm=- 0.827396059946821368141165095479816291999033115784384819917809 99999999999863508`59.2041Dan, is there any simple way to get what I want? As I repeated already number of times, at this stageof the development of computer technology, softwareshould do it for me (!). We both know that this isdoable. Some of the textbooks that you just advised meto read describe it. As a developer of Mathematica,tell us why do you consider this to be a bad idea? Peter Kosta> As for what happens when you artificially raise> precision (or accuracy)> of machine numbers far beyond that guaranteed by> their internal> representation, that falls into to category of> garbage in, garbage out.> It is, howoever, valid to use SetPrecision to raise> precision in> (typically iterative) algorithms where significance> arithmetic might be> unduly pessimistic due to incorrect assumptions> about uncorollatedness> of numerical error. Examples of such usage have> appeared in this news> group.> Daniel Lichtblau> Wolfram Research__________________________________________________Do you Yahoo!?http://faith.yahoo.com ==== Dear colleagues,how can I solve the following problem: The task is to successively plot the functions given in FuncList with the accociated variableFuncList = {Exp[x], Sin[y], z^3};VarList = {x, y, z};Do[Plot[FuncList[LeftDoubleBracket] i[RightDoubleBracket], {VarList[LeftDoubleBracket] i[RightDoubleBracket], -5, 5}], {i, 1, Length[VarList]}]]Frank Brand ==== > f[{x_}]:=x;> f[{x_, y_, z___}]:=f[Join[{x[CircleTimes]y},{z}]];> However, the output was not exactly what I expected, it looked like:> ((a op b) op c) op d> It seems when doing the Join operation, a pair of parenthesis was added.> Can someone let me know how I can get rid of these parenthesis?SetAttributes[CircleTimes,Flat]f[{a,b,c,d}]a[ CircleTimes]b[CircleTimes]c[CircleTimes]dTom Burton ==== The Illinois Institute of Technology's Stuart Graduate School ofBusiness in collaboration with Wolfram Research, Inc. isoffering a seminar series on applications of the Mathematicasoftware system in mathematical and computational finance. Theweekly seminars will begin Friday, October 25, 2002, and will beheld at the Stuart Graduate School of Business in Chicago.The speakers will illustrate the built-in functionality ofMathematica as well as the extensive Mathematica applicationsavailable from both Wolfram Research and independent developers.They will also give detailed synopses of applications that solvea wide range of financial problems.Advance registration is required. You can register by writing toseminar@wolfram.com.For more information, visit the seminar website at:http://www.wolfram.com/services/seminars/chicago2002/