A15 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 := from], to] convertBase[5, 3, {1, 2}] {2, 1} Bobby Treat -----Original Message----- 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). ==== 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 > I don't have any idea about how to solve next problem. Back space key when I am in the front end don't work > correctly. It advances instead of go back and there is > pointer mark of the mouse looks like a hand instead > of an arrow, and this don't work fine too. > 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. Cesar. > __________________________________________________ > Do you Yahoo!? > Yahoo! News - Today's headlines > http://news.yahoo.com ==== 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----- 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}} Jens 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 ... > Tom ********************************************** > Thomas P. Moliterno > Graduate School of Management > University of California, Irvine > tmoliter@uci.edu > ********************************************** ==== 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----- 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 ==== << 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----- ==== 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----- ==== 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----- understood the significance of choosing the bin width......jerry blimbaum -----Original Message----- 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 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. ==== > 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 ==== 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----- Bobby -----Original Message----- blimbaum -----Original Message----- 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 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. ==== Could someone calculate the number Pi to 67,108,864 (2^26) decimal places I made the calculation in another program and would like to verify its ==== > Could someone calculate the number Pi to 67,108,864 (2^26) decimal places > I made the calculation in another program and would like to verify its Does it really matter what program is used to verify it? If not, here's the digits (computed with the fastest pi crunching program for a PC): 33863220896223409803 ==== >I 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 ==== >-----Original Message----- >Sent: Wednesday, September 18, 2002 8:09 AM >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 >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 ==== 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?). ==== > 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?). z = Reverse[Partition[p, r, r, {1,1}, 0] pads 0 on the right before partitioning. This doesn't completely do what you want because when you reverse, those digits are still on the right in the first element (i.e., they are appended instead of prepended. To have them prepended, just add z[[1]] = RotateRight[z[[1]], r Length[z] - Length[p]]; and z will have what you want. Here is an example with Range (easier to see what is happening) In[1]:= p = Range[8]; b = 2; r = 3; In[2]:= z = Reverse[Partition[p, r, r, {1, 1}, 0]] Out[2]= {{7, 8, 0}, {4, 5, 6}, {1, 2, 3}} In[3]:= z[[1]] = RotateRight[z[[1]], r Length[z] - Length[p]]; In[4]:= z Out[4]= {{0, 7, 8}, {4, 5, 6}, {1, 2, 3}} Rob Knapp > ==== Has anyone had any luck getting Mathematica 4.2 to work on a Sun running Solaris 6? I get the following error message when starting Mathematica: ./Mathematica ld.so.1: ./Mathematica: fatal: librt.so.1: open failed: No such file or directory Killed But math works. Any thoughts on this would be appreciated - even if it's just Solaris 6 sucks - Reinstall with Solaris 8/9. I'd rather not go to the trouble of reinstalling the box unless absolutely necessary (It is a 270mhz Ultra 5) -- Alex Dawson 08 9380 1587 School of Electrical, Electronic and Computer Engineering Systems Administrator http://www.ee.uwa.edu.au/~alex ==== > Has anyone had any luck getting Mathematica 4.2 to work > on a Sun running Solaris 6? I get the following error message when starting Mathematica: ./Mathematica > ld.so.1: ./Mathematica: fatal: librt.so.1: open failed: No such file or > directory > Killed But math works. Any thoughts on this would be appreciated - even if it's just > Solaris 6 sucks - Reinstall with Solaris 8/9. I'd rather not go to the > trouble of reinstalling the box unless absolutely necessary (It is a > 270mhz Ultra 5) I'd be tempted to run 'ldd' and see what libraries it needs. On my Solaris 9 box, with Mathematica 4.2 I see: wren /usr/local/stow/Mathematica-4.2/SystemFiles/FrontEnd/Binaries/Solaris % ldd ../Mathematica libXt.so.4 => /usr/lib/libXt.so.4 libXext.so.0 => /usr/lib/libXext.so.0 libXmu.so.4 => /usr/lib/libXmu.so.4 libX11.so.4 => /usr/lib/libX11.so.4 libnsl.so.1 => /usr/lib/libnsl.so.1 libsocket.so.1 => /usr/lib/libsocket.so.1 libc.so.1 => /usr/lib/libc.so.1 libucb.so.1 => /usr/ucblib/libucb.so.1 librt.so.1 => /usr/lib/librt.so.1 libpthread.so.1 => /usr/lib/libpthread.so.1 libSM.so.6 => /usr/lib/libSM.so.6 libICE.so.6 => /usr/lib/libICE.so.6 libm.so.1 => /usr/lib/libm.so.1 libdl.so.1 => /usr/lib/libdl.so.1 libmp.so.2 => /usr/lib/libmp.so.2 libelf.so.1 => /usr/lib/libelf.so.1 libaio.so.1 => /usr/lib/libaio.so.1 libmd5.so.1 => /usr/lib/libmd5.so.1 /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1 libthread.so.1 => /usr/lib/libthread.so.1 /usr/platform/SUNW,Ultra-60/lib/libmd5_psr.so.1 You should be able to find the libraries it's using, and hopefully it might just be looking in the wrong place, in which case you may be able to create a symbolic link. However, if Solaris 2.6 is not supported (I don't know if it is) it is quite possible it wants a library you don't have, in which case you are stuck unless you re-install a later OS. -- Dr. David Kirkby, Senior Research Fellow, Department of Medical Physics, University College London, 11-20 Capper St, London, WC1E 6JA. Internal telephone: ext 46408 ==== One of these days the company I work for will buy one Mathematica 4.2 versions of the product. window manager. Our Windows systems are running on top of VMWare in Windows XP Professional. In testing using an evaluation version I found that the VMWare/XP version is performing pretty well so that wouldn't be an issue. My main concern (and probably the grounds on which we will base our decision) is the quality of the front-end. The Windows frontend works flawlessly; however, in test-driving earlier versions of Mathematica (3.0 satisfactorily. I didn't spend much time to hunt down the source of the problem, but it is probable that some X key-mapping was wrong making, for example, keyboard shortcuts for 'Copy' and 'Paste' malfunctioning. On the Windows frontend. to full satisfaction? I'd be willing to spend a couple of hours to fix some settings, but only if I'm sure it could be done. The bottom line is that I I not if that would mean putting up with a quircky front-end. Sidney Cadot ==== > One of these days the company I work for will buy one Mathematica 4.2 > versions of the product. window manager. Our Windows systems are running on top of VMWare in Windows > XP Professional. > In testing using an evaluation version I found that the VMWare/XP version is > performing pretty well so that wouldn't be an issue. My main concern (and probably the grounds on which we will base our > decision) is the quality of the front-end. The Windows frontend works > flawlessly; however, in test-driving earlier versions of Mathematica (3.0 > satisfactorily. I didn't spend much time to hunt down the source of the > problem, but it is probable that some X key-mapping was wrong making, for > example, keyboard shortcuts for 'Copy' and 'Paste' malfunctioning. On the > Windows frontend. to full satisfaction? I'd be willing to spend a couple of hours to fix some > settings, but only if I'm sure it could be done. The bottom line is that I I > not if that would mean putting up with a quircky front-end. For what it is worth, I have no problems with the front end under Solaris - another varient of Unix. -- Dr. David Kirkby PhD, web page: http://www.david-kirkby.co.uk Amateur radio callsign: G8WRB ==== >> One of these days the company I work for will buy one Mathematica 4.2 >> Windows versions of the product. >> window manager. Our Windows systems are running on top of VMWare in >> Windows XP Professional. >> In testing using an evaluation version I found that the VMWare/XP version >> is performing pretty well so that wouldn't be an issue. >> My main concern (and probably the grounds on which we will base our >> decision) is the quality of the front-end. The Windows frontend works >> flawlessly; however, in test-driving earlier versions of Mathematica (3.0 >> satisfactorily. I didn't spend much time to hunt down the source of the >> problem, but it is probable that some X key-mapping was wrong making, for >> example, keyboard shortcuts for 'Copy' and 'Paste' malfunctioning. On the >> Windows frontend. >> working to full satisfaction? I'd be willing to spend a couple of hours >> to fix some settings, but only if I'm sure it could be done. The bottom >> VMWare/Windows, but not if that would mean putting up with a quircky >> front-end. For what it is worth, I have no problems with the front end under Solaris > - another varient of Unix. I sincerely wish WRI were more relaxed about allowing people to use the same license on the same hardware, but with a different OS. My understanding is that I would have to buy two licenses if I wanted to switch back and forth That's how open source is paid for. Not everybody has the same amount of spare blood in their veins, or willingness to spill it. For those who release of Mathematica, it would be nice to have a dual boot option. Perhaps it's simply a support issue. It would potentially cause the same customer to require more support if he were switching back and forth between OSs. http://public.globalsymmetry.com/proprietary/com/wri/ch05.html http://66.92.149.152/proprietary/com/wri/ch05.html I still have some tweaks to add to this, such as M-k -> C-k, but it at least demonstrates that (all) things aren't cast in stone. STH ==== Sidney, (or other Unix) for some years so perhaps my experience could help with your decision. Most of the time I run on Windows (2000, not yet XP) because: 1. The Front End is more stable. 2. The Front End is more comfortable in the sense that the keys for deleting, copying, pasting etc. are the ones my fingers expect them to be. 3. Command completion via Ctrl-k, which I use all the time, does not work 4. Generally speaking it takes more mouse clicks and keystrokes to do things I think these are general differences between the user interfaces on these operating systems rather than something specific to the Mathematica implementations. I have tried to overcome them at various time without success. Since I switched from Windows 95 to Windows NT several years ago, 2. I need to have access to certain files created on that system by other people. 3. I want to run long calculations on additional CPUs, leaving my desktop computer free for other things. You can do this between Windows machines kernel via Mathlink. This is very simple and more reliable and robust than Front End and it is easy, say, to transfer input or output betwen systems within a single Front End. I should add that in our lab we can access the the additional convenience of being able to save a notebook from the Windows Front End in the same directory as other files the kernel may be working with. You may not have this option and, of course, you need Mathematica on both systems. These are my personal opinions based on practical experience, I really do not want to enter into any controversy about operating systems. John Jowett One of these days the company I work for will buy one Mathematica 4.2 Windows > versions of the product. window manager. Our Windows systems are running on top of VMWare in Windows > XP Professional. > In testing using an evaluation version I found that the VMWare/XP version is > performing pretty well so that wouldn't be an issue. My main concern (and probably the grounds on which we will base our > decision) is the quality of the front-end. The Windows frontend works > flawlessly; however, in test-driving earlier versions of Mathematica (3.0 > satisfactorily. I didn't spend much time to hunt down the source of the > problem, but it is probable that some X key-mapping was wrong making, for > example, keyboard shortcuts for 'Copy' and 'Paste' malfunctioning. On the > Windows frontend. > working > to full satisfaction? I'd be willing to spend a couple of hours to fix some > settings, but only if I'm sure it could be done. The bottom line is that I I but > not if that would mean putting up with a quircky front-end. > Sidney Cadot > ==== One of these days the company I work for will buy one Mathematica 4.2 > Windows versions of the product. The Redmond chaos code is IMHO no system at all (SCNR). I have only one problem with my Mathematica 4.0 for students, which is that the Export function does not work for gif and other graphics formats. I have posted a question about this into this group but nobody has answered, so I guess there is no fix for that, but on the other hand 4.2 is much newer and should work. > My main concern (and probably the grounds on which we will base our > decision) is the quality of the front-end. The Windows frontend works > flawlessly; however, in test-driving earlier versions of Mathematica (3.0 > satisfactorily. I didn't spend much time to hunt down the source of the > problem, but it is probable that some X key-mapping was wrong making, for > example, keyboard shortcuts for 'Copy' and 'Paste' malfunctioning. On the > Windows frontend. I have no problem concerning the frontend. One has only to adjust the font settings (if you need it, I can send you a pdf file explaining how). -- Hendrik van Hees Fakult.8at f.9fr Physik http://theory.gsi.de/~vanhees/ D-33615 Bielefeld ==== > 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?). Although you can't see it in your particular example, I think your two Reverse functions would lead to reversed partitions, so I got rid of them. Then it's a matter of following directions for Partition in Help. The only issue is computing kL. The following way is a bit complicated. Perhaps someone will post a simpler way. n = 10101111; r = 3; p = Characters[n]; kL = r + 1 - Mod[Length[p], r, 1]; kR = r; z = Partition[p, r, r, {kL, kR}, 0] Tom Burton ==== Although And and Or don't have to evaluate all their arguments, I find that this is useless in many situations I run into. For instance, I might have a long list 'boolList' of Boolean expressions and I want to know if ANY of them are False, so I calculate And@@boolList In this situation, ALL the expressions in 'boolList' are calculated, even though the first may be False. Here's an example in which I overcome that: boolList = Hold[Print@#; PrimeQ@#] & /@ Range[3, 1000, 2]; ReleaseHold[And @@ boolList] 3 5 7 9 False Bobby Treat -----Original Message----- 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 ----- > 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 > ==== Maybe this will work for you: groupDigits[n_String, k_Integer] := Partition[ PadLeft[Characters[n], k Ceiling[StringLength[n]/k], 0], k] Bobby Treat -----Original Message----- {{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?). ==== After I load a package using < 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?). ==== Dear Group, It is a pleasure write to you again. I have three questions to ask. Alexandre Costa Question One: The below code is working fine but I think there are more elegant ways of doing so. Any suggestions are VERY WELCOME. << DiscreteMath`Permutations` individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] CutPosition = 3 ; CutLength = 4 ; CutSequence = Take[Drop[individual1, CutPosition], CutLength] SonOne = individual2; Do[ If[MemberQ[SonOne, CutSequence[[i]]], SonOne = Delete[SonOne, Position[SonOne, CutSequence[[i]]]]], {i, 1, CutLength}]; SonOne SonOne = RotateLeft[SonOne, 1] Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}] SonOne Question Two: How can I change points properties (such as Size and Color) for the plot below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, {6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] Question Three: Why the Goto statement below is not working? q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] Reply-To: murray@math.umass.edu ==== I presume packagename is a context name, e.g., Graphics`Colors` . Then evaluating the expression Names[packagename*] containing the wildcard symbol * will probably do what you want. It may tell you more than you want to know unless the package was decently written. By decently I mean that names not needing to be known to the outside world have been enclosed within a Private context within the package's context. > After I load a package using > < the source file? -- 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 ==== Jose, I generally use the Needs statement to load a package. It avoids double loading and all the error messages that result. Say Needs[Graphics`Graphics`] Then to obtain information on the routines in the package just use... ?Graphics`Graphics`* names in the package. If you click on any of the names you obtain the usage message for the name. (On earlier Mathematica versions you only obtain a list of the names and you have to use ?name to obtain the usage message.) More link. If you click on that it will bring you to the relevant Help page. (Private packages may not have that feature.) David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Reply-To: ==== Maybe there's a faster way -- I hope so! -- but here's my answer: n = 2^26 Timing[RealDigits[N[Pi - 3, n], 10, 20, 19 - n]] 67108864 {15027.922*Second, {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, 4, 0, 9, 8, 0, 3}, -67108844}} hrMinSec[15027.922] {4*hours, 10*minutes, 27.92200000000048*seconds} Bobby Treat -----Original Message----- ==== Could you tell me the CPU you used and its speed etc...i am curious, other programs out there. > Maybe there's a faster way -- I hope so! -- but here's my answer: n = 2^26 > Timing[RealDigits[N[Pi - 3, n], 10, 20, 19 - n]] 67108864 > {15027.922*Second, > {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, 4, 0, 9, 8, 0, 3}, > -67108844}} hrMinSec[15027.922] > {4*hours, 10*minutes, 27.92200000000048*seconds} Bobby Treat -----Original Message----- > 4 for me? Could someone calculate the number Pi to 67,108,864 (2^26) decimal > places > I made the calculation in another program and would like to verify its > ==== > Could you tell me the CPU you used and its speed etc...i am curious, > other programs out there. I used one processor of a dual 1GH Mac and got the same answer with the following speed: 4.2 for Mac OS X (June 4, 2002) oldmax = $MaxPrecision 6 1. 10 $MaxPrecision = Infinity Infinity With[{n = 2^26}, Timing[ pd = RealDigits[N[Pi, n + 1], 10, 20, 19 - n]; ]] {28794.1 Second, Null} MaxMemoryUsed[] 512055204 pd {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, 4, 0, 9, 8, 0, 3}, -67108844} Tom Burton -- ==== So would it take about the same amont of time for the complete printout of digits? Of course it would take a few additional seconds to format the output... Or does Mathematica take alot less time when it truncates the output? > Could you tell me the CPU you used and its speed etc...i am curious, > other programs out there. I used one processor of a dual 1GH Mac and got the same answer with the > following speed: 4.2 for Mac OS X (June 4, 2002) > oldmax = $MaxPrecision > 6 > 1. 10 > $MaxPrecision = Infinity > Infinity > With[{n = 2^26}, Timing[ > pd = RealDigits[N[Pi, n + 1], 10, 20, > 19 - n]; ]] > {28794.1 Second, Null} > MaxMemoryUsed[] > 512055204 > pd > {{3, 3, 8, 6, 3, 2, 2, 0, 8, 9, 6, 2, 2, 3, > > 4, 0, 9, 8, 0, 3}, -67108844} Tom Burton ==== Here's an answer to Question 1: individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] cutPosition = 3; cutLength = 4; cutSequence = Take[Drop[individual1, cutPosition], cutLength] sonOne = Complement[individual2, cutSequence] sonOne = RotateLeft[sonOne, 1] sonOne = Join[Take[sonOne, cutLength - 1], cutSequence, Drop[sonOne, cutLength - 1]] Bobby Treat -----Original Message----- << DiscreteMath`Permutations` individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] CutPosition = 3 ; CutLength = 4 ; CutSequence = Take[Drop[individual1, CutPosition], CutLength] SonOne = individual2; Do[ If[MemberQ[SonOne, CutSequence[[i]]], SonOne = Delete[SonOne, Position[SonOne, CutSequence[[i]]]]], {i, 1, CutLength}]; SonOne SonOne = RotateLeft[SonOne, 1] Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}] SonOne Question Two: How can I change points properties (such as Size and Color) for the plot below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, {6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] Question Three: Why the Goto statement below is not working? q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] ==== I would like to build my Mathematica notebooks in manner which allows me to carry out two overlapping purposes: 1) prototype an algorithm completely within Mathematica, 2) use Mathematica as a partial evaluator to splice derived expressions into a C language version of the algorithm ( with the aid of the Format package from MathSource). The key complication in doing this is that for the Mathematica prototype I want everything to be evaluated, while for splicing I want the results from some of the functions to be retained as data in temporary variables. A first step towards these purposes is simple: write my component functions so they operate on lists (the natural form of the prototype data), then provide lists of arrays for arguments which I would like to supply as data in the resulting C language output forms. An example: -------------------------------------------------- In[1]:= t[x_] := {x[[4]]-x[[3]], x[[2]]-x[[1]]} In[2]:= f[x_,y_] := {y, 1}.t[x] In[3]:= f[{1,2,3,4},2] Out[3]= 3 In[4]:= f[Array[x,4],2] Out[4]= -x[1] + x[2] + 2 (-x[3] + x[4]) In[5]:= CAssign[fcnval, f[Array[x,4],2], AssignToArray->{x}] Out[5]//OutputForm= fcnval=-x[1]+x[2]+2.*(-x[3]+x[4]); -------------------------------------------------- For various reasons, however, I would like certain expressions of my symbolic derivation to be treated as data for the C language version. In the above example, for instance, I would like the array that function t produces to be a data array. The modification of the above example: -------------------------------------------------- In[6]:= tc[x_] := Array[tt,2] In[7]:= fc[x_,y_] := {y, 1}.tc[x] In[8]:= CAssign[tt, t[Array[x,4]], AssignToArray->{x}] Out[8]//OutputForm= tt[0]=-x[3]+x[4]; tt[1]=-x[1]+x[2]; In[9]:= CAssign[fcnval, fc[Array[x,4],2], AssignToArray->{tt}] Out[9]//OutputForm= fcnval=2.*tt[1]+tt[2]; -------------------------------------------------- But I don't want to carry around two versions of everything, nor do I really want to thread all of the supporting functions through my definitions in order to choose the correct function for the purpose I would rather define the C language alternatives only for functions like t and tc in the example, with f using the appropriate one depending on some evaluation flag that I set at the highest level. For example, it would be nice to be able to sprinkle in the C language alternatives with a construct like In[10]:= t[x_] := {x[[4]]-x[[3]], x[[2]]-x[[1]]} In[11]:= DefineTemporaryForm[t[x_]] := Array[tt,Length[x]/2] then be able to write In[8]:= CAssign[tt, t[Array[x,4]], AssignToArray->{x}] Out[8]//OutputForm= tt[0]=-x[3]+x[4]; tt[1]=-x[1]+x[2]; In[9]:= CAssign[fcnval, UseTemporaryForm[f[Array[x,4],2]], AssignToArray- >{tt}] Out[9]//OutputForm= fcnval=2.*tt[1]+tt[2]; I would appreciate any pointers on a good, clean and hopefully simple way to do this within Mathematica! Alex ==== I've been using Mathematica 4.1 on Win98 as a word processor for math-related documents, but often people that need to see the documents don't have Mathematica, and for whatever reason on my computer the HTML saves don't work at all. I'd like to export to PDF format. I can export images to PDF format no problem using, for example Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], and I can export cells correctly to GIF, JPEG, and WMF formats (probably more, those are the only ones I tested) using, for example Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy As->Cell Expression)...>> ]] When I change the filename to a .PDF and evaluate the cell, the program displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf ' message as if a file was created, but no file is created anywhere with any name that I could find with Start->Find->[All files and folders created in the previous day]. Is there a limitation to PDF exporting I don't know about? Do I need to upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I need a faster computer? A patch? Something else? ==== I recently communicated with technical support about precisely this issue. Here's their reply: ``PDF and AI export use psrender, which is a MathLink program that interfaces with the kernel. Since the kernel has no knowledge of how cells are formatted, export cannot generate PDF and AI for cells, just Graphics. Note that this is contrary to the documentation, which says: ``All graphics formats in Export can handle any type of 2D or 3D Mathematica graphics. ... They can also handle Notebook and Cell objects. --- Selwyn Hollis > I've been using Mathematica 4.1 on Win98 as a word processor for > math-related documents, but often people that need to see the documents > don't have Mathematica, and for whatever reason on my computer the HTML > saves don't work at all. I'd like to export to PDF format. I can export > images to PDF format no problem using, for example > Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], > and I can export cells correctly to GIF, JPEG, and WMF formats (probably > more, those are the only ones I tested) using, for example > Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy > As->Cell Expression)...>> ]] > When I change the filename to a .PDF and evaluate the cell, the program > displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf > ' message as if a file was created, but no file is created anywhere with any > name that I could find with Start->Find->[All files and folders created in > the previous day]. > Is there a limitation to PDF exporting I don't know about? Do I need to > upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I > need a faster computer? A patch? Something else? > ==== Here's a smoother animation, taking into account the period and cutting the step size in half (without using more frames): Do[Show[curve, Graphics[Disk[{ xx[t], Cosh[xx[t]]}, 0.035]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes -> None], {t, 0, 2.3, 0.05}] SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute[OpenCloseGroup] FrontEndTokenExecute[SelectionAnimate] Bobby Treat -----Original Message----- and the equation of motion is diffeq = Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ] Now solve and animate ... xx[t_] = x[t]/. First[ NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]] curve = Plot[Cosh[x], {x, -1, 1}] Do[ Show[curve, Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes->None], {t, 0, 5, 0.1}] ---- Selwyn Hollis > Dear Colleagues, I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the > right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my > means. > Matthias Bode > Sal. Oppenheim jr. & Cie. KGaA > Koenigsberger Strasse 29 > D-60487 Frankfurt am Main > GERMANY > Mobile: +49(0)172 6 74 95 77 > Internet: http://www.oppenheim.de ==== I would like to build my Mathematica notebooks in manner which allows me to carry out two overlapping purposes: 1) prototype an algorithm completely within Mathematica, 2) use Mathematica as a partial evaluator to splice derived expressions into a C language version of the algorithm (with the aid of the Format package from MathSource). The key complication in doing this is that for the Mathematica prototype I want everything to be evaluated, while for splicing I want the results from some of the functions to be retained as data in temporary variables. A first step towards these purposes is simple: write my component functions so they operate on lists (the natural form of the prototype data), then provide lists of arrays for arguments which I would like to supply as data in the resulting C language output forms. An example: -------------------------------------------------- In[1]:= t[x_] := {x[[4]]-x[[3]], x[[2]]-x[[1]]} In[2]:= f[x_,y_] := {y, 1}.t[x] In[3]:= f[{1,2,3,4},2] Out[3]= 3 In[4]:= f[Array[x,4],2] Out[4]= -x[1] + x[2] + 2 (-x[3] + x[4]) In[5]:= CAssign[fcnval, f[Array[x,4],2], AssignToArray->{x}] Out[5]//OutputForm= fcnval=-x[1]+x[2]+2.*(-x[3]+x[4]); -------------------------------------------------- For various reasons, however, I would like certain expressions of my symbolic derivation to be treated as data for the C language version. In the above example, for instance, I would like the array that function t produces to be a data array. The modification of the above example: -------------------------------------------------- In[6]:= tc[x_] := Array[tt,2] In[7]:= fc[x_,y_] := {y, 1}.tc[x] In[8]:= CAssign[tt, t[Array[x,4]], AssignToArray->{x}] Out[8]//OutputForm= tt[0]=-x[3]+x[4]; tt[1]=-x[1]+x[2]; In[9]:= CAssign[fcnval, fc[Array[x,4],2], AssignToArray->{tt}] Out[9]//OutputForm= fcnval=2.*tt[1]+tt[2]; -------------------------------------------------- But I don't want to carry around two versions of everything, nor do I really want to thread all of the supporting functions through my definitions in order to choose the correct function for the purpose I would rather define the C language alternatives only for functions like t and tc in the example, with f using the appropriate one depending on some evaluation flag that I set at the highest level. For example, it would be nice to be able to sprinkle in the C language alternatives with a construct like In[10]:= t[x_] := {x[[4]]-x[[3]], x[[2]]-x[[1]]} In[11]:= DefineTemporaryForm[t[x_]] := Array[tt,Length[x]/2] then be able to write In[8]:= CAssign[tt, t[Array[x,4]], AssignToArray->{x}] Out[8]//OutputForm= tt[0]=-x[3]+x[4]; tt[1]=-x[1]+x[2]; In[9]:= CAssign[fcnval, UseTemporaryForm[f[Array[x,4],2]], AssignToArray->{tt}] Out[9]//OutputForm= fcnval=2.*tt[1]+tt[2]; I would appreciate any pointers on a good, clean and hopefully simple way to do this within Mathematica! Alex ==== To find out what loaded contexts are related to the package, use: Contexts[Integrate`*] {Integrate`,Integrate`Elliptic`} To see the symbols exported by the context, execute: Names[Integrate`*] {(* too many to list here *)} Names[Integrate`*`*] {Integrate`Elliptic`Elliptic} To find out what context a symbol comes from: Context[Integrate] System` Bobby Treat -----Original Message----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Reply-To: ==== Oops! That should be individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] cutPosition = 3; cutLength = 4; cutSequence = Take[Drop[individual1, cutPosition], cutLength] sonOne = DeleteCases[individual2, _?(MemberQ[cutSequence, #] &)] sonOne = RotateLeft[sonOne, 1] sonOne = Join[Take[ sonOne, cutLength - 1], cutSequence, Drop[sonOne, cutLength - 1]] Complement returns a sorted result, and you didn't want that. Bobby Treat -----Original Message----- sonOne = Join[Take[sonOne, cutLength - 1], cutSequence, Drop[sonOne, cutLength - 1]] Bobby Treat -----Original Message----- << DiscreteMath`Permutations` individual1 = RandomPermutation[12] individual2 = RandomPermutation[12] CutPosition = 3 ; CutLength = 4 ; CutSequence = Take[Drop[individual1, CutPosition], CutLength] SonOne = individual2; Do[ If[MemberQ[SonOne, CutSequence[[i]]], SonOne = Delete[SonOne, Position[SonOne, CutSequence[[i]]]]], {i, 1, CutLength}]; SonOne SonOne = RotateLeft[SonOne, 1] Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}] SonOne Question Two: How can I change points properties (such as Size and Color) for the plot below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, {6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] Question Three: Why the Goto statement below is not working? q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] ==== I would appreciate help with these problems: 1. I'm plotting several thousand points, which I can do either with something like this (this is a test): w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; dw = Graphics[{PointSize[0.01], RGBColor[ 1, 0, 0], w}]; dx = Graphics[{PointSize[0.01], RGBColor[.8, .8, .8], x}]; dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; Show[dw, dx, dy, dz, AspectRatio -> Automatic, PlotRange -> {{0, 1}, {0, 1}}, Axes -> Automatic, Frame -> True, Background -> GrayLevel[.026], This gives me dots in 4 colors for distinguishing different kinds of points in my real application. This works fine but needs the Point structure. Or, I can do (this is for one kind of point), t = Table[{Random[], Random[]}, {i, 1, 1024}]; ListPlot[t, AspectRatio -> Automatic, Axes -> Automatic, Frame -> True, Background -> GrayLevel[.026] ]; which seems simpler and may fit into the rest of the program more easily. 1. How do I get the RGBColor Rule or the equivalent into the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. How do I get ListPlot to put down 4 plots superimposed? Or can't I? 3. In either case, I need to make the whole plot area about twice as big. That is, it now occupies about a 4 square. To see details better in my real plot, and because with 16k points the small plot just looks almost like a solid blur, I want to make it more like 8 square, or as big as will fit the screen (without changing the plot range or anything else). There must be a scale factor somewhere. ==== Steve, You could try something like this: Needs[Graphics`Colors`] Clear[t]; Do[t[i] = Table[{Random[], Random[]}, {i, 1, 1024}], {i, 4}]; Show[Graphics[ {PointSize[0.005], RoyalBlue, Point /@ t[1], OrangeRed, Point /@ t[2], SpringGreen, Point /@ t[3], CadmiumLemon, Point /@ t[4]}], AspectRatio -> Automatic, Frame -> True, PlotRegion -> {{0.02, 0.96}, {0, 1}}, Background -> IvoryBlack, ImageSize -> 700]; The overall size of the plot can be controlled with the ImageSize option. ListPlot is more a hindrance than a help - throw it in the ash can. Just Map Point onto the lists of point coordinates. Give the color before each set of points. I adjusted the PlotRegion to obtain some black margin on all sides of the frame. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; Show[dw, dx, dy, dz, AspectRatio -> Automatic, PlotRange -> {{0, 1}, {0, 1}}, Axes -> Automatic, Frame -> True, Background -> GrayLevel[.026], This gives me dots in 4 colors for distinguishing different kinds of points in my real application. This works fine but needs the Point structure. Or, I can do (this is for one kind of point), t = Table[{Random[], Random[]}, {i, 1, 1024}]; ListPlot[t, AspectRatio -> Automatic, Axes -> Automatic, Frame -> True, Background -> GrayLevel[.026] ]; which seems simpler and may fit into the rest of the program more easily. 1. How do I get the RGBColor Rule or the equivalent into the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. How do I get ListPlot to put down 4 plots superimposed? Or can't I? 3. In either case, I need to make the whole plot area about twice as big. That is, it now occupies about a 4 square. To see details better in my real plot, and because with 16k points the small plot just looks almost like a solid blur, I want to make it more like 8 square, or as big as will fit the screen (without changing the plot range or anything else). There must be a scale factor somewhere. ==== Bobby, Your ODE is different from both mine and Borut's. You do however get the same as mine with your approach, if you differentiate the total energy rather than the Lagrangian. KE = Simplify[(x'[t]^2 + D[f[x[t]], t]^2)/2]; PE = g*f[x[t]]; totalE = KE + PE; treat = D[totalE, t] == 0 x''[t] - (x''[t] /. First[Solve[treat, x''[t]]]//Apart) == 0 Borut's ODE differs only in his factor of 2 in the first-order term. I suspect that might have been a typo... Borut? By the way, some nice animations of mechanical systems (some based on the same sort of approach) can be seen here: http://www.math.armstrong.edu/faculty/hollis/DEmovies/ --Selwyn > The two of you derived slightly different ODE's. I think Selwyn's is > correct, but I only had one physics course, 30 years ago. Here's a notebook expression showing how Selwyn's approach can be used > to derive the ODE for y[t] = f[x[t]], with arbitrary f. It shows that > solution in a form that is easily compared with Borut's ODE, and then it > shows my own solution (same as Borut's, by a slightly simpler method). Bobby Treat > KE = Simplify[(x'[t]^2 + D[f[x[t]], t]^2)/2]; > PE = g*f[x[t]]; > L = KE - PE; > treat = D[L, t] == 0 > ==== I've modified Selwyn's solution to make it more general. In particular, the height can be specified (up to about 35 meters). The differential equation is solved for t=0 to 5 first. The quarter-period is computed by finding a zero; then the differential equation is solved again for t=0 to the quarter-period, and the solution is extended using reflection and periodicity. This yields a higher-precision solution. Then I graph the solution, with a stepsize equal to period/40, from t=0 to 'period', labeling each frame with the values of t, x[t], and y[t]. Using a step size that divides period/4 guarantees the lowest point is reached ON a frame when appropriate. Here's the solution as a notebook expression: Notebook[{ Cell[CellGroupData[{ Cell[Borut L's solution:, Subsubtitle], Cell[TextData[StyleBox[Having noticed your statement ... BEYOND MY MEANS I thing you aren't yetnfamiliar with Lagrangian formalism. It's quite easy to derive a generalnequation of motion for a point mass, subjected to gravity and to moving on ancurve f = y(x) (i.e. f = Cosh[#]&).nn1) I'll leave re-deriving equation to you, here is what I've got (just copynpaste it).:, FontFamily->Courier New, FontSize->10, CharacterEncoding->WindowsANSI]], Text], Cell[BoxData[ RowBox[{selwyn, =, RowBox[{First, [, RowBox[{ RowBox[{ RowBox[{ RowBox[{x, ''}], [, t, ]}], /., RowBox[{Solve, [, RowBox[{diffeq, ,, RowBox[{ RowBox[{x, ''}], [, t, ]}]}], ]}]}], //, Simplify}], ]}]}]], Input], Cell[BoxData[ RowBox[{borut, =, RowBox[{First, [, RowBox[{ RowBox[{ RowBox[{x, ''}], [, t, ]}], /., RowBox[{Solve, [, RowBox[{ RowBox[{getEq, [, Cosh, ]}], ,, RowBox[{ RowBox[{x, ''}], [, t, ]}]}], ]}]}], ]}]}]], Input], Cell[BoxData[ RowBox[{ RowBox[{getEq, [, f_, ]}], :=, [IndentingNewLine], RowBox[{Simplify, [, RowBox[{ RowBox[{ RowBox[{ RowBox[{x, ''}], [, t, ]}], +, RowBox[{ SuperscriptBox[ RowBox[{ RowBox[{x, '}], [, t, ]}], 2], , FractionBox[ RowBox[{2, , RowBox[{ RowBox[{f, '}], [, RowBox[{x, [, t, ]}], ]}], , RowBox[{ RowBox[{f, ''}], [, RowBox[{x, [, t, ]}], ]}]}], RowBox[{1, +, SuperscriptBox[ RowBox[{ RowBox[{f, '}], [, RowBox[{x, [, t, ]}], ]}], 2]}]]}], +, FractionBox[ RowBox[{g, , RowBox[{ RowBox[{f, '}], [, RowBox[{x, [, t, ]}], ]}]}], RowBox[{1, +, SuperscriptBox[ RowBox[{ RowBox[{f, '}], [, RowBox[{x, [, t, ]}], ]}], 2]}]]}], ==, 0}], ]}]}]], Input], Cell[TextData[{ StyleBox[2) Next, you integrate it .:, FontFamily->Courier New, FontSize->10, CharacterEncoding->WindowsANSI], }], Text], Cell[BoxData[ RowBox[{ RowBox[{getSol, [, RowBox[{f_, ,, RowBox[{h0_, ?, Positive}], ,, RowBox[{x0_, ?, Positive}]}], ]}], :=, RowBox[{Module, [, RowBox[{ RowBox[{{, tStop, }}], ,, [IndentingNewLine], RowBox[{First, @, RowBox[{NDSolve, [, [IndentingNewLine], RowBox[{ RowBox[{{, RowBox[{ RowBox[{getEq, [, f, ]}], ,, RowBox[{ RowBox[{x, [, 0, ]}], [Equal], h0}], ,, RowBox[{ RowBox[{ RowBox[{x, '}], [, 0, ]}], [Equal], 0}]}], }}], ,, [IndentingNewLine], x, ,, [IndentingNewLine], RowBox[{{, RowBox[{t, ,, 0, ,, 10}], }}], ,, [IndentingNewLine], RowBox[{MaxStepSize, [Rule], RowBox[{1, /, 100}]}], ,, RowBox[{StoppingTest, [RuleDelayed], RowBox[{If, [, RowBox[{ RowBox[{h0, <, 0}], ,, RowBox[{x, >, 0}], ,, RowBox[{x, <, 0}]}], ]}]}]}], [IndentingNewLine], ]}]}]}], [IndentingNewLine], ]}]}]], Input], Cell[< 3) Here follows animation code, specially for linear versus cosh case, apply my initial conditions (below) >, Text], Cell[BoxData[ RowBox[{ RowBox[{makeDuo, [, RowBox[{f_, ,, g_, ,, h0_}], ]}], :=, RowBox[{Module, [, RowBox[{ RowBox[{{, RowBox[{ RowBox[{solf, =, RowBox[{getSol, [, RowBox[{f, ,, h0}], ]}]}], ,, RowBox[{solg, =, RowBox[{getSol, [, RowBox[{g, ,, h0}], ]}]}], ,, tf, ,, tg, ,, maxT, ,, minT}], }}], ,, [IndentingNewLine], RowBox[{ RowBox[{tf, =, RowBox[{solf, [, RowBox[{[, RowBox[{ 1, ,, 2, ,, 1, ,, 1, ,, 2}], ]}], ]}]}], ;, [IndentingNewLine], RowBox[{tg, =, RowBox[{solg, [, RowBox[{[, RowBox[{ 1, ,, 2, ,, 1, ,, 1, ,, 2}], ]}], ]}]}], ;, [IndentingNewLine], RowBox[{maxT, =, RowBox[{Max, [, RowBox[{{, RowBox[{tf, ,, tg}], }}], ]}]}], ;, [IndentingNewLine], RowBox[{minT, =, RowBox[{Min, [, RowBox[{{, RowBox[{tf, ,, tg}], }}], ]}]}], ;, [IndentingNewLine], RowBox[{Do, [, RowBox[{ RowBox[{Plot, [, RowBox[{ RowBox[{{, RowBox[{ RowBox[{f, @, x}], ,, RowBox[{g, @, x}]}], }}], ,, RowBox[{{, RowBox[{x, ,, 0, ,, RowBox[{ArcCosh, @, h0}]}], }}], ,, RowBox[{AspectRatio, [Rule], Automatic}], ,, RowBox[{Frame, [Rule], True}], ,, RowBox[{Axes, [Rule], False}], ,, RowBox[{Epilog, [Rule], RowBox[{{, RowBox[{ RowBox[{ AbsolutePointSize, [, 10, ]}], ,, RowBox[{Hue, [, 0, ]}], ,, RowBox[{Point, [, RowBox[{ RowBox[{{, RowBox[{ RowBox[{x, [, t, ]}], ,, RowBox[{f, @, RowBox[{x, [, t, ]}]}]}], }}], /., solf}], ]}], ,, RowBox[{Hue, [, .6, ]}], ,, RowBox[{Point, [, RowBox[{ RowBox[{{, RowBox[{ RowBox[{x, [, t, ]}], ,, RowBox[{g, @, RowBox[{x, [, t, ]}]}]}], }}], /., solg}], ]}]}], }}]}]}], ]}], ,, RowBox[{{, RowBox[{t, ,, 0, ,, minT, ,, minT}], }}]}], ]}]}]}], ]}]}]], Input], Cell[TextData[{ StyleBox[4) My initial conditions. In my opinion, you weren't true on this. Saying nSTARTING FROM THE SAME HEIGHT is not enough - you should specify x asnwell, thus specifing starting POINT and not just height y., FontFamily->Courier New, FontSize->10, CharacterEncoding->WindowsANSI], }], Text], Cell[BoxData[{ RowBox[{makeDuo, [, RowBox[{ RowBox[{ RowBox[{ RowBox[{Cosh, [, 1., ]}], , #}], &}], ,, RowBox[{ RowBox[{Cosh, [, #, ]}], &}], ,, 23}], ]}], [IndentingNewLine], RowBox[{SelectionMove, [, RowBox[{ RowBox[{EvaluationNotebook, [, ]}], ,, All, ,, GeneratedCell}], ]}], n, RowBox[{ FrontEndTokenExecute, [, , ]}], n, RowBox[{ FrontEndTokenExecute, [, , ]}]}], Input] }, Open ]] }, ScreenRectangle->{{0, 1024}, {0, 711}}, WindowSize->{815, 569}, WindowMargins->{{0, Automatic}, {Automatic, -1}}, ShowSelection->True ] Bobby Treat -----Original Message----- and the equation of motion is diffeq = Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ] Now solve and animate ... xx[t_] = x[t]/. First[ NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]] curve = Plot[Cosh[x], {x, -1, 1}] Do[ Show[curve, Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes->None], {t, 0, 5, 0.1}] ---- Selwyn Hollis > Dear Colleagues, I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the > right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my > means. > Matthias Bode > Sal. Oppenheim jr. & Cie. KGaA > Koenigsberger Strasse 29 > D-60487 Frankfurt am Main > GERMANY > Mobile: +49(0)172 6 74 95 77 > Internet: http://www.oppenheim.de ==== Try this: << Graphics`Colors` n = 4096; data = {w, x, y, z} = Array[Random[] &, {4, n, 2}]; g@{a_, b_} := ListPlot[a, PlotStyle -> {PointSize[0.005], b}, DisplayFunction -> Identity, Show[g /@ Transpose[{data, {Red, Blue, Yellow, White}}], PlotRange -> {{0, 1}, {0, 1}}, Axes -> Automatic, Frame -> True, DisplayFunction -> $DisplayFunction, Background -> GrayLevel[.026], ImageSize -> 500]; Bobby Treat -----Original Message----- dx = Graphics[{PointSize[0.01], RGBColor[.8, .8, .8], x}]; dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; Show[dw, dx, dy, dz, AspectRatio -> Automatic, PlotRange -> {{0, 1}, {0, 1}}, Axes -> Automatic, Frame -> True, Background -> GrayLevel[.026], This gives me dots in 4 colors for distinguishing different kinds of points in my real application. This works fine but needs the Point structure. Or, I can do (this is for one kind of point), t = Table[{Random[], Random[]}, {i, 1, 1024}]; ListPlot[t, AspectRatio -> Automatic, Axes -> Automatic, Frame -> True, Background -> GrayLevel[.026] ]; which seems simpler and may fit into the rest of the program more easily. 1. How do I get the RGBColor Rule or the equivalent into the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. How do I get ListPlot to put down 4 plots superimposed? Or can't I? 3. In either case, I need to make the whole plot area about twice as big. That is, it now occupies about a 4 square. To see details better in my real plot, and because with 16k points the small plot just looks almost like a solid blur, I want to make it more like 8 square, or as big as will fit the screen (without changing the plot range or anything else). There must be a scale factor somewhere. ==== The same command worked for me, insofar as creating the plot is concerned. I did get an error message opening the file, saying that Adobe Acrobat was Unable to find or create the font 'Mathematica1Mono-Bold'. Some characters may not display or print correctly. The plot looks fine, though. Bobby Treat -----Original Message----- Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy As->Cell Expression)...>> ]] When I change the filename to a .PDF and evaluate the cell, the program displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf ' message as if a file was created, but no file is created anywhere with any name that I could find with Start->Find->[All files and folders created in the previous day]. Is there a limitation to PDF exporting I don't know about? Do I need to upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I need a faster computer? A patch? Something else? ==== I'm trying to export a table from Mathematica 4.0 to Notepad, for examples, or something similar, but it's impossible for me! It always exports the cell with all its rubbish, or an image (if I use Word). How can I export just plain _numbers_? Thanx Fip ==== You can use Export[file.dat, expr] where expr is a two-dimensional array. Or for more flexibility study the following. Assuming data has n rows and 2 columns. file = OpenWrite[file.dat]; Map[ ( (* the N may be redundant haven't tested the code w/o it *) str = ToString[PaddedForm[N[#[[1]]],{10,6}]]<> <> ToString[PaddedForm[N[#[[2]]],{10,6}]]; (* make numbers e notation: the *^ notation has given me fits, so I just put this in as a precaution *) str = StringReplace[str, *^ -> e]; WriteString[file, str, n] )&, data]; Close[file] Hope this helps, Lawrence > I'm trying to export a table from Mathematica 4.0 to Notepad, for examples, > or something similar, but it's impossible for me! It always exports the cell > with all its rubbish, or an image (if I use Word). > How can I export just plain _numbers_? Thanx > Fip -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== I'm trying to export a table from Mathematica 4.0 to Notepad, for examples, > or something similar, but it's impossible for me! It always exports the cell > with all its rubbish, or an image (if I use Word). > How can I export just plain _numbers_? Try with this: WriteSimpleTableForm[file_String, data_List, opts___] := Module[{str}, str = OpenWrite[file]; WriteString[str, ToString[TableForm[data, opts]]]; Close[str] ] This is my small solution for this problem. marek ==== I put the following in .../.../KeyEventTranslations.tr: Item[KeyEvent[<,Modifiers->{Control}], FrontEndExecute[{ FrontEnd`NotebookWrite[FrontEnd`SelectedNotebook[], [LeftDoubleBracket][RightDoubleBracket],After]}]], to make it easy to insert the double-brackets. This works fine, but I want the cursor to be placed between the brackets not after them. How can this be done? Gru137 Peter -- =--=--=--=--=--=--=--=--=--=--=--=--=--= http://home.t-online.de/home/phbrf ~ ~ ~ ==== >I've been using Mathematica 4.1 on Win98 as a word processor for >math-related documents, but often people that need to see the documents >don't have Mathematica, and for whatever reason on my computer the HTML >saves don't work at all. I'd like to export to PDF format. I can export >images to PDF format no problem using, for example >Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], >and I can export cells correctly to GIF, JPEG, and WMF formats (probably >more, those are the only ones I tested) using, for example >Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy >As->Cell Expression)...>> ]] >When I change the filename to a .PDF and evaluate the cell, the program >displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf >' message as if a file was created, but no file is created anywhere with any >name that I could find with Start->Find->[All files and folders created in >the previous day]. >Is there a limitation to PDF exporting I don't know about? Do I need to >upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I >need a faster computer? A patch? Something else? This is a limitation of PDF export. The mechanism for exporting GIF, JPEG, and other raster formats is completely different than the system used for PDF export. Because of this PDF export is limited to graphics expressions. Cells and Notebooks cannot be converted via Export. However, there is a way to generate PDFs using the frontend. See http://support.wolfram.com/mathematica/graphics/export/convertpdfghostscript .html http://support.wolfram.com/mathematica/graphics/export/convertpdfdistiller.h tml -Dale ==== Dear Mathematica friends, how can Mathematica 4.1 be used to combine sound and graphics? In particular, I would like to prepare a demo video about differential equations. I can Plot the solution and I can Play the solution. How to combine the 2 results into a single file that can be played back using xine or DivX, like ordinary video can? Best wishes from Prague -- Pavel Pokorny Math Dept, Prague Institute of Chemical Technology http://staffold.vscht.cz/mat/Pavel.Pokorny ==== Hoi, it depends a bit what you want to do. E.g.: If you want to write applications for clients then go with that systems your clients use (probably Windows). If you just use it for yourself, for development: use what you like more. anymore, like there were in 3.0 times. The copy and paste problems are gone if you switch off the KDE Klipper. On the other hand, there are a few OS- (or better Window-manager-specific) 1.: you cannot rotate text (i.e., FrameLabel settings will look weird (vertically arranged horizontal letters), you have to use RotateLabel -> False generally, or play with the Fonts settings such that horizontal tick marks still fit) 2.: If you work with bigger graphics in notebooks I suggest Windows (or MacOS X) since least on my XFree 4.2 installation with a not too modern graphics card). Also I find resizing of larger notebooks somewhat slow. 3.: If you like to work with keyboard shortcuts: Windows is better, clearly. 4.: There are a couple of Font issues which are better on Windows since not all fonts engels, nederlands, duits of spaans) Rolf Mertig Mertig Consulting Berlin ==== I'd like to add a JLink animation of the rolling ball based on Selwyn's solution: UseFrontEndForRendering = False; createWindow[] := Module[{frame}, frame = JavaNew[com.wolfram.jlink.MathFrame, Doppler Animation]; drawArea = JavaNew[com.wolfram.jlink.MathCanvas]; drawArea@setUsesFE[UseFrontEndForRendering]; drawArea@setSize[800, 600]; JavaBlock[frame@setLayout[JavaNew[java.awt.BorderLayout]]; frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]]; frame@pack[]; frame@setSize[800, 600]; frame@setLocation[200, 200]; JavaShow[frame]]; frame ] drawRoll[t_] := Show[curve, Graphics[{RGBColor[1, 0, 0], Disk[{xx[t], Cosh[xx[t]]}, 0.05]}], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes -> None, DisplayFunction -> Identity]; times = Range[0, 5, .05]; LoadJavaClass[java.lang.Thread]; AnimationPlot[t_List] := JavaBlock[Block[{frm}, frm = createWindow[]; Map[(obj = drawRoll[#]; drawArea@setMathCommand[obj]; drawArea@repaintNow[]; Thread@sleep[5];) &, t ] ]] AnimationPlot[times] jerry blimbaum panama city, fl -----Original Message----- and the equation of motion is diffeq = Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ] Now solve and animate ... xx[t_] = x[t]/. First[ NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]] curve = Plot[Cosh[x], {x, -1, 1}] Do[ Show[curve, Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes->None], {t, 0, 5, 0.1}] ---- Selwyn Hollis > Dear Colleagues, I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the > right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my > means. > Matthias Bode > Sal. Oppenheim jr. & Cie. KGaA > Koenigsberger Strasse 29 > D-60487 Frankfurt am Main > GERMANY > Mobile: +49(0)172 6 74 95 77 > Internet: http://www.oppenheim.de ==== I noticed that n Mathematica 3.0 , IntegerDigits function is giving wrong results. This problem is not found in Mathematica 4.1. Whether any body else has also noted any such problem. For example IntegerDigits[10^18+7] will give the digits 0 and 7 , omitting 1. Shyam Sunder Gupta ==== You're right; I wasn't exporting a Cell. I misunderstood his post and successfully executed this: Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]] but that was working for him, already. Sorry for the confusion. Bobby -----Original Message----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== > w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > 2. In the latter case I also want to plot 4 types of points. > How do I get ListPlot to put down 4 plots superimposed? > Or can't I? You can, but you have to do it via Graphics`MulitpleListPlot`. Load the requisite packages Needs[Graphics`Colors`] Needs[Graphics`MultipleListPlot`] Define cols = {Black, Red, Green, Blue}; pnts = {PlotSymbol[Triangle], PlotSymbol[Box], PlotSymbol[Diamond], PlotSymbol[Star]}; Then grf = MultipleListPlot[w, x, y, z, PlotStyle->cols, SymbolShape->pnts, SymbolsStyle->cols ]; Documentation shows how to incorporate legends and to define other symbols. Dave. ========================================== Dr. David Annetts EM Modelling Analyst Australia David.Annetts@csiro.au =========================================== ==== >Dear Group, It is a pleasure write to you again. I have three questions to ask. > Alexandre Costa > >Question Two: > >How can I change points properties (such as Size and Color) for the plot >below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` > >listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, >{6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; > >LabeledListPlot[listcities, Axes -> None, Frame -> True, > DisplayFunction -> $DisplayFunction] It's not a built-in feature of LabeledListPlot, so you'll have to do it manually. gr=LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] You can add graphics directives to the points and text with a replacement rule. Show[gr/.x_Point|x_Text->{RGBColor[1,0,0],x}] >Question Three: Why the Goto statement below is not working? > >q = 2; >Label[start]; >q = 3; >Label[begin]; >Print[q]; >q += 1; If[q < 6, Goto[begin], Goto[start]] First, let me say that noone should ever use Goto. You should always use a loop or some other process instead. With that said . . . When you type semicolon separated input into the frontend, each command is treated as a separate input (as if they were in separate input cells). So the Labels and the Gotos are evaluated separately and there's no way to jump from one to the other. Instead, the commands need to be within the same expression. This can be done by wrapping the command in a CompoundExpression ( q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] ) Or some other expression, like a Module. -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== >I would appreciate help with these problems: 1. I'm plotting several thousand points, which I can do >either with something like this (this is a test): > >w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >dw = Graphics[{PointSize[0.01], RGBColor[ 1, 0, 0], w}]; >dx = Graphics[{PointSize[0.01], RGBColor[.8, .8, .8], x}]; >dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; >dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; >Show[dw, dx, dy, dz, AspectRatio -> Automatic, > PlotRange -> {{0, 1}, {0, 1}}, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026], > >This gives me dots in 4 colors for distinguishing different >kinds of points in my real application. This works fine but >needs the Point structure. Or, I can do (this is for one >kind of point), > >t = Table[{Random[], Random[]}, {i, 1, 1024}]; >ListPlot[t, AspectRatio -> Automatic, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026] > ]; > >which seems simpler and may fit into the rest of the program >more easily. 1. How do I get the RGBColor Rule or the equivalent into >the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. >How do I get ListPlot to put down 4 plots superimposed? >Or can't I? 3. In either case, I need to make the whole plot area about >twice as big. That is, it now occupies about a 4 square. To >see details better in my real plot, and because with 16k points >the small plot just looks almost like a solid blur, I want to >make it more like 8 square, or as big as will fit the screen >(without changing the plot range or anything else). There >must be a scale factor somewhere. > You can plot more than one list with MultipleListPlot. <Automatic,Axes->Automatic,Frame->True, SymbolShape->{ColorPoint[RGBColor[1,0,0]], ColorPoint[RGBColor[.8, .8, .8]],ColorPoint[RGBColor[ 0, .5, .9]], ColorPoint[RGBColor[.8, .8, 0]]}, SymbolStyle->PointSize[0.01],Background->GrayLevel[.026] ] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== >I have to use a graphics of mathematica with powerpoint for a little >Y-axes and line of function) are bold or more visible: how can I do >that? Use the PlotStyle and AxesStyle options as in Plot[x,{x,0,5},PlotStyle->Thickness[0.015],AxesStyle->Thickness[0.015]] ==== Dear Mathematica friends, how can Mathematica 4.1 be used to combine sound and graphics? In particular, I would like to prepare a demo video about differential equations. I can Plot the solution and I can Play the solution. How to combine the 2 results into a single file that can be played back using xine or DivX, like ordinary video can? Best wishes from Prague -- Pavel Pokorny Math Dept, Prague Institute of Chemical Technology http://staffold.vscht.cz/mat/Pavel.Pokorny ==== I'd like to add a JLink animation of the rolling ball based on Selwyn's solution: UseFrontEndForRendering = False; createWindow[] := Module[{frame}, frame = JavaNew[com.wolfram.jlink.MathFrame, Doppler Animation]; drawArea = JavaNew[com.wolfram.jlink.MathCanvas]; drawArea@setUsesFE[UseFrontEndForRendering]; drawArea@setSize[800, 600]; JavaBlock[frame@setLayout[JavaNew[java.awt.BorderLayout]]; frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]]; frame@pack[]; frame@setSize[800, 600]; frame@setLocation[200, 200]; JavaShow[frame]]; frame ] drawRoll[t_] := Show[curve, Graphics[{RGBColor[1, 0, 0], Disk[{xx[t], Cosh[xx[t]]}, 0.05]}], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes -> None, DisplayFunction -> Identity]; times = Range[0, 5, .05]; LoadJavaClass[java.lang.Thread]; AnimationPlot[t_List] := JavaBlock[Block[{frm}, frm = createWindow[]; Map[(obj = drawRoll[#]; drawArea@setMathCommand[obj]; drawArea@repaintNow[]; Thread@sleep[5];) &, t ] ]] AnimationPlot[times] jerry blimbaum panama city, fl -----Original Message----- and the equation of motion is diffeq = Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ] Now solve and animate ... xx[t_] = x[t]/. First[ NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]] curve = Plot[Cosh[x], {x, -1, 1}] Do[ Show[curve, Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]], PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, Axes->None], {t, 0, 5, 0.1}] ---- Selwyn Hollis > Dear Colleagues, I intend to make an animation in which ball A rolls down on an inclined plane from the left whilst ball B - starting from the same height - rolls down Cosh[t]'s path from the > right. x-axis is time t, y-axis is height h. Ball A is fine; ball B - which should arrive at h=0 before A - is beyond my > means. > Matthias Bode > Sal. Oppenheim jr. & Cie. KGaA > Koenigsberger Strasse 29 > D-60487 Frankfurt am Main > GERMANY > Mobile: +49(0)172 6 74 95 77 > Internet: http://www.oppenheim.de ==== >I've been using Mathematica 4.1 on Win98 as a word processor for >math-related documents, but often people that need to see the documents >don't have Mathematica, and for whatever reason on my computer the HTML >saves don't work at all. I'd like to export to PDF format. I can export >images to PDF format no problem using, for example >Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], >and I can export cells correctly to GIF, JPEG, and WMF formats (probably >more, those are the only ones I tested) using, for example >Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy >As->Cell Expression)...>> ]] >When I change the filename to a .PDF and evaluate the cell, the program >displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf >' message as if a file was created, but no file is created anywhere with any >name that I could find with Start->Find->[All files and folders created in >the previous day]. >Is there a limitation to PDF exporting I don't know about? Do I need to >upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I >need a faster computer? A patch? Something else? This is a limitation of PDF export. The mechanism for exporting GIF, JPEG, and other raster formats is completely different than the system used for PDF export. Because of this PDF export is limited to graphics expressions. Cells and Notebooks cannot be converted via Export. However, there is a way to generate PDFs using the frontend. See http://support.wolfram.com/mathematica/graphics/export/convertpdfghostscript .html http://support.wolfram.com/mathematica/graphics/export/convertpdfdistiller.h tml -Dale ==== I noticed that n Mathematica 3.0 , IntegerDigits function is giving wrong results. This problem is not found in Mathematica 4.1. Whether any body else has also noted any such problem. For example IntegerDigits[10^18+7] will give the digits 0 and 7 , omitting 1. Shyam Sunder Gupta ==== You're right; I wasn't exporting a Cell. I misunderstood his post and successfully executed this: Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]] but that was working for him, already. Sorry for the confusion. Bobby -----Original Message----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== > w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; > 2. In the latter case I also want to plot 4 types of points. > How do I get ListPlot to put down 4 plots superimposed? > Or can't I? You can, but you have to do it via Graphics`MulitpleListPlot`. Load the requisite packages Needs[Graphics`Colors`] Needs[Graphics`MultipleListPlot`] Define cols = {Black, Red, Green, Blue}; pnts = {PlotSymbol[Triangle], PlotSymbol[Box], PlotSymbol[Diamond], PlotSymbol[Star]}; Then grf = MultipleListPlot[w, x, y, z, PlotStyle->cols, SymbolShape->pnts, SymbolsStyle->cols ]; Documentation shows how to incorporate legends and to define other symbols. Dave. ========================================== Dr. David Annetts EM Modelling Analyst Australia David.Annetts@csiro.au =========================================== ==== >Dear Group, It is a pleasure write to you again. I have three questions to ask. > Alexandre Costa > >Question Two: > >How can I change points properties (such as Size and Color) for the plot >below? The PlotStyle Option does not work for this LabeledListPlot << Graphics`Graphics` > >listcities = {{1, 5}, {4, 6}, {7, 5}, {5, 4}, {9, 4}, {2, 3}, {4, 2}, >{6, 2}, {1, 1}, {5, 1}, {3, 0}, {9, 0}}; > >LabeledListPlot[listcities, Axes -> None, Frame -> True, > DisplayFunction -> $DisplayFunction] It's not a built-in feature of LabeledListPlot, so you'll have to do it manually. gr=LabeledListPlot[listcities, Axes -> None, Frame -> True, DisplayFunction -> $DisplayFunction] You can add graphics directives to the points and text with a replacement rule. Show[gr/.x_Point|x_Text->{RGBColor[1,0,0],x}] >Question Three: Why the Goto statement below is not working? > >q = 2; >Label[start]; >q = 3; >Label[begin]; >Print[q]; >q += 1; If[q < 6, Goto[begin], Goto[start]] First, let me say that noone should ever use Goto. You should always use a loop or some other process instead. With that said . . . When you type semicolon separated input into the frontend, each command is treated as a separate input (as if they were in separate input cells). So the Labels and the Gotos are evaluated separately and there's no way to jump from one to the other. Instead, the commands need to be within the same expression. This can be done by wrapping the command in a CompoundExpression ( q = 2; Label[start]; q = 3; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin], Goto[start]] ) Or some other expression, like a Module. -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== Mario: Use, for example, PlotStyle->Thickness[0.01] for plot and AxesStyle->Thickness[0.01]. Other way is using AbsoluteThickness instead of Thickness. See The Mathematica Book: Section 2.9.3. Germ.87n Buitrago A. ----- Original Message ----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== Mario: Use, for example, PlotStyle->Thickness[0.01] for plot and AxesStyle->Thickness[0.01]. Other way is using AbsoluteThickness instead of Thickness. See The Mathematica Book: Section 2.9.3. Germ.87n Buitrago A. ----- Original Message ----- Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator ==== I have to use a graphics of mathematica with powerpoint for a little Y-axes and line of function) are bold or more visible: how can I do that? ==== >I have to use a graphics of mathematica with powerpoint for a little >Y-axes and line of function) are bold or more visible: how can I do >that? Use the PlotStyle and AxesStyle options as in Plot[x,{x,0,5},PlotStyle->Thickness[0.015],AxesStyle->Thickness[0.015]] ==== >I would appreciate help with these problems: 1. I'm plotting several thousand points, which I can do >either with something like this (this is a test): > >w = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >x = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >y = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >z = Table[Point[{Random[], Random[]}], {i, 1, 4096}]; >dw = Graphics[{PointSize[0.01], RGBColor[ 1, 0, 0], w}]; >dx = Graphics[{PointSize[0.01], RGBColor[.8, .8, .8], x}]; >dy = Graphics[{PointSize[0.01], RGBColor[ 0, .5, .9], y}]; >dz = Graphics[{PointSize[0.01], RGBColor[.8, .8, 0], z}]; >Show[dw, dx, dy, dz, AspectRatio -> Automatic, > PlotRange -> {{0, 1}, {0, 1}}, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026], > >This gives me dots in 4 colors for distinguishing different >kinds of points in my real application. This works fine but >needs the Point structure. Or, I can do (this is for one >kind of point), > >t = Table[{Random[], Random[]}, {i, 1, 1024}]; >ListPlot[t, AspectRatio -> Automatic, > Axes -> Automatic, > Frame -> True, > Background -> GrayLevel[.026] > ]; > >which seems simpler and may fit into the rest of the program >more easily. 1. How do I get the RGBColor Rule or the equivalent into >the latter? The RGBColor[] call is not a rule. 2. In the latter case I also want to plot 4 types of points. >How do I get ListPlot to put down 4 plots superimposed? >Or can't I? 3. In either case, I need to make the whole plot area about >twice as big. That is, it now occupies about a 4 square. To >see details better in my real plot, and because with 16k points >the small plot just looks almost like a solid blur, I want to >make it more like 8 square, or as big as will fit the screen >(without changing the plot range or anything else). There >must be a scale factor somewhere. > You can plot more than one list with MultipleListPlot. <Automatic,Axes->Automatic,Frame->True, SymbolShape->{ColorPoint[RGBColor[1,0,0]], ColorPoint[RGBColor[.8, .8, .8]],ColorPoint[RGBColor[ 0, .5, .9]], ColorPoint[RGBColor[.8, .8, 0]]}, SymbolStyle->PointSize[0.01],Background->GrayLevel[.026] ] -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== For the life of me I am not sure why the following is not working in my v. 4.2: ru[a]=a->x; f[x_]:=(a+b) /. ru[a]; Why do I get f[c] = b+x and not f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com Reply-To: kuska@informatik.uni-leipzig.de ==== because te right hand side of SetDelayed[] is not evaluate. Try ru[a] = a -> x; f[x_] := (a + b) /. ru[a]; f1[x_] := Evaluate[(a + b) /. ru[a]]; and f1[] does what you expect In[]:={f[c], f1[c]} Out[]={b + x, b + c} Jens > For the life of me I am not sure why the following is not working in my > v. 4.2: ru[a]=a->x; > f[x_]:=(a+b) /. ru[a]; Why do I get > f[c] = b+x and not > f[c] = b+c? What gives? Lawrence -- > Lawrence A. Walker Jr. > http://www.kingshonor.com ==== Sir, we are having FreeBSD Server, In this we connected a heavy duty Dot matrix printer locally. While on taking outputs, username and file name are printing as BANNER TYPE. Instead of this, we would like to take the print out as username and file name should be printed as header through out the file. if u are having any scripts like that please send us Raj Mohan System Administrator Reply-To: jmt@dxdydz.net ==== I would like to add : Some characters, at least with a french keyboard, are not directly available typed through their Mathematica entities : [EHat] , [OHat], etc. While this is not an issue when programming, it can become quite painful when writing documentation. > Hoi, > it depends a bit what you want to do. > E.g.: If you want to write applications for clients then go with that > systems your clients use (probably Windows). > If you just use it for yourself, for development: use what you like more. > anymore, like > there were in 3.0 times. > The copy and paste problems are gone if you switch off the KDE Klipper. On the other hand, there are a few OS- (or better Window-manager-specific) > 1.: you cannot rotate text (i.e., FrameLabel settings will look weird > (vertically arranged > horizontal letters), you have to use > RotateLabel -> False generally, or play with the Fonts settings > such that horizontal > tick marks still fit) 2.: If you work with bigger graphics in notebooks I suggest Windows (or > MacOS X) since > least on my XFree 4.2 > installation with a not too modern graphics card). > Also I find resizing of larger notebooks somewhat slow. 3.: If you like to work with keyboard shortcuts: Windows is better, clearly. 4.: There are a couple of Font issues which are better on Windows since > not all fonts engels, nederlands, duits of spaans) Rolf Mertig Mertig Consulting > Berlin > ==== Hoi, it depends a bit what you want to do. E.g.: If you want to write applications for clients then go with that systems your clients use (probably Windows). If you just use it for yourself, for development: use what you like more. anymore, like there were in 3.0 times. The copy and paste problems are gone if you switch off the KDE Klipper. On the other hand, there are a few OS- (or better Window-manager-specific) 1.: you cannot rotate text (i.e., FrameLabel settings will look weird (vertically arranged horizontal letters), you have to use RotateLabel -> False generally, or play with the Fonts settings such that horizontal tick marks still fit) 2.: If you work with bigger graphics in notebooks I suggest Windows (or MacOS X) since least on my XFree 4.2 installation with a not too modern graphics card). Also I find resizing of larger notebooks somewhat slow. 3.: If you like to work with keyboard shortcuts: Windows is better, clearly. 4.: There are a couple of Font issues which are better on Windows since not all fonts engels, nederlands, duits of spaans) Rolf Mertig Mertig Consulting Berlin ==== I am considering the following integral W[m_,n_]:=Integrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}] where m,n are reals >=0. With Mathematica 4.1 I obtain: If[Re[m+n]>-1, -Cos[(m-n)Pi/2]/(2 Pi)* (2 EulerGamma + Log[4] + PolyGamma[0, 1/2(1 + m - n)] + PolyGamma[0, 1/2(1 - m + n)] + 2PolyGamma[0, 1/2(1 + m + n)]) and so using this answer as a definition I obtain W[0,0]=-(2 EulerGamma + Log[4] + 4 PolyGamma[0, 1/2])/(2 Pi)=0.84564 I suspect that these integrals are divergent (*). So I try the numerical integration: NW[m_,n_]:=NIntegrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}] so that NW[0,0]=11.167 Othe couples are W[1,0]=Indeterminate NW[1,0]=0.597973 W[0,1.5]=0.537095 NW[0,1.5]=-5.79306 W[1,1]=0.20902 NW[1,1]=17.5425 W[2,0]=0.427599 NW[2,0]=-6.83464 W[2,1]=Indeterminate NW[2,1]=4.69013 (*) The integral is a particular case of the Weber-Schafheitlin integrals (Abramowitz, 11.4.33). Any explanation about the analytical expression will be gratefully accepteed. Roberto. Roberto Brambilla CESI Via Rubattino 54 20134 Milano tel +39.02.2125.5875 fax +39.02.2125.5492 rlbrambilla@cesi.it ==== WRI Tech Support sent me an answer to the font problem. Copying the Type 1 (not True Type) fonts made the error go away: A workaround for the font-related issue that you encountered, is to place copies of the Mathematica Type 1 fonts from C:Program FilesWolfram ResearchMathematica4.2SystemFilesFontsType1 into C:Program FilesAdobeAcrobat 5.0ResourceFont Sincerely, George Kambouroglou Technical Support Wolfram Research, Inc. support@wolfram.com -----Original Message----- I've been using Mathematica 4.1 on Win98 as a word processor for math-related documents, but often people that need to see the documents don't have Mathematica, and for whatever reason on my computer the HTML saves don't work at all. I'd like to export to PDF format. I can export images to PDF format no problem using, for example Export[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]], and I can export cells correctly to GIF, JPEG, and WMF formats (probably more, those are the only ones I tested) using, for example Export[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->Copy As->Cell Expression)...>> ]] When I change the filename to a .PDF and evaluate the cell, the program displays 'Running...' for a second and gives the 'Out[n] = c:docscell4.pdf ' message as if a file was created, but no file is created anywhere with any name that I could find with Start->Find->[All files and folders created in the previous day]. Is there a limitation to PDF exporting I don't know about? Do I need to upgrade to 4.2? Am I doing something wrong with the Export[] command? Do I need a faster computer? A patch? Something else? ==== SSG> I noticed that n Mathematica 3.0 , IntegerDigits function is SSG> giving wrong results. This problem is not found in Mathematica SSG> 4.1. Whether anybody else has also noted any such problem. SSG> For example IntegerDigits[10^18+7] will give the digits 0 SSG> and 7, omitting 1. Having made totally 4,000,000 attemtps, I was not able to reproduce your example. What version of Mathematica do you use? ...................................................... 4.2 for Microsoft Windows (February 28, 2002) 4.1 for Microsoft Windows (November 2, 2000) 4.0 for Microsoft Windows (April 21, 1999) Microsoft Windows 3.0 (April 25, 1997) Windows 387 2.2 (April 9, 1993) IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] IntegerDigits[10^18 + 7] {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7} ...................................................... Best wishes, Vladimir Bondarenko Mathematical Director Symbolic Testing Group Web : http://www.CAS-testing.org/ http://maple.bug-list.org/VER2/ (under tuning) http://maple.bug-list.org/VER3/ (under tuning) http://maple.bug-list.org/VER1/ (under tuning) Voice : (380)-652-447325 Mon-Fri 9 a.m.-6 p.m. Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== Just tested it with no errors, version 3.0 John A. Velling -----Original Message----- ==== I would appreciate any info on these issues. 1. I have a symbol slback. I was getting tag times lback protected (or something) errors. (A typically uninformative error message.) I suspected there was a separation between the s and l, and they looked too far apart, but when I spaced past them with the arrow keys, there did not appear to be anything like a space in between. I retyped the symbol and all was ok. This has happened before. What's going on ??? 2. I'm using Raster to plot data points in a 256x256 array. Two problems: First, regardless of the ImageSize setting (I need the display as big as possible), the individual data cells when examined closely at 300% vary in size by almost 2:1. This makes detailed inspection of the data values difficult. Surely there is some setting of something which would make each data cell an exact number of screen pixels? Second, I'm using Show[ Graphics[Raster[ rescol, ColorFunction -> Hue]], AspectRatio -> Automatic, ImageSize -> 700]; but the Hues don't allow enough easily distinguishable shades to visually recognize even 6 data values easily. (I'm slightly colorblind.) It would be nice to have black and white available for two of the data values, but Hue does not allow this. I don't understand what the documentation says about RasterArray. 3. I wanted to get this raster image into a format where I could dissect it with Photoshop or equivalent. After much fooling around, I found that I can export the selection as an html file, read it into Navigator, do File> Edit Page, which brings up Netscape Composer, right click the image which, allows saving it as a GIF, which I can finally work on with a photo editor. Maybe there is an easier way, or maybe this description will help someone with the same need. Reply-To: kuska@informatik.uni-leipzig.de ==== > I would appreciate any info on these issues. 1. I have a symbol slback. I was getting > tag times lback protected (or something) errors. > (A typically uninformative error message.) > I suspected there was a separation between the s > and l, and they looked too far apart, but when I > spaced past them with the arrow keys, there did > not appear to be anything like a space in between. > I retyped the symbol and all was ok. This has > happened before. What's going on ??? As long as you don't send us the *exact* input we can't help you. You should also send the mathematica version you are using. But typical this error comes from a equation a*b==c where the user has mixed up Equal[] and Set[] 2. I'm using Raster to plot data points > in a 256x256 array. Two problems: First, > regardless of the ImageSize setting (I need the > display as big as possible), the individual data cells > when examined closely at 300% vary in size by > almost 2:1. This makes detailed inspection of the > data values difficult. Surely there is some setting > of something which would make each data cell an > exact number of screen pixels? Second, I'm > using > Show[ Graphics[Raster[ rescol, > ColorFunction -> Hue]], > AspectRatio -> Automatic, > ImageSize -> 700]; > but the Hues don't allow enough easily distinguishable > shades to visually recognize even 6 data values easily. > (I'm slightly colorblind.) The most humans can distinguish 160 gray levels >It would be nice to have black > and white available for two of the data values, but Hue > does not allow this. And something like: mycolor[i_] := Switch[Round[i], 0, RGBColor[0, 0, 0], 1, RGBColor[1, 0, 0], 2, RGBColor[1, 1, 0], 3, RGBColor[0, 1, 0], 4, RGBColor[0, 1, 1], 5, RGBColor[0, 0, 1], _, RGBColor[1, 1, 1]] Show[Graphics[ Raster[Table[Random[Integer, {0, 6}], {16}, {16}], ColorFunction -> mycolor, ColorFunctionScaling -> False]]] does not help ? > I don't understand what the > documentation says about RasterArray. If you can't be more specific *what* you not understand we can not help you. 3. I wanted to get this raster image into a format > where I could dissect it with Photoshop or equivalent. And ? waht does Export[] do ? it write the expression in a desired format, TIFF, PNG, PPM are all lossless compressed bitmap formats, that Mathematica can export and that can be imported into PhotoShop > After much fooling around, I found that I can export the > selection as an html file, read it into Navigator, do File> > Edit Page, which brings up Netscape Composer, right > click the image which, allows saving it as a GIF, which > I can finally work on with a photo editor. Maybe > there is an easier way, or maybe this description will > help someone with the same need. May be that thhis description help someone who can't read the fancy documation on Import[] and Export[]. Jens ==== [snip] > 2. I'm using Raster to plot data points > in a 256x256 array. Two problems: First, > regardless of the ImageSize setting (I need the > display as big as possible), the individual data cells > when examined closely at 300% vary in size by > almost 2:1. This makes detailed inspection of the > data values difficult. Surely there is some setting > of something which would make each data cell an > exact number of screen pixels? GRAY: (No answer received.) I can get around this by making the images bigger but this is not a complete solution. > Second, I'm using > Show[ Graphics[Raster[ rescol, > ColorFunction -> Hue]], > AspectRatio -> Automatic, > ImageSize -> 700]; > but the Hues don't allow enough easily distinguishable > shades to visually recognize even 6 data values easily. > (I'm slightly colorblind.) The most humans can distinguish 160 gray levels >It would be nice to have black > and white available for two of the data values, but Hue > does not allow this. And something like: mycolor[i_] := > Switch[Round[i], > 0, RGBColor[0, 0, 0], > 1, RGBColor[1, 0, 0], > 2, RGBColor[1, 1, 0], > 3, RGBColor[0, 1, 0], > 4, RGBColor[0, 1, 1], > 5, RGBColor[0, 0, 1], > _, RGBColor[1, 1, 1]] Show[Graphics[ > Raster[Table[Random[Integer, {0, 6}], {16}, {16}], > ColorFunction -> mycolor, ColorFunctionScaling -> False]]] GRAY: Sounds good. I'll try it. Interesting that the help does not contain this in a form I could easily find. > 3. I wanted to get this raster image into a format > where I could dissect it with Photoshop or equivalent. And ? what does Export[] do ? it write the expression > in a desired format, TIFF, PNG, PPM are all lossless > compressed bitmap formats, that Mathematica can export > and that can be imported into PhotoShop GRAY: I foolishly thought something like Export would be under the File menu. > After much fooling around, I found that I can export the > selection as an html file, read it into Navigator, do File> > Edit Page, which brings up Netscape Composer, right > click the image which, allows saving it as a GIF, which > I can finally work on with a photo editor. Maybe > there is an easier way, or maybe this description will > help someone with the same need. GRAY: I just found that simply Copying the image and Pasting it into Paint Shop Pro (or no doubt lots of other bitmap editors) works. For outputting a Raster noninteractively, there is Export, but I haven't tried it yet. Jens, thank you for your reply. ==== explain to me why I get this behavior and what I can do to fix it. When I run Mathematica in X with the graphical user interface by typing mathematica, I can run the following commands and get the expected output, namely a plot with the plot label in a big font. However, when I run the math command and get the text interface and run the same code I do not get the label in a big font. cc = Plot[Sin[x], {x, 0, Pi}, {PlotLabel -> StyleForm[Label, FontSize -> 60]}] Export[test.eps, cc, eps] I believe that this is due to the different method in which the math and mathematica commands setup fonts. Is there anyway to get the behavior that I want? As a side note when I use the old syntax of cc=Plot[Sin[x],{x,0,Pi},{PlotLabel->FontForm[Label,{Courier,60}]}] I get it to work. However, I would like not to use this syntax as it has several limitations. Any suggestions would be greatly appreciated. ==== I have a dual processor Dell computer...unfortunately, I can only access one of the processors...I purchased Wolfram's parallel processing toolkit which , because of the very poor documentation, never did me any good...i'm told that another option for accessing the dual processors is to write C code etc...I can't C program, so i'm wondering this...duzz anyone have C code, both source and binary, that they could give me for accomplishing this....in addition, i would like to access this C code with JavaNativeCode, etc...can anyone help me with this? thanks... jerry blimbaum NSWC panama city, fl Reply-To: kuska@informatik.uni-leipzig.de ==== you can have a parallel implicit Runge-Kutta method programmed in C *and* with the Parallel Computing Toolkit both on the base of the MathLink protocol. Since I have a SGI I can't help you with the binary for a Dell what ever computer but if you like the source ... You can also have a native MPI source of the code but you will need a running MPI for your computer. Jens I have a dual processor Dell computer...unfortunately, I can only access one > of the processors...I purchased Wolfram's parallel processing toolkit which > , because of the very poor documentation, never did me any good...i'm told > that another option for accessing the dual processors is to write C code > etc...I can't C program, so i'm wondering this...duzz anyone have C code, > both source and binary, that they could give me for accomplishing this....in > addition, i would like to access this C code with JavaNativeCode, etc...can > anyone help me with this? thanks... jerry blimbaum NSWC panama city, fl ==== I have a set of inequalities that I solve with InequalitySolve. But then it gives a complete set of solutions, but not in the way I would like it to be! :-) For example, the simple following calculation will give: In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >= -1}; InequalitySolve[ineq,{y4,y6,y5}] Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 the result is good, but I would like it to be in the simpler but equivalent form y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6 How can I tell InequalitySolve to do that? It is simple for this example, but for a large set of simple inequalities InequalitySolve gives lines and lines of results instead of a simple result. Vincent Bouchard ==== f[c] == (c+b)/.ru[c] == (c+b)/.c->x == x+b == b+x Bobby Treat -----Original Message----- f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== Sorry; disregard my earlier answer. ru[c] isn't defined, so that obviously wasn't the correct sequence of events. Here's the right one: f[c] == HoldPattern[(a+b)/.ru[a]]/.x->c == (a+b)/.ru[a] == (a+b)/.a->x == x + b == b + x The substitution of c for x occurs before the rule ru[a] is evaluated, so there's no x in the expression to replace. Instead, there's an 'a' to replace with x. If the other sequence had been correct, you have no rule for evaluating ru[c], so it would have remained just that -- ru[c]. When the kernel tried to apply it as a rule to (a+b), there would have been an error. That didn't happen, so that wasn't the sequence of events. Bobby Treat -----Original Message----- f[c] = b+c? What gives? Lawrence -- Lawrence A. Walker Jr. http://www.kingshonor.com ==== You really should read about the difference between := (SetDelayed) and = (Set). When you enter your definition f[x_]:=(a+b) /. ru[a] the right hand side is not evaluated. So next when you evaluate f[c] you get (a+b)/.ru[a] and only now ru[a] is evaluated, thus giving you (a+b)/.a->x which is b+x There are several ways to get what you want. One is to use = instead of :=, another to force evaluation of the right hand side with f[x_]:=Evaluate[(a+b) /. ru[a]] yet another to insert the actual rule in the definition of f: f[x_]:=(a+b) /. a->x Andrzej Kozlowski Toyama International University JAPAN On Wednesday, September 25, 2002, at 02:50 PM, Lawrence A. Walker Jr. For the life of me I am not sure why the following is not working in my > v. 4.2: ru[a]=a->x; > f[x_]:=(a+b) /. ru[a]; Why do I get > f[c] = b+x and not > f[c] = b+c? What gives? Lawrence -- > Lawrence A. Walker Jr. > http://www.kingshonor.com > ==== Well, I have written the following notebook with Mathematica In[78]:= a=Sqrt[4*Pi/Sqrt[3]] In[79]:= fcom[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(1-Exp[-I*k*(a-mu)])/(I*k)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*(k+2*Pi/a)*(a-mu)])/(I*(k+2*Pi/a))+( 1-Exp[-I*(k-2*Pi/a)*(a-mu)])/(I*(k-2*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(k+4*Pi/a)*(a-mu)])/(I*(k+4*Pi/a))+( 1-Exp[-I*(k+2*Pi/a)*(a-mu)])/(I*(k+2*Pi/a)))+( 1-Exp[-I*(k-2*Pi/a)*(a-mu)])/(I*(k-2*Pi/a))+( 1-Exp[-I*(k-4*Pi/a)*(a-mu)])/(I*(k-4*Pi/a)))/(3*a) In[80]:= f0[k_,mu_]:=((1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(a-mu)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*2*Pi/a*(a-mu)])/(I*(2*Pi/a))+( 1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(4*Pi/a)*(a-mu)])/(I*(4*Pi/a))+( 1-Exp[-I*(2*Pi/a)*(a-mu)])/(I*(2*Pi/a)))+( 1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a))+( 1-Exp[-I*(-4*Pi/a)*(a-mu)])/(I*(-4*Pi/a)))/(3*a) In[81]:= fp1[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(1-Exp[-I*2*Pi/a*(a-mu)])/( I*2*Pi/a)+ Exp[-I*mu*2*Pi/a]*((1-Exp[-I*(4*Pi/a)*(a-mu)])/(I*(4*Pi/a))+(a-mu))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(6*Pi/a)*(a-mu)])/(I*(6*Pi/a))+( 1-Exp[-I*(4*Pi/a)*(a-mu)])/(I*(4*Pi/a)))+( a-mu)+(1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a)))/(3*a) In[82]:= fm1[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*( 1-Exp[I*2*Pi/a*(a-mu)])/(-I*2*Pi/a)+ Exp[-I*mu*2*Pi/a]*((a-mu)+(1-Exp[-I*(-4*Pi/a)*(a-mu)])/(I*(-4*Pi/a)))+ Exp[-I*mu*4*Pi/a]*((1-Exp[-I*(2*Pi/a)*(a-mu)])/(I*(2*Pi/a))+(a-mu))+( 1-Exp[-I*(-4*Pi/a)*(a-mu)])/(I*(-4*Pi/a))+( 1-Exp[-I*(-6*Pi/a)*(a-mu)])/(I*(-6*Pi/a)))/(3*a) In[83]:= fp2[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*(1-Exp[-I*4*Pi/a*(a-mu)])/( I*4*Pi/a)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*(6*Pi/a)*(a-mu)])/(I*(6*Pi/a))+(1-Exp[-I*( 2*Pi/a)*(a-mu)])/(I*(2*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((1-Exp[-I*(8*Pi/a)*(a-mu)])/(I*(8*Pi/a))+( 1-Exp[-I*(6*Pi/a)*(a-mu)])/(I*(6*Pi/a)))+( 1-Exp[-I*(2*Pi/a)*(a-mu)])/(I*(2*Pi/a))+(a-mu))/(3*a) In[84]:= fm2[k_,mu_]:=(( 1+Exp[-I*mu*2*Pi/a]+Exp[-I*mu*4*Pi/a])*( 1-Exp[I*4*Pi/a*(a-mu)])/(-I*4*Pi/a)+ Exp[-I*mu*2* Pi/a]*((1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a))+( 1-Exp[-I*(-6*Pi/a)*(a-mu)])/(I*(-6*Pi/a)))+ Exp[-I*mu*4* Pi/a]*((a-mu)+(1-Exp[-I*(-2*Pi/a)*(a-mu)])/(I*(-2*Pi/a)))+( 1-Exp[-I*(-6*Pi/a)*(a-mu)])/(I*(-6*Pi/a))+( 1-Exp[-I*(-8*Pi/a)*(a-mu)])/(I*(-8*Pi/a)))/(3*a) In[85]:= Lp[0|N[0],mu_]:=f0[0,mu] In[86]:= Lp[2*Pi/a|N[2*Pi/a],mu_]:=fp1[2*Pi/a,mu] In[87]:= Lp[-2*Pi/a|-N[2*Pi/a],mu_]:=fm1[2*Pi/a,mu] In[88]:= Lp[4*Pi/a|N[4*Pi/a],mu_]:=fp2[4*Pi/a,mu] In[89]:= Lp[-4*Pi/a|-N[4*Pi/a],mu_]:=fm2[-4*Pi/a,mu] In[90]:= Lp[k_,mu_]:=fcom[k,mu] In[91]:= Ll[k_,mu_]:=0/;mu>=a In[92]:= Ll[k_,mu_]:=0/;mu<=-a In[93]:= Ll[k_,mu_]:=Lp[k,mu]/;0<=muMonteCarlo,MaxPoints->100000000,Compiled->False] but this is not enough to ensure convergence of the integration. Notice that I have inserted some points in the integration path in order to avoid problems with numerical divergences which Mathematica detects in fcom[k,mu] (but these divergences do not really exist, analitically) Does somebody has a smart suggestion to perform this computation? Fabio ==== In a presentation I wish to use Plot to generate a sequence of frames and then animate them. The problem is that the audience sees the animation twice. Once when the frames are being generated and then again after I have closed the group and double clicked on the top graphic. However, the first showing during generation is enough (but uncontrolled). Is it possible to tidy up the generation of the graphic so that it becomes the animation? I have tried the following Do[Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEnd`SelectionAnimate[0.1]}]; FrontEndExecute[{FrontEndToken[Clear]}], {t, 0, 15, 0.1}] This works but the cell dividing line flashes on and off spoiling the animation and if there is anything in the cell below this jumps up and down. Is there a proper way of doing this? Hugh Goyder ==== I need to program the following recursion scheme for time series forecasting (The Innovation Algorithm). I will write it in pseudo-Mathematica notation. K is the given m x m autocovariance (numerical) matrix of the process v[0] = K[[1,1]]; H[n,n-k] = (v[k])^(-1) (K[[n+1,k+1]] - Sum[(H[k,k-j] H[n,n-j] v[j]), {j,0,k-}]) for k=0,1,...,n-1 v[n] = K[[n+1,n+1]] -Sum[(H[n,n-j])^2 v[j],{j,0,n-1}] The scheme should be solved in the order v[0], H[1,1], v[1], H[2,2], H[2,1], v[2], H[3,3], H[3,2], H[3,1], ... I have already tried to program it in a straght-forward way, but as have no experience with recursive functions with two variables, it doesn't seem to work properly and is also very slow. Any help would be Robert Reply-To: murray@math.umass.edu ==== I don't understand the problem. Say I enter the 2D form for the reciprocal of the square root of a^2 + b^2, but I enter it in Standard Form (i.e., using the Control key with / to form the fraction, and the Control key with 2 to get the square root symbol). If then I click anywhere within the subexpression inside the square root, then with 2 to three clicks the entire expression under the square root will be highlighted. I can then do a copy-and-paste to put that into any cell, in the usual way -- with keyboard key combinations, right-click context menu, or Mathematica Edit menu. Isn't that GUI enough? Would you REALLY want to be able to DRAG the highlighted expression to a new place? Think of how much of a mess this could cause through inadvertent movement of the mouse after highlighting some subexpression. In fact, I hate Microsoft Word's doing just that! >I'm a poor physicist trying to figure out how to sort out the >>physical from the non-physical solutions to a problem. To do >>that, I need to be able to look at an expression and pick out a >>subexpression, the part under the radical. > GRAY: > This points up the need, which I've been aware of for years, to be > able to select any part of an expression and drag it to a new line for > further processing. Mathematica and the other CAS I'm familiar with are still > pretty much stuck with a command line interface. They need a true > GUI with extensive interaction. > When I can see on the screen exactly what I want to do, why > should I have to type a bunch of stuff in to access what I want? > Maybe we'll see this in version 5? 6? Never? > -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street Amherst, MA 01375 ==== > I'm a poor physicist trying to figure out how to sort out the > physical from the non-physical solutions to a problem. To do > that, I need to be able to look at an expression and pick out a > subexpression, the part under the radical. GRAY: This points up the need, which I've been aware of for years, to be able to select any part of an expression and drag it to a new line for further processing. Mathematica and the other CAS I'm familiar with are still pretty much stuck with a command line interface. They need a true GUI with extensive interaction. When I can see on the screen exactly what I want to do, why should I have to type a bunch of stuff in to access what I want? Maybe we'll see this in version 5? 6? Never? Reply-To: murray@math.umass.edu ==== I get the same result in 4.2 (under Windows). Not sure why. But you could try this modification: PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur]; Pause[dur], {i, Length[L]}] Then PlaySeq[{224, 256, 384}, 3] seems to work as expected, prolonging the notes before the last one to their full expected duration. > PlayTone[F_, dur_] := Play[Sin[2*Pi*F*t], {t, 0, dur}] > allows me to play a sine wave of frequency F and duration dur PlaySeq[L_, dur_] := Do[PlayTone[L[[i]], dur], {i, Length[L]}] should allow me to play a sequence of tones > with a given list of frequencies L > and all the same duration dur. It does not work at least in 4.1 all tones but the last one are much shorter than dur. any help? > -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street Amherst, MA 01375 ==== this is almost the solution. but it creates some artificial rests. when the sounds