I now finished the creation of an oo system for Mathematica and put it onto my web site: www.schmitther.de The contents on the web site are: - a documentation of the system - the oo package - an example, that can be executed The system is a rather complete implementation of the principles of oo. I want to mention the following features: multiple inheritance and polymorphism. I am convinced, that there are applications, which can be better implemented by using the object-oriented method. Hermann Schmitt ==== Reformatted >> There seems to be a bug here due to the fact that ContinuousDistributions.m >> (4.0.0) does not check that q is numeric. >> >> Quantile[NoncentralChiSquareDistribution[2, 10], q] >> Produces a load of errors and some incorrect results when used in LogPlot. >> >> LogPlot[Quantile[NoncentralChiSquareDistribution[2, 10], q], {q, .1, .9}] >> This is of course a pain. What is the best way to correct this? Is it to >> copy the particular function from ContinuousDistribution.m and re-include it >> in a little add on or is there an updated version. > I cannot reproduce your difficulty in 4.2. LogPlot there has attribute > HoldFirst, Yes so does 4.0 Attributes[LogPlot] {HoldFirst} I do not understand why this is insufficient to hold off the evaluation until q gets a value. I suspect that it is something to do with the complexity of LogPlot's calls to scaledplot etc. > so no attempt is made to evaluate Quantile[...] before a numeric > value is substituted for q. If this is not true in version 4.0, then you > might try > > LogPlot[Unevaluated[Quantile[NoncentralChiSquareDistribution[2, 10], q]], > {q, .1, .9}] I was unfamiliar with Unevaluated. One would expect it to do the trick but it doesn't stop the Nintegrate ::nlim error > > PS I am unfamiliar with this distribution and would not notice some > incorrect results. TB I am reasonably certain the the incorrect results are caused by premature evaluation since I have rebuilt the function outside ContinuousDistributions and got what I believe are correct results. Would I be right in presuming that 4.2 has this problem fixed in which case it would be nice to be able to get hold of the 4.2 version of ContinuousDistributions.m Statistics`ContinuousDistributions`Private` Clear[Quantile[ NoncentralChiSquareDistribution]] Reprogram with the q_?NumericQ in place. I have actually corrected my copy of ContinuousDistributions.m by changing the line NoncentralChiSquareDistribution/: Quantile[NoncentralChiSquareDistribution[n_, lambda_], q_, opts___?OptionQ] := to NoncentralChiSquareDistribution/: Quantile[NoncentralChiSquareDistribution[n_, lambda_], q_?NumericQ, opts___?OptionQ] := This seems to be effective. -- ==== I am using mathematica in windows, I want that when I'm open a file by mouse clicking it will change the working directory of mathematica to the directory of the file, so if I will save data with save (without define to where),it will be saved in the directory of the open file automaticaly. thanks ==== How can i create a package? Any Directions and Tips? ==== I am seeking a working Launch Command for the Advanced Options of bare kernel on a remote OSX machine via ssh from my OSX machine, no problem, but have had no luck getting the same remote kernel to launch from my Front end. In the 4.2 Help Browser, under Getting Started,System-Specific Information, Troubleshooting,Macintosh (MacOSX) it says: In order to connect to a remote kernel, you must be able to connect via rsh without a password into the machine running the kernel. I of course have been ignoring this advice, since in my environment passwords are required. Does anyone know for sure if ssh can be used instead of rsh? Christopher Purcell DRDC-Atlantic, 9 Grove St., PO Box 1012, Dartmouth, NS Canada B2Y 3Z7 chris.purcell@drdc-rddc.gc.ca ==== Mathematica produce correct eps files, but *you* have not proper configured you ghostscript and your dvips to find and use the Mathematica PostScript fonts. ... is that true? > I am trying to export a cell with some greek letters in it as an eps > file from Mathematica to LyX and I end up with messed up symbols for > the greek letters. > I don't want to use bitmap, is there any way for eps with mathematica? ==== I have never used LyX (emacs by brith) and you should consult the LyX manual to configure it properly. I think LyX call ghostscript to render the eps file to a bitmap ian you should set the GS_LIB shell variable properly. First you should try to preview the eps-file with ghostscript from the command line and look for the error messages, if this works you should look if you can configure the ghostscript command inside LyX or if your setup of the environment variables is overwritten by LyX. > I've posted the same question a month ago [1], and was answered by some > people, namely Peer-Kuska, who provided a solution. > However, I couldn't get it work, so I wish we could try again, and solve > this tediousness. > [1] > http://forums.wolfram.com/mathgroup/archive/2002/Nov/msg00514.html | ... is that true? > | I am trying to export a cell with some greek letters in it as an eps > | file from Mathematica to LyX and I end up with messed up symbols for > | the greek letters. > | I don't want to use bitmap, is there any way for eps with mathematica? > | > | W. > | ==== Whoops, solved this one myself. Had to upgrade the Developer Package after upgrading to Jaguar. After that, no problem, worked fine. > I had the same problem. Running ranlib did fix the out-of-date error > message. > However, I still get the message /usr/bin/ld: > /usr/lib/libSystem.dylib load command 9 unknown cmd field. Then, > make: *** [addtwo] Error 1. Anyone seen this? > > I'm trying to get the example addtwo to compile, using ProjectBuilder. > > The Developer's guide says in different places, that I should not use > > libML.a, and also that I must use it. In any event, I get fatals errors > > 'out of date' if I try to include it. If I leave it out and use > > mathlink.framework instead, addtwo compiles but does not run normally. > > Any suggestions? I've been working on this for days, it is driving me > > crazy. I'm not a professional software developer and not very familair > > with ProjectBuilder, either. MacOS X uses a static library for MathLink, just as has been done with > other UNIX variants. There is a known issue for MacOS X wherein it is necessary to run the > command line tool ranlib on the library file libML.a before building > executables that are linked against the library. As long as you don't > move the library file to another location, you need only do this once. ==== make an Interpolation[] from the data and use Integrate[], or use the standard add on package NumericalMath`ListIntegrate` Mathematica don't use splines, it make pice wise polynomials and integrate the polynomial. Since you have the source code of ListIntegrate you can look by your self. Dear Mathemticons( * ): I have a very simple question. I have a function that is NOT specified > as an analytic expression. Rather, the function is a previsouly > tabulated list of the form: F( x ):= { ( x( 1 ),F( x( 1 ) ) ), ... , ( x( i ),F( x( i ) ) , ... , > ( x( N ),F( x( N ) ) ) } The list is comprised of N pairs of values, one for the independent varaible > x and the other for the dependent function F( x ). The x values are NOT equally spaced. They are tabulated at unevenly spaced > intervals. Also, I do NOT have the freedom to compute additional list values between the > ones initially provided. In a sense, this list can be conceived of as DATA, > although it is actually generated by a previous complex computation. GOAL: I wish to integrate this tabulated function from x( 1 ) to x( N ) SIMPLE SOLUTION: Apply the trapaziodal rule. DESIRED SOLUTION: I wish to integrate this tabulated function with a higher degree of accuracy > or fidelity, however this is construed. The caveat, is, as previously > mentioned, that I cannot direclty compute a more densely spaced list of > function values. PROVISIONAL DESIRED SOLUTION ? Should I implement a Romberg Type integration scheme where I synthetically > sample progressively more tightly spaced function values via interpolation until > the integral convereges to its final value within a pre-specified precision? What interpolation scheme should I employ? Cubic spine? Spath Monotonicity > Preserving Hermite? Cubic Spline with Tension? I only required vlaues of > the function, and not its higher derivatives. I am afraid to use Cubic Splines > in general since these often bulge and may produce an answer worse that > the linear interpolation that the Trapazoidal Rule uses. What technique, if any, does Mathematica employ? I wish to do this both on Mathematica as well as in an F90 code. The technique should be fast, since I will be integrating 1000's of such > functions sequentially. Any advice will be greatly appreciated! > ( * ) Mathematicon: The fundamental quantum of the Mathematica User's Field ==== would you be so kind to read the manual *before* you start to programm ? Fine. Your first definition > withdraw := Evaluate[ > Module[ { balance = 100 }, > Function[ amount, > If[ balance >= amount, > balance -= amount; balance, > Print[ Insufficient Funds ] > ] > ] > ] > ] return a pure function that does the If[] test when you call it withdraw[60]. Since you force to evaluate the Module[] you create global variable balance$ that can't removed when the Module[] ends. If you would like to use a fixed constant you should use With[], i.e. withdraw = With[{balance = 100}, Function[amount, If[balance >= amount, balance - amount, Print[Insufficient Funds]]]] In the next definition > secondWithdraw[ initBalance_ ] := Evaluate[ > Module[ { balance = initBalance }, > Function[ amount, > If[ balance >= amount, > balance -= amount; balance, > Print[ Insufficient Funds ] > ] > ] > ] > ] you Evaluate[] the right side before you have a given a value for initBalance but that can't work, because the pattern initBalance_ has absolute nothing to do with the variable initBalance. You mean withdraw::insuff = Insifficuent funds '1'. withdraw[amount_, balance_:100] := If[balance >= amount, balance - amount, Message[withdraw::insuff, balance] ] or withdraw1[amount_,balance_:100]/; balance>amount :=balance-amount withdraw1[amount_,balance_:100]:=(Message[withdraw::insuff, balance];balance) > This is a programming example from the wizard book chapter 3. > ( http://mitpress.mit.edu/sicp/full-text/book/book.html ) Consider the following: withdraw := Evaluate[ > Module[ { balance = 100 }, > Function[ amount, > If[ balance >= amount, > balance -= amount; balance, > Print[ Insufficient Funds ] > ] > ] > ] > ] In[2]:= withdraw [ 60 ] Out[2]= 40 In[2]:= withdraw[ 60 ] > Insufficient Funds The question now is, can I in Mathematica write a function that takes as > argument the balance, so that I do not have to use the fixed balance = > 100. Note that in first example balance is _not_ present in the global > context. My idea was the following: secondWithdraw[ initBalance_ ] := Evaluate[ > Module[ { balance = initBalance }, > Function[ amount, > If[ balance >= amount, > balance -= amount; balance, > Print[ Insufficient Funds ] > ] > ] > ] > ] In[7]:= W1:=secondWithdraw[ 100 ] In[8]:= W1[ 60 ] > Out[8]= If[initBalance >= 60, balance$2 -= 60; balance$2, > Print[Insufficient Funds]] So this however does not work. I _assume_ that Evaluate hits to early. > The evaluation of balance >= amount to initBalance >= amount is too > early. Is this the problem? How can I circumvent it? I'd be glad for any insights you might have. ==== you have alread, Mathematica only Print[] the short form Sqrt[1.3] // FullForm You can still use Sqrt[1.3`1000000] if you need more digits. Dear experts, I try to find the square root of 1.3, but obtain an not so correct > answer. Could someone point me how to do? My trials are the > followings. In[28]:= > Sqrt[1.3] Out[28]= > 1.14018 In[29]:= > Precision[Sqrt[1.3]] Out[29]= > 16 In[30]:= > N[Sqrt[1.3], 50] Out[30]= > 1.14018 In[31]:= > 1.14018*1.14018 Out[31]= > 1.30001 The more precise answer should be > In[32]:= > 1.140175425*1.140175425 Out[32]= > 1.3 > Wen-Feng Hsiao ==== > I try to find the square root of 1.3, but obtain an not so correct > answer. Could someone point me how to do? My trials are the > followings. In order to display a number to its full precision, it is often necessary to use NumberForm In[1]:= NumberForm[Sqrt[1.3], 50] Out[1]//NumberForm= 1. 140175425099138 An alternative is to specify the precision of 1.3 using 1.3`30 In[2]:= Sqrt[1.3`30] Out[2]= 1.140175425099137979136049025567 Note that the internally held answer for Sqrt[1.3] is much more accurate than the displayed number. In[3]:= x = Sqrt[1.3] Out[3]= 1.14018 In[4]:= NumberForm[x*x, 50] Out[4]//NumberForm= 1.3 I hope this helps --- ==== > I need some help, here. I'm using Mathematica 4.2 on OS X and I'd > like to save a notebook so that I can include it in a LaTeX file. > According to the Wolfram site, Mathematica has a convenient save as > option just for this sort of task. Unfortunately, I can't get it to > work for the life of me. The notebook saves, but it won't compile. I think this is an area where Wolfram over extended itself. I also tried to use TeX in the way suggested but gave up because the solution is incomplete. I even went to the trouble of adding my own extensions to TeXSave. I found the the complete result was much too restrictive in how one could use Mathematica or TeX. Now I write in TeX (actually ConTeXt) and copy formula and results over as necessary saving graphs as '.eps' and converting to '.pdf' etc. ConTeXt has a facility for pretty printing Perl, Java, SQL, TeX and MetaPost. I wonder whether an enterprising person will write one for Mathematica Source. I use TeXShop, a very standard LaTeX environment for OS X that's > built (I believe) on top of teTeX. Per the 'request' of my LaTeX > compiler, I've located copies of notebook2e.sty and wrisym.sty, but > this doesn't help; the fatal error is something like '! LaTeX Error: > This NFSS system isn't set up properly.' Does anybody out there have a slick solution to my problem? It seems > to me that Wolfram should have made this process work out-of-the-box > with standard installations of Mathematica 4.2 and standard > installation of LaTeX utilities. Perhaps I'm missing something. I agree. A facility should not be advertised without reservation if reservations exist. In this facility there are many reservations. I hope somebody out there can give me a hand with this. (FWIW, I > have access to latex and Mathematics 4.2 on linux and NT platforms, > too.) My comments only apply to 4.0, but I do not believe much has been done to improve the situation. I am sure Wolfram would have shouted if they had! > ==== Do a search on Google. Here are a couple of links: http://www.scientificweb.de/mathstef3.html http://www2.staff.fh-vorarlberg.ac.at/~ku/karl/mma.html Carsten Hansen I am due for a new computer and my driving requirement is Mathematica speed. I was wondering if anyone could recommend which processor family (Intel or > AMD) and which OS (Win NT or WXP) has the best speed comparison. I read a statement that said the AMD runs circles for FP ops. over Intel, > but there was no more detail, so I was wondering. Note: I have always thought about going MAC, but just have too much software > that I use and cannot afford to. ==== >I was wondering if anyone could recommend which processor family >(Intel or AMD) and which OS (Win NT or WXP) has the best speed >comparison. >Note: I have always thought about going MAC, but just have too much >software that I use and cannot afford to. FWIW, I've found Mathematica to run much better under Mac OS X than Win NT. I can't comment on Win XP having never used it. As far as other Windows softare, there is a program (Virtual PC) for Macs that enables a Mac to run just about any software written for a PC. ==== I have a text file with a first line containing words giving the names of the data in the column below. Subsequent lines contain the data: x y z 1 2 3 2 4 6 3 6 9 I want a function that will read this file and and create lists x={1,2,3} y={2,4,6} z={3,6,9} I do not understand how to take the strings x, y, and z that I read from the first line and create lists with those names to which I can assign the values. Peter ==== When i go: f1[x_] := something tmp = int(f1[x])dx f2[x_] = tmp then everything is nice but this: f1[x_] := something tmp = int(f1[x])dx f2[x_] = % just won't work. Apparetly Mathematica believes that % mean the thing i did BEFORE the integral! How come? -- ------------------- phone #1: (+46/0) 708 - 70 73 92 phone #2: (+46/0) 704 - 79 96 95 url: http://konrads.webbsida.com -------------------