From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newscon07.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: nth roots Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-WXE7RdBK3rBhck1+SU0Cw9LYK4UxcMsz+lF/M5wuobaBPpBti7IRoeeNg== NNTP-Posting-Date: Fri, 13 Sep 2002 22:27:46 CDT Lines: 26 X-Trace: sv3-KBtbbrnRkkOpOIPz8cifUDqgzL2NgsKqMNT0JoYa/J08/StXvzPFDjcqamR5Zpg+/oO1XKNd8goQDRy!37KeGyZpiTs2C1yzl/A38VClBSbQ0IvfQhdeFhlq0sN4NdMAOjpqeaTDiZ9gryU5Lqugi9U= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:27:46 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35144 Hi, > Simplify: > > 5nth sqrt (3)/sqrt (6) > > 5nth Sqrt(3) > ------------ > Sqrt(6) > > 1st.. is this the correct notation for use on a computer No. May be you mean 3^(1/5)/Sqrt[6] ?? > > 2nd.. how is the solution solved, step by step please. 3^(1/5)/Sqrt[6] // FullSimplify Regards Jens From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!howland.erols.net!newsfeed.mathworks.com!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: ByteCount for Global symbols Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-Pclj6Ly4yePjyqws9eJsOFyll56bte2OOOSFNAwVDfrWPxRsar9H9+bDw== NNTP-Posting-Date: Fri, 13 Sep 2002 22:28:47 CDT Lines: 23 X-Trace: sv3-P5S7KjL37Tl5HNnvkcgzFoTvkqUrviB/MfOc8cvB8TUBiSissziETz3uaKpVKoeBGzvM4IooFK7QZIh!5+wQpcvhBqtJUv3Vk/TBIZRo9lVLwl2h3/jqNPvehO2s5T6mR97uvNmsRA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:28:47 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35145 Hi, whats wrong with ToExpression[#, StandardForm, Hold] & /@ Names["Global`*"] /. Hold[a_] :> ByteCount[OwnValues[a]] Regards Jens DrBob wrote: > > I want to make a list of all symbols in the Global context, as in > > Names["Global`*"] > > and compute a ByteCount for each symbol's OwnValues -- without > evaluating the symbols. > > It seems possible in principle, but I haven't found a way. > > Bobby Treat From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!dca6-feed1.news.algx.net!ord2-feed1.news.algx.net!allegiance!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Arrow pointers rather than Legend Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-IhGmVkNhxJ8UNdDMfS6zV373i7PQpiTSTV+MhmNQq+fXB+RzyOB3lGksQ== NNTP-Posting-Date: Fri, 13 Sep 2002 22:29:48 CDT Lines: 33 X-Trace: sv3-coMeaoHPUWa7k2MJ/ZarLwnSJl350GWGo5H9WPPTvO4GoeM7YC3uio4PTm5vmlvSVAmKSqEhEVaR42t!lZZLAgvPMMRvoZ3hkysn6I9PZf1w5irY8zcjj0qzoROM0GdcIfIyLXVyat8= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:29:48 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35146 Hi, Needs["Graphics`Arrow`"] Plot[{Sin[x], Cos[x]}, {x, 0, 2Pi}, Epilog -> {{GrayLevel[0.9], Rectangle[{3.75, 0.25}, {5.2, 0.9}]}, Arrow[{4, 0.75}, {2, Sin[2]}], Text[Sin[x], {4, 0.75}, {-1, 0}], Arrow[{4, 0.5}, {2, Cos[2]}], Text[Cos[x], {4, 0.5}, {-1, 0}]}] Regards Jens JM wrote: > > Instead of using Legend in plots with multiple series is there a way > to have arrows with a text at the end identifying the different > series? The reason I'd like this is that the legend is a bit 'bulky' > looking and I'd want something tidier. > > I know there is an Arrow package but I think you'd need to manually > enter each start and end point of each arrow - is there a simple > command to do this? > > Also - is there a way to adjust the legend font size? I.e. make it > small so that it doesn't interfere with data series. > _ > |\ > \ > \ > \ > \ > thankyou From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!enews.sgi.com!proxad.net!proxad.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Todd Gayley Newsgroups: comp.soft-sys.math.mathematica Subject: Re: JLINK and Outputting a Plot Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-b4RHZdp6zuNQujzv0U1pDN06CoH+hvH1XXyPz9VLD3+ayVJUq6VuPU8cw== NNTP-Posting-Date: Fri, 13 Sep 2002 22:30:50 CDT Lines: 42 X-Trace: sv3-0JNxd7v2QOti622SFpqC8vJ5A9nA+DNqKllHamrq8YEB3anLlbbZg/bUc+fk0Okfr4dcCCBzsnjJugd!TjFCIQ+dFfIvaRt5oZfQCciejBV8F9Vv2nW6qfS+Xn4OexBgYyo/xnT/Ans= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:30:50 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35147 At 12:14 AM 9/13/02, Blimbaum Jerry DLPC wrote: >I have written the following in a JLink program: > > >drawArea=JavaNew["com.wolfram.jlink.MathCanvas"]; > >then I perform an analysis of some data with output of this form.... > >plot = DisplayTogether[ListPlot[],ListPlot[].etc...]; > > >Unfortunately, at this point I dont know how to associate 'plot' with >drawArea so that > >draw.Area@RepaintNow[]; repaints the math screen to show the plots I've >computed... > > >I've tried draw.Area@update[plot] and draw.Area@setImage[plot] but these >dont work........how to fix?.........thanks..... Jerry, You use the MathCanvas.setMathCommand() method to specify the Mathematica command that is used to generate the image to display: drawArea.setMathCommand("plot"); You will find a very simple example of this in section 1.2.8.2 of the J/Link User Guide (in the Help Browser hierarchy, this is found at JLink/Part 1. Installable Java/Drawing and Displaying Images in Java Windows/Showing Graphics and Typeset Expressions). You do not need to use the repaintNow() method unless you are updating the image continuously in response to a user action, like dragging a slider. Todd Gayley Wolfram Research From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Matthias.Bode@oppenheim.de Newsgroups: comp.soft-sys.math.mathematica Subject: AW: nth roots Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-U9yWzTScCAYWb+/2QfeBEGCTgebo/2ITCTlzWvx2c6f18ba22ey+hxQog== NNTP-Posting-Date: Fri, 13 Sep 2002 22:31:51 CDT Lines: 55 X-Trace: sv3-SAoJoKMoElocfIBgucTNcX+l6PsKDTtr7zVuInNyJMVKxPpN3v+opsAfAfLeeM5kVR3lT6p6rd3geqR!B3gqdW7wJvTN2D7NIlQmttYdfARM94u3xgrIeh0TgDu8nkw9fvki+7NY2Oo= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:31:51 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35148 Hello watcher2, try: (((((3^(1/2))^(1/2))^(1/2))^(1/2))^(1/2))/(6^(1/2)) Out: 1/(Sqrt[2]*3^(15/32)) You can see what happened: 1st: 6^(1/2) = 2^(1/2)*3^(1/2); 2nd: subtraction of the 3's exponents (1/2)^5 - 1/2 = 1/32 - 16/32 = - 15/32. MATHEMATICA does these straightforward simplifications without you having to invoke Simplify[]. Best regards, Matthias Bode Sal. Oppenheim jr. & Cie. KGaA Koenigsberger Strasse 29 D-60487 Frankfurt am Main GERMANY Tel.: +49(0)69 71 34 53 80 Mobile: +49(0)172 6 74 95 77 Fax: +49(0)69 71 34 95 380 E-mail: matthias.bode@oppenheim.de Internet: http://www.oppenheim.de -----Ursprüngliche Nachricht----- Von: watcher2@sympatico.ca [mailto:watcher2@sympatico.ca] Gesendet: Freitag, 13. September 2002 07:14 An: mathgroup@smc.vnet.net Betreff: nth roots Simplify: 5nth sqrt (3)/sqrt (6) 5nth Sqrt(3) ------------ Sqrt(6) 1st.. is this the correct notation for use on a computer 2nd.. how is the solution solved, step by step please. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Kyriakos Chourdakis Newsgroups: comp.soft-sys.math.mathematica Subject: LaTeX and Mathematica Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-NCTH9ShD6oHijWdz9Pt1IjN1fKK8DuMG/8W9R7xCht3ebgkObKCE/Icrg== NNTP-Posting-Date: Fri, 13 Sep 2002 22:32:52 CDT Lines: 33 X-Trace: sv3-AnilUe5Owvx0pWhLNQzyBWkS7l55QvwnKrT+rNoDHI3lJlaz7l/vx5ZtHqTutiY7NU5I3ZlnVmg3o31!aewxrlA97J+znyk+TKebXTHvM7QCCfopQpcQdAddvCFmsQUzJPysAhZhqA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:32:52 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35149 Dear all, I want to include some Mathematica code in some lecture notes I am writing. For that purpose, I use the LaTeX style provided with Mathematica. It seems to be working fine when I produce a document that is just Mathematica code. The problem - as expected - is that when I include the Mathematica code as a part of a larger document, there are (1) clashes with existing packages (2) some LaTeX elements, such as the equations, start to use the Mathematica fonts too. My objective would be to typeset a document in standard LaTeX, where only the Mathematica code has the Mathematica feeling. Does anyone know of any style available that is completely seperated from all other LaTeX definitions? Best Kyriakos _____+*"*+____+*"*+___+*"*+__+*"*+_ Kyriakos Chourdakis Lecturer in Financial Economics URL: http://www.qmw.ac.uk/~te9001 tel: (++44) (+20) 7882 5086 Dept of Economics University of London, QM London E1 4NS U.K. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: LaTeX and Mathematica Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-Sjg4db1mvCG6L8c3hctIUMRhoVQ/C4PrCWyEuR9Kz4oCr4ZDQo9DZ01aw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:22:22 CDT Lines: 75 X-Trace: sv3-rDJT7FN6qletF2PnRUv3b1cA6h72bgRAl82tVw7jzXAtGxlIgLy4Q+wzznZ15ucs/NFD8Nlw3TZ1hkA!aZHEp/7qPtLL3X2x2J3iIufy7lHG9TGv1tWuZlg3M3VITrYaDX4FIHGLl+53YS9UNx+KRBc= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:22:22 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35207 Hi, a) you must change the fonts, because the Mathematica symbols are designed to fit to Times/Helvetica/Courier and not to Computer Modern ! Mixing Computer Modern and the Mathematica fonts look not very nice because Comuter Modern has smaler strokes. You need atleast wrisym.sty, i.e. \usepackage[monospacemath]{wrisym} but this will switch the main document font to Times and the mono-space font to courier. With Mathematica 4.2 you can use Adobe-Garamond and Janson as document fonts too, with \usepackage[monospacemath,garamond]{wrisym} but this are commercial fonts and you have to buy it from Adobe. b) If you like the narrow monotype fonts similar to Computer Modern you can use the CMTT fonts, now included in Mathematica 4.2 Just use the package option \usepackage[cmtt]{wrisym} c) I have a TeX frontend that use only the wrisym package and a preprocessor. It run fine with the most style files But you have to use "TeX notebooks" that are essential TeX files with mathinput environments. The TeX frontend send the contents of the mathinput environments to the kernel and paste the output into the final TeX file. It also does some fancy formating with the Mathematica input and replace -> with \Rule, :> with \RuleDelayed .. You can have the program and the style files if you like. Regards Jens Kyriakos Chourdakis wrote: > > Dear all, > > I want to include some Mathematica code in some lecture notes I am writing. > For that purpose, I use the LaTeX style provided with Mathematica. It seems > to be working fine when I produce a document that is just Mathematica code. > > The problem - as expected - is that when I include the Mathematica code as > a part of a larger document, there are > (1) clashes with existing packages > (2) some LaTeX elements, such as the equations, start to use the > Mathematica fonts too. My objective would be to typeset a document in > standard LaTeX, where only the Mathematica code has the Mathematica feeling. > > Does anyone know of any style available that is completely seperated from > all other LaTeX definitions? > > Best > > Kyriakos > > _____+*"*+____+*"*+___+*"*+__+*"*+_ > > Kyriakos Chourdakis > Lecturer in Financial Economics > > URL: http://www.qmw.ac.uk/~te9001 > tel: (++44) (+20) 7882 5086 > Dept of Economics > University of London, QM > London E1 4NS > U.K. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "Calimero" Newsgroups: comp.soft-sys.math.mathematica Subject: Help Browser freezes Organization: Universitat Jaume I Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: NNTP-Posting-Date: Fri, 13 Sep 2002 22:33:53 CDT Lines: 7 X-Trace: sv3-MKJoc4FrYGzbG/39/nGUl0TXXUshJZv/EeW3lVBfx+lDENYSk7+vhWjEX+uKYRVpJw5A3sGmd141SI2!ebtSQoHPM0HrbmKsIlS5Zew/NboEHX+zqSQzlluZXFz6z3BYDKKPTgy6kHsaausZ4g== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:33:53 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35150 What about this problem? I have tried the previous suggestions but none of them worked. Will Wolfram help us in this problem? From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!washdc3-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!cyclone.swbell.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Vynce" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Help Browser freezes Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-Ze/RLiZ7Qc5tdEyg2zV8qHpD0T6ou1iBdD1NxWCYvfYlF3OyzB0urqAQg== NNTP-Posting-Date: Sat, 14 Sep 2002 23:19:45 CDT Lines: 17 X-Trace: sv3-vvtE16KhaUgQsJ/gdg5pc1aXdhbtlkgFHZd3e0nhTTgf2QUrIQncL5ep5eU5h5fWO+ULQgMzTB4ZlU9!RDbGPIsbdWFjC1cO6HgLhanK7PyaWVKPO9YJpFpiR8qpAdyDWxRgRzEo X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:19:45 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35167 Have you tried deleting ... \Mathematica\4.2\Documentation\English\MainBook\BrowserIndex.nb There are two BrowserIndex files. Only delete the .nb one (or just move it somewhere else). "Calimero" wrote in message news:aluavi$nk7$1@smc.vnet.net... > What about this problem? I have tried the previous suggestions but none of > them worked. Will Wolfram help us in this problem? > > > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!nntp.flash.net!news-out.visi.com!hermes.visi.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: mark@markfisher.net (Mark Fisher) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Empirical CDF and InterpolatingFunction Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Fri, 13 Sep 2002 22:34:54 CDT Lines: 95 X-Trace: sv3-MJBcJ7DEIvcSOBw7eY49GS4jEgLOF5M1YK5Z2wvC8e9fYRQ0rpjvWWqRJI00idtdQV9FFpQZffIt/c5!P2NtoBaOYrkA5LVmK92Ai7dRVhNoqDF6+X0NteU0ZTgyLzLSPQMimHlqURnhx7jPrw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:34:54 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35151 Daniel Lichtblau made two suggestions that allow one to use Interpolation the way I wanted. First, to make the resulting function right-continuous, change the sign twice. Second, to make the end point return the correct value, add an extra (phantom) observation (with an extra (irrelevant) value). (The phantom observation is made at the high end because of the sign reversals.) Here's the code I cooked up based on his suggestions: MakeEmpiricalCDF::usage = "MakeEmpiricalCDF[list] returns a function that evaluates the empirical CDF given the observations in the list. The function is defined on the entire real line." MakeEmpiricalCDF[list_?(VectorQ[#, NumericQ]&)] := Module[{n, s, a, r, idata}, n = Length[list]; s = Sort[list]; a = Append[s, s[[-1]] + 1]; (* phantom obs. *) r = Range[1/n, 1 + 1/n, 1/n]; (* phantom value 1 + 1/n *) idata = Last /@ Split[Transpose[{-a, r}], #1[[1]] == #2[[1]]&]; (* "-a" is the first sign change *) Block[{x}, Function @@ {x, Which @@ { x < s[[ 1]], 0., x > s[[-1]], 1., True, Interpolation[idata, InterpolationOrder -> 0][-x] (* "-x" is the second sign change *) }}] ] The construction "Last /@ Split[ ... ]" accounts for duplicate values. Here are two examples. Needs["Statistics`ContinuousDistributions`"] list1 = RandomArray[NormalDistribution[0, 1], 100]; f1 = MakeEmpiricalCDF[list1]; Plot[f1[x], {x, -4, 4}] list2 = Table[Random[Integer, {1, 10}], {10}]; f2 = MakeEmpiricalCDF[list2]; Plot[f2[x], {x, 0, 11}] --Mark mark@markfisher.net (Mark Fisher) wrote in message news:... > I'm trying to write a fast empirical cummulative distribution function > (CDF). Empirical CDFs are step functions that can be expressed in > terms of a Which statement. For example, given the list of > observations {1, 2, 3}, > > f = Which[# < 1, 0, # < 2, 1/3, # < 3, 2/3, True, 1]& > > is the empirical CDF. Note that f /@ {1, 2, 3} returns {1/3, 2/3, 1} > and f is continuous from the right. > > When the number of observations is large, the Which statement > evaluates fairly slowly (even if it has been Compiled). Since > InterpolationFunction evaluates so much faster in general, I've tried > to use Interpolation with InterpolationOrder -> 0. The problem is that > the resulting InterpolatingFunction doesn't behave the way (I think) > it ought to. For example, let > > g = Interpolation[{{1, 1/3}, {2, 2/3}, {3, 1}}, InterpolationOrder -> > 0] > > Then, g /@ {1, 2, 3} returns {2/3, 2/3, 1} instead of {1/3, 2/3, 1}. > In addition, g is continuous from the left rather than from the right. > > Obviously I am not aware of the considerations that went into > determining the behavior of InterpolationFunction when > InterpolationOrder -> 0. > > So I have two questions: > > (1) Does anyone have any opinions about how InterpolatingFunction > ought to behave with InterpolationOrder -> 0? > > (2) Does anyone have a faster way to evaluate an empirical CDF than a > compiled Which function? > > By the way, here's my current version: > > CompileEmpiricalCDF[list_?(VectorQ[#, NumericQ] &)] := > Block[{x}, Compile[{{x, _Real}}, Evaluate[ > Which @@ Flatten[ > Append[ > Transpose[{ > Thread[x < Sort[list]], > Range[0, 1 - 1/#, 1/#] & @ Length[list] > }], > {True, 1}]] > ]]] > > --Mark From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!rip!newsfeeds-atl1.usenetserver.com!news.webusenet.com!news-hub.cableinet.net!blueyonder!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Rob_jack" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: NIntegrate Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-4R230dIMQ6iSzZdCH8KE8ZZl9k6mGcMz6zBfeB5Smodrk5p1Z4RpWULCg== NNTP-Posting-Date: Fri, 13 Sep 2002 22:35:55 CDT Lines: 28 X-Trace: sv3-3u4zXIyotd7zhRXL0a9oWeydEhrd4nj2Y5lM6dZE8WWa3CqFqbEQhNBc899+kUOepnIyOEJEBZfJD33!MTfyrqWn/H6Fz6Sb69y2OfjXh7yg55TxLhO3wqklyfkE0U2Q7Watid556g== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:35:55 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35152 "Jens-Peer Kuska" wrote > > do you realy think that > > 1.07577/( 1+7.12336*10^-7 (1. + z)^2 ) > > with the z inside is numerical ? or do you mean > > F[z_?NumericQ]: = NIntegrate[f[y,z], {y, 0, Infinity}] > I'm a newbie, bat I mean: ************************* In[1]= NumericQ[z] Out[1]=False ************************* BTW, z is a real number. -- Rob_jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!west.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jack Goldberg Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: A symbol for Floor Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-xWXnNnLm9a2NlsSmP73S/yBooHN1lM3Y5PDIB3F5dwZoNlVFZucxe+2Hg== NNTP-Posting-Date: Fri, 13 Sep 2002 22:36:56 CDT Lines: 18 X-Trace: sv3-TChu9r3QaowNmdS2a9MtQsmWIPOna/+Cabb4QNYnlOxUxM9rIhhCQBkpkpABTZ4wTe75Kx6r2cPIelN!0GXaAmb3NnRTuHBkM8Y4Pit/d/DgOsyAl5OLLXyUzkB0F5nY/omBatzJZT67U03qk3JtfUU= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:36:56 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35153 Hi Group; First a thank you to all those who pointed out to me (and others apparently) about the various ways to input the symbolic form of Floor. On a larger note, it surprises me that no one has yet published a book on how to use Mathematica to write a technical document. The number of questions that appear on this board concerning the details of "how to do it" suggests the need for such documentation. I'm speculating when I say that many users give up in frustration and go back to (or learn) Latex. At least there are bookcases full of "learning Latex". I myself have 5! I don't mean this to sound like a rant, but using Mathematica to publish a document is, for most of us, not worth the effort. Jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!rip!ps01-chi1!news.webusenet.com!snoopy.risq.qc.ca!aotearoa.belnet.be!news.belnet.be!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jack Goldberg Newsgroups: comp.soft-sys.math.mathematica Subject: Checking Programming errors; a ? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-qb42yEsWeb3K8pm8YKtsDuOQXcpNc8iDXiamBwOxvbMyGiCB00NAaelKQ== NNTP-Posting-Date: Fri, 13 Sep 2002 22:37:57 CDT Lines: 48 X-Trace: sv3-CRI01UWMZv8ptDODBdlu02wfCVX5d9rJJMDPafaOF+OHsY7kgQDqUE9xjNAPKvCOjlVDTcNpDXVmvZO!xSEcp09vk1XXuy6U9Xty2ckFqpMRNvk1C8wOT2ZysWxV0TAvtiBgTwntg5+cIazmnjGmJe4= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:37:57 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35154 Hi Group: I often run into this difficulty: when designing a program, say as a module, and testing it for various inputs, I get wrong answers. What to do? I use a method that works for me but may not be the best available. I want to show my method and then ask a question about how it can be imporved. (Oh yes, I abandoned Trace a long time ago!) myFunction[f_] := Module[ {L1,L2,L3}, L1 = ... ; L2 = ... ; l3 = ... ; "final step" ] To see what went wrong, I use (* *) selectively as follows: Stage 1 myFunction[f_] := Module[ {L1,L2,L3}, L1 = ... (*; L2 = ... ; L3 = ... ; "final step" *) ] Thus I see if L1 worked as expected. The next step is to put (* after L2 and see if this works. I continue this til the bitter end and I usually find my errors. My question; The process of moving (* *) step by step through the program is quite tedious when the code has lots more lines. What I would like is a "meta-program" which (like FoldList) does this job for me. The output of this "meta-program" is the list of outputs of each line in the module, probably best printed as a column. This sounds like Trace but my problem with Trace is it is terribly difficult to read. For the not-so-subtle programming I do, the only thing I need is what expression is returned line by line. Any advice? All remarks are appreciated! Jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!enews.sgi.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Checking Programming errors; a ? Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-4R230dIMQ6iSzZdCH8KE8ZZl9k6mGcMz6zBfeB5Smodrk5p1Z4RpWULCg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:23:23 CDT Lines: 60 X-Trace: sv3-sGrqzDhlHCLD100+FaaWflISJBoXKC6h1j8IgFVb41ECO4AZfski81i5mZpYiTYLyJkpSdTqcyc6G5E!QS5xdcLKe4KZFOBWX+KnBCfO6euDAls0pYPcQ6yYlX11anR0jJXykqfsBQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:23:24 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35208 Hi, does http://www.mathsource.com/Content/Enhancements/FrontEnd/0211-037 help you ? Regards Jens Jack Goldberg wrote: > > Hi Group: > > I often run into this difficulty: when designing a program, say as a > module, and testing it for various inputs, I get wrong answers. What to > do? I use a method that works for me but may not be the best available. > I want to show my method and then ask a question about how it can be > imporved. (Oh yes, I abandoned Trace a long time ago!) > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... ; > L2 = ... ; > l3 = ... ; > "final step" > > ] > > To see what went wrong, I use (* *) selectively as follows: > > Stage 1 > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... (*; > L2 = ... ; > L3 = ... ; > "final step" *) > > ] > > Thus I see if L1 worked as expected. The next step is to put (* after L2 > and see if this works. I continue this til the bitter end and I usually > find my errors. > > My question; The process of moving (* *) step by step through the > program is quite tedious when the code has lots more lines. What I would > like is a "meta-program" which (like FoldList) does this job for me. The > output of this "meta-program" is the list of outputs of each line in the > module, probably best printed as a column. > This sounds like Trace but my problem with Trace is it is terribly > difficult to read. For the not-so-subtle programming I do, the only thing > I need is what expression is returned line by line. > > Any advice? All remarks are appreciated! > > Jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed1.bredband.com!bredband!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: mark@markfisher.net (Mark Fisher) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Checking Programming errors; a ? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-dSjAeWhPL8qGpUQPiFzQrfCSkwKwgxJM8xf0c1BldhcSDeLl3aU8iqI2Q== NNTP-Posting-Date: Wed, 18 Sep 2002 01:11:02 CDT Lines: 93 X-Trace: sv3-s0b6Zfqc3BKnz5hL2AUbPawyeI45jY9s0vim6J4Vudzwc/0R++LU6g6DEMoECbXRGKrzINDOGCbHfJZ!+sq7r8Wvr+l1RHunkVdhIUnTvk51saHNH+mu25Go3Toa3chKdeugPm30nQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:11:02 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35196 I've enhanced the code for PartialEvaluation (see my post, which I incorrectly attaced to someone else's reply). It is somewhat more flexible now and does more error checking. It finds the rule in DownValues that matches f[args] (allowing for more than one rule in DownValues); it allows the user to specify the position of the "main" CompoundExpression; and it allows the user to specify an expression that gets appended to the truncated CompoundExpression (and hence evaluated and returned). The package is just a bit too large to post here. It can be downloaded from my web site at http://www.markfisher.net/~mefisher/mma/mathematica.html Nevertheless, I can give an outline of the code here (absent the error checking stuff). PartialEvaluation[f[args], n, expr]: (* get the DownValues and "turn them off" *) dv = DownValues[f]; DownValues[f] = {}; (* find the rule that matches *) matches = Position[MatchQ[f[args], #]& /@ dv[[All, 1]], True]; match = dv[[ matches[[1, 1]] ]]; (* find the "main" CompoundExpression *) ppos = Position[match, HoldPattern[CompoundExpression[__]]]; pos = First[Sort[ppos]]; (* extract, truncate, append to, and reinsert it *) held = Extract[match, pos, Hold]; held = ReplacePart[held, Sequence, {1, 0}]; held = Take[held, n]; held = Join[held, Hold[expr]]; held = ReplacePart[Hold[Evaluate[held]], CompoundExpression, {1, 0}]; match = ReplacePart[match, held, pos, 1]; (* apply the modified rule and restore DownValues *) result = f[args] /. match; DownValues[f] = dv; result --Mark Jack Goldberg wrote in message news:... > Hi Group: > > I often run into this difficulty: when designing a program, say as a > module, and testing it for various inputs, I get wrong answers. What to > do? I use a method that works for me but may not be the best available. > I want to show my method and then ask a question about how it can be > imporved. (Oh yes, I abandoned Trace a long time ago!) > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... ; > L2 = ... ; > l3 = ... ; > "final step" > > ] > > To see what went wrong, I use (* *) selectively as follows: > > Stage 1 > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... (*; > L2 = ... ; > L3 = ... ; > "final step" *) > > ] > > Thus I see if L1 worked as expected. The next step is to put (* after L2 > and see if this works. I continue this til the bitter end and I usually > find my errors. > > My question; The process of moving (* *) step by step through the > program is quite tedious when the code has lots more lines. What I would > like is a "meta-program" which (like FoldList) does this job for me. The > output of this "meta-program" is the list of outputs of each line in the > module, probably best printed as a column. > This sounds like Trace but my problem with Trace is it is terribly > difficult to read. For the not-so-subtle programming I do, the only thing > I need is what expression is returned line by line. > > Any advice? All remarks are appreciated! > > Jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Arrow pointers rather than Legend Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-jgZ7mzdEufEyBowEaur+iCJYbbNyNVWBT4thny01v5z9HzN4ql8UXZ7DA== NNTP-Posting-Date: Fri, 13 Sep 2002 22:39:01 CDT Lines: 49 X-Trace: sv3-cu223z5DbgKKOHVskLuNjsvmNUuJVyrar0XixAW1ELd6TqKeCZgryC9rnYc2o6CGS9fXa3mVSxskW5O!6EMrvPSHxDmf5RKSNQoLnkS91MjVZxF3C+mvKha9Jmr0TipdfEF7JPfUsA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:39:01 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35155 JM, You are certainly correct in wanting to make a tidier plot! Legends are often poor because they actually distract from the message of the data. However, the best solution will depend on the particular nature of your data. If there are not too many curves you could perhaps put Text labels right on top of each curve. If there are many curves, or some of them are close together, use arrows for some of them. If you have a really large number of curves, then maybe a different approach is needed. It is probably not possible to make a useful general routine for labeled arrows because the best placement would depend upon the particular nature of the graph. So, to make a nice graphic you will have to do some "hand" work, specifying each Arrow and Text label. You can actually click the coordinates off the graph to put into the Arrow and Text statements. If you want to actually show me your plot, I could try to make some suggestions. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: JM [mailto:j_m_1967@hotmail.com] Instead of using Legend in plots with multiple series is there a way to have arrows with a text at the end identifying the different series? The reason I'd like this is that the legend is a bit 'bulky' looking and I'd want something tidier. I know there is an Arrow package but I think you'd need to manually enter each start and end point of each arrow - is there a simple command to do this? Also - is there a way to adjust the legend font size? I.e. make it small so that it doesn't interfere with data series. _ |\ \ \ \ \ thankyou From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.wirehub.nl!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Dale Horton Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Using Slide View in mathematica 4.2 Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-jgZ7mzdEufEyBowEaur+iCJYbbNyNVWBT4thny01v5z9HzN4ql8UXZ7DA== NNTP-Posting-Date: Fri, 13 Sep 2002 22:40:02 CDT Lines: 33 X-Trace: sv3-8EmPcn5540HIX4utriyJ7xvG2OM2m5O5vjh9kzE20nVza630P1uyoI6L/aqndAuMnuyxEi3lhxRTraV!3vimP5BlD5cxJ2XsgEcU8eM0ywIPsWTKgnUUPkawvVRoWyE4yY2FJnEkRWFK4gbx7DrtUj8= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:40:02 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35156 At 02:27 AM 9/11/2002, Brian Higgins wrote: >I am interested in creating a slide presentation using slide view >mode in Mathematica 4.2. I would like to have hyperlinks between >different slides ( e.g., a hyperlink in say slide 6 takes me back to >slide 3). > >I have no difficulty in creating such a hyperlink (using tags) when I >am in the author mode. But the hyperlink does not work when a revert >back to slide view mode. > >I guess it has somthing to do with the fact that in author view mode >your slides are a subset of a single notebook but in slide view mode >each slide becomes a distinct notebook. > >So my question: Is there a way to reference the individual slides >using the hyperlink command? > >Thanks in advance for all your help > >Brian If you set "PagewiseScrolling"->True, then your hyperlink will work. Go to the Option Inspector and set the scope to Notebook. Then go to the option NotebookOptions|Window Properties|ScrollingOptions|"PagewiseScrolling" And set it to True. The disadvantage to this setting is that you can now only have one screen's worth of contents per slide. (But then it is a slide show after all, so maybe that's not so bad.) -Dale From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.mathworks.com!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: swidrygiello@wp.pl (Swidrygiello) Newsgroups: comp.soft-sys.math.mathematica Subject: empirical CDF Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-cl6NdIV5U+aPwg15iacaHIkVGa1B7ZUTabspgW2hKFRijG58djU+OVbbA== NNTP-Posting-Date: Fri, 13 Sep 2002 22:41:03 CDT Lines: 10 X-Trace: sv3-cd0Iw4RfqTzkHDB/Yp7ygyEsPccs2/rA7JziRs+TzUnjLlw/wtWgh+JJqlu1Kl4T8QoX/LMNcAQX3vt!kobf4UFR0QqwAyp3FLd67mK2LKGn8JHH2nJ6X+1LXU2llJohnK/I1RcIZw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:41:03 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35157 Hello!!! Does anybody know how to calculate in Mathematica: a)empirical CDF, b)empirical PDF, c)normal QQ-plot; d)QQ-plot two different random samples?! Swidrygiello. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news-out.triton.net!triton.net!newsfeeder.triton.net!nntp-relay.ihug.net!ihug.co.nz!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "ng" Newsgroups: comp.soft-sys.math.mathematica Subject: Postponing loading of Package Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-oBmm5MQbX7ylXDXsqXiDUc5zUS6/fPXhvho3b7ftGLjx+TITBQBWfcf7Q== NNTP-Posting-Date: Fri, 13 Sep 2002 22:42:04 CDT Lines: 36 X-Trace: sv3-t6HOjLjZPwe9AftizgaMbJQ3TAX+0WWnw3A5aw6R8Tu6pWeNBHwutztkvqsqfypNzTc9MfM7CtJfXOj!KhHjtA5VobZG2rhCjUdw9Mzns+pYB7MfzAUyOzrt+YddRtlkLM6BvYLf3w== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:42:04 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35158 I wrote a package (call it "ThisPackage`") that uses DeclarePackage["OtherPackage`", {"BigVariable"} ]. The idea was to prevent the loading of a large file in routine cases. However, when ThisPackage` defines its functions, inside the Private` area, it includes a conditional call to BigVariable. It turns out that OtherPackage is loaded when that function is defined. I was wondering if there is a way to avoid this. Roughly speaking, here is the setting: BeginPackage[ "OtherPackage`" ] BigVariable::usage="example Begin[Private`] BigVariable=Table[x y,{x,1000},{y,1000}] End[ ] EndPackage[ ] BeginPackage[ "ThisPackage`" ] function::usage="example Begin[Private`] function[x_]:=Module[{y}, y=If[x>1000,BigVariable[[x]],x] ] End[ ] EndPackage[ ] I don't want OtherPakage to be loaded unless function[x] is called with x>1000 but it loads when function is defined. Any ideas? Thanks! Nicholas From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!triton.net!smallfeed.triton.net!newsfeed.wirehub.nl!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Postponing loading of Package Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-xWXnNnLm9a2NlsSmP73S/yBooHN1lM3Y5PDIB3F5dwZoNlVFZucxe+2Hg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:24:26 CDT Lines: 67 X-Trace: sv3-BKgizL3Wzwjcd9CI+7dfR9inJMjRHYKQy6zeo9KLga8fYe0FyrFJucWDTqgJYWu4llL0Z0rumLtq+aJ!s+5NKae3CT0TLvmg82EJRDrHzya2z8+FBLrocib1KFBI2rKJ45pUdggHcA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:24:26 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35209 Hi, BeginPackage[ "OtherPackage`" ] BigVariable::usage="example" Begin["`Private`"] BigVariable=Table[x y,{x,1000},{y,1000}] End[ ] EndPackage[ ] Print["Loading ..."]; and BeginPackage[ "ThisPackage`" ] function::usage="example" Begin["`Private`"] function[x_]:=Module[{y}, y=If[x>1000, Needs["OtherPackage`"]; OtherPackage`BigVariable[[x]], x] ] End[ ] EndPackage[ ] should do that. Regards Jens ng wrote: > > I wrote a package (call it "ThisPackage`") that uses > DeclarePackage["OtherPackage`", {"BigVariable"} ]. The idea was to prevent > the loading of a large file in routine cases. However, when ThisPackage` > defines its functions, inside the Private` area, it includes a conditional > call to BigVariable. It turns out that OtherPackage is loaded when that > function is defined. I was wondering if there is a way to avoid this. > Roughly speaking, here is the setting: > > BeginPackage[ "OtherPackage`" ] > BigVariable::usage="example > Begin[Private`] > BigVariable=Table[x y,{x,1000},{y,1000}] > End[ ] > EndPackage[ ] > > BeginPackage[ "ThisPackage`" ] > function::usage="example > Begin[Private`] > function[x_]:=Module[{y}, > y=If[x>1000,BigVariable[[x]],x] ] > End[ ] > EndPackage[ ] > > I don't want OtherPakage to be loaded unless function[x] is called with > x>1000 but it loads when function is defined. Any ideas? > > Thanks! > > Nicholas From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!feed.newsfeeds.com!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "John Jowett" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Postponing loading of Package Organization: CERN Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-fs1Ggvvpld9I76f7qQddEKP5R3Un9In1NhDqw4LyYSrSLy+yAkC7F7g3g== NNTP-Posting-Date: Wed, 18 Sep 2002 01:02:40 CDT Lines: 54 X-Trace: sv3-fImB8SJuQEG37cIM0mZMhiNZPF8bCsXdpa3SeaZ+fTazrDVCUj+gEwiKBri6XlZpvXdajvUmU8e16/L!iYpY7OW0hyLw1uUlCJkYc+XM2WtcYFJ5OJgYRRJMSwPnCqQ+C+kryI785Q== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:02:40 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35188 Hello, Dynamic programming might help: replace the line defining BigVariable with BigVariable:=BigVariable=Table[x y,{x,1000},{y,1000}] Then the table will not be calculated unless it is needed. (See the section on "Functions that Remember Values They Have Found", 2.4.9 in the Mathematica Book). John Jowett "ng" wrote in message news:alubet$no8$1@smc.vnet.net... > I wrote a package (call it "ThisPackage`") that uses > DeclarePackage["OtherPackage`", {"BigVariable"} ]. The idea was to prevent > the loading of a large file in routine cases. However, when ThisPackage` > defines its functions, inside the Private` area, it includes a conditional > call to BigVariable. It turns out that OtherPackage is loaded when that > function is defined. I was wondering if there is a way to avoid this. > Roughly speaking, here is the setting: > > BeginPackage[ "OtherPackage`" ] > BigVariable::usage="example > Begin[Private`] > BigVariable=Table[x y,{x,1000},{y,1000}] > End[ ] > EndPackage[ ] > > BeginPackage[ "ThisPackage`" ] > function::usage="example > Begin[Private`] > function[x_]:=Module[{y}, > y=If[x>1000,BigVariable[[x]],x] ] > End[ ] > EndPackage[ ] > > > I don't want OtherPakage to be loaded unless function[x] is called with > x>1000 but it loads when function is defined. Any ideas? > > > Thanks! > > Nicholas > > > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!mango.news.easynet.net!easynet.net!proxad.net!proxad.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Tomas Garza Newsgroups: comp.soft-sys.math.mathematica Subject: Re: trying to pull numbers out of a string from a file... Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209130514.BAA17465@smc.vnet.net> X-GC-Trace: gv1-hGHFQCTDtHHwfTmCukSRZZ/rKjEfHdhn3o3yT1RuysHZEZKugfJauTTwg== NNTP-Posting-Date: Fri, 13 Sep 2002 22:43:05 CDT Lines: 43 X-Trace: sv3-4bys59gGhaYUzhSVP0Ed69o+yFWDOqIMPN0KyZaaky/ybBQdX5nTBjAWEm9x9/+rakiWZpq0WLMLn7V!IpI6RUqRNoi8RS7jNOZNx3c2OieqtEyMQ9LTKeQjpWG91o5204wnCDndSA8t9aZXd3X6M/I= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:43:05 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35159 Could you send a sample example of your file -- just a few records. Tomas Garza Mexico City ----- Original Message ----- From: "1.156" Subject: trying to pull numbers out of a string from a file... > I've got to extract some numbers from a file that are in lines of text. Since the line contents are not numbers, I presume I must pull the line out as a string. Here I start by pulling out just one line: > > inFile = OpenRead["197-tst.txt"] > y = ReadList[inFile, String, 1, RecordLists -> True] > Close[inFile]; > > This appears to pull in a line. Now I want to take characters 25 to 110 to get just the stuff I want: > y1=StringTake[y ,{25,110}]; > > Here's the output. StringTake doesn't seem to work. > > StringTake[{aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 -1281.9 -229. 321. 317. 367. -115. 126. 146. -410. -426.000000EF 75.}, {25, 110}] > > It doesn't take loading another package as far > as I can tell from the help. I'm thinking that it doesn't work because it's trying to work on a list > rather than a string. I've tried Flatten, and other stuff to try to get to just a string and not a list but > nothing has worked so far. I'm a long way from getting to those numbers in there but heck, I > can't even get to the string. Can anyone point me in the right direction? > > Thanks, Rob > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!rip!ps01-chi1!news.webusenet.com!snoopy.risq.qc.ca!newsfeed.news2me.com!west.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Selwyn Hollis Newsgroups: comp.soft-sys.math.mathematica Subject: Re: MathematicaTeX Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-aLoeluLq0V73k6Rl3TA7bGl9J8CWjh0N1cUb2IGQWyEwR5CAGvco8eahw== NNTP-Posting-Date: Fri, 13 Sep 2002 22:44:05 CDT Lines: 65 X-Trace: sv3-1q2mLH5Hc8hdSyZVrwzUsKD0LKvcg/cTysaBt7MAEcojFU6O4RqUIiX+rKGFsI+gG/vf2P169SaoiFV!WqxrAMggOqJm+o6ig5IXGbbPmsbSE+urH42h6LamoJ0eRb6pOF20m557kw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:44:05 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35160 Jens-Peer Kuska wrote: > Hi, > > you mean the inverse of TeXForm[] ? > For what ? A TeXpert && Mathematica guru && MathLink expert > has a TeX frontend, that translate a TeXNotebook > (that is a TeX file with some Mathematica Input/Output > environments) and send the input cells to a kernel > and insert the output into the final TeX file ... Congratulations to you if you can do that and if you're happy with it. I'd prefer life to be a bit simpler. The point is that many users of Mathematica already have sufficient knowledge of TeX/LaTeX to typeset very complicated mathematics and get excellent results with little or no grief. To achieve even close to the same quality with Mathematica alone can require ten times the effort and a hundred times the grief. ---Selwyn > > The most of the remaining work like creating hyperlinks > to references and figures is done my LaTeX and pdfLaTeX, > with help of CTAN and some macros one generate almost every > layout *and* I have more than 20 books about TeX/LaTeX > (including Don Knuths excelent manuals) but I have not > a single book about the Mathematica Frontend. > > The way is not to teach TeX to the frontend, the way is > to teach TeX a bit Mathematica. > > And a TeXpert will never switch from his beloved TeX > to the Frontend and it's typesetting -- that's why > he is a TeXpert. > > Regards > Jens > > > Selwyn Hollis wrote: > >>Recent threads about word processing and typesetting have got me >>dreaming again... >> >>Wouldn't it be nice if someone developed a package that provided a >>function like this: >> >> DisplayTeX[ " some TeX code " ] >> >>which would cause the kernel to generate PostScript for the typeset >>text, to be displayed by the front end? >> >>I doubt that WRI will ever consider this, but surely there's someone out >>there who's both a TeXpert and a Mathematica guru who can do it. No >>doubt there's money to be made. >> >>Probably just a pipe dream... >> >>--- >>Selwyn Hollis > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!news.infoave.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Annetts, Dave (E&M, North Ryde)" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: trying to pull numbers out of a string from a file. Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-TQJpT+JuFEYn35pqMPWzdkq1Gj3aZdqAsAa5jkbevOBziP9Ff9ybcVRiA== NNTP-Posting-Date: Fri, 13 Sep 2002 22:45:06 CDT Lines: 46 X-Trace: sv3-3bMLbnxlePkwPzXo14FFQAC5I8sIU1eAQhLM74ghkn2mHN3Znq0u5o8Y4HI/eE6NVrb+5UjHVQF3XV+!/G4AnvsSHZeC4G1shhUReoD3jm41bkp1snMJF3qwblBHMtB72+JceBrZFw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:45:06 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35161 Hi Rob, > inFile = OpenRead["197-tst.txt"] > y = ReadList[inFile, String, 1, RecordLists -> True] > Close[inFile]; > > This appears to pull in a line. Now I want to take characters > 25 to 110 to get just the stuff I want: > y1=StringTake[y ,{25,110}]; > > Here's the output. StringTake doesn't seem to work. > > StringTake[{aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 > -1281.9 -229. 321. 317. 367. -115. 126. > 146. -410. -426.000000EF 75.}, {25, 110}] > > It doesn't take loading another package as far > as I can tell from the help. I'm thinking that it doesn't > work because it's trying to work on a list > rather than a string. I've tried Flatten, and other stuff to > try to get to just a string and not a list but > nothing has worked so far. I'm a long way from getting to > those numbers in there but heck, I > can't even get to the string. Can anyone point me in the > right direction? You might try lst = Read[StringToStream[y1], {Word, Table[Number, {16}], Word, Number}]//Flatten; You can then pick the numbers (or words) from the list "lst". A quicker alternative might be as follows:- ifile = ReadList["197-tst.txt", {Word, Table[Number, {16}], Word, Number}]; Regards, Dave. ========================================== Dr. David Annetts EM Modelling Analyst CSIRO DEM Tel: +612 9490 5416 North Ryde Fax: +612 9490 5467 Australia David.Annetts@csiro.au =========================================== From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.cwix.com!news.maxwell.syr.edu!nntp-relay.ihug.net!ihug.co.nz!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "tgarza01@prodigy.net.mx" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: trying to pull numbers out of a string from a file... Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-qb42yEsWeb3K8pm8YKtsDuOQXcpNc8iDXiamBwOxvbMyGiCB00NAaelKQ== NNTP-Posting-Date: Fri, 13 Sep 2002 22:46:07 CDT Lines: 144 X-Trace: sv3-1f59o04t/wkUfJDCbu3ifxBZtFtqM9kanLGSg6vAfGHEZ0hAxsqFleOZa23sTkW8iKQtWGpw6DDH6Zv!0/YnbMQqfesJ+jhcqv6vo9JdGPDxMe01lbp5iOYDd7HZ5KxVTXB0+EEv8DwKn0LNIU6QjIg= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sat, 14 Sep 2002 03:46:07 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35162 Hello, Rob: First of all, I used ReadList directly, with Word instead of String, and with the option WordSeparators -> None, like this (I presume your file is adequately located, so that there is no problem in finding it): In[1]:= a = ReadList["197-tst.txt", Word, RecordLists -> True, WordSeparators -> None]; This allowed me to examine your records and I found out that in this way each record comes out as a list of length 1: In[2]:= Head[a[[1]]] Out[2]= List In[3]:= Length[a[[1]]] Out[3]= 1 That is, In[3]:= a[[1]] Out[3]= {"aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 -1281.9 -229. 321. 317. 367. -115. 126. 146. -410. \ -426.000000EF 75."} In[4]:= StringLength[a[[1,1]]] Out[4]= 140 and the characters you want are In[5]:= StringTake[a[[1,1]], {25, 110}] Out[5]= "5935.80 5946.66 27.06 -1281.9 -229. 321. 317. 367. -115. 126. 146." So far, so good. It seems that you want these 11 numbers, OK? The problem now, I think, is that this is just a string and I can think of no easy way to convert it precisely into a list of 11 real numbers. Then, I suggest you read the file in a different way, without the WordSeparators option: In[6]:= b=ReadList["197-tst.txt",Word,RecordLists -> True]; In[7]:= b[[1]] Out[7]= {aEX-004,2002197,0,0,0,5935.80,5946.66,27.06,-1281.9,-229.,321.,317.,367.,-\ 115.,126.,146.,-410.,-426.000000EF,75.} In[8]:= Head[b[[1]]] Out[8]= List In[9]:= Length[b[[1]]] Out[9]= 19 so that each record is now a list of 19 strings. What you want is strings 6 to 16, but converted to reals (unless I'm being presumptuous). This will achieve that: In[10]:= ToExpression[Take[b[[1]],{6,16}]] Out[10]= {5935.8,5946.66,27.06,-1281.9,-229.,321.,317.,367.,-115.,126.,146.} Now you have a nice list of real numbers to work with. You can do this for the whole file like this: In[11]:= ToExpression[Take[#,{6,16}]&/@b]; I hope this will solve your problem. Tomas Garza Mexico City > ----- Original Message ----- > From: "1.156" > Sent: Friday, September 13, 2002 12:14 AM > Subject: trying to pull numbers out of a string from a file... > > > I've got to extract some numbers from a file that are in lines of text. > Since the line contents are not numbers, I presume I must pull the line out > as a string. Here I start by pulling out just one line: > > > > inFile = OpenRead["197-tst.txt"] > > y = ReadList[inFile, String, 1, RecordLists -> True] > > Close[inFile]; > > > > This appears to pull in a line. Now I want to take characters 25 to 110 to > get just the stuff I want: > > y1=StringTake[y ,{25,110}]; > > > > Here's the output. StringTake doesn't seem to work. > > > > StringTake[{aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 -1281.9 -229. > 321. 317. 367. -115. 126. 146. -410. -426.000000EF 75.}, > {25, 110}] > > > > It doesn't take loading another package as far > > as I can tell from the help. I'm thinking that it doesn't work because > it's trying to work on a list > > rather than a string. I've tried Flatten, and other stuff to try to get to > just a string and not a list but > > nothing has worked so far. I'm a long way from getting to those numbers > in there but heck, I > > can't even get to the string. Can anyone point me in the right direction? > > > > Thanks, Rob > > -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!howland.erols.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: andrew.glew@amd.com Newsgroups: comp.soft-sys.math.mathematica Subject: RE: More levels of subsection nesting Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-cl6NdIV5U+aPwg15iacaHIkVGa1B7ZUTabspgW2hKFRijG58djU+OVbbA== NNTP-Posting-Date: Sat, 14 Sep 2002 23:16:41 CDT Lines: 48 X-Trace: sv3-osaDEXjQxx3c4DjHzURfgLbyn7PMKQXtGvEHrKKi2qeBvSzkM44Avzzy1QJ3/p5NQvN/buZmq5oZPq8!6L+M4SRFk6gOyuAzcaqqFScDmsKdwVz0wTsUWPfz6paEsWHYS9HE6xll X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:16:41 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35164 > BRIEF > > Mathematica seems to support 3 levels of nesting: > section, subsection, and subsubsection. > > Q: how can I obtain more levels of nesting? > I typically go 6-7 levels deep. Well, I started by editting the notebook in a text editor (having used Edit Style Sheet to unshare), and I created styles Sub3section ... Sub9section, with Dewey decimal numbering 1.2.3.4.5.6.7.8.9.10 I got collapsable group working, by mucking with CellGroupingRules->{"SectionGrouping", 100}, changing the number. I am not sure what the number is, but I'm guessing it may be a pixel count for the nesting boxes at the left of the screen. I'm a bit worried about whether this is fragile. === Was there any way to accomplish this from the GUI? Or was using a text editor mandatory? === Related: this exercise makes it obvious that a common operation is to "push down" or "pull up" a whole subtree - e.g. a Subsection becomes a Subsubsection, a Subsubsection becomes a Sub3section, etc. The sort of thing that Microsoft Word does with Outline mode. Q: has anyone got something like Outline mode for Mathematica? I'm tempted to go the other way, and ask if anyone has a front end that allows Mathematica to be embedded in Word documents. But that might be a hassle, since Word runs on Windows, and the Mathematica licence I have access to runs on Suns. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Annetts, Dave (E&M, North Ryde)" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: trying to pull numbers out of a string from a file. Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-nU9u/VUq5gu+MpXiz3lC/SGbDd9v/G92JAT4f9TQR+LaVhEVGRhKWQlZw== NNTP-Posting-Date: Sat, 14 Sep 2002 23:17:43 CDT Lines: 46 X-Trace: sv3-NF677zK4YRMqGvGiqKebYP+V3zEHZzwO344tQ8AjFqmR2i3K7Fqaocsjsw2nBneoA82boH6/Ho9LDYa!Xyzq013wHIrjPnjjM0tEL+/vBpdAe1HETgkC6t4WYUg0ODEbvHulNsTfbUwzpiak3lvSMQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:17:43 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35165 Hi Rob, > inFile = OpenRead["197-tst.txt"] > y = ReadList[inFile, String, 1, RecordLists -> True] > Close[inFile]; > > This appears to pull in a line. Now I want to take characters > 25 to 110 to get just the stuff I want: > y1=StringTake[y ,{25,110}]; > > Here's the output. StringTake doesn't seem to work. > > StringTake[{aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 > -1281.9 -229. 321. 317. 367. -115. 126. > 146. -410. -426.000000EF 75.}, {25, 110}] > > It doesn't take loading another package as far > as I can tell from the help. I'm thinking that it doesn't > work because it's trying to work on a list > rather than a string. I've tried Flatten, and other stuff to > try to get to just a string and not a list but > nothing has worked so far. I'm a long way from getting to > those numbers in there but heck, I > can't even get to the string. Can anyone point me in the > right direction? You might try lst = Read[StringToStream[y1], {Word, Table[Number, {16}], Word, Number}]//Flatten; You can then pick the numbers (or words) from the list "lst". A quicker alternative might be as follows:- ifile = ReadList["197-tst.txt", {Word, Table[Number, {16}], Word, Number}]; Regards, Dave. ========================================== Dr. David Annetts EM Modelling Analyst CSIRO DEM Tel: +612 9490 5416 North Ryde Fax: +612 9490 5467 Australia David.Annetts@csiro.au =========================================== From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!nntp-relay.ihug.net!ihug.co.nz!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: M Hanson Newsgroups: comp.soft-sys.math.mathematica Subject: Export Problem Mathematica 4.0.1.0 Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-e/MgKZT30CdssA8Y9UmHETkiWVrxlBea/nj6ut/OThjEq3xZxJQj3kpDQ== NNTP-Posting-Date: Sat, 14 Sep 2002 23:18:44 CDT Lines: 22 X-Trace: sv3-ZFdUdSfOrDgShR7AGGg85shVINzUUNKYt41hhuOejFHpsNoU7MNEj/kMHkDj76vMiYs9a6ISB42JFhk!zVdTIRFx3cpSLzT1AYctO1x7/gTrOzx/RIBh4IdifJXyOzjxaAIGPAW1lpXn7mbEBxJVgA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:18:44 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35166 I was and do have problems reading files Exported files in Adobe Illustrator format (.ai) from Adobe Illustrator 10.0.3. With an upgrade to Adobe Illustrator 10.0.3, I can read EPS files created by Mathematica 4.0.1. A message from tech support at Wolfram implies that Adobe Illustrator format files can be read ONLY if you are using the correct Adobe and Wolfram programs. Additionally, Mathematica is going to favor the export of EPS files (is that clear enough?). My approach to using Mathematica as a source of images for Adobe Illustrator 10.0.3 is: Create the image in Mathematica Export["ImageFileName.eps", theMathematicaImageCreated, "EPS"] Open the file ImageFileName.eps within Adobe Illustrator 10.0.3 Save the file as a ".ai" file Be sure to check the ImageSize as it is not often what you told Mathematica. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!howland.erols.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "ET" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Arbitrary Crash with Compile Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-Sjg4db1mvCG6L8c3hctIUMRhoVQ/C4PrCWyEuR9Kz4oCr4ZDQo9DZ01aw== NNTP-Posting-Date: Sat, 14 Sep 2002 23:20:46 CDT Lines: 63 X-Trace: sv3-Z10zWjo4n3SBLtFiBguFCnIgvu3Cj6jtQSFJtUNGlrvBgFGmXunw+NhzLAYv/7dAfJXYfT0xDx3+X1g!e3jPN9HUbNVifpgNn35NL7QaihcQX/kLuvm6PB7h8rCny+8exKQqCFlBUgA0ZIg2OUFUyg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:20:46 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35168 I ran it 10 times on 4.2 with no crashes. "Wizard Lab" wrote in message news:alru2n$hct$1@smc.vnet.net... > Jens-Peer Kuska tells me that he gets no crash with Mathematica 4.2, however after working > with this program for more than a month, trying every possible permutation and > manipulation, and having it still crash, I am still worried that upgrading to 4.2 > won't solve my problem. Can anyone else with 4.2 try running this program for me a > good number of times, say 3 or 4, and see if they get similar good results? > > Regards, > > Bernard Gress > > Wizard Lab wrote: > Dear Group, > > I have a program to take the local polynomial non parametric regression > of two variables. It uses Compile, unfortunately, and regularly, but > inconsistently, causes Mathematica to crash (in Win2K, with I forget > what error, and in Win98/Mathematica4.0 with an invalid memory access from > MathDLL.dll). I am running Mathematica 4.1, and have this problem consistently > on 4 different machines. > > Here is the code, if it doesn't crash the first time, it will the second > or third: > > (* > w = Compile[{{xj, _Real, 0}, {XX, _Real, 1}, {YY, _Real, 1}, {h, _Real, > 0}, > {nn, _Integer, 0}, {ord, _Integer, 0}}, > First[Inverse[Sum[Outer[Times, Table[If[Positive[q], (XX[[i]] - xj)^q, > 1], {q, 0, ord}], > Table[If[Positive[q], (XX[[i]] - xj)^q, 1.], {q, 0, > ord}]*E^(-0.5*((XX[[i]] - xj)/h)^2)], {i, nn}]] . > Sum[(Table[If[Positive[q], (XX[[i]] - xj)^q, 1.], {q, 0, ord}]*YY[[i]])* > E^(-0.5*((XX[[i]] - xj)/h)^2), {i, nn}]]]; > *) > > (* > \!\(tt = MemoryInUse[]; > ListPlot[Table[{\((i + 1)\)\^2, \(Timing[ > nn = \((i + 1)\)\^2; \[Epsilon] = Table[Random[]*3, {i, > nn}]; > testX = Table[i* .3 - Random[]*2, {i, nn}]; > testY = Table[Sin[i/3] - 2, {i, nn}] + \[Epsilon]; > Map[w[#, testX, testY, .1 + Random[], nn, 0] &, > testX];]\)[\([1]\)]/Second}, {i, 15}], PlotJoined -> > True, > PlotLabel -> "\"]; > MemoryInUse[] - tt\) > *) > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newscon07.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!triton.net!smallfeed.triton.net!66.181.128.6.MISMATCH!news.ticon.net!ns.osirusoft.com!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Re: NIntegrate Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-LoBfhwtM4cSDcxn43Q45A2/GmJ0q+yoixUnzYiIlvjyZyJHRXRZ0mR3Ig== NNTP-Posting-Date: Sat, 14 Sep 2002 23:21:47 CDT Lines: 96 X-Trace: sv3-sqoe/s7n9UcfzugtGEidNenZn/7h0RqMt1w2peHNwe0cd5lUyyqZzgKiF09OxJ+DUoDDT5dzKBt8Zmy!AzDw/cfFHaDM5yEMdD1Tqg95U7boogKYbqsHOz/M1gDgO0zuhnYQubzH X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:21:47 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35169 In his not-so-subtle way, Jens-Peer is trying to tell you that since you see z in the error message, that's what NIntegrate saw too. z is a symbol, and NIntegrate needs numbers. Now I'll have to search online for your original problem, since I deleted my copy long ago... (Excuse me a few minutes...) Hmm... OK, I'm back. Well... there's still a missing (or extra) parenthesis in the definition of f and a missing bracket in the definition of F, but I also can't see that you've given z a numerical value. The error shouldn't occur until you use F though, since you used SetDelayed. So, the error message goes with a line you didn't include in your post. However, in your latest post, the lines NumericQ[z] False tell me z is NOT a real number. For instance, NumericQ[1.2] True So, proceeding with the theory that z needs to be numeric, let's try F[1.2] NIntegrate::itraw:Raw object 1.2` cannot be used as an iterator. NIntegrate[f[y, 1.2], {1.2, 0, Infinity}] NIntegrate::"itraw":"Raw object \!\(1.2`\) cannot be used as an iterator." As you see, in the definition of F, you've used z as an iterator. No matter what the argument z to F is -- number, symbol, whatever -- you can't use it as an iterator, because it already has an identity, and iterators are stand-ins -- temporary variables that don't exist outside (in this case) NIntegrate. So, as Jens-Peer pointed out, y should have been your iterator. (Probably. We don't actually know what you were trying to do. We only know for sure that z couldn't be the iterator.) So, if I've made the right guesses, the definition for F should be F[z_] := NIntegrate[f[y, z], {y, 0, Infinity}] But... F[z] will still give you an error if z doesn't have a numerical value, so it's even better to define F this way: ClearAll[F] F[z_?NumericQ] := NIntegrate[f[y, z], {y, 0, Infinity}] That way, F[z] is left unevaluated if z isn't numeric. I can't go any further, since I don't know the value of f -- because I don't know where to add or subtract that pesky parenthesis. (I asked you about that days ago, but your e-mail address was no good -- probably still isn't.) Bobby Treat -----Original Message----- From: Rob_jack [mailto:rob_jackNSP@libero.it] Subject: Re: NIntegrate "Jens-Peer Kuska" wrote > > do you realy think that > > 1.07577/( 1+7.12336*10^-7 (1. + z)^2 ) > > with the z inside is numerical ? or do you mean > > F[z_?NumericQ]: = NIntegrate[f[y,z], {y, 0, Infinity}] > I'm a newbie, bat I mean: ************************* In[1]= NumericQ[z] Out[1]=False ************************* BTW, z is a real number. -- Rob_jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Re: ByteCount for Global symbols Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-izwf0rZUuDjIgTtOU+HbeEkuDnDHCRzDPTyqGT8GIwZ7iA7LI+s97u/7Q== NNTP-Posting-Date: Sat, 14 Sep 2002 23:22:48 CDT Lines: 37 X-Trace: sv3-2XdGPLW22DEuBiWdK3XfF/7CTmiAaYb3pMvMW7ifWqnPaYtXpwEfJxR14B6KkUyQKldxS9d5p2PW1YE!NZZ5SpJMB/iuG0QCML8lkg0AWIbGiJxUYWR4QKFNjBzvsaxQeTtwg6iV X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:22:48 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35170 Thanks! You're brilliant -- though I'm not clear on why that worked. I'm learning the fine art of patterns and Hold one tricky example at a time. Bobby -----Original Message----- From: Jens-Peer Kuska [mailto:kuska@informatik.uni-leipzig.de] Subject: Re: ByteCount for Global symbols Hi, whats wrong with ToExpression[#, StandardForm, Hold] & /@ Names["Global`*"] /. Hold[a_] :> ByteCount[OwnValues[a]] Regards Jens DrBob wrote: > > I want to make a list of all symbols in the Global context, as in > > Names["Global`*"] > > and compute a ByteCount for each symbol's OwnValues -- without > evaluating the symbols. > > It seems possible in principle, but I haven't found a way. > > Bobby Treat From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!isdnet!nerim.net!aotearoa.belnet.be!news.belnet.be!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Re: ByteCount for Global symbols Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-9yDzVUnKb9DPLBHhm/1lXnje3R9q4KpjoVeXbtETKMy1XggpCjRWSJ+WQ== NNTP-Posting-Date: Sat, 14 Sep 2002 23:23:48 CDT Lines: 40 X-Trace: sv3-AgbL8tHMKYH14D46sSI/GprDr5zTIfLyETsravtZ/1JbgytNbZpBU7FsC+BLjC33lKRuwcE2jdxsR3K!QZvIoFdn1TbMj2OCbn5qlYAQU5aOhnnygNWpfTnBntQdeNNjd3r/gkOiDg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:23:49 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35171 Here's the fairly useful bit of code I came up with, using Jens-Peer's brilliant solution: names = Names["Global`*"]; counts = ToExpression[#, StandardForm, Hold] & /@ names /. Hold[a_] :> ByteCount[OwnValues[a]]; Select[Transpose[{names, counts}], Last@# > 16 &] // TableForm It tells me how some of my memory is being spent. Bobby Treat -----Original Message----- From: Jens-Peer Kuska [mailto:kuska@informatik.uni-leipzig.de] Subject: Re: ByteCount for Global symbols Hi, whats wrong with ToExpression[#, StandardForm, Hold] & /@ Names["Global`*"] /. Hold[a_] :> ByteCount[OwnValues[a]] Regards Jens DrBob wrote: > > I want to make a list of all symbols in the Global context, as in > > Names["Global`*"] > > and compute a ByteCount for each symbol's OwnValues -- without > evaluating the symbols. > > It seems possible in principle, but I haven't found a way. > > Bobby Treat From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!rip!ps01-sjc1!news.webusenet.com!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jacob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Mathematica 4.2: Problem with online help. Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-23kXIckSWkURl+Ex2yhYmiH0FVsKLT1NrS5Dumx4f7NF0lAPu/h9P/1eg== NNTP-Posting-Date: Sat, 14 Sep 2002 23:24:49 CDT Lines: 13 X-Trace: sv3-kH5UvX5zOoWo6368wphZrLSdGzHHuoxqRtQQzrAvZ4IcpKCpiWWabdTuApswBoQXKmnajW9M1iHmKrR!NL4jWE2aDn3DNvw6rCa04ufOXYMvfjz1HFub3nNEMY/qBgn3MK900Wb75Qj4ZcGTruNeMA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:24:49 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35172 On Fri, 13 Sep 2002 05:20:59 GMT, "Vynce" wrote: >Try deleting ... >\Mathematica\4.2\Documentation\English\MainBook\BrowserIndex.nb > > > > That did it. It now works! Thanks From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Checking Programming errors; a ? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-v8FvqZRK2p9dJAPgr7e9v4OhajwEsRV8V75LrBkja+TTrXqbwRJwmjymw== NNTP-Posting-Date: Sat, 14 Sep 2002 23:25:50 CDT Lines: 79 X-Trace: sv3-dWpJ9qG/kw9USFSa3MUOtJb/jHxtJzaTwjF2KrLaTllXoiLL+3TWp4LLOa3m63QYDWglrJNsvuYFl45!+ODVxVlzac/CgkK8nTlW6I5dvn9nv4+by775UCK6KJrc/dpp5WDOKwrmPCBjeiorgWNq4Q== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:25:50 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35173 Jack, Often, what I do when developing a slightly complicated module is to first test it after I add each statement L1, L2, etc. But then often I want to make changes after I have all the statements in. Then to debug I just add temporary Print statements. For example... myFunction[f_] := Module[ {L1,L2,L3}, L1 = ... ; L2 = ... ; Print[{L1, L2}]; l3 = ... ; ] Sometimes I use multiple Print statements. The only problem with this approach is that sometimes the difficulty might be in a subexpression of a longer expression. This forces me to temporarily break out the longer expression into multiple statements, or perhaps duplicate the subexpression in the Print statement. But I find that the easiest method to track down errors. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: Jack Goldberg [mailto:jackgold@umich.edu] Hi Group: I often run into this difficulty: when designing a program, say as a module, and testing it for various inputs, I get wrong answers. What to do? I use a method that works for me but may not be the best available. I want to show my method and then ask a question about how it can be imporved. (Oh yes, I abandoned Trace a long time ago!) myFunction[f_] := Module[ {L1,L2,L3}, L1 = ... ; L2 = ... ; l3 = ... ; "final step" ] To see what went wrong, I use (* *) selectively as follows: Stage 1 myFunction[f_] := Module[ {L1,L2,L3}, L1 = ... (*; L2 = ... ; L3 = ... ; "final step" *) ] Thus I see if L1 worked as expected. The next step is to put (* after L2 and see if this works. I continue this til the bitter end and I usually find my errors. My question; The process of moving (* *) step by step through the program is quite tedious when the code has lots more lines. What I would like is a "meta-program" which (like FoldList) does this job for me. The output of this "meta-program" is the list of outputs of each line in the module, probably best printed as a column. This sounds like Trace but my problem with Trace is it is terribly difficult to read. For the not-so-subtle programming I do, the only thing I need is what expression is returned line by line. Any advice? All remarks are appreciated! Jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!isdnet!btnet-peer1!btnet!newsr1.ipcore.viaginterkom.de!newsfeed.stueberl.de!newspeer1-gui.server.ntli.net!ntli.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: mark@markfisher.net (Mark Fisher) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Checking Programming errors; a ? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Sun, 15 Sep 2002 23:32:53 CDT Lines: 145 X-Trace: sv3-IYmG+6qnw0fo1obdFT/OjcPE1QkU8rsH1kSNgwjP1yE7IVxvCsuGfyo67n9+83ItYph01x0i3wZ4G3i!oRMCNzHbeFieFCVKbg76jpcMtic3gnoHL2fQI8JqUHS0NX/2W4CWeaU5aDCHEX7U/A== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Mon, 16 Sep 2002 04:32:53 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35186 The following code is my attempt to provide the functionality you requested. It does some rudimentary error checking, but I haven't tried very hard to fool it. The code manipulates the DownValues, locating the "highest" CompoundExpression (see the lines in which "pos" is defined), keeping only those expressions specified. DownValues are restored after the expression is evaluated. The tricky part is keeping the CompoundExpression from evaluating while it is being manipulated. (See the lines in which "held" and "new" are defined.) I'm not sure I'm doing this part the most elegant way, but it seems to work. (* code starts here *) PartialEvaluation::usage = "PartialEvaluation[f[args], n] returns f[args] where only the first n expressions are evaluated in the \"main\" CompoundExpression in DownValues[f]. For example:\n\t Clear[f]\n\t f[x_] := Module[{a,b}, a=3; b=4; a b x]\n\t PartialEvaluation[f, 2]\n returns 4." PartialEvaluation::dvprob = "DownValues[``] is either empty or has more than one element." PartialEvaluation::toobig = "There are only `1` expressions in the CompoundExpression in `2`." PartialEvaluation::noce = "There are no CompoundExpressions in DownValues[``]." SetAttributes[PartialEvaluation, HoldFirst] PartialEvaluation[f_[args__], n_Integer] := Module[{dv, pos, held, new, eval}, Catch[ dv = DownValues[f]; If[Length[dv] != 1, Message[PartialEvaluation::dvprob, f]; Throw[HoldForm[f[args]]]]; pos = Sort[Position[dv, CompoundExpression]]; If[pos == {}, Message[PartialEvaluation::noce, f]; Throw[HoldForm[f[args]]]]; pos = Drop[First @ pos, -1]; held = Extract[dv, pos, Hold] /. CompoundExpression -> Sequence; If[Abs[n] > Length[held], Message[PartialEvaluation::toobig, Length[held], HoldForm[f[args]]]; Throw[HoldForm[f[args]]]]; new = ReplacePart[dv, Take[held, n] /. Hold[x__] :> Hold[CompoundExpression[x]], pos, 1]; DownValues[f] = new; eval = f[args]; DownValues[f] = dv; eval ]] (* code ends here *) --Mark. P.S. The version of this message I posted directly from my newsreader didn't show up, so I'm reposting (a slightly improved version) from Google. "David Park" wrote in message news:... > Jack, > > Often, what I do when developing a slightly complicated module is to first > test it after I add each statement L1, L2, etc. But then often I want to > make changes after I have all the statements in. Then to debug I just add > temporary Print statements. For example... > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... ; > L2 = ... ; > Print[{L1, L2}]; > l3 = ... ; > > ] > > Sometimes I use multiple Print statements. The only problem with this > approach is that sometimes the difficulty might be in a subexpression of a > longer expression. > This forces me to temporarily break out the longer expression into multiple > statements, or perhaps duplicate the subexpression in the Print statement. > But I find that the easiest method to track down errors. > > David Park > djmp@earthlink.net > http://home.earthlink.net/~djmp/ > > From: Jack Goldberg [mailto:jackgold@umich.edu] > > Hi Group: > > I often run into this difficulty: when designing a program, say as a > module, and testing it for various inputs, I get wrong answers. What to > do? I use a method that works for me but may not be the best available. > I want to show my method and then ask a question about how it can be > imporved. (Oh yes, I abandoned Trace a long time ago!) > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... ; > L2 = ... ; > l3 = ... ; > "final step" > > ] > > To see what went wrong, I use (* *) selectively as follows: > > Stage 1 > > myFunction[f_] := Module[ {L1,L2,L3}, > > L1 = ... (*; > L2 = ... ; > L3 = ... ; > "final step" *) > > ] > > Thus I see if L1 worked as expected. The next step is to put (* after L2 > and see if this works. I continue this til the bitter end and I usually > find my errors. > > My question; The process of moving (* *) step by step through the > program is quite tedious when the code has lots more lines. What I would > like is a "meta-program" which (like FoldList) does this job for me. The > output of this "meta-program" is the list of outputs of each line in the > module, probably best printed as a column. > This sounds like Trace but my problem with Trace is it is terribly > difficult to read. For the not-so-subtle programming I do, the only thing > I need is what expression is returned line by line. > > Any advice? All remarks are appreciated! > > Jack From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Klamser Newsgroups: comp.soft-sys.math.mathematica Subject: no complex Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-oBmm5MQbX7ylXDXsqXiDUc5zUS6/fPXhvho3b7ftGLjx+TITBQBWfcf7Q== NNTP-Posting-Date: Sat, 14 Sep 2002 23:26:51 CDT Lines: 30 X-Trace: sv3-gITCLAg/Mguv0hivWVIH3TALUOeWSjJIrz+gogOZQjrPo5GdTqFmzfi6BzOB56tT0Hh8DdBRq4H5n0B!uGv+VhmnYmVX7PMvHSJnVBaIjBNFwbSfePian5HWutJhMyK9MK9eby8R X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:26:51 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35174 Hi, Mathematica often produces complex resluts. But the problem is not complex: Try Solve[FR == Pi r1^2 - Pi r2^2, r1] It is simple to eliminate it in this case. Just square it. Does someone give me a hint, how to write ra rule for simplify, lik Ted Ersek did in http://www.verbeia.com/mathematica/tips/Links/Tricks_lnk_41.html I thin, one has to to replace the pattern i Sqrt[-a_] by Sqrt[(i Sqrt[-a_])^2] and then one has to simplify it? Regards, Peter Klamser From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.algonet.se!algonet!newsfeed1.bredband.com!bredband!news01.chello.se!amsnews01.chello.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "Hermann Meier" Newsgroups: comp.soft-sys.math.mathematica Subject: (Simple) Empirical CDF Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: NNTP-Posting-Date: Sat, 14 Sep 2002 23:27:52 CDT Lines: 43 X-Trace: sv3-sinqXdCodBFXDV1M+FcTVyPdDxMGXSMkBvd4uL6FvT5lyDxahd0XPIYPmNlQXvoHv1o6gG6i6ha+KLw!mS9Nl4MhtI6m0cf6ldB2WR6oKz0SMh3/fhSNNbSu0c7pjGyAQuP/t2BeMIrXPGP5 X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:27:52 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35175 There has been an interesting discussion about using InterpolatingFunction for an empirical CDF. If one is willing to sacrifice some theoretical soundness, an empirical CDF may be computed in a simplified form: simpleEmpiricalCDF[distr_/;VectorQ[distr,NumberQ]] := With[{nonu=Sort[distr], u=Union[distr]}, Transpose[{u,FoldList[Plus,0,(Count[nonu,#]&/@u)/Length[nonu]]//Rest}]] This code does not return a function, and the result needs some interpretation. Nevertheless, it may be of some use. data = {0.59, 0.72, 0.47, 0.43, 0.31, 0.56, 0.22, 0.9, 0.96, 0.78, 0.66, 0.18, 0.73, 0.43, 0.58, 0.11} (the tie [0.43] will be accounted for in a way that is consistent with some textbooks) simpleEmpiricalCDF[data]//N returns {{0.11,0.0625},{0.18,0.125},{0.22,0.1875},{0.31,0.25},{0.43,0.375},{0.47,0.4 375},{0.56,0.5},{0.58,0.5625},{0.59,0.625},{0.66,0.6875},{0.72,0.75},{0.73,0 ..8125},{0.78,0.875},{0.9,0.9375},{0.96,1.}} A plot may be given with: simpleEmpiricalCDFPlot[distr_/;VectorQ[distr,NumberQ]] := Module[{res,x,p}, res=simpleEmpiricalCDF[distr]; x=({#,#}& /@ Transpose[res][[1]])//Flatten; p=({#,#}& /@ Transpose[res][[2]])//Flatten; p= Join[{0},Drop[p,-2],{1}]; ListPlot[Transpose[{x,p}], PlotRange->{0,1},PlotJoined->True,Axes->None,Frame->True,GridLines->Automati c]] Again, this plot does not reflect theoretical considerations at the lower and upper end. With regard Hermann Meier From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.mathworks.com!cyclone.swbell.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Re: Empirical CDF and InterpolatingFunction Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-oBmm5MQbX7ylXDXsqXiDUc5zUS6/fPXhvho3b7ftGLjx+TITBQBWfcf7Q== NNTP-Posting-Date: Sat, 14 Sep 2002 23:28:53 CDT Lines: 106 X-Trace: sv3-fcwmR6LN9El7F7TNtMSTliIsa0X1JkllowzArMFgaSdNGlEHp0vyHi4k7KLgXL9x3RbXvtTl+OAVW/x!J1yQCaSlHy4Q36Mpa4Giw/qp4n60pF02/8E8WybyZJ7rpDlcHE5XwrGlvM5DmkRTYXK6MQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:28:53 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35176 Caution: where right- and left-continuity are concerned, Daniel's relying on undocumented behavior that may change in the next version. Bobby -----Original Message----- From: Mark Fisher [mailto:mark@markfisher.net] Subject: Re: Empirical CDF and InterpolatingFunction Daniel Lichtblau made two suggestions that allow one to use Interpolation the way I wanted. First, to make the resulting function right-continuous, change the sign twice. Second, to make the end point return the correct value, add an extra (phantom) observation (with an extra (irrelevant) value). (The phantom observation is made at the high end because of the sign reversals.) Here's the code I cooked up based on his suggestions: MakeEmpiricalCDF::usage = "MakeEmpiricalCDF[list] returns a function that evaluates the empirical CDF given the observations in the list. The function is defined on the entire real line." MakeEmpiricalCDF[list_?(VectorQ[#, NumericQ]&)] := Module[{n, s, a, r, idata}, n = Length[list]; s = Sort[list]; a = Append[s, s[[-1]] + 1]; (* phantom obs. *) r = Range[1/n, 1 + 1/n, 1/n]; (* phantom value 1 + 1/n *) idata = Last /@ Split[Transpose[{-a, r}], #1[[1]] == #2[[1]]&]; (* "-a" is the first sign change *) Block[{x}, Function @@ {x, Which @@ { x < s[[ 1]], 0., x > s[[-1]], 1., True, Interpolation[idata, InterpolationOrder -> 0][-x] (* "-x" is the second sign change *) }}] ] The construction "Last /@ Split[ ... ]" accounts for duplicate values. Here are two examples. Needs["Statistics`ContinuousDistributions`"] list1 = RandomArray[NormalDistribution[0, 1], 100]; f1 = MakeEmpiricalCDF[list1]; Plot[f1[x], {x, -4, 4}] list2 = Table[Random[Integer, {1, 10}], {10}]; f2 = MakeEmpiricalCDF[list2]; Plot[f2[x], {x, 0, 11}] --Mark mark@markfisher.net (Mark Fisher) wrote in message news:... > I'm trying to write a fast empirical cummulative distribution function > (CDF). Empirical CDFs are step functions that can be expressed in > terms of a Which statement. For example, given the list of > observations {1, 2, 3}, > > f = Which[# < 1, 0, # < 2, 1/3, # < 3, 2/3, True, 1]& > > is the empirical CDF. Note that f /@ {1, 2, 3} returns {1/3, 2/3, 1} > and f is continuous from the right. > > When the number of observations is large, the Which statement > evaluates fairly slowly (even if it has been Compiled). Since > InterpolationFunction evaluates so much faster in general, I've tried > to use Interpolation with InterpolationOrder -> 0. The problem is that > the resulting InterpolatingFunction doesn't behave the way (I think) > it ought to. For example, let > > g = Interpolation[{{1, 1/3}, {2, 2/3}, {3, 1}}, InterpolationOrder -> > 0] > > Then, g /@ {1, 2, 3} returns {2/3, 2/3, 1} instead of {1/3, 2/3, 1}. > In addition, g is continuous from the left rather than from the right. > > Obviously I am not aware of the considerations that went into > determining the behavior of InterpolationFunction when > InterpolationOrder -> 0. > > So I have two questions: > > (1) Does anyone have any opinions about how InterpolatingFunction > ought to behave with InterpolationOrder -> 0? > > (2) Does anyone have a faster way to evaluate an empirical CDF than a > compiled Which function? > > By the way, here's my current version: > > CompileEmpiricalCDF[list_?(VectorQ[#, NumericQ] &)] := > Block[{x}, Compile[{{x, _Real}}, Evaluate[ > Which @@ Flatten[ > Append[ > Transpose[{ > Thread[x < Sort[list]], > Range[0, 1 - 1/#, 1/#] & @ Length[list] > }], > {True, 1}]] > ]]] > > --Mark From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.frii.net!newsfeed.frii.net!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!news.he.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Lawrence A. Walker Jr." Newsgroups: comp.soft-sys.math.mathematica Subject: 'More' hyperlinks Organization: Morgan State University, COMSARE Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-TQJpT+JuFEYn35pqMPWzdkq1Gj3aZdqAsAa5jkbevOBziP9Ff9ybcVRiA== NNTP-Posting-Date: Sat, 14 Sep 2002 23:29:54 CDT Lines: 10 X-Trace: sv3-lku1HL8Cc/Qqa73XftZ2BRYX61QFIsgHsAyvg2jXLrQfVAItoSa5bzRGiZViXgyoEyW4oWrhh1xb1nw!66/UvrDEtiR2MU4EWu+Ngm8mN797hgPRG/+Hqh8teSL3w7fuy01Mj6r9 X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:29:54 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35177 Hey, How can I duplicate those nifty 'More' hyperlinks in my usage statements? That is the hyperlinks that appears at the end of text that is generated after invoking a '?' to get more information about a function. Thanks, Lawrence From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Bill Rowe Newsgroups: comp.soft-sys.math.mathematica Subject: Re: trying to pull numbers out of a string from a file... Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-MVqSJSYIuPDMbAXF3knwbcw2x93PpuoNB+hyZTOPf2GVz0EBmmhvVYfAw== NNTP-Posting-Date: Sat, 14 Sep 2002 23:30:55 CDT Lines: 23 X-Trace: sv3-gWJkUAj5RSAUklJyjS3vpEgtgYS0F11iQONlPTL84cvYIu0sNZk/Du+xn7jMDTINvOLxZ+oHAg9/uyy!phKg+Q+Z9eh7StkH1DSpzWlWBu2rwIiaX+0MejCaik+/hR+kHVkD2Lix X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:30:55 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35178 On 9/13/02 at 1:14 AM, rob@piovere.com (1.156) wrote: >I've got to extract some numbers from a file that are in lines of >text. Since the line contents are not numbers, I presume I must pull >the line out as a string. Here I start by pulling out just one line: > >inFile = OpenRead["197-tst.txt"] >y = ReadList[inFile, String, 1, RecordLists -> True] >Close[inFile]; > >This appears to pull in a line. Now I want to take characters 25 to >110 to get just the stuff I want: y1=StringTake[y ,{25,110}]; > >Here's the output. StringTake doesn't seem to work. ReadList returns a List not a String. So, y is a List and StringTake fails since it expects a String. Also, you do not need the options RecordLists->True when reading Strings. Nor do you need the OpenRead/Close statements with ReadList Try y = First[readList["197-tst.txt",String,1]; y1 = StringTake[y, {25,110}]; From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newspeer1-gui.server.ntli.net!ntli.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Bill Rowe Newsgroups: comp.soft-sys.math.mathematica Subject: Re: empirical CDF Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-FaLydLZ64jMriHkdI2cscUwJwd2Ajy5zn4flGyn9SRQtdF5uijfHSQRMA== NNTP-Posting-Date: Sat, 14 Sep 2002 23:31:57 CDT Lines: 16 X-Trace: sv3-HToO5wMSutzTw0Axl4FkftEnAQLO66Goz6U8YQ2pyOn2SB0cYpgWoC45/itp6bmdTumX+Bv7peSVtiX!pi3wBaAYBGoqPfaq/g+zXtuizQjy4YTodD2OEX5K1l3JX4G9fDV7S/3A X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:31:58 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35179 On 9/13/02 at 11:33 PM, swidrygiello@wp.pl (Swidrygiello) wrote: >Does anybody know how to calculate in Mathematica: >a)empirical CDF, >b)empirical PDF, >c)normal QQ-plot; >d)QQ-plot two different random samples?! Yes, but there are a number of issues particularly with an empirical PDF. A very nice package that does all of the above and more is mathStatica. See http://www.mathstatica.com for details. Obviously, it is less expensive to write your own functions. Just recently in message Mark Fisher posted code that addresses the empirical CDF. However, in this code you may want to replace 1/n with 1/(n+1) or (j-0.5)/n depending on your application. Note, these will have no significant effect for large data sets. The key issue with an empirical PDF is deciding the bin width. A simple approach would be to use the functions in Statistics`DataManipulation` and Graphics`Graphics`. Look at the functions Histogram, Frequencies and BinListCounts. More sophisticated approaches involve kernel methods. These methods will generate smoother estimates for the PDF. Again, the key is bandwidth. There is no apriori choice for bin width or bandwith. Bad choices will obscure significant features in the data set. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newspeer.monmouth.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Daniel Lichtblau Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Why is my Implementation of Sorted Trees So Slow? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209080731.DAA05480@smc.vnet.net> X-GC-Trace: gv1-rIh8Lv379YxHoN3G9JKQMqdnbVZTIiQaal1v/cB1EGIyMepX8rk8NA+BA== NNTP-Posting-Date: Sat, 14 Sep 2002 23:32:58 CDT Lines: 162 X-Trace: sv3-ALjS2Bu3GVzeOzXa1dR71KGAJma9e+2pcvKyyg+2h6h/gp3IToLrk7KSLFRdPUrY11WE03EYsfD1m0e!nzPKRZ5jr6Yk3yVASBimya4bHL7H4rsJ4/W85CbS1h3BNkM0fUId30OqHQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:32:59 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35180 Husain Ali Al-Mohssen wrote: > > Hi all, > > I am trying to implement a very simple sorted tree to quickly store some > real numbers I need. I have written an add, delete, minimum, and pop > (delete the lowest value) function and they seem to work ok but are very > slow. Let's just look @ my implementation of the add part: > nums=Null;(*my initial blank Tree) > In[326]:= > Clear[add] > > In[327]:= > add[Null,x_Real]:=node[x,Null,Null] > > add[Null,node[x_Real,lower_,higher_]]=node[x,lower,higher] > > In[328]:= > add[node[x_Real,lower_,higher_],y_Real]:= > If[x>y,node[x,add[lower,y],higher],node[x,lower,add[higher,y]]] > > In[288]:= > add[node[x_Real,lowerx_,higherx_],node[y_Real,lowery_,highery_]]:=If[x>y, > node[x,add[lowerx,node[y,lowery,highery]],higherx], > node[x,lowerx,add[higherx,node[y,lowery,highery]]] > ] > > Now this is my attempt to test how fast my add works: > > SeedRandom[5]; > Do[nums=add[nums,Random[]],{5000}];//Timing > > Out[333]= > {13.279 Second,Null} > > (running on Mathematica 4.1 on a win2k VMWare machine running on Linux RH7.3 > running on an 1.4GHz Athlon with 1GB of ram). > > Questions: > 1. Is this as fast as I can get my code to run? > 2. Am I doing something obviously stupid? > 3. would Compiling things help? > > Thanks, > Husain I'll respond to your third question first. No, use of Compile will not help. You do not have a tensor structure and moreover it will copy its arguments. Hence invoking it within a loop would be quite slow for a problem where the argument grows in size. One thing you did not check is the actual run-time complexity of your code. On my 15.GHz machine I get: In[6]:= SeedRandom[5]; In[7]:= ee = Table[Random[], {10000}]; In[8]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,1000}];] Out[8]= {0.34 Second, Null} In[9]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,2000}];] Out[9]= {1.28 Second, Null} In[10]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,4000}];] Out[10]= {4.94 Second, Null} In[11]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,8000}];] Out[11]= {25.08 Second, Null} We see this is clearly of no better than quadratic complexity, whereas I would guess you were expecting O(n*Log[n]). So this indicates a problem. Offhand I do not know what aspect of your code is responsible, but I'll give some different code that has the desired complexity. Note that some of this, and code very similar to that below, is discussed at: http://library.wolfram.com/conferences/devconf99/lichtblau/ in the section entitled Trees. There is a corresponding Mathematica notebook available at: http://library.wolfram.com/conferences/devconf99/ near the bottom of the web page. The code I used to implement a tree structure similar to yours is below. One difference is that, as I place node values in the center, when they are flattened the tree is automatically sorted. You might (or might not) regard this as an added benefit. leftsubtree[node[left_, _, _]] := left rightsubtree[node[_, _, right_]] := right nodevalue[node[_, val_, _]] := val emptyTree = node[]; Clear[treeInsert] treeInsert[emptyTree, elem_] := node[emptyTree, elem, emptyTree] treeInsert[tree_, elem_] /; OrderedQ[{nodevalue[tree], elem}] := node[leftsubtree[tree], nodevalue[tree], treeInsert[rightsubtree[tree], elem]] treeInsert[tree_, elem_] := node[treeInsert[leftsubtree[tree],elem], nodevalue[tree], rightsubtree[tree]] Now for some tests. In[40]:= tt1k = First[Timing[ff1k = node[]; Do[ff1k = treeInsert[ff1k, ee[[j]]], {j,1000}];]] Out[40]= 0.15 Second We will check that the flattened version is actually sorted. In[41]:= gg1k = Apply[List,Flatten[ff1k]]; In[42]:= gg1k === Sort[Take[ee,1000]] Out[42]= True Also we will observe that the maximum depth is reasonable. In[43]:= Depth[ff1k] Out[43]= 23 In the perfectly balanced case it would be 10 so this is not too bad. For larger examples I'll just show timings. In[44]:= tt2k = First[Timing[ff2k = node[]; Do[ff2k = treeInsert[ff2k, ee[[j]]], {j,2000}];]] Out[44]= 0.32 Second In[45]:= tt4k = First[Timing[ff4k = node[]; Do[ff4k = treeInsert[ff4k, ee[[j]]], {j,4000}];]] Out[45]= 0.73 Second In[47]:= tt8k = First[Timing[ff8k = node[]; Do[ff8k = treeInsert[ff8k, ee[[j]]], {j,8000}];]] Out[47]= 1.58 Second In[53]:= SeedRandom[5]; ee = Table[Random[], {32000}]; In[54]:= tt32k = First[Timing[ff32k = node[]; Do[ff32k = treeInsert[ff32k, ee[[j]]], {j,32000}];]] Out[54]= 7.58 Second This is not of blinding speed but it has the advantage of exhibiting the appropriate run-time complexity. One can, with careful coding, cut down on tree size but if you check with LeafCount you will find that the version above is already not too wasteful (3x larger than #values stored). Moreover the code needed would run a bit slower as it would have more cases to check. As for removing nodes, I think you will need to use some form of held attribute so as to avoid copying the entire tree when you alter elements. Daniel Lichtblau Wolfram Research From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news-out.visi.com!hermes.visi.com!newsfeed.news2me.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: trying to pull numbers out of a string from a file... Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-kNCNQ0SxhV0IPFSPJnf6hz6EwKDJJ2MTr+nn6KQq2pqUbpe/jHqEeu4TA== NNTP-Posting-Date: Sat, 14 Sep 2002 23:33:59 CDT Lines: 178 X-Trace: sv3-J0GsnBuyYO41HuVCVm2exjqa2gRx1ihP86RuVXMPcby4tIESte9UQcDr0XkU9CGb6H3lXZzpapzJeZa!8FLyVA1+dkCnaGIk7eAxVkx507aap7oYOcePFK1d2e/+D7wqppDDNAME X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Sun, 15 Sep 2002 04:33:59 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35181 >>So far, so good. It seems that you want these 11 numbers, OK? The problem now, I think, is that this is just a string and I can think of no easy way to convert it precisely into a list of 11 real numbers. You could try StringToStream followed by a Read from that stream. Bobby Treat -----Original Message----- From: tgarza01@prodigy.net.mx [mailto:tgarza01@prodigy.net.mx] Subject: trying to pull numbers out of a string from a file... Hello, Rob: First of all, I used ReadList directly, with Word instead of String, and with the option WordSeparators -> None, like this (I presume your file is adequately located, so that there is no problem in finding it): In[1]:= a = ReadList["197-tst.txt", Word, RecordLists -> True, WordSeparators -> None]; This allowed me to examine your records and I found out that in this way each record comes out as a list of length 1: In[2]:= Head[a[[1]]] Out[2]= List In[3]:= Length[a[[1]]] Out[3]= 1 That is, In[3]:= a[[1]] Out[3]= {"aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 -1281.9 -229. 321. 317. 367. -115. 126. 146. -410. \ -426.000000EF 75."} In[4]:= StringLength[a[[1,1]]] Out[4]= 140 and the characters you want are In[5]:= StringTake[a[[1,1]], {25, 110}] Out[5]= "5935.80 5946.66 27.06 -1281.9 -229. 321. 317. 367. -115. 126. 146." So far, so good. It seems that you want these 11 numbers, OK? The problem now, I think, is that this is just a string and I can think of no easy way to convert it precisely into a list of 11 real numbers. Then, I suggest you read the file in a different way, without the WordSeparators option: In[6]:= b=ReadList["197-tst.txt",Word,RecordLists -> True]; In[7]:= b[[1]] Out[7]= {aEX-004,2002197,0,0,0,5935.80,5946.66,27.06,-1281.9,-229.,321.,317.,367 .,-\ 115.,126.,146.,-410.,-426.000000EF,75.} In[8]:= Head[b[[1]]] Out[8]= List In[9]:= Length[b[[1]]] Out[9]= 19 so that each record is now a list of 19 strings. What you want is strings 6 to 16, but converted to reals (unless I'm being presumptuous). This will achieve that: In[10]:= ToExpression[Take[b[[1]],{6,16}]] Out[10]= {5935.8,5946.66,27.06,-1281.9,-229.,321.,317.,367.,-115.,126.,146.} Now you have a nice list of real numbers to work with. You can do this for the whole file like this: In[11]:= ToExpression[Take[#,{6,16}]&/@b]; I hope this will solve your problem. Tomas Garza Mexico City > ----- Original Message ----- > From: "1.156" > Sent: Friday, September 13, 2002 12:14 AM > Subject: trying to pull numbers out of a string from a file... > > > I've got to extract some numbers from a file that are in lines of text. > Since the line contents are not numbers, I presume I must pull the line out > as a string. Here I start by pulling out just one line: > > > > inFile = OpenRead["197-tst.txt"] > > y = ReadList[inFile, String, 1, RecordLists -> True] > > Close[inFile]; > > > > This appears to pull in a line. Now I want to take characters 25 to 110 to > get just the stuff I want: > > y1=StringTake[y ,{25,110}]; > > > > Here's the output. StringTake doesn't seem to work. > > > > StringTake[{aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 -1281.9 -229. > 321. 317. 367. -115. 126. 146. -410. -426.000000EF 75.}, > {25, 110}] > > > > It doesn't take loading another package as far > > as I can tell from the help. I'm thinking that it doesn't work because > it's trying to work on a list > > rather than a string. I've tried Flatten, and other stuff to try to get to > just a string and not a list but > > nothing has worked so far. I'm a long way from getting to those numbers > in there but heck, I > > can't even get to the string. Can anyone point me in the right direction? > > > > Thanks, Rob > > -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: 'More' hyperlinks Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: NNTP-Posting-Date: Sun, 15 Sep 2002 23:28:49 CDT Lines: 42 X-Trace: sv3-qQYvSObT85fE3X5OcLtcwduXoL0Ys6Icws3+Dso5kvxd2gpHDyirFQJwU8r3dpzVQz33B2dMYDrc+mJ!+dFFGbZe7xR3EnZ2N4ogeYXTL+4lBe+xEXTlA3BhwiokCRJ5WgH8lQEu0TC1r45arw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Mon, 16 Sep 2002 04:28:49 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35182 Evaluate ?Floor and then, with your cursor in the output cell from that, push Ctrl-Shift-E, and you should see something like: Information["Floor", LongForm -> False] "Floor[x] gives the greatest integer less than or equal to x."*Button[More\[Ellipsis], ButtonData :> "Floor", Active -> True, ButtonStyle -> "RefGuideLink"] OK. Change ButtonData :> "Floor" to ButtonData :> "Ceiling", and push Ctrl-Shift-E again. Push the "More..." button, and you should go to Ceiling in the Help Browser, not Floor. Another method is to click Input>Create Button>RefLink and type in Ceiling. You should get a button that takes you to Help for Ceiling. Push Ctrl-Shift-E in both cells and compare, and you'll see some clues to your options. Clues are all you get in Mathematica, so get used to it! Bobby Treat -----Original Message----- From: Lawrence A. Walker Jr. [mailto:lwalker701@earthlink.net] Subject: 'More' hyperlinks Hey, How can I duplicate those nifty 'More' hyperlinks in my usage statements? That is the hyperlinks that appears at the end of text that is generated after invoking a '?' to get more information about a function. Thanks, Lawrence From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.stueberl.de!aotearoa.belnet.be!news.belnet.be!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: no complex Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: NNTP-Posting-Date: Sun, 15 Sep 2002 23:29:50 CDT Lines: 55 X-Trace: sv3-wR5SPjaP2wLZxSMv4kV/aiJbbSA2n79SFXzzLKfp6QbLmYhObhXYrlp4lOPCgqF2jZdMJPeM+rv/4pR!kxqWrKGu3IvqakvA+5+a7bC7hGF6+71NPe15UDTb+NAfy0HXSq/csVR/IU93a5eZXA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Mon, 16 Sep 2002 04:29:50 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35183 Since r1 and r2 only appear squared, you can do it this way: Simplify[Solve[FR == Pi*r1Sq - Pi*r2Sq, r1Sq]] {{r1Sq -> FR/Pi + r2Sq}} or Simplify[Solve[FR == Pi*r1Sq - Pi*r2^2, r1Sq]] {{r1Sq -> FR/Pi + r2^2}} Then r1 is the square root of r1Sq. In the complex plane, real numbers have two square roots, but we usually ignore that. Bobby Treat -----Original Message----- From: Klamser [mailto:klamser@t-online.de] Subject: no complex Hi, Mathematica often produces complex resluts. But the problem is not complex: Try Solve[FR == Pi r1^2 - Pi r2^2, r1] It is simple to eliminate it in this case. Just square it. Does someone give me a hint, how to write ra rule for simplify, lik Ted Ersek did in http://www.verbeia.com/mathematica/tips/Links/Tricks_lnk_41.html I thin, one has to to replace the pattern i Sqrt[-a_] by Sqrt[(i Sqrt[-a_])^2] and then one has to simplify it? Regards, Peter Klamser From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.mathworks.com!cyclone.swbell.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Tom Burton Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Checking Programming errors; a ? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-rIh8Lv379YxHoN3G9JKQMqdnbVZTIiQaal1v/cB1EGIyMepX8rk8NA+BA== NNTP-Posting-Date: Sun, 15 Sep 2002 23:30:51 CDT Lines: 40 X-Trace: sv3-rSMWBwpZoo6A9kFLBeLo4Ozl22qhLsz5WlX70A83G/pfBhNsL9USA7avhSWDiV9wVYhJTc3k84rbmyj!8tsNF9C91TXeALfQFEWwLuiCDeyPJG0wvdwKBWB1hiDfiNeXMTnqM1esUYa8FgwsozuxRwQ= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Mon, 16 Sep 2002 04:30:51 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35184 Hello, On 9/13/02 8:37 PM, in article alub76$nld$1@smc.vnet.net, "Jack Goldberg" wrote: > My question; The process of moving (* *) step by step through the > program is quite tedious when the code has lots more lines. What I would > like is a "meta-program" which (like FoldList) does this job for me. The > output of this "meta-program" is the list of outputs of each line in the > module, probably best printed as a column. Beside the Print statements, sometimes I do the following. Put the function to be tested in its own context and then empty the list of local symbols, e.g., myfunction[stuff__] := Module [{}, expr1; expr2; ... ] so that all temporary variables defined within the function are now global within the new context. Then I can examine the values of all these variables after execution of the function and can often find the error. If the error is caused by a complex expression of nested functions, then I unwind the complex expression, adding more temporary variables, until I see the problem. Then I think twice before recomplexifying. The two advandages of a special context are (1) I don't get the previously local symbols mixed up with other symbols and (2) I can examine all of them and only them with TableForm[{#,ToExpression[#]}&/@Names["mynewcontext`*"]] Once I do this, I often leave the new context in place. Mathematica seems to be able to handle a large number of contexts efficiently. Tom Burton From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!panix!nycmny1-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!cyclone.swbell.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: bagarell@unipa.it (fabio bagarello) Newsgroups: comp.soft-sys.math.mathematica Subject: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-WXE7RdBK3rBhck1+SU0Cw9LYK4UxcMsz+lF/M5wuobaBPpBti7IRoeeNg== NNTP-Posting-Date: Sun, 15 Sep 2002 23:33:54 CDT Lines: 10 X-Trace: sv3-QMC9T4SggbK1pIDwn44WKMQsFyaLlceoaww+MtBHDbCiXXfaDOn2aormuSk3ofhVsYX5fM/0z5fo0PI!sI+xQSyreajwuD240A6aWZL8hb14GdLr+BovGPTUOg1nzCLI/9XgQ23SQKE= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Mon, 16 Sep 2002 04:33:54 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35187 Hi there!! I have quite an easy and annoying problem with mathematica: I need to define a function f(x,y) which takes some values for x=0,2pi,4pi (indepently of y) and has a different expression for all the other values of y. This is easily done for one-dimensional functions but I am in serious troubles for my two-dimensional problem: any suggestion? Thanks a lot, Fabio From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.mathworks.com!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: problems with the definition of a function Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de NNTP-Posting-Date: Wed, 18 Sep 2002 01:25:28 CDT Lines: 25 X-Trace: sv3-APoNCR1HS06ajie2WKVfOzzSCPtj9Ne3DAPlAPXN6nlNbcChGtLTkJjAZellVSo5qQPYGY+9S5u3Yt/!W5W8mfAKmuqFMiR4jQKPmuqy5QfjklD35jQcGBWw/I03olSYXtUkWsc0UWzkp5Ovcw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:25:28 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35210 Hi, Clear[f] f[0, _] := q f[Pi, _] := p f[2Pi, _] := r f[x_, y_] := x^2*y^2 ??? Regards Jens fabio bagarello wrote: > > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.mathworks.com!cyclone.swbell.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: mnewstein@juno.com (Maurice Newstein) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-K7YDGYtwOV7JjrwdTCFFg38C62gP279j84JDbXzZkidFQfS04tStmIuvg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:21:20 CDT Lines: 23 X-Trace: sv3-vVGFqlVCRSLdBg5gJS9lj4u+iyqyDKxsYJfK3Hnc74daLzT3Oht8S0Lv5dMLrc0SJ5SHJj7rvMOclsn!rqZJLlbVTMsG7gHf19nyrHkliIk4hdJc4D0ljHWauZRVr8gnvh8BWFfHiQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:21:20 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35206 bagarell@unipa.it (fabio bagarello) wrote in message news:... > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio There were some typos in my last message. It should have read: Let the known values of the function at x={0,2Pi,4Pi} be {f0,f2,f4}. Your conditions can be met by f(x,y)=x(x-2Pi)(x-4Pi)g(y)+h(x), where {h(0),h(2Pi),h(4Pi)}={f0,f2,f4}. An h(x) can be found by quadratic interpolation: h[x]= a + bx + cx^2; Solve[{a==f0,a+2Pi b +(2Pi)^2 c==f2, a+4Pi b+(4Pi)^2 c==f4},{a,b,c}] {{b -> -(3*f0 - 4*f2 + f4)/(4*Pi), c -> -(-f0 + 2*f2 - f4)/(8*Pi^2), a -> f0}} From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!feed.newsfeeds.com!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: mnewstein@juno.com (Maurice Newstein) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-zwpR1zlSy2TmitaviEfS2yXbpmEH4Vrf65unL/hc/t+dj9KtmZ53Smdaw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:20:18 CDT Lines: 23 X-Trace: sv3-Ufko+o2tFwLXLAfSCkRjplU9yMOfBcVQc1HjCaTNr+b9rTfJREhupaRqokTFQJQmP3CgONv9KdqtOvM!SbfMyWdKhu9HnqIeUVsTpjNQfbDfNC1m4uvmavwQOiwLYiZNctaWMoBcjg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:20:18 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35205 bagarell@unipa.it (fabio bagarello) wrote in message news:... > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio Let the known values of the function at x={0,2Pi,4Pi} be {f0,f2,f4}. Your conditions can be met by f(x,y)=x(x-2Pi)(x-4Pi)g(y)+h(x), where {h(0),h(2Pi),h(4Pi)}={f0,f2,f4}. An h(x) can be found by quadratic interpolation: h[x]= a + bx + cx^2; Solve[{a==f0,a+2Pi b +(2Pi)^2+(2Pi)^2 c==f2, a+4Pi b+(4Pi)^2 c==f4] {{b -> -(3*f0 - 4*f2 + f4)/(4*Pi), c -> -(-f0 + 2*f2 - f4)/(8*Pi^2), a -> f0}} Maurice From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!howland.erols.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: lalu_bhatt@yahoo.com (Bhuvanesh) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-+fsMsx4k33iTS9K21OJZuqJO56dm9VwQdoJP/Y3qYeoAi1pwVVIX4e4Ow== NNTP-Posting-Date: Wed, 18 Sep 2002 01:08:58 CDT Lines: 31 X-Trace: sv3-tGAFqdJbD4ibQRV4kvwVBCTCDPVyofAVDFRb6PwNUcj71pK+vqOAkfUKv620Ao4jRhtp7VL5n5rT+y+!1NcyVC5t/Oekk8MkN75TetotAPrFsEuuEwpuvUe+NvTsKdl3RH8zWy9U3z3fGj1VB3Timyo= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:08:58 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35194 bagarell@unipa.it (fabio bagarello) wrote: > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio Hi, Something like this? In[1]:= f[x_,y_] := If[Mod[x,2*Pi] === 0, Exp[x], Sin[y]+x] In[2]:= f[4*Pi, y] 4 Pi Out[2]= E In[3]:= f[1, y] Out[3]= 1 + Sin[y] -- Bhuvanesh, Wolfram Research. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.frii.net!newsfeed.frii.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!easynet-quince!easynet.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "PSi" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Wed, 18 Sep 2002 01:06:52 CDT Lines: 23 X-Trace: sv3-16L4V4GBj2VdJXbJDzfUZ/PRZ+jlkqvxVgG+gUqdTKcGxDqdx8w3jLNYEaFOKjB6+r7YQpG23FXWmsn!NOmAYKHwo22dk3+oZi5gdtQKcmwt72MTv74C/YMrw6HKfvMRdKlS8/BTL9owFVysiw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:06:52 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35192 "fabio bagarello" wrote in message news:am3n85$6tk$1@smc.vnet.net... > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio > f[0, y_] := 5 f[2 Pi, y_] := 7 f[4 Pi, y_] := -3 f[x_ /; x < 0, y_] := x y f[x_ /; 0 < x < 2 Pi, y_] := x + y f[x_ /; 2Pi < x < 4 Pi, y_] := x - y f[x_ /; 4Pi < x, y_] := 2x y From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Wolf, Hartmut" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-1K798OHxCs3tGBNKHDShIMVWBoHkWzGfieFhzbeLmM6z5KsjGpAsdV+wg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:03:43 CDT Lines: 44 X-Trace: sv3-Y3C+SqAjustBygEWZJObgxXx6OCr3p9GsvsvWlIN4m/9eehkSoqY4sJQ1qYmmJxSycM/eFnOqMOMCP8!YsPuNydzQQzy8AIdaFXnIBURSQi1Yu4ONFTeoCjkteOxn8yX6Xn+QCuUJQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:03:43 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35189 >-----Original Message----- >From: bagarell@unipa.it [mailto:bagarell@unipa.it] >Sent: Monday, September 16, 2002 6:34 AM >Subject: problems with the definition of a function >I have quite an easy and annoying problem with mathematica: >I need to define a function f(x,y) which takes some values for >x=0,2pi,4pi (indepently of y) and has a different expression for all >the other values of y. This is easily done for one-dimensional >functions but I am in serious troubles for my two-dimensional problem: >any suggestion? >Thanks a lot, >Fabio It's difficult to guess what you wanted to attain and what your problems were. Perhaps this example might help you: In[11]:= f[x_, _] /; Mod[x, 2Pi] == 0 := x/(2Pi) In[12]:= f[x_, y_] := x + y In[13]:= epsilon = $MachineEpsilon Out[13]= 2.220446049250313*^-16 In[14]:= f[6Pi(1 + epsilon Sin[#]), #] & /@ Range[0, 4Pi, Pi 10^-1] Out[14]= {3, 3., 19.4779, 19.792, 20.1062, 20.4204, 20.7345, 21.0487, 21.3628, 3., 3, \ 22.3053, 22.6195, 22.9336, 23.2478, 23.5619, 23.8761, 24.1903, 24.5044, \ 24.8186, 3, 3., 25.7611, 26.0752, 26.3894, 26.7035, 27.0177, 27.3319, 27.646, \ 3., 3, 28.5885, 28.9027, 29.2168, 29.531, 29.8451, 30.1593, 30.4734, 30.7876, \ 31.1018, 3} Look close at the values returned (compare with epsilon Sin[Range[0, 4Pi, Pi 10^-1]]), also to recognize the dangers of such a definition. -- Hartmut From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!feed.newsfeeds.com!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "pimak" Newsgroups: comp.soft-sys.math.mathematica Subject: Drawing an ellipse Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-FaLydLZ64jMriHkdI2cscUwJwd2Ajy5zn4flGyn9SRQtdF5uijfHSQRMA== NNTP-Posting-Date: Wed, 18 Sep 2002 01:04:46 CDT Lines: 16 X-Trace: sv3-jqrcgkhNQ2XmqhxJVe64pDQ/yggW7WiPdKtqS4V42TsBEdJN3Jmj8jUvOdC6pAGW+nY4lWGCotRwJGe!Lnc9R0oEx8iZPhol18zpoMTAfAY4YZO550wCgfU6CFEIDkmGAFi0O1M0xA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:04:46 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35190 Hello, I am new with Mathematica, I have one question, I know that the sollution might be very easy, but I wasn't able to find it by now. I would like to draw an ellipse, the formula let's say is as follows: 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 Thanks Maciej From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news-FFM2.ecrc.net!newsfeed.mathworks.com!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "German BUITRAGO A." Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Drawing an ellipse Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209180609.CAA20387@smc.vnet.net> X-GC-Trace: gv1-b4RHZdp6zuNQujzv0U1pDN06CoH+hvH1XXyPz9VLD3+ayVJUq6VuPU8cw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:50:04 CDT Lines: 45 X-Trace: sv3-xCJ7oPRG2appTTg13bEnKsmkYvVtouIvIAW1F4H7fD0a7irGFJVvLH3wiY1P+K02yXQ1JD2+McXn7vN!jEp3/zvcwAjKDVqdM3sDMn6Z9E3LVVfj9D4QxfzfPGoK5wXQ22+HCIq+WcM= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:50:04 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35244 Hello, Maciej: Although it is not outstanding, I prefer to write your equation in the form: 9*x^2+4*x*y+6*y^2==400 In order to plot the ellipse you can use the package Graphics`ImplicitPlot` in this way: In[1]:= << Graphics`ImplicitPlot` In[2]:= ImplicitPlot[ 9*x^2 + 4*x*y + 6*y^2 == 400, {x, -7, 7}, PlotStyle -> RGBColor[1, 0, 0]]; Germán Buitrago A. ----- Original Message ----- From: "pimak" Subject: Drawing an ellipse > Hello, > I am new with Mathematica, I have one question, > I know that the sollution might be very easy, but I wasn't able to > find it by now. > I would like to draw an ellipse, the formula let's say is as follows: > > > > 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 > > Thanks > > Maciej > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed1.bredband.com!bredband!news01.chello.se!amsnews01.chello.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Umby" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Drawing an ellipse Organization: C.D.S. Centro di Servizi Didattico Scientifico Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-3kNXOagi9egKYrR29TD0NOD4DAZGLsH9Bm4atKduu/4BrMnrUMRoMmqFQ== NNTP-Posting-Date: Thu, 19 Sep 2002 02:40:39 CDT Lines: 60 X-Trace: sv3-geklDEZD27Kdf/pIdDoymcG6GOQ9ugRE5tZ3xond/yLy7wGyeDCx1gVwBaBTEKGcVwNgXjrhcTiVP74!ybk3pcnDyycwesqO3/GDIeINLwf2hh1sevtMK0OFJD2gsrv5cbjQVbEgKqOmXtUwEs80ilQ= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:40:39 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35235 hello, first this in not an ellipse. the ellipse generic formula is : (x^2)/(a^2)+(y^2)/(b^2) = 0. I guest that you want report a graph of the solution y of the equation: 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 for x varying into a given range. As you can veryfing using: Solve[0.09 x\^2 + 0.04 x y + 0.06 y^2 == 4, y] the solutins are two: {{y -> 8.333333333333334*(-0.04*x - 0.1414213562373095*Sqrt[48.00000000000001 \ + 0.*x - 1.*x^2])}, {y -> 8.333333333333334*(-0.04*x + 0.1414213562373095*Sqrt[48.00000000000001 \ + 0.*x - 1.*x^2])}} than you can construct a function: function1[x_] = 8.333333333333334*(-0.04*x - 0.1414213562373095*Sqrt[48.00000000000001 - *x^2])}, that is a real value only if (48.00000000000001 - *x^2)>0, i.e. if approximatively -6 True] the same for the other soluztion. good luck -u "pimak" ha scritto nel messaggio news:am95aj$jsk$1@smc.vnet.net... > Hello, > I am new with Mathematica, I have one question, > I know that the sollution might be very easy, but I wasn't able to > find it by now. > I would like to draw an ellipse, the formula let's say is as follows: > > > > 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 > > Thanks > > Maciej > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newscon07.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Murray Eisenberg Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Drawing an ellipse Organization: Mathematics & Statistics, Univ. of Mass./Amherst Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209180609.CAA20387@smc.vnet.net> Reply-To: murray@math.umass.edu X-GC-Trace: gv1-FaLydLZ64jMriHkdI2cscUwJwd2Ajy5zn4flGyn9SRQtdF5uijfHSQRMA== NNTP-Posting-Date: Thu, 19 Sep 2002 02:35:26 CDT Lines: 34 X-Trace: sv3-eFya1/aUIU17e+c8m6jML4lVsJTzB/FPqoreh01eTiddaeTKszd4hRZgqldT4jREpYDZFH59KUNn4zd!Stvcn9jFnEYgyNC1e8lNeHJx8R+FagWU8yaIpALmupQLAxdxjLiC0UjHZ6gZDbWMi7CWhVU= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:35:26 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35230 One way is: ContourPlot[0.09 x^2 + 0.04 x y + 0.06 y^2, {x, -10, 10}, {y, -10, 10}, Contours -> {4}, PlotPoints -> 50, ContourShading -> False]; pimak wrote: > Hello, > I am new with Mathematica, I have one question, > I know that the sollution might be very easy, but I wasn't able to > find it by now. > I would like to draw an ellipse, the formula let's say is as follows: > > > > 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 > > Thanks > > Maciej > > > > > -- 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 From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.cwix.com!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!newsfeed.news2me.com!west.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Drawing an ellipse Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-hGHFQCTDtHHwfTmCukSRZZ/rKjEfHdhn3o3yT1RuysHZEZKugfJauTTwg== NNTP-Posting-Date: Thu, 19 Sep 2002 02:23:54 CDT Lines: 25 X-Trace: sv3-njLMgaMVQUKobRXTNwwUIsqeziPtmMqhgCrwzjEyN5Q0VqwwH9fmhIhsVBzgNsz+AoN5T7JiG8SDinl!AWA4eWyHY1wf/L+V+My7DX4zCvAKeOl853qOS7tQgzbgQjGilH0oGBMCJw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:23:54 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35219 Hi, Needs["Graphics`ImplicitPlot`"] ImplicitPlot[0.09 x^2 + 0.04 x y + 0.06 y^2 == 4, {x, -10, 10}, {y, -10, 10}] may help. Regards Jens pimak wrote: > > Hello, > I am new with Mathematica, I have one question, > I know that the sollution might be very easy, but I wasn't able to > find it by now. > I would like to draw an ellipse, the formula let's say is as follows: > > 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 > > Thanks > > Maciej From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!triton.net!smallfeed.triton.net!green.readfreenews.net!news.readfreenews.net!news-out.visi.com!hermes.visi.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "Higinio Ramos" Newsgroups: comp.soft-sys.math.mathematica Subject: function evaluations with NDSolve Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: "Higinio Ramos" NNTP-Posting-Date: Wed, 18 Sep 2002 01:05:50 CDT Lines: 17 X-Trace: sv3-L3PLXeG3xDxOpRojDqGLWjhpTgrm6hM+lyhklNMGbEvzuJuTt2F8dLtU9hSTghRR5ZTWKnwaK/e9OQr!WUAoRhJq8zJ8s5R9d/Qxu4lOWCFe1czrcJPtMYp6zuUkFps9nn18mvyBNnBeIsvcUQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:05:50 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35191 I pretend to know how many times the function f has to be evaluated when using NDSolve to solve a differential equation. I've tried : cont=0; f[x_]:=(cont++;x^2); NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] I obtain the solution of the ODE but cont returns 1 instead the number of funtion evaluations. How can I obtain it? Thanks. Higinio Ramos From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Eckhard.Hennig@infineon.com (Eckhard Hennig) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: function evaluations with NDSolve Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-xWXnNnLm9a2NlsSmP73S/yBooHN1lM3Y5PDIB3F5dwZoNlVFZucxe+2Hg== NNTP-Posting-Date: Fri, 20 Sep 2002 03:11:05 CDT Lines: 33 X-Trace: sv3-OSc9XdgoGoIU05EXbyvtBMJizFFKfwlul/M3+Ia48XFhIRVNTQiIXR1YENegs6VEG4IXEGd74XtKumu!bgvz3B++iL+++R0oE2BJ1Eh5Je6JdWX9YeTLWd5KIBBrH3z0Mnv4L47wal9JezWWnm/OpTY= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:11:05 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35250 "Higinio Ramos" wrote in message news:... > I pretend to know how many times the function f has to be evaluated when > using NDSolve to solve a differential equation. > I've tried : > > cont=0; > f[x_]:=(cont++;x^2); > NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] > > I obtain the solution of the ODE but cont returns 1 instead the number > of funtion evaluations. > How can I obtain it? > > Thanks. > Higinio Ramos Hi Higinio, you need to make sure that the function f[x] is evaluated only when it gets a numeric argument. Otherwise, Mathematica expands f[x] symbolically to the expression x^2 before NDSolve is called. Writing your code as follows will solve your problem: cont=0; f[x_?NumericQ]:=(cont++;x^2); NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] Best regards, Eckhard Hennig From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jim Radford Newsgroups: comp.soft-sys.math.mathematica Subject: Re: function evaluations with NDSolve Organization: California Institute of Technology, Pasadena Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-Pclj6Ly4yePjyqws9eJsOFyll56bte2OOOSFNAwVDfrWPxRsar9H9+bDw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:46:54 CDT Lines: 22 X-Trace: sv3-ERL78u8F/vB1leHkijPwLNQIc0nw7w0rwLKXTcy7vf8KuzrZeG1NzDGSnm/IGlgNcLsIrcM9Sb/Xio2!3Uom9TYJ9JXt4NA4QVKWz5DIx9lujEjE2cJoguTKtO49S3oiZ5FHSs0DLA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:46:54 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35241 "Higinio Ramos" writes: > I pretend to know how many times the function f has to be evaluated when > using NDSolve to solve a differential equation. > I've tried : > > cont=0; > f[x_]:=(cont++;x^2); > NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] > > I obtain the solution of the ODE but cont returns 1 instead the number > of funtion evaluations. > How can I obtain it? cont=0; f[x_?NumericQ]:=(cont++;x^2) NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] -> cont = 94 -Jim From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "Carl K. Woll" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: function evaluations with NDSolve Organization: University of Washington Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Thu, 19 Sep 2002 02:39:36 CDT Lines: 42 X-Trace: sv3-AJwgDW+2cCQeRpYDswsIyKRCJvHP5A7v8S+/36FxyC1K+6PKPD8WcMAkP4wrDOlGTygK66mOxHPUs6T!3h7nh6K6rzdk5m3XJCoxMpP7aPDaSJTztBJ4/pYCzzHs9ll1tSZgVrwFV9GSfxfUaQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:39:36 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35234 Higinio, Try the following: Clear[f] cont=0; f[x_?NumericQ]:=(cont++;x^2); NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] The problem you are encountering occurs because NDSolve evaluates it's inputs first, and so NDSolve is trying to solve the differential equation y''[x]+y[x]==x^2 instead of y''[x]+y[x]==f[x]. By restricting the definition of f to evaluate only when it's input is numeric, NDSolve will keep the f[x] in the differential equation. I've included a Clear[f] statement just in case the old definition of f was still there. Carl Woll Physics Dept U of Washington "Higinio Ramos" wrote in message news:am95cj$k1k$1@smc.vnet.net... > > I pretend to know how many times the function f has to be evaluated when > using NDSolve to solve a differential equation. > I've tried : > > cont=0; > f[x_]:=(cont++;x^2); > NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] > > I obtain the solution of the ODE but cont returns 1 instead the number > of funtion evaluations. > How can I obtain it? > > Thanks. > Higinio Ramos > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.tele.dk!small.news.tele.dk!193.251.151.101!opentransit.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: function evaluations with NDSolve Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de NNTP-Posting-Date: Thu, 19 Sep 2002 02:24:56 CDT Lines: 37 X-Trace: sv3-xC0os2UWdl2Vq2+biQ7LHsV4NlI1/rInoN368BLsUfYICMXq1d/TiVGOFKCZsjAxjJkjwWq84QYm3G7!3YF8FFMzVyorrW0Hlhd2Ib2Cyhh1cqOqskbTu/1oNeZvW5EyURyBCajDwerw38vPiQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:24:56 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35220 Hi, and after cont = 0; f[x_?NumericQ] := (cont++; x^2); NDSolve[{y''[x] + y[x] == f[x], y[0] == 1, y'[0] == 0}, y, {x, 0, 6}] cont is 93. Thats because *you* gave only a blank pattern for f[x_] and NDSolve[] evaluate it to compile the right hand sides or translate it to an internal function. So *your* function is only once when Mathematica can include it into it's internal function for the right hand sides. Regards Jens Higinio Ramos wrote: > > I pretend to know how many times the function f has to be evaluated when > using NDSolve to solve a differential equation. > I've tried : > > cont=0; > f[x_]:=(cont++;x^2); > NDSolve[ {y''[x]+y[x]==f[x],y[0]==1,y'[0]==0},y,{x,0,6}] > > I obtain the solution of the ODE but cont returns 1 instead the number > of funtion evaluations. > How can I obtain it? > > Thanks. > Higinio Ramos From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!aotearoa.belnet.be!news.belnet.be!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: NNTP-Posting-Date: Wed, 18 Sep 2002 01:07:55 CDT Lines: 43 X-Trace: sv3-P2y5CZlvd5iZ2qjUHEtpz1JSL8HT+d6cSznFR7dMExtdg4nrte/9Nwk7+i/MTLL0DgYn+N3pEbvqCeY!9mJC4AqsVqJw/i+3KdzbGHzfq8f0dCGBnZz2pU2u0cUxRksa6sUpRyJG3fKJcURGoQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:07:55 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35193 Fabio, f[x_ /; IntegerQ[Rationalize[x/(2Pi)]], y] := g[x] f[x_, y_] := h[x, y] f[# Pi, y] & /@ Range[10] {h[Pi, y], g[2*Pi], h[3*Pi, y], g[4*Pi], h[5*Pi, y], g[6*Pi], h[7*Pi, y], g[8*Pi], h[9*Pi, y], g[10*Pi]} f[2.0Pi, y] g[6.28319] f[3.5, y] h[3.5, y] f[4.01Pi, 5] h[12.5978, 5] You can use a second argument in Rationalize to control how small a rationalization error is allowed and there is always the question about what domain around 2nPi you want to include in the first definition. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: fabio bagarello [mailto:bagarell@unipa.it] Hi there!! I have quite an easy and annoying problem with mathematica: I need to define a function f(x,y) which takes some values for x=0,2pi,4pi (indepently of y) and has a different expression for all the other values of y. This is easily done for one-dimensional functions but I am in serious troubles for my two-dimensional problem: any suggestion? Thanks a lot, Fabio From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!howland.erols.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Rolf Mertig Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Postponing loading of Package Organization: Mertig Consulting Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-kNCNQ0SxhV0IPFSPJnf6hz6EwKDJJ2MTr+nn6KQq2pqUbpe/jHqEeu4TA== NNTP-Posting-Date: Wed, 18 Sep 2002 01:10:00 CDT Lines: 68 X-Trace: sv3-kCkbuzsWInw0digeNNUVI69b2+XuddTyVQBC6yrfN4KX4D12dD/7Gue9dq2IXi/twZJtNE7jxo9tQmF!GHI4AvROGpPt/C859/wRVo/Ge1e/GTgHVmk60bFVcBxR+gNRw442tlbdr/4= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:10:00 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35195 Hi, yes, this is a comon problem. You can either do: y=If[x>1000, ToExpression["BigVariable"][[x]],x] ] or, maybe more readable, declare at the begging of "ThisPackage": bigvar := bigvar = ToExpression["OtherPackage`BigVariable"]; and then y=If[x>1000, bigvar, x] (* ************************** *) Alternatively you can create .mx files which load much quicker than .m files. It would be really nice if WRI could investigate why loading larger .m files is so slow ( I suspect it has to do something with the speed of side effects like DownValues declarations etc., but I don't know ). Rolf Mertig Mertig Consulting http://www.mertig.com ================================== I wrote a package (call it "ThisPackage`") that uses DeclareePackage["OtherPackage`", {"BigVariable"} ]. The idea was to prevent the loading of a large file in routine cases. However, when ThisPackage` defines its functions, inside the Private` area, it includes a conditional call to BigVariable. It turns out that OtherPackage is loaded when that function is defined. I was wondering if there is a way to avoid this. Roughly speaking, here is the setting: BeginPackage[ "OtherPackage`" ] BigVariable::usage="example Begin[Private`] BigVariable=Table[x y,{x,1000},{y,1000}] End[ ] EndPackage[ ] BeginPackage[ "ThisPackage`" ] function::usage="example Begin[Private`] function[x_]:=Module[{y}, y=If[x>1000,BigVariable[[x]],x] ] End[ ] EndPackage[ ] I don't want OtherPakage to be loaded unless function[x] is called with x>1000 but it loads when function is defined. Any ideas? Thanks! Nicholas From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!skynet.be!skynet.be!news.stealth.net!news.stealth.net!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "flip" Newsgroups: comp.soft-sys.math.mathematica Subject: Converting Between Bases Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-WXE7RdBK3rBhck1+SU0Cw9LYK4UxcMsz+lF/M5wuobaBPpBti7IRoeeNg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:13:06 CDT Lines: 24 X-Trace: sv3-PMobcuJ8/a3y4LB89M5HpC1NDXC7lDdkQsOz+xE+LR3Ba0KE2SJQ5Lx2DrwVk3/a0CjtLrc8t6NP8Bs!zTgg+p0aW2/7LtkeVUcmhIpqe0XhQnG6lSJ36gGX+36tUifBsEJxtrNcuQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:13:06 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35198 Hello, I was looking for a function that can convert numbers between bases. For example, going from Base 3 to Base 9, or from Base 16 to Base 8. It seems like I have to a few steps and then use BaseForm to convert to the desired end base. Is there a single command or simple function to do such conversions? For example, ConvertBase[from_, to_, num_] would convert from base to base 9 using the number num as the number to convert (it would best be allowed to let users input in that specific base since they'd be going from base 3 to base 9, for example so maybe num is needed at all). Thank you, Flip From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.frii.net!newsfeed.frii.net!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!newsfeed.news2me.com!west.cox.net!cox.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: martinskogstad@hotmail.com (martin skogstad) Newsgroups: comp.soft-sys.math.mathematica Subject: Inv.Interpol.Function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-8FaK28K6cqsd8bJH48Typ/kF/4LB60KLcrcV6KslxTdBRW24i0spcunnw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:14:07 CDT Lines: 23 X-Trace: sv3-JuUI/mGAQu7uoMrSeFDipx84lsq6owUrjxxOfQhl7sOFRnXE/bypwlowqcUWsFPHghe2+dVLQyuZQDM!KGdRs7eYjxiWxUI3hOh00fpTL1+iirPfBpXjALocjH0zqO8mZOV8Daza6eY= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:14:07 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35199 Dear NG Mabye this is too simple, but I cant just figure it out I want to get an inverse function for y[t] where y[t_]:=NIntegrate[R[x]^4,{x,0,t}] /. ndsolution[[1]] and R[t] is an interpolatingfunction(R>0 from NDSolve) on the interval 0= Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Inv.Interpol.Function Organization: Ohio State University Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-v8FvqZRK2p9dJAPgr7e9v4OhajwEsRV8V75LrBkja+TTrXqbwRJwmjymw== NNTP-Posting-Date: Fri, 20 Sep 2002 03:17:19 CDT Lines: 45 X-Trace: sv3-BBxyqh8S5CQoybGEKLvF7ulKu1GE1yovXw6CaGcNHBw0aQf0hDGozVJtO0hVTGfduXYYnbCkhxvCWjx!pz+I6hRnxSJe2Kiq4XYShBb6wrWqUtX8xxys8KDnMIbMwgRSqIrST956Pg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:17:19 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35256 A slick way to solve this particular problem is to use NDSolve. The inverse function t[y] sattisfies the differential equation t'[y]==1/R[t[y]]^4 with the inital condition t[0]==0 So the following command should give an interpolating function for t[y] (you should change the 1 in {y,0,1} to whatever the appropriate value is) NDSolve[{t'[y]==1/R[t[y]]^4,t[0]==0},t,{y,0,1}] Erich On Wed, 18 Sep 2002, martin skogstad wrote: > Dear NG > > > Mabye this is too simple, but I cant just figure it out > > I want to get an inverse function for y[t] where > > y[t_]:=NIntegrate[R[x]^4,{x,0,t}] /. ndsolution[[1]] > and > R[t] is an interpolatingfunction(R>0 from NDSolve) on the interval 0= > after that I hope to be able to calculate the integral : > > a = (1/y[T])* > NIntegrate[R[InvFunction[y[t]]*Cos[y[t]], {y[t], 0, y[T]}] > > it works with a constant instead of R[t]. > > Hope you can help, and that the above is understandable. > > > Martin Skogstad > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!skynet.be!skynet.be!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Carl K. Woll" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Inv.Interpol.Function Organization: University of Washington Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-dSjAeWhPL8qGpUQPiFzQrfCSkwKwgxJM8xf0c1BldhcSDeLl3aU8iqI2Q== NNTP-Posting-Date: Thu, 19 Sep 2002 02:41:41 CDT Lines: 49 X-Trace: sv3-0jOJ85DD7uTT/1y7WotrbkbSYSJobTcKAJMv/3Kb+86Git3O18cCM3VkqHwCgnG9JUMoz2eer1s9HCq!6dQwwIC6E9S0SwcrpPH1pAPaz9JzfTQ8mu4hhPsNzUnpLZne88mew5KAJQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:41:41 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35236 Martin, In a post a while ago, I introduced a function called NInverse which ought to be able to help you out. The message can be found at http://library.wolfram.com/mathgroup/archive/2001/Jun/msg00125.html The output of NInverse (in your case) is a function which given a value of y returns the corresponding value of t. In your case, you would use NInverse something like the following: NInverse[y, {t0,y0}, {yy, ymin, ymax}] You will probably get some error messages, but the answer should be okay. The function NInverse can be improved (witness the inclusion of yy above), and I will post an improved version sometime. Carl Woll Physics Dept U of Washington "martin skogstad" wrote in message news:am95s4$k3d$1@smc.vnet.net... > Dear NG > > > Mabye this is too simple, but I cant just figure it out > > I want to get an inverse function for y[t] where > > y[t_]:=NIntegrate[R[x]^4,{x,0,t}] /. ndsolution[[1]] > and > R[t] is an interpolatingfunction(R>0 from NDSolve) on the interval 0= > after that I hope to be able to calculate the integral : > > a = (1/y[T])* > NIntegrate[R[InvFunction[y[t]]*Cos[y[t]], {y[t], 0, y[T]}] > > it works with a constant instead of R[t]. > > Hope you can help, and that the above is understandable. > > > Martin Skogstad > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news-FFM2.ecrc.net!newsfeed.vmunix.org!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!worldnet.att.net!216.166.71.11!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Blimbaum Jerry DLPC Newsgroups: comp.soft-sys.math.mathematica Subject: FW: empirical CDF Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-7YxOWXSyRljYzf+IwJbC/rR/M2+vvE3U2AlY+fO6Ef1v0lzBW6rLklzDg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:15:09 CDT Lines: 39 X-Trace: sv3-VPsyXhmlTuIgcW1vCjvykAXK3FobJgL+wlD+CKBUQhNZBjA6DF2QCd/wYDhKENxkiF0agKsHZag2NCM!72E4loyr+zg92xodNXy6CGK0swgF5biCK/ilVXP0EVPoDj6UWUR+ZwGLgUzlfv48Wj5CuQw= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:15:09 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35200 There is a very nice java applet at http://statman.stat.sc.edu/~west/javahtml/classes/ , in which you can include your own data by replacing what is in the Applet with your own, which gives you a real time histogram plot and lets you alter the bin width and see how this effects the histogram....it wasnt until I saw this that i understood the significance of choosing the bin width......jerry blimbaum -----Original Message----- From: Bill Rowe [mailto:listuser@earthlink.net] Subject: empirical CDF On 9/13/02 at 11:33 PM, swidrygiello@wp.pl (Swidrygiello) wrote: >Does anybody know how to calculate in Mathematica: >a)empirical CDF, >b)empirical PDF, >c)normal QQ-plot; >d)QQ-plot two different random samples?! Yes, but there are a number of issues particularly with an empirical PDF. A very nice package that does all of the above and more is mathStatica. See http://www.mathstatica.com for details. Obviously, it is less expensive to write your own functions. Just recently in message Mark Fisher posted code that addresses the empirical CDF. However, in this code you may want to replace 1/n with 1/(n+1) or (j-0.5)/n depending on your application. Note, these will have no significant effect for large data sets. The key issue with an empirical PDF is deciding the bin width. A simple approach would be to use the functions in Statistics`DataManipulation` and Graphics`Graphics`. Look at the functions Histogram, Frequencies and BinListCounts. More sophisticated approaches involve kernel methods. These methods will generate smoother estimates for the PDF. Again, the key is bandwidth. There is no apriori choice for bin width or bandwith. Bad choices will obscure significant features in the data set. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Blimbaum Jerry DLPC Newsgroups: comp.soft-sys.math.mathematica Subject: Plotting one point at a time with JLink Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-BmnQUbc9Btnz/NelsAG1h9MwVSX9s7kKbgTaUTDM6jncdLfR+UohD3iXw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:17:13 CDT Lines: 58 X-Trace: sv3-BwxvtIiCJwQp5ZYFdsaxKrwLJ+PmPTOunaaYtVhkZMr68i86fhhDeyzVE9HoGQ1wMr0BxEjwil6Ex0F!NMYh0DZSCE2jpmCLWNui0NQN4pJZWneSQgfJQOqDXlwN+4dL2V3kypYczGb6oE9Kl85JPwA= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:17:13 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35202 A while back someone asked if Mathematica could plot data one point at a time....most answers were no, with one exception, where someone showed how to use the same Graphic Cell repeatedly....here is some Mathematica, JLink program that will do just that... << JLink` InstallJava[CommandLine -> "c:\\j2sdk1.4.1\\bin\\java.exe"] (* or set command line to where your java.exe is *) UseFrontEndForRendering = False; createWindow[] := Module[{frame}, frame = JavaNew["com.wolfram.jlink.MathFrame", "Drawing Sine Wave Animation One Point at a Time"]; 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[]; points = Range[data // Length] frame@setSize[800, 600]; frame@setLocation[200, 200]; JavaShow[frame]]; frame ] data = Table[{x, Sin[x]}, {x, -0.0000000000001, 2 Pi, .1}]; frame[n_] := ListPlot[Take[data, {1, n}], PlotRange -> {{0, 2 Pi}, {-1.5, 1.5}}, PlotStyle -> {PointSize[.005], Hue[0]}, DisplayFunction -> Identity] drawPoints[ptNow_] := Show[frame[ptNow], AspectRatio -> Automatic]; points = Range[data // Length]; AnimationPlot[pt_List] := JavaBlock[ Block[{frm}, frm = createWindow[]; Map[(obj = drawPoints[#]; drawArea@setMathCommand["obj"]; drawArea@repaintNow[]; Pause[0.0001];) &, pt]; ] ] AnimationPlot[points] jerry blimbaum NSWC panama city, fl From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!xmission!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jason Miller Newsgroups: comp.soft-sys.math.mathematica Subject: Q: argmax Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-nU9u/VUq5gu+MpXiz3lC/SGbDd9v/G92JAT4f9TQR+LaVhEVGRhKWQlZw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:18:15 CDT Lines: 26 X-Trace: sv3-PGwfZM30rInRHDaqI/4CpeQCHDmQZxwnBE5Toz8UFno8Ga+o6WwLdrHnQMh7TvsCIkbSDaBo9hvnTvB!13ety6BnQ/RffL0yZmnR9/6UbezYzKw9gD2MpOTPa8WpzXYzVrozcBPhAj8OPE7hjAxV/uA= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:18:15 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35203 I never liked the function, but now I have need of it. I hope someone can help me see the way to implement it. For a class I am teaching I want to write a simple function that does a random search for a function's maxima. I feed the function N randomly generated inputs and look at the outputs. Provided N is large enough, the largest of the outputs I obtain should be near the function's maximum value. What I want to be able to do is to identify the input that gave me that largest output. Any ideas? My only idea is this: create a table of pairs {output, input{ and find the element of the table that has the largest first entry. This will give me the input I seek. Is there a slick way of doing this in mathematica? -- 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 From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp-out.monmouth.com!newspeer.monmouth.com!kibo.news.demon.net!demon!newshub1.nl.home.com!news.nl.home.com!amsnews01.chello.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Daniel Reeves Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Q: argmax Organization: University of Michigan Engineering Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-MVqSJSYIuPDMbAXF3knwbcw2x93PpuoNB+hyZTOPf2GVz0EBmmhvVYfAw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:33:20 CDT Lines: 53 X-Trace: sv3-CL2KZoT0p84A8DZXOUm1CwkdVGFJIv2EUzn5nxirYemvA7H++Huv//ZI7c0sgkr9HmVwdH+YWxkWgF2!luJIdmHzt5yevUazQIzMVSiSEBg5yfqeL2T6opD0iSFoJhSLRRcv4IgF2Q== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:33:20 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35228 Here's one way: argMax::usage = "argMax[f, domain] returns the element of domain for which f of that element is maximal -- breaks ties in favor of first occurrence."; SetAttributes[argMax, HoldFirst]; argMax[f_, dom_List] := Fold[If[f[#1]>=f[#2], #1, #2]&, First[dom], Rest[dom]] And here's another way (defining it in terms of tupleMax)... tupleMax::usage = "tupleMax[list] returns the tuple that is lexicographically maximal."; tupleMax[l_List] := Fold[If[OrderedQ[{#1, #2}], #2, #1]&, First[l], Rest[l]] argMax[f_, dom_List] := tupleMax[{f[#],#}& /@ dom][[2]] --- \/ FROM Jason Miller AT 02.09.18 06:18 (Today) \/ --- > I never liked the function, but now I have need of it. I hope > someone can help me see the way to implement it. > > For a class I am teaching I want to write a simple function that does > a random search for a function's maxima. I feed the function N > randomly generated inputs and look at the outputs. Provided N is > large enough, the largest of the outputs I obtain should be near the > function's maximum value. > > What I want to be able to do is to identify the input that gave me > that largest output. Any ideas? > > My only idea is this: create a table of pairs {output, input{ and > find the element of the table that has the largest first entry. This > will give me the input I seek. Is there a slick way of doing this in > mathematica? -- -- -- -- -- -- -- -- -- -- -- -- Daniel Reeves http://ai.eecs.umich.edu/people/dreeves/ "In science it often happens that scientists say, 'You know that's a really good argument; my position is mistaken,' and then they would actually change their minds and you never hear that old view from them again. They really do it. It doesn't happen as often as it should, because scientists are human and change is sometimes painful. But it happens every day. I cannot recall the last time something like that happened in politics or religion." -- Carl Sagan, 1987 CSICOP Keynote Address From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp-out.monmouth.com!newspeer.monmouth.com!newsfeed.mathworks.com!cyclone.swbell.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Q: argmax Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-dSjAeWhPL8qGpUQPiFzQrfCSkwKwgxJM8xf0c1BldhcSDeLl3aU8iqI2Q== NNTP-Posting-Date: Thu, 19 Sep 2002 02:26:00 CDT Lines: 41 X-Trace: sv3-8jZ8oNAcxS0GY7Ndpfo5C9Kg3R/90f8yroXy1IgYf8HjLvhbUkaYLoYoPALRLqhoCi/wxd5Vse84Msv!PclA79/WhEvBJM+x6pdcuX+UrzapYSjXptbVF7PZhR6ziCRqqM9ij9U5VA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:26:00 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35221 Hi, fun[x_, y_] := x^2 + y^2 RandomMin[n_Integer] := First[Sort[ {#, fun @@ #} & /@ Table[{Random[], Random[]}, {n}], Last[#1] < Last[#2] &]] should do it. Regards Jens Jason Miller wrote: > > I never liked the function, but now I have need of it. I hope > someone can help me see the way to implement it. > > For a class I am teaching I want to write a simple function that does > a random search for a function's maxima. I feed the function N > randomly generated inputs and look at the outputs. Provided N is > large enough, the largest of the outputs I obtain should be near the > function's maximum value. > > What I want to be able to do is to identify the input that gave me > that largest output. Any ideas? > > My only idea is this: create a table of pairs {output, input{ and > find the element of the table that has the largest first entry. This > will give me the input I seek. Is there a slick way of doing this in > mathematica? > > -- > 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 From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!telocity-west!TELOCITY!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!newsfeed.sjc.globix.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Murray Eisenberg Newsgroups: comp.soft-sys.math.mathematica Subject: Re: problems with the definition of a function Organization: Mathematics & Statistics, Univ. of Mass./Amherst Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209160434.AAA07065@smc.vnet.net> Reply-To: murray@math.umass.edu X-GC-Trace: gv1-NCTH9ShD6oHijWdz9Pt1IjN1fKK8DuMG/8W9R7xCht3ebgkObKCE/Icrg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:19:17 CDT Lines: 48 X-Trace: sv3-rQz4z4aFrna7tjR0aeBb8BVJGt/FpPNZ0vBo+CFECFQ0V9z0eAhdCxiJCYNXZgJ5XmFGtAb5aMgaDXl!JCXfBer77jXDPOfN9aPsQjbw7yKpO5AIkFLoff6S9N7k/uhZMW0+vcupBqKMU5H0b7FUz9c= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:19:17 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35204 The same principles that allow particular cases for defining a function of a single variable would apply here, because Mathematica applies particular rules before it applies general ones. For example: f[0, y_] := 0 f[2 Pi, y_] := y - 2 f[4 Pi, y_] := y - 4 f[x_, y_] := x^2 + y^3 This will do exactly what it looks like it does! If you have a general family of particular cases, say at all even integral multiples of Pi, then you could use something like the following in place of the first three lines above: f[k_ Pi, y_] := y - k /; IntegerQ[k] && EvenQ[k] There are variants as to where to place the "condition" IntegerQ[k] && EvenQ[k], for example: f[k_ Pi , y_] /; IntegerQ[k] && EvenQ[k] := y - k f[k_ Pi /; IntegerQ[k] && EvenQ[k], y_] := y - k fabio bagarello wrote: > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio > > > -- 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 From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp-out.monmouth.com!newspeer.monmouth.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: problems with the definition of a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-b4RHZdp6zuNQujzv0U1pDN06CoH+hvH1XXyPz9VLD3+ayVJUq6VuPU8cw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:16:11 CDT Lines: 37 X-Trace: sv3-Gr94rwNYV5FhXhTNklHEPuOpItVlU+qcDHMhCDPBzuOVJzpXui3m6WM8jhMzMcknu+7Yl4n5T9YTDM6!QWjRfLjZzUqJnqg96aHgub6nozKqoNKTdVjwi/SOog087BCon0c36bnh5w== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:16:11 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35201 >>and has a different expression for all the other values of y. Do you mean "all the other values of x"? You can't expect to make yourself understood to Mathematica, if you don't say what you mean. Mathematica can't guess, like we can. If that's what you meant, it's really easy: f[0 | N[0], y_] := y f[2*Pi | N[2*Pi], y_] := y^2 f[4*Pi | 4.*Pi, y_] := y^3 f[x_, y_] := y^4 If the first three of those expressions are supposed to be the same, you can substitute f[0 | N[0] | 2*Pi | N[2*Pi] | 4*Pi | 4.*Pi, y_] := y^3 Bobby Treat -----Original Message----- From: fabio bagarello [mailto:bagarell@unipa.it] Subject: problems with the definition of a function Hi there!! I have quite an easy and annoying problem with mathematica: I need to define a function f(x,y) which takes some values for x=0,2pi,4pi (indepently of y) and has a different expression for all the other values of y. This is easily done for one-dimensional functions but I am in serious troubles for my two-dimensional problem: any suggestion? Thanks a lot, Fabio From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!triton.net!smallfeed.triton.net!66.181.128.6.MISMATCH!news.ticon.net!nntp-relay.ihug.net!ihug.co.nz!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: rajgupta121@rediffmail.com (Raj) Newsgroups: comp.soft-sys.math.mathematica Subject: Invert a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-qb42yEsWeb3K8pm8YKtsDuOQXcpNc8iDXiamBwOxvbMyGiCB00NAaelKQ== NNTP-Posting-Date: Wed, 18 Sep 2002 01:26:30 CDT Lines: 17 X-Trace: sv3-cwzkCrpiYz9FZo5FdhD7nc3fmFwc3idhPxqyT7NN+SIsoXaMIfr3HQ4zVDQE1ziJljhnEen6IOs6AW5!t476K+jxasTZ/LLOi82ucQwGHkP8PDoJbdKYyPv806zJ32XjaGn40e6X1w== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:26:30 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35211 Hi Everybody, How can I invert a funcion? For example In:=f[h_]:=Exp[-h](a*h+b*h^2); I want to invert it as h as a function of f How can I do that? Please suggest. Raj From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Chris Becker" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Invert a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-e/MgKZT30CdssA8Y9UmHETkiWVrxlBea/nj6ut/OThjEq3xZxJQj3kpDQ== NNTP-Posting-Date: Thu, 19 Sep 2002 02:55:16 CDT Lines: 25 X-Trace: sv3-QicW7VRJP7b1R/Ivuky0KKn0OODyveGQU+Feq4/xzJlX9xwDlFk69tJxNnABz3L0cpmbp99ArVjC2FH!cLuDt2mjP0x4BjhEMNflL9Rp47Wj0QI/rgRy1rmzgSXw9HrOrpwG6MrHbQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:55:16 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35249 Well, you can just solve for h. However, in this case there isn't a symbolic solution. "Raj" wrote in message news:am96ja$k65$1@smc.vnet.net... > Hi Everybody, > > How can I invert a funcion? For example > > In:=f[h_]:=Exp[-h](a*h+b*h^2); > > I want to invert it as > > h as a function of f > > > How can I do that? > > Please suggest. > > Raj > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed1.bredband.com!bredband!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!kibo.news.demon.net!demon!aotearoa.belnet.be!news.belnet.be!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Invert a function Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-aLoeluLq0V73k6Rl3TA7bGl9J8CWjh0N1cUb2IGQWyEwR5CAGvco8eahw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:27:03 CDT Lines: 31 X-Trace: sv3-A9OObNUm62TMBpDIqkHT71aCWWM6d0/NxHTwqSWJ5JPyxwv+zp9dnkrdcBknKLDtK4+WX5k8IEmnoKb!8l2nF6UA3W+S9ctX/LXa5zcr83sV3x8yp/g73RkvsOI2vfRpklTZoHkx/Q== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:27:03 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35222 Hi, Solve[ f=Exp[-h](a*h+b*h^2),h] will not help you but you can try to invert the series expansion as long as the function is monoton ser = Series[Exp[-h](a*h + b*h^2), {h, 0, 4}]; InverseSeries[ser, f] Regards Jens Raj wrote: > > Hi Everybody, > > How can I invert a funcion? For example > > In:=f[h_]:=Exp[-h](a*h+b*h^2); > > I want to invert it as > > h as a function of f > > How can I do that? > > Please suggest. > > Raj From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.telusplanet.net!snoopy.risq.qc.ca!newsfeed.news2me.com!west.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Cesar Guerra Newsgroups: comp.soft-sys.math.mathematica Subject: Front end proble in Linux Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-QJOCSEmHrvS16808idqf3WirUB+aNraDDYZI6RdRmuFFkHlqzxVqOs/2g== NNTP-Posting-Date: Wed, 18 Sep 2002 01:27:31 CDT Lines: 25 X-Trace: sv3-RDKa0S21rLturbfC60goXjkDQkyUKwQ1R+zqfw/fj+455T2GngDZueyezSa0OWQiP1p8oVIlaSt3Yez!C/t009jPcdPf7g1EmeR83Rt8u3S/8U+r/lTL1YZrDxPibY4Id8bSQRcnTWc= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:27:31 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35212 Hi math group, I don't have any idea about how to solve next problem. Thanks in advance for any hints... Back space key when I am in the front end don't work correctly. It advances instead of go back and there is no way to erase something I wrote in the notebook. The pointer mark of the mouse looks like a hand instead of an arrow, and this don't work fine too. Is it a Mathematica Configuration problem or a Linux Configuration one? How can I solve this? Note: This problem seems to appear just in my workspace i mean this not happen for other users. I used Mathematica 4.1 for Linux Red hat 7.0 Regards, Cesar. __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!enews.sgi.com!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!151.164.30.35!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Rainer Gruber Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Front end proble in Linux Organization: Johannes Kepler Universitaet Linz Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-EtisGFVPbmhnDrNQl/1wcMrI24SfpNLvNIbvYSw9QbNAAVft/AVROMSbQ== NNTP-Posting-Date: Fri, 20 Sep 2002 03:12:08 CDT Lines: 37 X-Trace: sv3-1HKV2OrNPn63Iuw5F47FXXAA3nXhj9N17QHyC/UdbZyVIrb5So2R9MW3gd8w0XKOMOLy1KOQefiH2vJ!DUgx22UCtQN3r1dnH086/SHp6wmSJrIxXSHKwQTOj/qsB1kGjtz03DADdQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:12:08 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35251 Cesar Guerra wrote: > Hi math group, > I don't have any idea about how to solve next problem. > Thanks in advance for any hints... > > Back space key when I am in the front end don't work > correctly. It advances instead of go back and there is > no way to erase something I wrote in the notebook. The > pointer mark of the mouse looks like a hand instead > of an arrow, and this don't work fine too. > Is it a Mathematica Configuration problem or a Linux > Configuration one? How can I solve this? > Note: This problem seems to appear just in my > workspace > i mean this not happen for other users. > I used Mathematica 4.1 for Linux Red hat 7.0 > > Regards, > Cesar. > > > __________________________________________________ > Do you Yahoo!? > Yahoo! News - Today's headlines > http://news.yahoo.com > Pressing the 'Num'-Key maybe solves your problem: If you switch off the 'Num Lock' your 'hand pointer mark' should turn into an 'arrow pointer mark' and you can place the cursor in a notebook. You get more details on -- Rainer Gruber From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!skynet.be!skynet.be!newsfeed.news2me.com!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "1.156" Newsgroups: comp.soft-sys.math.mathematica Subject: Thanks to all; here's what looks to be best solution Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-JOv0Azm/gwM6fQR9noquuJvXAWxNuRxtg3AM81T/Yl50zvtd1BWCz0WQg== NNTP-Posting-Date: Wed, 18 Sep 2002 01:28:33 CDT Lines: 54 X-Trace: sv3-MYzsExEx01qzj23yFEA8exROtuXrcjQTLcg1YyCkRVfMu/CC64DSKZgB8ZUXsRLGIhbefg5lvwgGG3A!IbYiYWv6hkWYaU82c7AlWTx2w/0oBncDlDW0HOfjCdvx3vP5Lgir7z1MDwG77fm+c9vo0o8= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:28:33 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35213 Thanks to all who helped me on this. Tomas in Mexico appears to have nailed this thing. Here is what I'm using now: In[1]:= a=ReadList["197-tst.txt",Word,RecordLists->True, WordSeparators->None]; In[2]:= flds={{25,31}, {32,39},{40,46},{47,54},{55,62},{63,70},{71,78},{79,86},{87, 94},{95,102},{103,110}}; Define this function: In[3]:= f[x_]:=ToExpression[StringTake[x[[1]],#]]&/@flds Now, map this function onto a: In[8]:= f/@a Out[8]= {{5935.8,5946.66,27.06,-1281.9,-229.,321.,317.,367.,-115.,126.,146.},{5935.8 .... ************ The data is now in a matrix of numbers and each variable is in a column. Now I just transpose this to get each variable in a row for easy access (apparently Mathematica has no way to directly access a column in a matrix, you gotta transpose I think) Rob "1.156" wrote: > I've got to extract some numbers from a file that are in lines of text. Since the line contents are not numbers, I presume I must pull the line out as a string. Here I start by pulling out just one line: > > inFile = OpenRead["197-tst.txt"] > y = ReadList[inFile, String, 1, RecordLists -> True] > Close[inFile]; > > This appears to pull in a line. Now I want to take characters 25 to 110 to get just the stuff I want: > y1=StringTake[y ,{25,110}]; > > Here's the output. StringTake doesn't seem to work. > > StringTake[{aEX-004 2002197 0 0 0 5935.80 5946.66 27.06 -1281.9 -229. 321. 317. 367. -115. 126. 146. -410. -426.000000EF 75.}, {25, 110}] > > It doesn't take loading another package as far > as I can tell from the help. I'm thinking that it doesn't work because it's trying to work on a list > rather than a string. I've tried Flatten, and other stuff to try to get to just a string and not a list but > nothing has worked so far. I'm a long way from getting to those numbers in there but heck, I > can't even get to the string. Can anyone point me in the right direction? > > Thanks, Rob From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp-out.monmouth.com!newspeer.monmouth.com!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: lalu_bhatt@yahoo.com (Bhuvanesh) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Thanks to all; here's what looks to be best solution Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Thu, 19 Sep 2002 02:37:31 CDT Lines: 19 X-Trace: sv3-CaLFl1ESqL05Dkvlpd6t7YXi5wcgBDGU9S/dR8vBFo8I4pSROSxSnuMKR7wMWWzAAfS3ZDz+6QakE4Q!wH5YF9LNo1Y8IgfL/DwMBHAtJuN/S0KkJhOpTLBE1aanlO4CUxgtaVb+M7tabLfC9w== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:37:31 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35232 "1.156" wrote: > The data is now in a matrix of numbers and each variable is in a column. > Now I just transpose this to get each variable in a row for easy access > (apparently Mathematica has no way to directly access a column in a matrix, > you gotta transpose I think) You can use "All": In[1]:= mat = {{a,b,c},{d,e,f}}; In[2]:= mat[[All,2]] Out[2]= {b, e} -- Bhuvanesh, Wolfram Research. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!enews.sgi.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: David Sagan Newsgroups: comp.soft-sys.math.mathematica Subject: Resetting after SetOptions Organization: Cornell University Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-v8FvqZRK2p9dJAPgr7e9v4OhajwEsRV8V75LrBkja+TTrXqbwRJwmjymw== NNTP-Posting-Date: Wed, 18 Sep 2002 01:29:35 CDT Lines: 8 X-Trace: sv3-Ij4jnWK8CRSwES0Kc4ukh9+ZM53u+CjI7P3sYEmt5IfZ0FK+eTGGrm0Cw+eiqzvxFlYiXclQ0Ii2RRP!Sg9gyN6cgT6CCRGcBXeLo89rO8ts17FgufrBryu+PjhPvi/S2K77ouk6+A== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:29:35 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35214 Help! After using SetOptions[Graphics3D, ...] I am trying to set the default options of Graphics3D back to what they were when I started up Mathematica. I cannot find a command to do this. Is this possible? -- Thanks for any help, David Sagan From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.cwix.com!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: Daniel Reeves Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Resetting after SetOptions Organization: University of Michigan Engineering Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Thu, 19 Sep 2002 02:34:24 CDT Lines: 25 X-Trace: sv3-Za7r1tIFO6RGd2bx5j/nERiIU8t23/67ZsEzLYM1v94qan3vsGLqXKqgGJIUtXdIjDO1V/pdsDgdbU/!ztyydHup5/dNLzRJ2MRe8szJphjwQwPJtoeH4922qrb/LcJIvZGUq8oWGOjqb2JZug== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:34:24 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35229 o = Options[Graphics3D]; (* save the original options *) SetOptions[Graphics3D, ...]; (* mess with them *) SetOptions[Graphics3D, Sequence@@o]; (* restore them *) --- \/ FROM David Sagan AT 02.09.18 06:29 (Today) \/ --- > Help! > > After using SetOptions[Graphics3D, ...] I am trying to set the default > options of Graphics3D back to what they were when I started up > Mathematica. I cannot find a command to do this. Is this possible? > > -- Thanks for any help, David Sagan -- -- -- -- -- -- -- -- -- -- -- -- Daniel Reeves http://ai.eecs.umich.edu/people/dreeves/ "The idea of programming in a low level language like C will seem as specialized and esoteric as programming in microcode or assembler seems today." -- Stephen Wolfram, creator of Mathematica From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.cwix.com!ord2-feed1.news.algx.net!allegiance!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Jens-Peer Kuska Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Resetting after SetOptions Organization: Universitaet Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: kuska@informatik.uni-leipzig.de X-GC-Trace: gv1-aLoeluLq0V73k6Rl3TA7bGl9J8CWjh0N1cUb2IGQWyEwR5CAGvco8eahw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:28:05 CDT Lines: 23 X-Trace: sv3-kFveo3GtSeZKE6CZQGZRz3BW2Wc+0Wn+sO2xlojY9SDV+XzRN56MzxZTAdQ7Egc9d3LvjvLRyIeKCv/!nU2T+OF0UFAMf2AqR+yY4fq99SfLpitF5MImb1zGCZDDlXf29CxPd2E36nlurjHhHSvVitk= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:28:05 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35223 Hmm, oldOptions=Options[Graphics3D]; SetOptions[Graphics3D,Boxed->False] (* do something with it *) SetOptions[Graphics3D, Sequence @@ oldOptions] works fine. Regards Jens David Sagan wrote: > > Help! > > After using SetOptions[Graphics3D, ...] I am trying to set the default > options of Graphics3D back to what they were when I started up > Mathematica. I cannot find a command to do this. Is this possible? > > -- Thanks for any help, David Sagan From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: Daniel Lichtblau Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Why is my Implementation of Sorted Trees So Slow? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209160433.AAA07056@smc.vnet.net> NNTP-Posting-Date: Wed, 18 Sep 2002 01:30:36 CDT Lines: 83 X-Trace: sv3-tvxjCumcfm/mQfyPCMR8rj9B3xCS2eM7slc709z7dL7uWje53KGQOnXcAJBzfs7yDQx8OSCcorwwr3f!pKufsG5qXUyeAINnr0aMYj/qsxZRQWldEl9RT4m/0L+KO829teI4sxkVBmQXu5jdAA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:30:36 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35215 DrBob wrote: > > This code is almost identical to yours in principle, yet 30% faster: > > (compared with the code in your notebook, not the code in the post > below) > > ClearAll[emptyTree, treeInsert]; > emptyTree = {}; > > treeInsert[emptyTree, elem_] := {emptyTree, elem, emptyTree} > treeInsert[tree_, elem_] /; SameQ[tree[[2]], elem] := tree > treeInsert[tree_, elem_] /; OrderedQ[{tree[[2]], elem}] := > {First[tree], tree[[2]], treeInsert[Last[tree], elem]} > treeInsert[tree_, elem_] := {treeInsert[First[tree], elem], tree[[2]], \ > Last[tree]} > > Here's an even simpler version, same speed: > > ClearAll[emptyTree, treeInsert]; > emptyTree = {}; > > treeInsert[emptyTree, elem_] := {emptyTree, elem, emptyTree} > treeInsert[tree_, elem_] := Which[ > SameQ[tree[[2]], elem], tree, OrderedQ[{tree[[2]], elem}], > {First@tree, tree[[2]], treeInsert[Last@tree, elem]}, > True, {treeInsert[First@tree, elem], tree[[2]], Last@tree}] I had tried variations on this but they all seemed ever so slightly slower. Might be version an OS dependent. > I see one obvious advantage of your algorithm over Husain's and my > earlier code; though I'm not sure it explains its better behavior. That > is, while my algorithm made pattern matching more burdensome, yours > virtually eliminated it. > > Also, the biggest improvement I've seen comes simply from replacing Null > with anything else in Husain's code. Again, that seems to suggest that > time spent on pattern matching is the problem. All the algorithms do > approximately the same real work on the tree structure. > > I really like how Flatten changes your tree into a sorted list. Very > nice! Goes by the name of "tree sort". Using Flatten is basically a shortcut for walking the tree left-to-right. > Bobby Treat It seems I did not look hard enough at the original post or the follow-ups. In point of fact, regarding speed, there IS no obvious advantage of my code over that first version. The advantage is there, of course, as timing checks indicate. But it is quite far from obvious. The reason is related to the (rare) need for Update. It is pointed out in the manual that "infinite" evaluation is not in fact possible (no surprise thus far). A consequence is that Mathematica requires internal optimization features to keep reevaluation to a minimum. Update may be required in cases where such optimizations are overzealous. What we have in the case of this example is, roughly, the opposite. The code that determines need for reevaluation is simply not working sufficiently well. It does make the correct determination, but only after looking over the entire structure that is being evaluated. As we have a structure growing linearly in the number of iterations, and it gets mostly traversed each iteration, the algorithmic complexity becomes at least O(n^2). Not a disaster unless the appropriate complexity is smaller, which was the case for this example. This is not a bug insofar as it is a (regretably) necessary consequence of Mathematica evaluation semantics. The problems it can cause are all the same quite undesirable. We've made some inroads on this problem by enlarging substantially the class of expressions for which reevaluation may be quickly short-circuited, with the idea of fixing all but the most pathological of examples. The status of that work is unfortunately not known to me at present, though I'll try to find out about it. Daniel Lichtblau Wolfram Research From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newscon07.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!news.he.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Why is my Implementation of Sorted Trees So Slow? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-3kNXOagi9egKYrR29TD0NOD4DAZGLsH9Bm4atKduu/4BrMnrUMRoMmqFQ== NNTP-Posting-Date: Sun, 15 Sep 2002 23:31:52 CDT Lines: 216 X-Trace: sv3-2UTRqRDjtohWtSacU1cmmpddEFDobfQ9nMGTmRzp2v87tuR+ouRwfpJlx15Qzu3KLYxMhp1WVBdppTT!a321k3sMcVNTmr8HriwJbK8X8Qe7OiDDY+mx7kbt1qHcPlRpDPnvs1bM/1cepu6XMVTIckY= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Mon, 16 Sep 2002 04:31:52 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35185 This code is almost identical to yours in principle, yet 30% faster: (compared with the code in your notebook, not the code in the post below) ClearAll[emptyTree, treeInsert]; emptyTree = {}; treeInsert[emptyTree, elem_] := {emptyTree, elem, emptyTree} treeInsert[tree_, elem_] /; SameQ[tree[[2]], elem] := tree treeInsert[tree_, elem_] /; OrderedQ[{tree[[2]], elem}] := {First[tree], tree[[2]], treeInsert[Last[tree], elem]} treeInsert[tree_, elem_] := {treeInsert[First[tree], elem], tree[[2]], \ Last[tree]} Here's an even simpler version, same speed: ClearAll[emptyTree, treeInsert]; emptyTree = {}; treeInsert[emptyTree, elem_] := {emptyTree, elem, emptyTree} treeInsert[tree_, elem_] := Which[ SameQ[tree[[2]], elem], tree, OrderedQ[{tree[[2]], elem}], {First@tree, tree[[2]], treeInsert[Last@tree, elem]}, True, {treeInsert[First@tree, elem], tree[[2]], Last@tree}] I see one obvious advantage of your algorithm over Husain's and my earlier code; though I'm not sure it explains its better behavior. That is, while my algorithm made pattern matching more burdensome, yours virtually eliminated it. Also, the biggest improvement I've seen comes simply from replacing Null with anything else in Husain's code. Again, that seems to suggest that time spent on pattern matching is the problem. All the algorithms do approximately the same real work on the tree structure. I really like how Flatten changes your tree into a sorted list. Very nice! Bobby Treat -----Original Message----- From: Daniel Lichtblau [mailto:danl@wolfram.com] Subject: Why is my Implementation of Sorted Trees So Slow? Husain Ali Al-Mohssen wrote: > > Hi all, > > I am trying to implement a very simple sorted tree to quickly store some > real numbers I need. I have written an add, delete, minimum, and pop > (delete the lowest value) function and they seem to work ok but are very > slow. Let's just look @ my implementation of the add part: > nums=Null;(*my initial blank Tree) > In[326]:= > Clear[add] > > In[327]:= > add[Null,x_Real]:=node[x,Null,Null] > > add[Null,node[x_Real,lower_,higher_]]=node[x,lower,higher] > > In[328]:= > add[node[x_Real,lower_,higher_],y_Real]:= > If[x>y,node[x,add[lower,y],higher],node[x,lower,add[higher,y]]] > > In[288]:= > add[node[x_Real,lowerx_,higherx_],node[y_Real,lowery_,highery_]]:=If[x>y , > node[x,add[lowerx,node[y,lowery,highery]],higherx], > node[x,lowerx,add[higherx,node[y,lowery,highery]]] > ] > > Now this is my attempt to test how fast my add works: > > SeedRandom[5]; > Do[nums=add[nums,Random[]],{5000}];//Timing > > Out[333]= > {13.279 Second,Null} > > (running on Mathematica 4.1 on a win2k VMWare machine running on Linux RH7.3 > running on an 1.4GHz Athlon with 1GB of ram). > > Questions: > 1. Is this as fast as I can get my code to run? > 2. Am I doing something obviously stupid? > 3. would Compiling things help? > > Thanks, > Husain I'll respond to your third question first. No, use of Compile will not help. You do not have a tensor structure and moreover it will copy its arguments. Hence invoking it within a loop would be quite slow for a problem where the argument grows in size. One thing you did not check is the actual run-time complexity of your code. On my 15.GHz machine I get: In[6]:= SeedRandom[5]; In[7]:= ee = Table[Random[], {10000}]; In[8]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,1000}];] Out[8]= {0.34 Second, Null} In[9]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,2000}];] Out[9]= {1.28 Second, Null} In[10]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,4000}];] Out[10]= {4.94 Second, Null} In[11]:= nums = Null; Timing[Do[nums = add[nums,ee[[j]]],{j,8000}];] Out[11]= {25.08 Second, Null} We see this is clearly of no better than quadratic complexity, whereas I would guess you were expecting O(n*Log[n]). So this indicates a problem. Offhand I do not know what aspect of your code is responsible, but I'll give some different code that has the desired complexity. Note that some of this, and code very similar to that below, is discussed at: http://library.wolfram.com/conferences/devconf99/lichtblau/ in the section entitled Trees. There is a corresponding Mathematica notebook available at: http://library.wolfram.com/conferences/devconf99/ near the bottom of the web page. The code I used to implement a tree structure similar to yours is below. One difference is that, as I place node values in the center, when they are flattened the tree is automatically sorted. You might (or might not) regard this as an added benefit. leftsubtree[node[left_, _, _]] := left rightsubtree[node[_, _, right_]] := right nodevalue[node[_, val_, _]] := val emptyTree = node[]; Clear[treeInsert] treeInsert[emptyTree, elem_] := node[emptyTree, elem, emptyTree] treeInsert[tree_, elem_] /; OrderedQ[{nodevalue[tree], elem}] := node[leftsubtree[tree], nodevalue[tree], treeInsert[rightsubtree[tree], elem]] treeInsert[tree_, elem_] := node[treeInsert[leftsubtree[tree],elem], nodevalue[tree], rightsubtree[tree]] Now for some tests. In[40]:= tt1k = First[Timing[ff1k = node[]; Do[ff1k = treeInsert[ff1k, ee[[j]]], {j,1000}];]] Out[40]= 0.15 Second We will check that the flattened version is actually sorted. In[41]:= gg1k = Apply[List,Flatten[ff1k]]; In[42]:= gg1k === Sort[Take[ee,1000]] Out[42]= True Also we will observe that the maximum depth is reasonable. In[43]:= Depth[ff1k] Out[43]= 23 In the perfectly balanced case it would be 10 so this is not too bad. For larger examples I'll just show timings. In[44]:= tt2k = First[Timing[ff2k = node[]; Do[ff2k = treeInsert[ff2k, ee[[j]]], {j,2000}];]] Out[44]= 0.32 Second In[45]:= tt4k = First[Timing[ff4k = node[]; Do[ff4k = treeInsert[ff4k, ee[[j]]], {j,4000}];]] Out[45]= 0.73 Second In[47]:= tt8k = First[Timing[ff8k = node[]; Do[ff8k = treeInsert[ff8k, ee[[j]]], {j,8000}];]] Out[47]= 1.58 Second In[53]:= SeedRandom[5]; ee = Table[Random[], {32000}]; In[54]:= tt32k = First[Timing[ff32k = node[]; Do[ff32k = treeInsert[ff32k, ee[[j]]], {j,32000}];]] Out[54]= 7.58 Second This is not of blinding speed but it has the advantage of exhibiting the appropriate run-time complexity. One can, with careful coding, cut down on tree size but if you check with LeafCount you will find that the version above is already not too wasteful (3x larger than #values stored). Moreover the code needed would run a bit slower as it would have more cases to check. As for removing nodes, I think you will need to use some form of held attribute so as to avoid copying the entire tree when you alter elements. Daniel Lichtblau Wolfram Research From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!enews.sgi.com!arclight.uoregon.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Why is my Implementation of Sorted Trees So Slow? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-Ov836PHmHl9KkaW94IP+m63UDTeZgCyYw08ldIPLnoK/G2HgVKX8bCrNQ== NNTP-Posting-Date: Wed, 18 Sep 2002 01:31:41 CDT Lines: 131 X-Trace: sv3-GuPg7vo72zZ0yWqDqbjh6zWmEael7I1To2mVub9Y1HuJGC6npOyARIZjCwvBzVVhCXkH56S5dTAdq/P!k3Yzvo7u1rNmiza46flA1jX3/BlUN8i18ZAxGOTnJk0m0OGUfr2Sek3vIQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:31:41 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35216 Daniel, I'd say your algorithm (as an ALGORITHM) is precisely the same as Husain's. The implementation is different, but the logical steps are the same (except perhaps for <= vs. <), and so is the logical structure of the tree produced. Even the storage method is pretty much the same. Using {} instead of Null and List instead of 'node', and putting values in the middle position, doesn't add up to a change that could affect algorithmic complexity. Even the fact that Flatten gives a sorted List with your implementation is something you get "for free", and the advantage comes only when it's time to output a sorted list. It has nothing to do with the work of building the tree. Algorithmic complexity (absent hidden factors under the kernel's control) is precisely the same for your solution and Husain's (mine too, I think). The speed differences we're seeing have to do with nuances of the kernel, pattern matching costs, etc. Our three nearly equivalent algorithms simply incur different hidden costs. That's the case with many of the problems that turn into "speed wars" among us. We compare implementation speed (including hidden costs), not pure algorithmic complexity. Compiled code or packed arrays often make all the difference, and it usually happens in the background where we can't see it. As you've hinted below, the vagaries of Update can make a linear algorithm quadratic, but may NOT so plague a slightly different implementation of the very same algorithm. So... I'm suggesting we might want to be careful when we leap to conclusions about "algorithmic complexity" based on a few timed experiments. Bobby Treat -----Original Message----- From: danl@wolfram.com [mailto:danl@wolfram.com] Subject: Re: Why is my Implementation of Sorted Trees So Slow? DrBob wrote: > > This code is almost identical to yours in principle, yet 30% faster: > > (compared with the code in your notebook, not the code in the post > below) > > ClearAll[emptyTree, treeInsert]; > emptyTree = {}; > > treeInsert[emptyTree, elem_] := {emptyTree, elem, emptyTree} > treeInsert[tree_, elem_] /; SameQ[tree[[2]], elem] := tree > treeInsert[tree_, elem_] /; OrderedQ[{tree[[2]], elem}] := > {First[tree], tree[[2]], treeInsert[Last[tree], elem]} > treeInsert[tree_, elem_] := {treeInsert[First[tree], elem], tree[[2]], \ > Last[tree]} > > Here's an even simpler version, same speed: > > ClearAll[emptyTree, treeInsert]; > emptyTree = {}; > > treeInsert[emptyTree, elem_] := {emptyTree, elem, emptyTree} > treeInsert[tree_, elem_] := Which[ > SameQ[tree[[2]], elem], tree, OrderedQ[{tree[[2]], elem}], > {First@tree, tree[[2]], treeInsert[Last@tree, elem]}, > True, {treeInsert[First@tree, elem], tree[[2]], Last@tree}] I had tried variations on this but they all seemed ever so slightly slower. Might be version an OS dependent. > I see one obvious advantage of your algorithm over Husain's and my > earlier code; though I'm not sure it explains its better behavior. That > is, while my algorithm made pattern matching more burdensome, yours > virtually eliminated it. > > Also, the biggest improvement I've seen comes simply from replacing Null > with anything else in Husain's code. Again, that seems to suggest that > time spent on pattern matching is the problem. All the algorithms do > approximately the same real work on the tree structure. > > I really like how Flatten changes your tree into a sorted list. Very > nice! Goes by the name of "tree sort". Using Flatten is basically a shortcut for walking the tree left-to-right. > Bobby Treat It seems I did not look hard enough at the original post or the follow-ups. In point of fact, regarding speed, there IS no obvious advantage of my code over that first version. The advantage is there, of course, as timing checks indicate. But it is quite far from obvious. The reason is related to the (rare) need for Update. It is pointed out in the manual that "infinite" evaluation is not in fact possible (no surprise thus far). A consequence is that Mathematica requires internal optimization features to keep reevaluation to a minimum. Update may be required in cases where such optimizations are overzealous. What we have in the case of this example is, roughly, the opposite. The code that determines need for reevaluation is simply not working sufficiently well. It does make the correct determination, but only after looking over the entire structure that is being evaluated. As we have a structure growing linearly in the number of iterations, and it gets mostly traversed each iteration, the algorithmic complexity becomes at least O(n^2). Not a disaster unless the appropriate complexity is smaller, which was the case for this example. This is not a bug insofar as it is a (regretably) necessary consequence of Mathematica evaluation semantics. The problems it can cause are all the same quite undesirable. We've made some inroads on this problem by enlarging substantially the class of expressions for which reevaluation may be quickly short-circuited, with the idea of fixing all but the most pathological of examples. The status of that work is unfortunately not known to me at present, though I'll try to find out about it. Daniel Lichtblau Wolfram Research From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: algolog@yandex.ru (Evgeni Trifonov) Newsgroups: comp.soft-sys.math.mathematica Subject: build-in commutativity Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-oBmm5MQbX7ylXDXsqXiDUc5zUS6/fPXhvho3b7ftGLjx+TITBQBWfcf7Q== NNTP-Posting-Date: Thu, 19 Sep 2002 02:21:49 CDT Lines: 19 X-Trace: sv3-tPDDj5mwZiqlIrh35Npk+L2S9ClceoJRAHphdb/ScIjYpWowlLPWee+FQ8Cc44BbpUlXPMudcw/i1a2!ophHGducUezhZu88tm9XI4U4LV4n6F0yREXFG4rcC6i0JdiFG4ukFAdbAFlTqtcmA1sdAqQ= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:21:49 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35217 I'm curious, why the built-in boolean functions "And" and "Or" aren't commutative? Attributes/@{Or,And}//ColumnForm {Flat, HoldAll, OneIdentity, Protected} {Flat, HoldAll, OneIdentity, Protected} However, the arithmetical functions are "Orderless": Attributes/@{Plus,Times}//ColumnForm {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected} {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected} ------------------- Evgeni Trifonov Vladivostok, Russia From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.cc.ukans.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Carl K. Woll" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: build-in commutativity Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-b4RHZdp6zuNQujzv0U1pDN06CoH+hvH1XXyPz9VLD3+ayVJUq6VuPU8cw== NNTP-Posting-Date: Fri, 20 Sep 2002 03:18:21 CDT Lines: 47 X-Trace: sv3-5eIavwVmXR8PWSfyXfQeAxomDJ6gkiR5dAGHY/FWapHeZ9A4KpgMlExKGUh2LB1BsjQheqD9eXo2oqW!Hn8efDXec+sNgbxQNGtsbwR11DPrNZgp7ZlvJHrt9vVn9OW3jNttySNziA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:18:21 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35257 Evgeni, Note that both "And" and "Or" can return a value without evaluating all of their arguments. For example, if the first argument to And is False, there is no reason to look at the other arguments. Suppose a user knows that one of the arguments is usually false, and so would like to look at that argument before any of the others, to avoid unneeded computations of the other arguments. He would put that argument first. If Mathematica turned around and sorted the arguments (which is what happens when a function is orderless), then that argument might end up being evaluated last. If the arguments take a significant amount of time to compute, then sorting first may cause the function to take much longer to evaluate. At any rate, if the above is not a concern for you, you may always change the attributes of And and Or to anything you want. Carl Woll Physics Dept U of Washington ----- Original Message ----- From: "Evgeni Trifonov" Subject: build-in commutativity > I'm curious, why the built-in boolean functions "And" and "Or" > aren't commutative? > > Attributes/@{Or,And}//ColumnForm > > {Flat, HoldAll, OneIdentity, Protected} > {Flat, HoldAll, OneIdentity, Protected} > > However, the arithmetical functions are "Orderless": > > Attributes/@{Plus,Times}//ColumnForm > > {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected} > {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected} > > ------------------- > Evgeni Trifonov > Vladivostok, Russia > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newscon07.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!ps01-sjc1!news.webusenet.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: guillerm@usal.es Newsgroups: comp.soft-sys.math.mathematica Subject: Different letters different solutions!! Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-7YxOWXSyRljYzf+IwJbC/rR/M2+vvE3U2AlY+fO6Ef1v0lzBW6rLklzDg== NNTP-Posting-Date: Thu, 19 Sep 2002 02:22:51 CDT Lines: 31 X-Trace: sv3-HyYEyJLtnAXUkVS7Svlf1GQoePXZrAMpvgtSuHmuDLDpIMv/r/XsH3JAlQmo1o/hs/Wtkd4fBPZ0YUV!uDVqUp1An0MxDXeiH90y1xgxWgWMjKaXBTgQZztZoTY0aVDYE517LQuW+Q== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:22:51 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35218 I have defined two functions (Math 4.1) In[1]:= integrate[c_ y_,t_]:=c*integrate[y,t]/;FreeQ[c,t]; In[2]:= integrate[Exp[(a_.)*tau], t_]:=(E^(a*t)-1)/a/; FreeQ[a,t]&&FreeQ[a,tau]; when I applied these functions the solution is different if the coefficient is the letter d or lower (solution fine) or f or higher (solution wrong) . Here is an example: Using letter f In[3]:=integrate[f Exp[-0.8316*tau], t] Out[3]:=integrate[f, t]/E^(0.8316*tau) (*wrong*) Using letter a (the solution is rigth In[4]:=integrate[a Exp[-0.8316*tau], t] Out[4]:=-1.20250*a*(-1 + E^(-0.8316*t)) What it wrong? Guillermo Sanchez --------------------------------------------- This message was sent using Endymion MailMan. http://www.endymion.com/products/mailman/ From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!easynet-quince!easynet.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: Erich Mueller Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Different letters different solutions!! Organization: Ohio State University Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: NNTP-Posting-Date: Fri, 20 Sep 2002 03:15:15 CDT Lines: 73 X-Trace: sv3-vLLBW7NsYVjDroj2ZDd+eKodMcWo3FmBG60qzOfpKSqwXy+uqzuYhgspUPG7x/dkPDL8aQQi4/vuzqY!ynb1P/HcW1sFxqlwhPtAxETb+bRLqZJ9FBWh3pSY2xeD5Kr7f+tnAsw/KEAKes7L8g== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:15:15 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35254 Neither of your solutions are "wrong" according to your rules. Lets step through them In[3]:=integrate[f Exp[-0.8316*tau], t] The function Times is Orderless, so the kernel rewrites the integrand in lexographical (sp) order as In[3]:=integrate[Exp[-0.8316*tau] f, t] It then applies rule 1: integrate[c_ y_,t_]:=c*integrate[y,t]/;FreeQ[c,t] Well, The term "Exp[-0.8316*tau]" contains no "t", so according to your rule it is equal to Exp[-0.8316*tau] integrate[f, t] At this point none of your rules apply, so the kernel stops. When you use "a" instead of "f" the ordering of the "constant" and the exponential are reversed, and you get the behaviour that you actually desired. A simple fix is to replace the condition in rule 1 by FreeQ[c,t]&&FreeQ[c,tau] You may however want to think carefully about exactly what you want your function "integrate" to do. For example, with the rules given, the variable "t" and the variable "tau" seem to be playing the same role. Cheers, Erich On Thu, 19 Sep 2002 guillerm@usal.es wrote: > I have defined two functions (Math 4.1) > In[1]:= integrate[c_ y_,t_]:=c*integrate[y,t]/;FreeQ[c,t]; > In[2]:= integrate[Exp[(a_.)*tau], t_]:=(E^(a*t)-1)/a/; > FreeQ[a,t]&&FreeQ[a,tau]; > > when I applied these functions the solution is different if the coefficient is > the letter d or lower (solution fine) or f or higher (solution wrong) . Here is > an example: > > Using letter f > In[3]:=integrate[f Exp[-0.8316*tau], t] > > Out[3]:=integrate[f, t]/E^(0.8316*tau) (*wrong*) > > Using letter a (the solution is rigth > > In[4]:=integrate[a Exp[-0.8316*tau], t] > > Out[4]:=-1.20250*a*(-1 + E^(-0.8316*t)) > > What it wrong? > > Guillermo > Sanchez > > --------------------------------------------- > This message was sent using Endymion MailMan. > http://www.endymion.com/products/mailman/ > > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Matthias.Bode@oppenheim.de Newsgroups: comp.soft-sys.math.mathematica Subject: AW: Drawing an ellipse Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-A5+tt9jAX5y048gAE5pBa2fvHA4DiAFurcIuRElwcpBN9XDpVJ9g1Dukw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:29:08 CDT Lines: 44 X-Trace: sv3-zHIBxQvdQD3ioquKHDO3tQdtfJljaR3Py6cw6J4sMqIQKO8eX9Req+8X0cP/00QciUgpytzinS05G9v!+/44VHK4OyztjSea5fyMMpsxbFJxw/7cdRxzYJ9ZhRKq6Vx9u8TKhxT1Eg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:29:08 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35224 Hello Maciej, << Graphics`ImplicitPlot` does the job. Best regards, Matthias Bode Sal. Oppenheim jr. & Cie. KGaA Koenigsberger Strasse 29 D-60487 Frankfurt am Main GERMANY Tel.: +49(0)69 71 34 53 80 Mobile: +49(0)172 6 74 95 77 Fax: +49(0)69 71 34 95 380 E-mail: matthias.bode@oppenheim.de Internet: http://www.oppenheim.de -----Ursprüngliche Nachricht----- Von: pimak [mailto:piotrowski.maciek@interia.pl] Gesendet: Mittwoch, 18. September 2002 08:09 An: mathgroup@smc.vnet.net Betreff: Drawing an ellipse Hello, I am new with Mathematica, I have one question, I know that the sollution might be very easy, but I wasn't able to find it by now. I would like to draw an ellipse, the formula let's say is as follows: 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 Thanks Maciej From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!newsfeed.cwix.com!newsfeed.nyc.globix.net!newsfeed.sjc.globix.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Matthias.Bode@oppenheim.de Newsgroups: comp.soft-sys.math.mathematica Subject: AW: Invert a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-A5+tt9jAX5y048gAE5pBa2fvHA4DiAFurcIuRElwcpBN9XDpVJ9g1Dukw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:30:12 CDT Lines: 54 X-Trace: sv3-BCAf3xy4hrBPcpJlxPXmbJhn+u4aJ+y6Ps5o/JMSH93r+NQnNi1HpMSjq66m2yE1Mn4SYRy9H1WfNqQ!BKzN7XqLx1FNOA4NUKWsZ5qx2oG9+iqQH4nvjHh19MTr0WgsuVpQTDVAQg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:30:12 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35225 Hello Raj, Solve[eqn, var] and InverseFunction are designed to do what you want, in principle. Try Solve[(a*h+b*h^2) == f, h] For your eqn, however, it is impossible to solve for h since h appears as a factor in a sum *and* as an exponent. Try Solve[Exp[-h]*(a*h+b*h^2) == f, h] and study Mathematica's message. Best regards, Matthias Bode Sal. Oppenheim jr. & Cie. KGaA Koenigsberger Strasse 29 D-60487 Frankfurt am Main GERMANY Tel.: +49(0)69 71 34 53 80 Mobile: +49(0)172 6 74 95 77 Fax: +49(0)69 71 34 95 380 E-mail: matthias.bode@oppenheim.de Internet: http://www.oppenheim.de -----Ursprüngliche Nachricht----- Von: rajgupta121@rediffmail.com [mailto:rajgupta121@rediffmail.com] Gesendet: Mittwoch, 18. September 2002 08:10 An: mathgroup@smc.vnet.net Betreff: Invert a function Hi Everybody, How can I invert a funcion? For example In:=f[h_]:=Exp[-h](a*h+b*h^2); I want to invert it as h as a function of f How can I do that? Please suggest. Raj From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp-out.monmouth.com!newspeer.monmouth.com!jfk3-feed1.news.algx.net!ord2-feed1.news.algx.net!allegiance!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Werner Schuster Newsgroups: comp.soft-sys.math.mathematica Subject: Re: JLink and speeding up graphics display by java routine Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200209180609.CAA20424@smc.vnet.net> X-GC-Trace: gv1-mnUZlPbbx8gcPSiQvL5lV6csSf2mk2UxbciQOEWZQb5AMFSdc7H7Iz4HQ== NNTP-Posting-Date: Thu, 19 Sep 2002 02:31:16 CDT Lines: 83 X-Trace: sv3-1b7zPsoMBLcg5Xy7F6pKp5e72F/oe4mgErWaancypCf0oaju8uJ3iXdh4aaFDBHGqbYhfGtoTHEpVpl!kNYsOuvgDnCLlvxHOftBn475LkZ6AKs6wE/O6kFgX6COKbRg71x7YtX43R3v7L7QhCl/7P0= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:31:16 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35226 Blimbaum Jerry DLPC wrote: > Map[(obj = drawMembrane[#]; > drawArea@setMathCommand["obj"]; > drawArea@repaintNow[]; > Pause[.0001];) &, t ] This is the exact code you use? Maybe I am missing something here, but you seem to pass only the String "obj" to the setMathCommand method, not the content of the obj variable; > public class My_DisplayGraphicsViaJava { > public void displayGraphics(String cmds[]) { > for (int i = 0; i < cmds.length-1; i++) > drawArea.setMathCommand(cmds[i]); > drawArea.repaintNow(); > Thread.sleep(200);} } er... this won't work; you are using the drawArea variable, without ever declaring or assigning something to it! pff... hm... you could try this: import com.wolfram.jlink.MathCanvas; public class My_DisplayGraphicsViaJava { public static void displayGraphics(String cmds[], MathCanvas drawArea){ for (int i = 0; i < cmds.length-1; i++){ drawArea.setMathCommand(cmds[i]); drawArea.repaintNow(); Thread.sleep(200); } } } save this to a file called My_DisplayGraphicsViaJava.java and compile it. Put the class file in a directory that is in your CLASSPATH (or look up how the CLASSPATH works in J/Link 2.0 in the J/Link documentation, its properly explained there); If all that has worked, load the class: LoadJavaClass["My_DisplayGraphicsViaJava"]; then use the static method displayGraphics, by passing it the String array and the drawArea variablen (which is the MathCanvas object, you have instantiated in your Mathematica Notebook): My_DisplayGraphicsViaJava`displayGraphics[obj, drawArea]; obj being the String array (or string List in M_) that holds your Graphics Expressions (or what you want to show); > But needless to say this dont work....LoadJavaClass responds by saying Class > not Found.....so what should I do to correct this? Also , on the java > routine, was i supposed to add: Extends MathFrame, etc....how will my > java routine know what drawArea.setMathCommand is, etc..... > am I also supposed to compile my java routine? Yes! ... use the Java code I proposed above, that should at least compile properly; Place the compiled class file in a directory on your CLASSPATH (consult J/Link docu if you don't know about CLASSPATH) and then try the Mathematica code again. I hope this was not too confusing; I don't have a working Mathematica here, so I can't verify, if my proposed code would really work; there migth be typos/errors in my code. murphee From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!triton.net!smallfeed.triton.net!newsfeed.freenet.de!amsnews01.chello.com!news-hub.cableinet.net!blueyonder!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Blimbaum Jerry DLPC Newsgroups: comp.soft-sys.math.mathematica Subject: JLink and speeding up graphics display by java routine Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-wpugckoGFLlneuM3qF7WoXE3Dl9O8cXfuN3a/qWc+tACsywD5rzVdA/sA== NNTP-Posting-Date: Wed, 18 Sep 2002 01:12:04 CDT Lines: 47 X-Trace: sv3-n9T076S96RUkiGwfoyiflaYcs/pTDgboMPXfC6xN/CQ3bNkOVqE90MmSkqBSmjetlblMd4OcSXOYKhT!cvtM2EWrfwAA7fVKIwFlQEHJY+i4XhcPMqJOpY65RUjL+5AJMHPnfD6u9A== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Wed, 18 Sep 2002 06:12:04 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35197 I am trying to write an animation using JLink.....basically as follows...(using Mathematica 4.1, JLink 2.01 and java 1.4.1)... frm = createWindow[]; (* basically to create a MathFrame and a drawArea = MathCanvas *) Here is my drawing routine.... Map[(obj = drawMembrane[#]; drawArea@setMathCommand["obj"]; drawArea@repaintNow[]; Pause[.0001];) &, t ] t = time list ={0,.25,etc}.... and drawMembrane is a function that uses the time value to make a graphics plot......unfortunately, this routine draws the next time plot very slowly, plus I also notice that without the Pause[] statement, Mathematica only draws the graph for the final time value... Following an example in the JLink documentation, I have written the following java routine....which I saved in the same dir as MathFrame, etc.... public class My_DisplayGraphicsViaJava { public void displayGraphics(String cmds[]) { // declare String Array for Graphics Objects for (int i = 0; i < cmds.length-1; i++) drawArea.setMathCommand(cmds[i]); drawArea.repaintNow(); Thread.sleep(200);} } and then in Mathematica I have LoadJavaClass["My_DisplayGraphicsViaJava"]; My_DisplayGraphicsViaJava`displayGraphics["obj"]; (* where obj is the array of Graphics plots created *) But needless to say this dont work....LoadJavaClass responds by saying Class not Found.....so what should I do to correct this? Also , on the java routine, was i supposed to add: Extends MathFrame, etc....how will my java routine know what drawArea.setMathCommand is, etc.....am I also supposed to compile my java routine? thanks....jerry blimbaum NSWC panama city, fl From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!dca6-feed1.news.algx.net!ord2-feed1.news.algx.net!allegiance!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Juan Egea Garcia Newsgroups: comp.soft-sys.math.mathematica Subject: the meaning of a exponential plot in the negative region Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-5+fLEN46mqfRtja1cK/kX8w17PVI+W8YEfL+s8ghaFtEkJu0OUbCHILZw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:32:18 CDT Lines: 19 X-Trace: sv3-Vwnwz22JdtYQ+L4Z1MInpdVp8GfKnWtTr6nC0jgVEhxQB3dA58CynVJFsvNNLe/KyRpVkeigRcJbbHv!pN3hejInvnDP5J9+axsSA6ybBJR22otQ8ji2ew9XIDAslM43Nd+4nl8Whg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:32:18 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35227 Dear colleagues, I'm trying to plot the next exponential function Plot[Exp[1/(Abs[x-1]-Abs[x-2])],Range] If the Range is positive there aren´t problems. However if the Range is negative Mathematica plots a strange beast... Have anyone found anything of this sort? I would apreciate to know how to resolve this problem. Thanks in advance, best regards, Juan Egea Garcia Bullas - Murcia - España From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newscon07.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Erich Mueller Newsgroups: comp.soft-sys.math.mathematica Subject: Re: the meaning of a exponential plot in the negative region Organization: Ohio State University Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: X-GC-Trace: gv1-JOv0Azm/gwM6fQR9noquuJvXAWxNuRxtg3AM81T/Yl50zvtd1BWCz0WQg== NNTP-Posting-Date: Fri, 20 Sep 2002 03:16:17 CDT Lines: 31 X-Trace: sv3-GpHcnNApq+jt9acVqCLnV0gR2gB7l6RTRbyoTFJ27CWoz5VGTBmH1s8w6oGMOG1PjQP6vlyNWO3LCu4!h8j9lX/tAQttoA+DXobpXnzhcLZ2VO/eAB2b3rn7MUSiVHq4LD8sXW/bzA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:16:17 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35255 The function you are plotting is constant for negative x. You might want to specify a plotrange, such as PlotRange->{0,2}, or Mathematica may try to zoom in on the line and show you a picture of numerical noise. Erich On Thu, 19 Sep 2002, Juan Egea Garcia wrote: > Dear colleagues, > > I'm trying to plot the next exponential function > > Plot[Exp[1/(Abs[x-1]-Abs[x-2])],Range] > > If the Range is positive there aren´t problems. However if the Range is > negative Mathematica plots a strange beast... > > Have anyone found anything of this sort? I would apreciate to know how to > resolve this problem. > > Thanks in advance, best regards, > > > Juan Egea Garcia > Bullas - Murcia - España > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newshosting.com!news-xfer1.atl.newshosting.com!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Reinhard Oldenburg Newsgroups: comp.soft-sys.math.mathematica Subject: DAEs with Mathematica Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-YxWfbYaLVdY6rHRTEX33WDBRXcUI7UQ5HeIqwndWBGHLMEhFp4eCIU2RQ== NNTP-Posting-Date: Thu, 19 Sep 2002 02:36:28 CDT Lines: 21 X-Trace: sv3-4PXvI4uIbMlPfjkvd3/8fDaz9vP9k8xRS3Rn9VSnDrBCviEUYpnjSeLGy2Wp/x04SxkytbdY/1T+hhM!BNtl+XdGoCI1VVqdGdPtyajpaG1CVtIfRu8YfjLJXh/gRqREHzWq9d96yUE= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:36:28 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35231 I need to solve algebraic-differential-equations (some of index 1, maybe some of higher index as well) from within Mathematica 4.2. Is there an implementation of numerical (like DASSL) or symbolic algorithms capable of doing that around? I know that some numerical software systems which may have DASSL-routines that do what I want. Has anybody suggestions on which of these systems is easy to interface with Mathematica? Is there a C++ library that contains such routines and can be interfaced with Mathematica? Yours, Reinhard Oldenburg From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.telusplanet.net!snoopy.risq.qc.ca!newsfeed.news2me.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Matthias.Bode@oppenheim.de Newsgroups: comp.soft-sys.math.mathematica Subject: Ball Rolling down on Cosh[t] Path Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-R239AgwsMGGjTMHuVrE/s2O7dv0Z6uZPxxsll9PKDyr33Ouv18Vmt1DZQ== NNTP-Posting-Date: Thu, 19 Sep 2002 02:38:34 CDT Lines: 28 X-Trace: sv3-SPJBLeaF+r90b69yHJtvs/KrMn1W+O7TkVQB2BLojnG/s53RvRXy0/wim+r8D6U/3pJC/h/26vktIYt!a2d4FP0i2apQpPij4Q8AiXIdzM8BGGsHv2YYgqTvvE2N84ODzuILBwk3hwA= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:38:34 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35233 Dear Colleagues, I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my means. Thank you for your consideration, Matthias Bode Sal. Oppenheim jr. & Cie. KGaA Koenigsberger Strasse 29 D-60487 Frankfurt am Main GERMANY Tel.: +49(0)69 71 34 53 80 Mobile: +49(0)172 6 74 95 77 Fax: +49(0)69 71 34 95 380 E-mail: matthias.bode@oppenheim.de Internet: http://www.oppenheim.de From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!howland.erols.net!cyclone-sf.pbi.net!216.166.71.10!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Resetting after SetOptions Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-DA52lkBnZNwtPotlYqQLUHDcbxohhi9j2TxybFUSg9Ie8j4cF01n30a/g== NNTP-Posting-Date: Thu, 19 Sep 2002 02:42:43 CDT Lines: 31 X-Trace: sv3-01H86ZTEzoKQpq8b9X3iA5kWtv3BgZK9gVgtf4vB/RDEwfdt7jod/Ad7d2TRLassUSTc3OW1KX/G2t7!Wv803L8g/QFbWiokppymLdHFi25HP3l+4tok32uTZmOLOzfSKON3tPeNAhs= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:42:43 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35237 David, There is no command such as RestoreDefaults. But you can do the following: saveGraphics3DOptions = Options[Graphics3D]; SetOptions[Graphics3D, Boxed -> False]; (say) Make your plots. SetOptions[Graphics3D, Sequence @@ saveGraphics3DOptions]; The example in the Help for SetOptions shows a similar example. My own personal preference would be to not change the Graphics3D options, but to add the option change to the plot itself. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: David Sagan [mailto:dcs16@cornell.DeleteThis.edu] Help! After using SetOptions[Graphics3D, ...] I am trying to set the default options of Graphics3D back to what they were when I started up Mathematica. I cannot find a command to do this. Is this possible? -- Thanks for any help, David Sagan From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!triton.net!smallfeed.triton.net!newsfeed.vmunix.org!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: Peter Abilla Newsgroups: comp.soft-sys.math.mathematica Subject: ShowLegend Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: NNTP-Posting-Date: Thu, 19 Sep 2002 02:43:46 CDT Lines: 27 X-Trace: sv3-tN1kvEk0s/cbOY2/0ROI4LBc9bmIoJpvXl+MLYfsSBBzqh6cpoYmnXiqOTb2oxlIiC617pMocIMgwAQ!ScI+j5atj7rpuk9hRTUzn9z9QxKeFFvWmJKvgQvoGfCzu26UpWkL3EyfPCmfy5ZCFA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:43:46 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35238 I have the following code and am trying to include a legend. The BarChart appears, but with no legend. I have followed the 'help files', but I think I'm missing something. In my code, SortTime and SessTime are value pairs. Photog is a string array containing labels. /* *Begin code here */ ShowLegend[BarChart[SortTime, SessTime, BarSpacing -> -.3,, BarGroupSpacing -> .5, BarLabels -> Photog, BarStyle -> {RGBColor[1, 0, 0], RGBColor[0.5, 0.5, 1]}, PlotLabel -> "Photographer Time" , DefaultFont -> {"Helvetica", 9}], {{{RGBColor[1, 0, 0], "Sort Time" }, {RGBColor[0.5, 0.5, 1], "Session Time" }}, LegendLabel -> "Mean Time"}] pete From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!proxad.net!proxad.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Q: argmax Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: NNTP-Posting-Date: Thu, 19 Sep 2002 02:44:50 CDT Lines: 46 X-Trace: sv3-cHi1a3lu2LEq0fvAVaQf89tw9FVD7oYJcMJ085KNchir63uuie2HYsDSyFxCBkUxvciHMo5CWbgkdzc!trzelOYtDPVMRtUUKYSkY4QgD8MGM4qkKqBI4HjqU4LaM6wfC3zIpli9rawDdwlR5Q== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:44:50 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35239 How's this: maxima[f_, x_List] := Last@Sort@({f[#], #} & /@ x) maxima[Sin,Range[0,2Pi,0.1]] {0.999574,1.6} That gives you both f[x] and x at the maximum. Bobby Treat -----Original Message----- From: Jason Miller [mailto:millerj@truman.edu] Subject: Q: argmax I never liked the function, but now I have need of it. I hope someone can help me see the way to implement it. For a class I am teaching I want to write a simple function that does a random search for a function's maxima. I feed the function N randomly generated inputs and look at the outputs. Provided N is large enough, the largest of the outputs I obtain should be near the function's maximum value. What I want to be able to do is to identify the input that gave me that largest output. Any ideas? My only idea is this: create a table of pairs {output, input{ and find the element of the table that has the largest first entry. This will give me the input I seek. Is there a slick way of doing this in mathematica? -- 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 From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!smallfeed.triton.net!triton.net!newsfeeder.triton.net!ord2-feed1.news.algx.net!allegiance!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Converting Between Bases Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-8FaK28K6cqsd8bJH48Typ/kF/4LB60KLcrcV6KslxTdBRW24i0spcunnw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:45:53 CDT Lines: 54 X-Trace: sv3-s4Mh75gmW3ozIXcxtQ8h6tlw/MwR2A6fYQg08xYeWWT0aNRV1iEnzQwzeYyX2RnV/WsfDeTzzWJGOCj!cHeeRq8hseUItNfOBIkEeZzubre/I9JgD1AZZryVH402zAiYzMzUKpgj9g== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:45:53 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35240 Start with IntegerDigits and FromDigits. A key issue is what form you want base 12 numbers, for instance, stored in -- a List of digits? A character string? A list of digits, highest power to lowest, is easy to handle: ClearAll[convertBase] convertBase[(from_Integer)? (#1 > 1 & ), (to_Integer)?(#1 > 1 & ), n:{_Integer..}] /; Max[n] < from := IntegerDigits[FromDigits[n, from], to] convertBase[5, 3, {1, 2}] {2, 1} Bobby Treat -----Original Message----- From: flip [mailto:flip_alpha@safebunch.com] Subject: Converting Between Bases Hello, I was looking for a function that can convert numbers between bases. For example, going from Base 3 to Base 9, or from Base 16 to Base 8. It seems like I have to a few steps and then use BaseForm to convert to the desired end base. Is there a single command or simple function to do such conversions? For example, ConvertBase[from_, to_, num_] would convert from base to base 9 using the number num as the number to convert (it would best be allowed to let users input in that specific base since they'd be going from base 3 to base 9, for example so maybe num is needed at all). Thank you, Flip From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!howland.erols.net!nntp-out.news.gblx.net.MISMATCH!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Y.A.Tesiram" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Front end proble in Linux Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-7YxOWXSyRljYzf+IwJbC/rR/M2+vvE3U2AlY+fO6Ef1v0lzBW6rLklzDg== NNTP-Posting-Date: Thu, 19 Sep 2002 02:47:57 CDT Lines: 37 X-Trace: sv3-lEHNJIfQo9oev5W+1PAz4PsZlgtYRIUotNaJJFTxxsIglc9gs6QvUKyImlb5SEQ0RIJGnscMn+wruc/!Ksaqgoh4kRXRsrVz0WD5xYOi0IPCeLO4B5pb8lo1KVYOHr5DFA91XWaS0w== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:47:57 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35242 This came up some time ago. Can't remember exactly what my reply was but I discovered later that it is because the number lock is on. Turn it off and the hand will disappear. May even fix the back space trouble. Yas On Wed, 18 Sep 2002, Cesar Guerra wrote: > Hi math group, > I don't have any idea about how to solve next problem. > Thanks in advance for any hints... > > Back space key when I am in the front end don't work > correctly. It advances instead of go back and there is > no way to erase something I wrote in the notebook. The > pointer mark of the mouse looks like a hand instead > of an arrow, and this don't work fine too. > Is it a Mathematica Configuration problem or a Linux > Configuration one? How can I solve this? > Note: This problem seems to appear just in my > workspace > i mean this not happen for other users. > I used Mathematica 4.1 for Linux Red hat 7.0 > > Regards, > Cesar. > > > __________________________________________________ > Do you Yahoo!? > Yahoo! News - Today's headlines > http://news.yahoo.com > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.stealth.net!news.stealth.net!telocity-west!TELOCITY!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Re: creating adjacency matrices Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-IhGmVkNhxJ8UNdDMfS6zV373i7PQpiTSTV+MhmNQq+fXB+RzyOB3lGksQ== NNTP-Posting-Date: Thu, 19 Sep 2002 02:49:00 CDT Lines: 116 X-Trace: sv3-u5crW0h1IIFl+Um73nX69+66a+RNitKfmfG+SFrnbbw4igbOhHgvH1SMYqgS8HD9Fr5ZB8N0VAHFtHO!OjEPosKAR/EemnXMD31n0znXeg4+6hwUzBoeF0hN3dphDaTQ8xiPNa0T9BHl4JBDILoeyi0= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:49:01 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35243 I believe that's not the adjacency matrix Thomas asked for. It doesn't have zeroes on the diagonal (it isn't square) and it doesn't have ones to indicate that two actors are associated with the same event. Instead, it shows connections between actors and events, which is actually more useful, as I'll demonstrate. (In addition -- though it doesn't really matter -- Jens-Peer switched the 'actors' and 'events' nomenclature within the function.) If you multiply it by its transpose, you get something else that's useful: 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 the diagonal, it shows the total number of events each actor is connected to. 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----- From: Jens-Peer Kuska [mailto:kuska@informatik.uni-leipzig.de] Subject: Re: creating adjacency matrices Hi, with In[]:=lst = {{1, A}, {1, B}, {2 , B}, {3, C}, {3, D}, {1, D}}; and In[]:= 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 get In[]:=AdjacenceMatrix[lst] Out[]={{1, 1, 0, 1}, {0, 1, 0, 0}, {0, 0, 1, 1}} Regards Jens "Moliterno, Thomas" wrote: > > I need to create an adjacency matrix from my data, which is currently in > 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 is to > 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 I can't > seem to get it to work ... > > Thanks to any and all in advance. > > Tom > > ********************************************** > Thomas P. Moliterno > Graduate School of Management > University of California, Irvine > tmoliter@uci.edu > ********************************************** From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!prodigy.com!enews.sgi.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Inv.Interpol.Function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-b4RHZdp6zuNQujzv0U1pDN06CoH+hvH1XXyPz9VLD3+ayVJUq6VuPU8cw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:51:07 CDT Lines: 51 X-Trace: sv3-Xa9q1//Qq/wS2U1UKg3ge66/V0pMGyawSsWEUkLWaAMK3ptri2K1V6N0JeW+nIu2vqetPRK9c2O8OnQ!4bLEBSi7BcAaRGJ/J0dXSObQ40UBBpz6j2GcXf5jAQ01b1JOXBGhE8IxXssNkCqSJnyf9KY= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:51:07 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35245 Maybe this will help. I had to do some guessing, and I fabricated my own R function (r). I never start user-defined symbols with capital letters. ClearAll[r] t = Pi/2.; r = Interpolation[{#, Abs@Cos@#} & /@ Range[0, N@t, Pi/100.]]; y[z_] := NIntegrate[r[x]^4, {x, 0, z}] Timing[yInverse = Interpolation[{y[#], #} & /@ Range[0, N@t, Pi/100.]];] {0.030999999999998806*Second, Null} a = NIntegrate[r[yInverse[z]*Cos[z]], {z, 0, y[t]}]/y[t] 0.9249048118568042 Bobby Treat -----Original Message----- From: martin skogstad [mailto:martinskogstad@hotmail.com] Subject: Inv.Interpol.Function Dear NG Mabye this is too simple, but I cant just figure it out I want to get an inverse function for y[t] where y[t_]:=NIntegrate[R[x]^4,{x,0,t}] /. ndsolution[[1]] and R[t] is an interpolatingfunction(R>0 from NDSolve) on the interval 0= Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Drawing an ellipse Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-uPcBAqxe2sOKlowYDmKJfzbBOLhv7jmWxMGdM4eoBeLHmG2sqPeljFSoA== NNTP-Posting-Date: Thu, 19 Sep 2002 02:52:10 CDT Lines: 61 X-Trace: sv3-5ODCn1izFpdtILwgT4D8Fq1tISdieKKDj/XWDnRXxXTkmyC3dPjKMQvfEWz/SMRo/jnG/egmjLRWXOx!XWCAviIdIyhZWq/qDjBJeGfk//82Cb3t3hAuoD2EmOU1n5dFdOY4KxhoLQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:52:10 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35246 << "Graphics`ImplicitPlot`" eqn = 0.09*x^2 + 0.04*x*y + 0.06*y^2 == 4; maxX = 1.1*Sqrt[4/0.09]; ImplicitPlot[eqn, {x, -maxX, maxX}]; You could also use ParametricPlot: polarEqn = eqn /. {x -> r Sin[t], y -> r Cos[t]} radius[t_] = r /. Last@Solve[polarEqn, r] ParametricPlot[radius[x]{Cos[x], Sin[x]}, {x, 0, 2Pi}, AspectRatio -> 1]; I tried and failed with InequalityGraphics: << Graphics`InequalityGraphics` InequalityPlot[{LessEqual @@ eqn}, {x, -xMax, xMax}, {y, -yMax, yMax}] InequalityPlot::region:The region defined by \[LeftSkeleton]1\[RightSkeleton] could not be broken down into cylinders. InequalityPlot[ 0.09*x^2 + 0.04*x*y + 0.06*y^2 <= 4, {x, -xMax, xMax}, {y, -yMax, yMax}] Plot can be used very neatly, if you first figure out the true extent of the x-values: positiveX[y_] = x /. Last@Solve[eqn, x] Solve[positiveX'[y] == 0] xMax = First@(positiveX[y] /. %) Plot[Evaluate[y /. Solve[eqn, y]], {x, -xMax, xMax}, AspectRatio -> 1]; Bobby Treat -----Original Message----- From: pimak [mailto:piotrowski.maciek@interia.pl] Subject: Drawing an ellipse Hello, I am new with Mathematica, I have one question, I know that the sollution might be very easy, but I wasn't able to find it by now. I would like to draw an ellipse, the formula let's say is as follows: 0.09 x^2 +0.04 x y + 0.06 y^2 = 4 Thanks Maciej From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.cwix.com!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!wanadoo.fr!proxad.net!proxad.net!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Invert a function Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: NNTP-Posting-Date: Thu, 19 Sep 2002 02:53:12 CDT Lines: 46 X-Trace: sv3-5D1FEMFrQg1qQaaGQlizx+sZYcXS++CuQvzd92+H0C4YnY09n/oh4dIxujwP4RezPQIg7QZNTWocInZ!7bzJTHiKn7KktWj3L1e8sOgddSjPkLmIEP//YTiMKkgBzZiR2AOh2rjsUCx6dCDnlg== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:53:12 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35247 That function isn't easily inverted and, in fact, has no inverse unless you limit the range of h. In this plot, for instance, you see that the same f[h] values are taken on for two different values of h: Plot[f@h /. {a -> 3, b -> 0.2}, {h, 0, 10}] The peak of the graph depends on the parameters a and b, so the domain of an inverse (if it exists) also depends on a and b. That's exactly the kind of situation Solve can't handle. For specific a, b and y, FindRoot can find h for you: FindRoot[Evaluate[f[h] == 1 /. {a -> 3, b -> 0.2}], {h, 2}] {h -> 1.799292219454869} FindRoot[Evaluate[f[h] == 1 /. {a -> 3, b -> 0.2}], {h, 0.5}] {h -> 0.5654110956582447} Bobby Treat -----Original Message----- From: Raj [mailto:rajgupta121@rediffmail.com] Subject: Invert a function Hi Everybody, How can I invert a funcion? For example In:=f[h_]:=Exp[-h](a*h+b*h^2); I want to invert it as h as a function of f How can I do that? Please suggest. Raj From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!nntp-relay.ihug.net!ihug.co.nz!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: empirical CDF Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: X-GC-Trace: gv1-nU9u/VUq5gu+MpXiz3lC/SGbDd9v/G92JAT4f9TQR+LaVhEVGRhKWQlZw== NNTP-Posting-Date: Thu, 19 Sep 2002 02:54:14 CDT Lines: 64 X-Trace: sv3-dJppNZoO+bkaWw7GIG9V/nK69sjBzDzHGrV3OlKuKBM1L8xL6xAE7uYdyUUhjaCMehtKPyPtfsgOadR!ZGPdPT41zMZOuTOAZxQgNEViJQUo2YJi55ClzQVG8rws5SBecDdc/G29aoY= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Thu, 19 Sep 2002 07:54:14 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35248 I'd say the applet demonstrates that histograms are useless unless we choose a pretty small bin-width. Choosing a bin-width of significant size that doesn't yield a misleading histogram is an unlikely accident. Bobby -----Original Message----- From: Blimbaum Jerry DLPC [mailto:BlimbaumJE@ncsc.navy.mil] Sent: Wednesday, September 18, 2002 1:10 AM Subject: empirical CDF There is a very nice java applet at http://statman.stat.sc.edu/~west/javahtml/classes/ , in which you can include your own data by replacing what is in the Applet with your own, which gives you a real time histogram plot and lets you alter the bin width and see how this effects the histogram....it wasnt until I saw this that i understood the significance of choosing the bin width......jerry blimbaum -----Original Message----- From: Bill Rowe [mailto:listuser@earthlink.net] Subject: empirical CDF On 9/13/02 at 11:33 PM, swidrygiello@wp.pl (Swidrygiello) wrote: >Does anybody know how to calculate in Mathematica: >a)empirical CDF, >b)empirical PDF, >c)normal QQ-plot; >d)QQ-plot two different random samples?! Yes, but there are a number of issues particularly with an empirical PDF. A very nice package that does all of the above and more is mathStatica. See http://www.mathstatica.com for details. Obviously, it is less expensive to write your own functions. Just recently in message Mark Fisher posted code that addresses the empirical CDF. However, in this code you may want to replace 1/n with 1/(n+1) or (j-0.5)/n depending on your application. Note, these will have no significant effect for large data sets. The key issue with an empirical PDF is deciding the bin width. A simple approach would be to use the functions in Statistics`DataManipulation` and Graphics`Graphics`. Look at the functions Histogram, Frequencies and BinListCounts. More sophisticated approaches involve kernel methods. These methods will generate smoother estimates for the PDF. Again, the key is bandwidth. There is no apriori choice for bin width or bandwith. Bad choices will obscure significant features in the data set. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!west.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin2.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Tom Burton Newsgroups: comp.soft-sys.math.mathematica Subject: Re: build-in commutativity Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-tizNtD7HS+ZvbcLosCnHpNmRMCefC1wW0voduViS29yv1VlEtU/yQn6pw== NNTP-Posting-Date: Fri, 20 Sep 2002 03:13:11 CDT Lines: 15 X-Trace: sv3-ISyve7YCQQv97DCBI51ZXgkelXtyEK1YQS+mUexERFhgZy3ZrFVhqkxunn4m/TD1SS2V/8UeLIXAcXS!U7+EzElGJ6mBGVeT6ohJksX1gA5VNiFrFktp6g+OtdGqwFwgyppj/AjsEQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:13:11 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35252 Hello, On 9/19/02 12:21 AM, in article ambu72$qst$1@smc.vnet.net, "Evgeni Trifonov" wrote: > I'm curious, why the built-in boolean functions "And" and "Or" > aren't commutative? The on-line help explains why. (Look up And or Or and then link A.4.2.) You are assured that the argments of And or Or are evaluated left to right, stopping on the first False (for And) or True (for Or). Tom Burton From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.frii.net!newsfeed.frii.net!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "DrBob" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: empirical CDF Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: NNTP-Posting-Date: Fri, 20 Sep 2002 03:14:13 CDT Lines: 84 X-Trace: sv3-JTGVrYR1oKJWzLc+zqX6GOCKLKTSiZrtilm+894St07mESIASRW7+84RPIhtsExqf4+8vY8yswp+Eb3!QcPrSJsEiOetrCFsZBLp34SGPBe71H6pW7ejxnMc5QMTVVoaEMAbWIVXDGNhQ7nlDA== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:14:13 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35253 True, but in this case, excitement means being misled far too often. I've never favored histograms much, except when there are lots of bars and little apparent noise. Otherwise, unless you're very lucky, a histogram doesn't even locate the mode well. Bobby Treat -----Original Message----- From: Blimbaum Jerry DLPC [mailto:BlimbaumJE@ncsc.navy.mil] Subject: RE: empirical CDF "Unlikely accidents", I think, are sometimes the most exciting part of science...jerry -----Original Message----- From: DrBob [mailto:drbob@bigfoot.com] Subject: RE: empirical CDF I'd say the applet demonstrates that histograms are useless unless we choose a pretty small bin-width. Choosing a bin-width of significant size that doesn't yield a misleading histogram is an unlikely accident. Bobby -----Original Message----- From: Blimbaum Jerry DLPC [mailto:BlimbaumJE@ncsc.navy.mil] Subject: empirical CDF There is a very nice java applet at http://statman.stat.sc.edu/~west/javahtml/classes/ , in which you can include your own data by replacing what is in the Applet with your own, which gives you a real time histogram plot and lets you alter the bin width and see how this effects the histogram....it wasnt until I saw this that i understood the significance of choosing the bin width......jerry blimbaum -----Original Message----- From: Bill Rowe [mailto:listuser@earthlink.net] Subject: empirical CDF On 9/13/02 at 11:33 PM, swidrygiello@wp.pl (Swidrygiello) wrote: >Does anybody know how to calculate in Mathematica: >a)empirical CDF, >b)empirical PDF, >c)normal QQ-plot; >d)QQ-plot two different random samples?! Yes, but there are a number of issues particularly with an empirical PDF. A very nice package that does all of the above and more is mathStatica. See http://www.mathstatica.com for details. Obviously, it is less expensive to write your own functions. Just recently in message Mark Fisher posted code that addresses the empirical CDF. However, in this code you may want to replace 1/n with 1/(n+1) or (j-0.5)/n depending on your application. Note, these will have no significant effect for large data sets. The key issue with an empirical PDF is deciding the bin width. A simple approach would be to use the functions in Statistics`DataManipulation` and Graphics`Graphics`. Look at the functions Histogram, Frequencies and BinListCounts. More sophisticated approaches involve kernel methods. These methods will generate smoother estimates for the PDF. Again, the key is bandwidth. There is no apriori choice for bin width or bandwith. Bad choices will obscure significant features in the data set. From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.zip.com.au!news.stealth.net!news.stealth.net!central.cox.net!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!not-for-mail From: zeno Newsgroups: comp.soft-sys.math.mathematica Subject: Could someone verify a long Pi calculation in Version 4 for me? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-Ov836PHmHl9KkaW94IP+m63UDTeZgCyYw08ldIPLnoK/G2HgVKX8bCrNQ== NNTP-Posting-Date: Fri, 20 Sep 2002 03:20:26 CDT Lines: 9 X-Trace: sv3-byGZKh41UoTEDPig/FjM2hxB5cX/9ld45qtP9yBuL+dLv9Y9amLe/EDRw5KUuhdTsEPUVlLeb+JecKc!9Sj8QeWUX4unkc5e8L1lgBZQxYW09lvxtnsbaXWTTT0hMds+Q7CxMMFtPSSl4eC+zvWRaD8= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:20:26 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35258 Could someone calculate the number Pi to 67,108,864 (2^26) decimal places for me in Version 4 and post here or email me the last 20 digits or so. I would do it but I only have Version 3 and it would take way to long.. I made the calculation in another program and would like to verify its results. Thanks so much... From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!newsfeed.nyu.edu!newsfeed.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.stealth.net!news.stealth.net!news.infoave.net!newsfeed1.easynews.com!easynews.com!easynews!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POSTED!not-for-mail From: Todd Gayley Newsgroups: comp.soft-sys.math.mathematica Subject: Re: JLink and speeding up graphics display by java routine Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-7YxOWXSyRljYzf+IwJbC/rR/M2+vvE3U2AlY+fO6Ef1v0lzBW6rLklzDg== NNTP-Posting-Date: Fri, 20 Sep 2002 03:19:23 CDT Lines: 107 X-Trace: sv3-7I5pegThZFVJZpZ2ti/AYk1Zs1sjzKs9eHggCGHIAQOLwqAMF/qDRwbVV1M+trIjwIuSFnE2f+AtXKU!8/z+FwvQal5ZuluVNpyXapuE+yu9xVACNQn3aV5JaUQCfS68rmtVUEBnE1HbHlnNf1XMwOs= X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:19:23 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35259 At 01:09 AM 9/18/02, Blimbaum Jerry DLPC wrote: >I am trying to write an animation using JLink.....basically as >follows...(using Mathematica 4.1, JLink 2.01 and java 1.4.1)... > >frm = createWindow[]; (* basically to create a MathFrame and a drawArea >= MathCanvas *) > >Here is my drawing routine.... > > Map[(obj = drawMembrane[#]; >drawArea@setMathCommand["obj"]; > drawArea@repaintNow[]; > Pause[.0001];) &, t ] > >t = time list ={0,.25,etc}.... and drawMembrane is a function that uses the >time value to make a graphics plot......unfortunately, this routine draws >the next time plot very slowly, plus I also notice that without the Pause[] >statement, Mathematica only draws the graph for the final time value... Jerry, You did a nice job with this "one-frame-at-a-time plot". (I'm replying here to this message and your previous one where you presented the full code.) The main reason that it is slow drawing the frames is that the Pause[] function only works with integer second intervals. If you say Pause[.0001] it pauses for a whole second, which inserts a 1-second delay between each frame. If I take out the Pause, I get about 5 frames per second on my laptop (for your Sin plot). This still seems slow to me, but it turns out that Java is just slow at taking GIF data and making it into pixels to be displayed. That step consumes virtually all the time for the animation. If you make the image smaller, the animation runs much faster. Try making your window size 400 x 300 instead of 800 x 600. At that size, the animation runs at a good speed on my machine. If you want to insert a delay between frames, you need to use Java instead of calling Pause[]: LoadJavaClass["java.lang.Thread"]; Map[(obj = drawMembrane[#]; drawArea@setMathCommand["obj"]; drawArea@repaintNow[]; (* Add a 100 ms delay *) Thread`sleep[100];) &, t ] You said that without the Pause[] you only get the last frame drawn, but that shouldn't have any effect. Perhaps you took out the call to repaintNow() along with the Pause? >Following an example in the JLink documentation, I have written the >following java routine....which I saved in the same dir as MathFrame, >etc.... > > >public class My_DisplayGraphicsViaJava { > public void displayGraphics(String cmds[]) { // declare String Array >for Graphics Objects > for (int i = 0; i < cmds.length-1; i++) > drawArea.setMathCommand(cmds[i]); > drawArea.repaintNow(); > Thread.sleep(200);} } > > >and then in Mathematica I have > > LoadJavaClass["My_DisplayGraphicsViaJava"]; >My_DisplayGraphicsViaJava`displayGraphics["obj"]; (* where obj is the >array of Graphics plots created *) > > >But needless to say this dont work....LoadJavaClass responds by saying Class >not Found.....so what should I do to correct this? Also , on the java >routine, was i supposed to add: Extends MathFrame, etc....how will my >java routine know what drawArea.setMathCommand is, etc.....am I also >supposed to compile my java routine? You will definitely need to compile any Java classes you write! But writing this in Java won't change anything because the delay is in Java itself, not in J/Link or the MathLink communication. This Java class would need a lot of work before it would compile. You would need to either create drawArea in the Java class rather than in Mathematica code, or pass it as an argument to displayGraphics() (which needs to be static, by the way). Anyway, there is no point in thinking about any of that, since this displayGraphics() method just duplicates functionality that you have already (much more conveniently) scripted in Mathematica code. One final general note for J/Link programmers: It's OK to create Java names with underscores in them, but you have to remember how they are handled in Mathematica. When you refer to a Java name in Mathematica code as a string, you keep the underscore: LoadJavaClass["My_DisplayGraphicsViaJava"]; But when a name appears as a symbol in Mathematica, J/Link maps it to a U because _ is not legal in a symbol name: MyUDisplayGraphicsViaJava`displayGraphics[....] It's often easiest to just avoid using _ in the names of Java classes and methods that you write for use with Mathematica. Todd Gayley Wolfram Research From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.maxwell.syr.edu!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Wolf, Hartmut" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: Drawing an ellipse Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: X-GC-Trace: gv1-0dSyct4LOMkm/MOCwynJOdxuptTN5cAdFtJ0jdguXXtfqVJr+8+HtnYVQ== NNTP-Posting-Date: Fri, 20 Sep 2002 03:21:28 CDT Lines: 63 X-Trace: sv3-lcl2JSdUoSB1UycdVuS8GSE3LlMQSbCVPs9suSvcZxot1Q9uLZlx/BvOsjo2ejarOVZpmcIj/PZCmaf!fLnl/zKU6Nfifau0o+immJtV3CSMvzsXv41DJDVkUg1UCYomtehp63F1Vw== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:21:28 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35260 >-----Original Message----- >From: pimak [mailto:piotrowski.maciek@interia.pl] >Sent: Wednesday, September 18, 2002 8:09 AM >Subject: Drawing an ellipse > > >Hello, >I am new with Mathematica, I have one question, >I know that the sollution might be very easy, but I wasn't able to >find it by now. >I would like to draw an ellipse, the formula let's say is as follows: > > > >0.09 x^2 +0.04 x y + 0.06 y^2 = 4 > >Thanks > >Maciej > > > Two methods: (1) solve for explit functions y = f[x] and plot those: In[2]:= eqn = 0.09 x^2 + 0.04 x y + 0.06 y^2 == 4 ... just for convenience; In[5]:= sols = Solve[eqn, y] In[6]:= y /. sols ...these are the two functions for y expressed by x. To find the minimum and maximum values for x, we spot the discriminant, and solve for x: In[12]:= {xmin, xmax} = x /. Solve[ Cases[y /. sols[[1]], Sqrt[disc_] :> disc, Infinity] == 0, x] ...now we may use Plot: In[18]:= Plot[Evaluate[y /. sols], {x, xmin, xmax}, AspectRatio -> Automatic] (2) guess approximate values for xmin, xmax and let Mathematica do all that work: In[1]:= << Graphics`ImplicitPlot` ...load the package In[19]:= ImplicitPlot[eqn, {x, -7, 7}] ...done. -- hw From ???@??? Fri Jan 01 00:00:00 1999 Path: newssvr05.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!nntp.flash.net!news.tele.dk!small.news.tele.dk!213.73.101.75!eusc.inter.net!newsfeed.freenet.de!newsfeed.stueberl.de!cox.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin3.nnrp.aus1.giganews.com.POSTED!smc.vnet.net!not-for-mail From: "flip" Newsgroups: comp.soft-sys.math.mathematica Subject: How to Properly Use Partition? Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: NNTP-Posting-Date: Fri, 20 Sep 2002 03:22:33 CDT Lines: 23 X-Trace: sv3-x1EQj2IkclwnJ8pDQ987teNJLDlnqt0c62e4AMpPf/d7l0GdrVsy5tw5Gi9/JuIPZvW52fj4IE4Anhp!HelK2cZiH3WEPeHXrD2OJJ11OUtGVsBfWSS2Z7YwUAWdX/OCG3iv9WITreIFG2xs9g== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Date: Fri, 20 Sep 2002 08:22:33 GMT Xref: newsmst01.news.prodigy.com comp.soft-sys.math.mathematica:35261 b = 2; r = 4; n = "10101111" p = Reverse[Characters[n]] {"1", "1", "1", "1", "0", "1", "0", "1"} z = Reverse[Partition[p, r]] {{"0", "1", "0", "1"}, {"1", "1", "1", "1"}} (* this is okay *) b = 2; r = 3; z = Reverse[Partition[p, r]] {{"1", "0", "1"}, {"1", "1", "1"}} (* this is wrong, want output to be {{0,1,0},{1,0,1},{1,1,1}}*) What I want is a function that takes a string as input, parses each character, partitions that to whatever length I want and Prepends zeros to the input as needed to create an appropriate length array. What is the correct syntax for Partition (or is there a better way?). Thanks, Flip Remove _alpha to email.