A25 ==== One of these days the company I work for will buy one Mathematica 4.2versions of the product.window manager. Our Windows systems are running on top of VMWare in WindowsXP Professional.In testing using an evaluation version I found that the VMWare/XP version isperforming pretty well so that wouldn't be an issue.My main concern (and probably the grounds on which we will base ourdecision) is the quality of the front-end. The Windows frontend worksßawlessly; however, in test-driving earlier versions of Mathematica (3.0satisfactorily. I didn't spend much time to hunt down the source of theproblem, but it is probable that some X key-mapping was wrong making, forexample, keyboard shortcuts for ÔCopy' and ÔPaste' malfunctioning. On theWindows frontend.to full satisfaction? I'd be willing to spend a couple of hours to fix somesettings, but only if I'm sure it could be done. The bottom line is that I Inot 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> ßawlessly; 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.ukAmateur 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>> ßawlessly; 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 .htmlhttp://66.92.149.152/proprietary/com/wri/ch05.htmlI 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 yourdecision.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 fordeleting, 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 work4. Generally speaking it takes more mouse clicks and keystrokes to do thingsI think these are general differences between the user interfaces on theseoperating systems rather than something specific to the Mathematicaimplementations. I have tried to overcome them at various time withoutsuccess. 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 otherpeople.3. I want to run long calculations on additional CPUs, leaving my desktopcomputer free for other things. You can do this between Windows machineskernel via Mathlink. This is very simple and more reliable and robust thanFront End and it is easy, say, to transfer input or output betwen systemswithin a single Front End. I should add that in our lab we can access thethe additional convenience of being able to save a notebook from the WindowsFront End in the same directory as other files the kernel may be workingwith. You may not have this option and, of course, you need Mathematica onboth systems.These are my personal opinions based on practical experience, I really donot 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.2Windows> versions of the product.> window manager. Our Windows systems are running on top of VMWare inWindows> XP Professional.> In testing using an evaluation version I found that the VMWare/XP versionis> 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> ßawlessly; 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 fixsome> settings, but only if I'm sure it could be done. The bottom line is that IIbut> 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> ßawlessly; 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 twoReverse 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 onlyissue is computing kL. The following way is a bit complicated. Perhapssomeone 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 ==== =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 eachcharacter, partitions that to whatever length I want and Prepends zerostothe input as needed to create an appropriate length array.What is the correct syntax for Partition (or is there a better way?). ==== I need to solve algebraic-differential-equations> (some of index 1, maybe some of higher index as well)> from within Mathematica 4.2.> Is there an implementation of numerical (like DASSL)> or symbolic algorithms capable of doing that around?> I know that some numerical software systems which> may have DASSL-routines that do what> I want. Has anybody suggestions on which of these> systems is easy to interface with Mathematica?> Is there a C++ library that contains such routines and can be> interfaced with Mathematica?Reinhard,have you tried the NDAESolve package that comes with the circuitanalysis toolbox Analog Insydes? You can get a free evaluation versionof Analog Insydes from www.analog-insydes.de. Eckhard Hennig ==== =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 tobe> {{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 Prependszeros 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}];SonOneSonOne = RotateLeft[SonOne, 1]Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}]SonOneQuestion 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> < Is there a way to figure out what the package exports without editing> the source file?> -- Murray Eisenberg murray@math.umass.eduMathematics & Statistics Dept.Lederle Graduate Research Tower phone 413 549-1020 (H)University of Massachusetts 413 545-2859 (W)710 North Pleasant StreetAmherst, MA 01375 ==== Jose,I generally use the Needs statement to load a package. It avoids doubleloading and all the error messages that result. SayNeeds[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 usagemessage for the name. (On earlier Mathematica versions you only obtain alist 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 Helppage. (Private packages may not have that feature.)David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , ModeratorReply-To: ==== =Maybe there's a faster way -- I hope so! -- but here's my answer:n = 2^26Timing[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 thefollowing speed:4.2 for Mac OS X (June 4, 2002)oldmax = $MaxPrecision 61. 10$MaxPrecision = InfinityInfinityWith[{n = 2^26}, Timing[ pd = RealDigits[N[Pi, n + 1], 10, 20, 19 - n]; ]]{28794.1 Second, Null}MaxMemoryUsed[]512055204pd{{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 printoutof digits? Of course it would take a few additional seconds to formatthe 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}];SonOneSonOne = RotateLeft[SonOne, 1]Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}]SonOneQuestion Two:How can I change points properties (such as Size and Color) for the plotbelow? 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]= 3In[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 ßag 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 likeIn[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 writeIn[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 formath-related documents, but often people that need to see the documentsdon't have Mathematica, and for whatever reason on my computer the HTMLsaves don't work at all. I'd like to export to PDF format. I can exportimages to PDF format no problem using, for exampleExport[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]],and I can export cells correctly to GIF, JPEG, and WMF formats (probablymore, those are the only ones I tested) using, for exampleExport[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->CopyAs->Cell Expression)...>> ]]When I change the filename to a .PDF and evaluate the cell, the programdisplays Ô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 anyname that I could find with Start->Find->[All files and folders created inthe previous day].Is there a limitation to PDF exporting I don't know about? Do I need toupgrade to 4.2? Am I doing something wrong with the Export[] command? Do Ineed 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 cuttingthe 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 pathfrom 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 - isbeyond 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]= 3In[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 ßag 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 likeIn[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 writeIn[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.netApproved: Steven M. Christensen , ModeratorReply-To: ==== =Oops! That should beindividual1 = 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}];SonOneSonOne = RotateLeft[SonOne, 1]Do[SonOne = Insert[SonOne, Reverse[CutSequence][[i]], CutPosition + 1], {i, 1, CutLength}]SonOneQuestion Two:How can I change points properties (such as Size and Color) for the plotbelow? 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 doeither 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 differentkinds of points in my real application. This works fine butneeds the Point structure. Or, I can do (this is for onekind 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 programmore easily.1. How do I get the RGBColor Rule or the equivalent intothe 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 abouttwice as big. That is, it now occupies about a 4 square. Tosee details better in my real plot, and because with 16k pointsthe small plot just looks almost like a solid blur, I want tomake it more like 8 square, or as big as will fit the screen(without changing the plot range or anything else). Theremust be a scale factor somewhere. ==== =As I derived a generalization for a 3D parameterized curve yesterday, I'dnoticed a mistake in my equation posted below, a factor Ô2' in expressioninvolving x'[t]^2, should be Ô1'.Since this forum is of an alt. type, I've published the whole notebook athttp://www2.arnes.si/~gljpoljane22/math/ FallingCurve3D.nbBye,Borutp.s. A Ôfill-the-gap' riddle for those interested in physics lore. RichardFeynman once said:Science is like _ _ _, sometimes something useful comes out, but that isnot the reason why we are doing it.| ...| 1) I'll leave re-deriving equation to you, here is what I've got (justcopy| paste it).:|| !(getEq[| f_] := [IndentingNewLine](x'')[| t] + (x')[t]^2 (2 (f')[x[t]] (f'')[x[t]])/(1 +| (f'| )[x[t]]^2) + (g (f')[x[t]])/(1 + (f')[x[t]]^2) == 0 /. g ->| 1)| ... ==== =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 MapPoint onto the lists of point coordinates. Give the color before each set ofpoints. I adjusted the PlotRegion to obtain some black margin on all sidesof the frame.David Parkdjmp@earthlink.nethttp://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 differentkinds of points in my real application. This works fine butneeds the Point structure. Or, I can do (this is for onekind 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 programmore easily.1. How do I get the RGBColor Rule or the equivalent intothe 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 abouttwice as big. That is, it now occupies about a 4 square. Tosee details better in my real plot, and because with 16k pointsthe small plot just looks almost like a solid blur, I want tomake it more like 8 square, or as big as will fit the screen(without changing the plot range or anything else). Theremust 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) == 0Borut'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 differentialequation is solved for t=0 to 5 first. The quarter-period is computedby finding a zero; then the differential equation is solved again fort=0 to the quarter-period, and the solution is extended using reßectionand periodicity. This yields a higher-precision solution. Then I graphthe 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 stepsize that divides period/4 guarantees the lowest point is reached ON aframe 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 pathfrom 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 - isbeyond 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 differentkinds of points in my real application. This works fine butneeds the Point structure. Or, I can do (this is for onekind 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 programmore easily.1. How do I get the RGBColor Rule or the equivalent intothe 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 abouttwice as big. That is, it now occupies about a 4 square. Tosee details better in my real plot, and because with 16k pointsthe small plot just looks almost like a solid blur, I want tomake it more like 8 square, or as big as will fit the screen(without changing the plot range or anything else). Theremust be a scale factor somewhere. ==== =The same command worked for me, insofar as creating the plot isconcerned.I did get an error message opening the file, saying that Adobe Acrobatwas Unable to find or create the font ÔMathematica1Mono-Bold'. Somecharacters 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->CopyAs->Cell Expression)...>> ]]When I change the filename to a .PDF and evaluate the cell, the programdisplays Ô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 withanyname that I could find with Start->Find->[All files and folders createdinthe previous day].Is there a limitation to PDF exporting I don't know about? Do I need toupgrade to 4.2? Am I doing something wrong with the Export[] command? DoIneed 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 cellwith all its rubbish, or an image (if I use Word).How can I export just plain _numbers_?ThanxFip ==== =You can useExport[file.dat, expr] where expr is a two-dimensional array.Or for more ßexibility 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 Iwant the cursor to be placed between the brackets not after them. Howcan 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. Seehttp://support.wolfram.com/mathematica/graphics/export/ convertpdfghostscript.htmlhttp://support.wolfram.com/ mathematica/graphics/export/convertpdfdistiller.html-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 aboutdifferential equations. I can Plot the solution and I canPlay 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 PokornyMath Dept, Prague Institute of Chemical Technologyhttp://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 thatsystems your clients use (probably Windows).If you just use it for yourself, for development: use what you like more.anymore, likethere 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) sinceleast 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 fontsengels, nederlands, duits of spaans)Rolf MertigMertig ConsultingBerlin ==== =I'd like to add a JLink animation of the rolling ball based on Selwyn'ssolution: 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, ß-----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 fromthe> 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 beyondmy> 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 andsuccessfully 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.netApproved: 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]};Thengrf = 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 ConsultingThe final answer to your Mathematica needsSpend 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 ConsultingThe final answer to your Mathematica needsSpend 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 inPlot[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 aboutdifferential equations. I can Plot the solution and I canPlay 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 PokornyMath Dept, Prague Institute of Chemical Technologyhttp://staffold.vscht.cz/mat/Pavel.Pokorny ==== =I'd like to add a JLink animation of the rolling ball based on Selwyn'ssolution: 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, ß-----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 fromthe> 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 beyondmy> 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. Seehttp://support.wolfram.com/mathematica/graphics/export/ convertpdfghostscript.htmlhttp://support.wolfram.com/ mathematica/graphics/export/convertpdfdistiller.html-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 andsuccessfully 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.netApproved: 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]};Thengrf = 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 ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== =Mario: Use, for example, PlotStyle->Thickness[0.01] for plot andAxesStyle->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.netApproved: Steven M. Christensen , Moderator ==== =Mario:Use, for example, PlotStyle->Thickness[0.01] for plot andAxesStyle->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.netApproved: Steven M. Christensen , Moderator ==== =I have to use a graphics of mathematica with powerpoint for a littleY-axes and line of function) are bold or more visible: how can I dothat? ==== 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 inPlot[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 ConsultingThe final answer to your Mathematica needsSpend 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 getf[c] = b+xand notf[c] = b+c?What gives?Lawrence-- Lawrence A. Walker Jr.http://www.kingshonor.comReply-To: kuska@informatik.uni-leipzig.de ==== =because te right hand side of SetDelayed[] is notevaluate.Tryru[a] = a -> x;f[x_] := (a + b) /. ru[a];f1[x_] := Evaluate[(a + b) /. ru[a]];and f1[] does what you expectIn[]:={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 usRaj MohanSystem 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 thatsystems your clients use (probably Windows).If you just use it for yourself, for development: use what you like more.anymore, likethere 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) sinceleast 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 fontsengels, nederlands, duits of spaans)Rolf MertigMertig ConsultingBerlin ==== =I am considering the following integralW[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.84564I suspect that these integrals are divergent (*). So I try the numericalintegration:NW[m_,n_]:=NIntegrate[BesselJ[m, x]*BesselJ[n, x], {x, 0, Infinity}]so thatNW[0,0]=11.167Othe couples areW[1,0]=Indeterminate NW[1,0]=0.597973W[0,1.5]=0.537095 NW[0,1.5]=-5.79306W[1,1]=0.20902 NW[1,1]=17.5425W[2,0]=0.427599 NW[2,0]=-6.83464W[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 BrambillaCESIVia Rubattino 5420134 Milanotel +39.02.2125.5875fax +39.02.2125.5492rlbrambilla@cesi.it ==== =WRI Tech Support sent me an answer to the font problem. Copying theType 1 (not True Type) fonts made the error go away:A workaround for the font-related issue that you encountered, is toplacecopies of the Mathematica Type 1 fonts fromC:Program FilesWolframResearchMathematica4.2SystemFilesFontsType1intoC: Program FilesAdobeAcrobat 5.0ResourceFontSincerely,George KambouroglouTechnical SupportWolfram Research, Inc.support@wolfram.com-----Original Message-----I've been using Mathematica 4.1 on Win98 as a word processor formath-related documents, but often people that need to see the documentsdon't have Mathematica, and for whatever reason on my computer the HTMLsaves don't work at all. I'd like to export to PDF format. I can exportimages to PDF format no problem using, for exampleExport[c:docsplot3.pdf, Plot[Sin[x],{x,-2Pi,2Pi}]],and I can export cells correctly to GIF, JPEG, and WMF formats (probablymore, those are the only ones I tested) using, for exampleExport[c:docscell4.gif, Cell[ <<...(copied cell data from Edit->CopyAs->Cell Expression)...>> ]]When I change the filename to a .PDF and evaluate the cell, the programdisplays Ô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 withanyname that I could find with Start->Find->[All files and folders createdinthe previous day].Is there a limitation to PDF exporting I don't know about? Do I need toupgrade to 4.2? Am I doing something wrong with the Export[] command? DoIneed a faster computer? A patch? Something else? ==== =SSG> I noticed that n Mathematica 3.0 , IntegerDigits function isSSG> giving wrong results. This problem is not found in MathematicaSSG> 4.1. Whether anybody else has also noted any such problem.SSG> For example IntegerDigits[10^18+7] will give the digits 0SSG> and 7, omitting 1.Having made totally 4,000,000 attemtps,I was not able to reproduce your example.What version of Mathematica do you use?......................................................4.2 for Microsoft Windows (February 28, 2002)4.1 for Microsoft Windows (November 2, 2000)4.0 for Microsoft Windows (April 21, 1999)Microsoft Windows 3.0 (April 25, 1997)Windows 387 2.2 (April 9, 1993)IntegerDigits[10^18 + 7]IntegerDigits[10^18 + 7]IntegerDigits[10^18 + 7]IntegerDigits[10^18 + 7]IntegerDigits[10^18 + 7]{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7}....................... ...............................Best wishes,Vladimir BondarenkoMathematical DirectorSymbolic Testing GroupWeb : http://www.CAS-testing.org/ http://maple.bug-list.org/VER2/ (under tuning) http://maple.bug-list.org/VER3/ (under tuning) http://maple.bug-list.org/VER1/ (under tuning)Voice : (380)-652-447325 Mon-Fri 9 a.m.-6 p.m.Mail : 76 Zalesskaya Str, Simferopol, Crimea, Ukraine ==== =Just tested it with no errors, version 3.0John A. Velling-----Original Message----- ==== =I would appreciate any info on these issues.1. I have a symbol slback. I was gettingtag times lback protected (or something) errors.(A typically uninformative error message.)I suspected there was a separation between the sand l, and they looked too far apart, but when Ispaced past them with the arrow keys, there didnot appear to be anything like a space in between.I retyped the symbol and all was ok. This hashappened before. What's going on ???2. I'm using Raster to plot data pointsin a 256x256 array. Two problems: First,regardless of the ImageSize setting (I need thedisplay as big as possible), the individual data cellswhen examined closely at 300% vary in size byalmost 2:1. This makes detailed inspection of thedata values difficult. Surely there is some settingof something which would make each data cell anexact number of screen pixels? Second, I'musingShow[ Graphics[Raster[ rescol, ColorFunction -> Hue]], AspectRatio -> Automatic, ImageSize -> 700];but the Hues don't allow enough easily distinguishableshades to visually recognize even 6 data values easily.(I'm slightly colorblind.) It would be nice to have blackand white available for two of the data values, but Huedoes not allow this. I don't understand what thedocumentation says about RasterArray.3. I wanted to get this raster image into a formatwhere I could dissect it with Photoshop or equivalent.After much fooling around, I found that I can export theselection as an html file, read it into Navigator, do File>Edit Page, which brings up Netscape Composer, rightclick the image which, allows saving it as a GIF, whichI can finally work on with a photo editor. Maybethere is an easier way, or maybe this description willhelp someone with the same need.Reply-To: kuska@informatik.uni-leipzig.de ==== I would appreciate any info on these issues.> 1. I have a symbol slback. I was getting> tag times lback protected (or something) errors.> (A typically uninformative error message.)> I suspected there was a separation between the s> and l, and they looked too far apart, but when I> spaced past them with the arrow keys, there did> not appear to be anything like a space in between.> I retyped the symbol and all was ok. This has> happened before. What's going on ???As long as you don't send us the *exact* input we can'thelp you. You should also send the mathematica versionyou are using. But typical this error comes from a equationa*b==cwhere the user has mixed up Equal[] and Set[]> 2. I'm using Raster to plot data points> in a 256x256 array. Two problems: First,> regardless of the ImageSize setting (I need the> display as big as possible), the individual data cells> when examined closely at 300% vary in size by> almost 2:1. This makes detailed inspection of the> data values difficult. Surely there is some setting> of something which would make each data cell an> exact number of screen pixels? Second, I'm> using> Show[ Graphics[Raster[ rescol,> ColorFunction -> Hue]],> AspectRatio -> Automatic,> ImageSize -> 700];> but the Hues don't allow enough easily distinguishable> shades to visually recognize even 6 data values easily.> (I'm slightly colorblind.) The most humans can distinguish 160 gray levels>It would be nice to have black> and white available for two of the data values, but Hue> does not allow this.And something like:mycolor[i_] := Switch[Round[i], 0, RGBColor[0, 0, 0], 1, RGBColor[1, 0, 0], 2, RGBColor[1, 1, 0], 3, RGBColor[0, 1, 0], 4, RGBColor[0, 1, 1], 5, RGBColor[0, 0, 1], _, RGBColor[1, 1, 1]]Show[Graphics[ Raster[Table[Random[Integer, {0, 6}], {16}, {16}], ColorFunction -> mycolor, ColorFunctionScaling -> False]]]does not help ?> I don't understand what the> documentation says about RasterArray.If you can't be more specific *what* you not understandwe can not help you.> 3. I wanted to get this raster image into a format> where I could dissect it with Photoshop or equivalent.And ? waht does Export[] do ? it write the expressionin a desired format, TIFF, PNG, PPM are all losslesscompressed bitmap formats, that Mathematica can exportand that can be imported into PhotoShop> After much fooling around, I found that I can export the> selection as an html file, read it into Navigator, do File Edit Page, which brings up Netscape Composer, right> click the image which, allows saving it as a GIF, which> I can finally work on with a photo editor. Maybe> there is an easier way, or maybe this description will> help someone with the same need.May be that thhis description help someone who can't readthe fancy documation on Import[] and Export[]. Jens ==== =[snip]> 2. I'm using Raster to plot data points> in a 256x256 array. Two problems: First,> regardless of the ImageSize setting (I need the> display as big as possible), the individual data cells> when examined closely at 300% vary in size by> almost 2:1. This makes detailed inspection of the> data values difficult. Surely there is some setting> of something which would make each data cell an> exact number of screen pixels?GRAY: (No answer received.) I can get around thisby making the images bigger but this is not a completesolution.> Second, I'm using> Show[ Graphics[Raster[ rescol,> ColorFunction -> Hue]],> AspectRatio -> Automatic,> ImageSize -> 700];> but the Hues don't allow enough easily distinguishable> shades to visually recognize even 6 data values easily.> (I'm slightly colorblind.)> The most humans can distinguish 160 gray levels>It would be nice to have black> and white available for two of the data values, but Hue> does not allow this.> And something like:> mycolor[i_] : Switch[Round[i],> 0, RGBColor[0, 0, 0],> 1, RGBColor[1, 0, 0],> 2, RGBColor[1, 1, 0],> 3, RGBColor[0, 1, 0],> 4, RGBColor[0, 1, 1],> 5, RGBColor[0, 0, 1],> _, RGBColor[1, 1, 1]]> Show[Graphics[> Raster[Table[Random[Integer, {0, 6}], {16}, {16}],> ColorFunction -> mycolor, ColorFunctionScaling -> False]]]GRAY: Sounds good. I'll try it. Interesting that the help does notcontain this in a form I could easily find.> 3. I wanted to get this raster image into a format> where I could dissect it with Photoshop or equivalent.> And ? what does Export[] do ? it write the expression> in a desired format, TIFF, PNG, PPM are all lossless> compressed bitmap formats, that Mathematica can export> and that can be imported into PhotoShopGRAY: I foolishly thought something like Export would be underthe File menu.> After much fooling around, I found that I can export the> selection as an html file, read it into Navigator, do File > Edit Page, which brings up Netscape Composer, right> click the image which, allows saving it as a GIF, which> I can finally work on with a photo editor. Maybe> there is an easier way, or maybe this description will> help someone with the same need.GRAY: I just found that simply Copying the image and Pastingit into Paint Shop Pro (or no doubt lots of other bitmapeditors) works. For outputting a Raster noninteractively, there is Export,but I haven't tried it yet. Jens, thank you for your reply. ==== =explain to me why I get this behavior and what I can do to fix it.When I run Mathematica in X with the graphical user interface by typing mathematica,I can run the following commands and get the expected output, namely a plot with the plot label in a big font. However, when I run the math command and get the text interface and run the same code I do not get the label in a big font. cc = Plot[Sin[x], {x, 0, Pi}, {PlotLabel -> StyleForm[Label, FontSize -> 60]}]Export[test.eps, cc, eps]I believe that this is due to the different method in which the math and mathematica commands setup fonts. Is there anyway to get the behavior that I want? As a side note when I use the old syntax of cc=Plot[Sin[x],{x,0,Pi},{PlotLabel->FontForm[Label,{Courier, 60}]}]I get it to work. However, I would like not to use this syntax as ithas several limitations.Any suggestions would be greatly appreciated. ==== =I have a dual processor Dell computer...unfortunately, I can only access oneof the processors...I purchased Wolfram's parallel processing toolkit which, because of the very poor documentation, never did me any good...i'm toldthat another option for accessing the dual processors is to write C codeetc...I can't C program, so i'm wondering this...duzz anyone have C code,both source and binary, that they could give me for accomplishing this....inaddition, i would like to access this C code with JavaNativeCode, etc...cananyone help me with this? thanks...jerry blimbaum NSWC panama city, ßReply-To: kuska@informatik.uni-leipzig.de ==== =you can have a parallel implicit Runge-Kutta methodprogrammed in C *and* with the Parallel Computing Toolkitboth on the base of the MathLink protocol.Since I have a SGI I can't help you with the binaryfor a Dell what ever computer but if you like the source ...You can also have a native MPI source of the code but you willneed a running MPI for your computer. Jens> I have a dual processor Dell computer...unfortunately, I can only access one> of the processors...I purchased Wolfram's parallel processing toolkit which> , because of the very poor documentation, never did me any good...i'm told> that another option for accessing the dual processors is to write C code> etc...I can't C program, so i'm wondering this...duzz anyone have C code,> both source and binary, that they could give me for accomplishing this....in> addition, i would like to access this C code with JavaNativeCode, etc...can> anyone help me with this? thanks...> jerry blimbaum NSWC panama city, ß ==== =I have a set of inequalities that I solve with InequalitySolve. But thenit gives a complete set of solutions, but not in the way I would like itto be! :-) For example, the simple following calculation will give:In[1]:= ineq = {y4 >= -1, y5 >= -1, y6 + y4 >= y5 - 1, y5 >= y6, y6 >= -1}; InequalitySolve[ineq,{y4,y6,y5}]Out[1]:= y4 == -1 && y6 >= -1 && y5 == y6 || y4 > -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6the result is good, but I would like it to be in the simpler butequivalent form y4 >= -1 && y6 >= -1 && y6 <= y5 <= 1 + y4 + y6How can I tell InequalitySolve to do that? It is simple for this example,but for a large set of simple inequalities InequalitySolve gives lines andlines of results instead of a simple result. ==== =Being at a stage were all editing is finished, Springer's schedule is to publish the Programmingvolume and the Graphics volume within the next few months andwithin three months after their publication the Numericsvolume and the Symbolics volume.My editor, Wayne Yuhasz might beable to give you a more concrete publication date.Michael Trott ==== =If I enter Sum[p^i, {i, 0, Infinity}] Mathematica says, it is 1/(1-p), but doesn't say something about the domain for p: 1/(1-p) is only valid for-1=1 and p<=-1?PS: you can find a nice animation for the geometric series at http://www.matheprisma.de/Module/Craps/summe.htm-- Frank Bu¤, fb@frank-buss.dehttp://www.frank-buss.de, http://www.it4-systems.de ==== =If I enter Sum[p^i, {i, 0, Infinity}] Mathematica says, it is 1/(1-p), but doesn't say something about the domain for p: 1/(1-p) is only valid for-1=1 and p<=-1?PS: you can find a nice animation for the geometric series at http://www.matheprisma.de/Module/Craps/summe.htm-- Frank Bu¤, fb@frank-buss.dehttp://www.frank-buss.de, http://www.it4-systems.deReply-To: kuska@informatik.uni-leipzig.de ==== =Hi,Needs[Graphics` FilledPlot`]Block[{$DisplayFunction = Identity}, g1 = FilledPlot[x^2, {x, 2, 4}]; g2 = Plot[x^2, {x, 0, 5}]; ]Show[g2, g1] Jens> i'm relatively new using mathematica 4.2. the other day, i came across what> seemed to be a simple problem, but i couldn't figure out how to do it.> say i was plotting y=x^2, and i wanted to shade the region under the graph> only between x=2 to x=4 over a range of {x, 0, 5}, is there a way to do> this? i tried FilledPlot, but it filled the entire area under the graph.> thank you! ==== =One possibility:In[1]:=g1 = Plot[x^2, {x, 0, 5}];In[2]:=< thank you!>>> ==== =I've found that if you use frames, that gets Ôem much more closelyaligned as well. And if you label any plot, you have to label all ofthem.> The reason why the graphs seem to be non-aligned is that the tick labels are> of different length (i.e., the plots are aligned; it is the axes that are> not vertically aligned). Viz., 0.9 has three positions, whereas -0.5 has> four. Try, for example,> In[1]: plots = Table[Plot[Sin[i*x], {x, 1, Pi}, Ticks -> None],> {i, 1, 3}];> Show[GraphicsArray[> Partition[plots, 1], GraphicsSpacing -> {1, -0.1}]]> The axes are now aligned as you wish.> One way to deal with the problem is to redefine the ticks on the vertical> axes using strings instead of numbers so that all the tick labels have the> same length.> Tomas Garza> Mexico City> ----- Original Message -----> To: mathgroup@smc.vnet.net> Hi,> How can I (vertically) align several Plots (graphs) in the> GraphicsArray to have y axis in the same x position?> Somehing like> plots = Table[Plot[Sin[i x], {x, 1, [Pi]}], {i, 1, 3}];> Show[GraphicsArray[Partition[plots, 1], GraphicsSpacing -> {1, -0.1}]]>> And how can I impose the AspectRatio of the individual graphs to have> x axis spanning the whole x resolution and y axis only one third of y> resolution?>>> Cyril Fischer>> ==== =1) What is the proper way to reset animation options (such as display time and ßow direction) in Mathematica 4.2 on a Mac iBook, OS 9.1?I don't see the menu control item for these that I thought I remembered from earlier versions; and trying to set options, for example SetOptions[Cell, AnimationDisplayTime->5.0]at the beginning of a notebook does not slow down the animation, nor change the value of AnimationDisplayTime shown by Options[Cell].2) More broadly, is the animation control process in 4.2 on a Mac known to be generally screwed up?Example: I create an animation and start it. On initial start the animation ßows forward. Click the || stop icon in the animation control bar at the bottom and it stops. Click || again and the animation restarts, *ßowing backward*, and continues run backwards only from then on.Or, hit the || stop icon, then single-step forward: the animation steps to end of frames and stops (won't jump back to initial cell). But if I stop and single-step backwards, animation can be single-stepped back to first cell, then jumps to final cell and continues single-stepping backward.-- Power tends to corrupt. Absolute power corrupts absolutely. Lord Acton (1834-1902)Dependence on advertising tends to corrupt. Total dependence on advertising corrupts totally. (today's equivalent) ==== =Hi,I wish to know how to increase an irregular polygon's area by, say, 10%.How would I go about doing that? For example, if I have a set of (x,y)coordinates and figured out an area from that and I get an area X, how wouldI increase the polygon's area by X + 10% ? In other words, if X = 100, Iwish to know how to increase X to 110.The area of a polygon is defined as: a = 1/2 *((x1+x2)(y1-y2)+(x2+x3)(y2-y3)+...+(xn+x1)(yn-y1)). Is this correct?John. ==== =Hi allI have the following problem with Mathematica 4.2 on Win2000sp2. With afresh install, every time I try to call the Help Mathematica freezes on thewindow Rebuilding Help Index. I have found a suggestion on this group: auser folders. I've already done so but nothing changed.Any other suggestions?E ==== =I could not reproduce your problem. E.g., suppose you haveIn[1]:=Table[Random[Integer, {0, 9}], {20000}](output omitted here) as the result of some calculation, and you have theoutput actually displayed in its entirety (why would you do that?). Then, ifI type in a new cell varx = and then I click the previous output bracketand copy it to be pasted in the new cell right after the = sign, and thenevaluate the cell, everything works fine. The previous output is now invarx, andIn[2]:=Length[varx]Out[2]=20000as expected. There are, of course, better ways to accomplish this, butanyway it works. Perhaps you could describe exactly the sequence of stepsyou followed.Tomas GarzaMexico City----- Original Message -----> complains but the assignment does not happen. If I ask>> Length[varx]>> the answer is zero.>> How can I solve this? Hope you can help>> Manuel> ==== =Hi there, why is it when I enter Log[Exp[r]] (or use Simplify orFullSimplify) I don't get r? If I do Log[Exp[2]] I get 2!--j-- Jonathan GreenbergGraduate Group in Ecology, U.C. Davishttp://www.cstars.ucdavis.edu/~jongreenhttp:// www.cstars.ucdavis.eduAIM: jgrn307 or jgrn3007MSN: jgrn307@msn.com or jgrn3007@msn.com> Out[5]= -x ==== =Mathgroup,I have an image in the form of nested lists. I would like to rotate this image. In the standard package, I can rotate it 90 degrees at a time. I would like to rotate the image by non-specific intervals. Does anyone know how I can do this with the standard package. ==== =f[x_] := x^2 - 2Ne[x_] := x - f[x]/f'[x]ap = NestList[Ne, 1.5, 5]tang[h_] := f[h] + f'[h](x - h)t = tang /@ apPlot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0}, PlotRange -> {{-5, 5}, {-3, 5}}] Now, How can I plot the last command?I got the following errors:Plot::plnr: !(te[x]) is not a machine-size real number at!(x) = !(-9.999999166666667`).Plot::plnr: !(te[x]) is not a machine-size real number at!(x) = !(-9.188660168541684`).I want to make a program that will plot the successives tangentlines of approximations of any function (when possible) using theNewton Methods... any idea on how can I implement or solve thatproblem? ==== Hi there, why is it when I enter Log[Exp[r]] (or use Simplify or> FullSimplify) I don't get r? If I do Log[Exp[2]] I get 2!> --jSimplify[ Log[Exp[r]], Element[r,Reals] ], does it!-- Nilton ==== =<< Graphics`ContourPlot3D`heart = (x^2 + 9/4y^2 + z^2 - 1)^3 - x^2z^3 - 9/80y^2z^3ContourPlot3D[heart, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, MaxRecursion -> 3, (*if you're patient, try 4 recursions *) Axes -> False, PlotRange -> All, ContourStyle -> {{EdgeForm[]}}, ViewPoint -> {0, 1, 0}, Boxed -> False]Export[heart.dxf, %](* dxf file can be imported into any 3D program this formula gets unstable near the z=0 plane causing the surface to get rough. I would like to see how the Gurus of this group solve that problem *)>Hi,>14th II is comming so I thought to draw some hearts, i know the formula>but i don't know how to draw it using mathematica, could anyone help me>with it ?>>Here's formula: (2x^2 + y^2 + z^2 -1)^3 = a*x^2*z^3 -y^2*z^3, where a is>a real-noumber value.>>Chris>>>-- >Serwis Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/>>> ==== =You could use ContourPlot3D. The following code gives something like whatyou want:a=5;r=5;ContourPlot3D[(2x^2+y^2+z^2-1)^3-a*x^2*z^3-y^2*z ^3,{x,-r,r},{y,-r,r},{z,-r, 2r},PlotPoints[Rule]{10,10}];--Steve LuttrellWest Malvern, UK> Hi,> 14th II is comming so I thought to draw some hearts, i know the formula> but i don't know how to draw it using mathematica, could anyone help me> with it ?>> Here's formula: (2x^2 + y^2 + z^2 -1)^3 = a*x^2*z^3 -y^2*z^3, where a is> a real-noumber value.>> Chris>>> --> Serwis Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/> ==== =I don^t know why...But I also notices that it is better to make your own abs :myAbs[x_]:=Sqrt[x^2]This one is very good on real numbers !but if you want to use for example FourierSeries or Laplacetransform, it isbetter to use the following :myAbs[x_]:=UnitStep[x]x-UnitStep[-x]xMeilleures salutationsFlorian Jaccardprofesseur de Math.8ematiquesEICN-HES7, av. de l'H.99tel-de-Ville2400 Le Loclet.8el. centrale +41 32 930 30 30t.8el. direct +41 32 930 35 52-----Message d'origine-----Envoy.8e : lun., 10. f.8evrier 2003 07:08è : mathgroup@smc.vnet.netObjet : Hi,Simplify[ Abs[x] , x>0 ] returns x.But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.Why is that?Uri ==== =Almost certainly an oversight. However, if you replace Abs by something equivalent, things work as they should, e.g:Simplify[Sqrt[x*Conjugate[x]], x < 0]-xorSimplify[Sqrt[Im[x]^2 + Re[x]^2], x < 0]-xetc.> Hi,>> Simplify[ Abs[x] , x>0 ] returns x.> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.>> Why is that?>> Uri>>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== =This is an issue of deciding what is simpler. With the defaultComplexityFunction -x is not simpler than Abs[x]. Simplify'sbuilt in complexity measure is based on FullForm of expressions,rather than on the size of printed output.In[1]:= LeafCount/@{-x, Abs[x]}Out[1]= {3, 2}In[2]:= -x // FullFormOut[2]//FullForm= Times[-1, x]In[3]:= Abs[x] // FullFormOut[3]//FullForm= Abs[x]With a ComplexityFunction attributing additional weight to AbsSimplify will transform Abs[x] to -x.In[4]:= f=1000 Count[#, _Abs, {0, Infinity}]+LeafCount[#]&;In[5]:= Simplify[ Abs[x] , x<0, ComplexityFunction -> f ]Out[5]= -xAdam StrzebonskiWolfram Research> Almost certainly an oversight. However, if you replace Abs by something > equivalent, things work as they should, e.g:> Simplify[Sqrt[x*Conjugate[x]], x < 0]> -x> or> Simplify[Sqrt[Im[x]^2 + Re[x]^2], x < 0]> -x> etc.>> Hi,>> Simplify[ Abs[x] , x>0 ] returns x.>> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.>> Why is that?>> Uri>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/> ==== =I do not wish to appear ßippant, but if you wish to calculate Abs[x] andyou know that x < 0, then evaluate Abs[-x] with the assumption that x >0:Abs[x] given that x <0 is equal to Abs[-x] given x > 0.In[1]:=Simplify[Abs[-x], x > 0]Out[1]=xOr else, useIn[2]:=Simplify[ComplexExpand[Abs[x]], x < 0]Out[47]=-xto make sure you are talking of real x (I presume).Tomas GarzaMexico City----- Original Message -----> ==== =Yes, but although I have known this for years, I kept getting deceived by this silly point. Would it not however be easier if the default ComplexityFunction in Mathematica reßected more closely the visible number of characters rather then the Mathematica FullForm? (LeafCount).It should be possible to create a VisibleCharacterLength function that would do that.A.> This is an issue of deciding what is simpler. With the default> ComplexityFunction -x is not simpler than Abs[x]. Simplify's> built in complexity measure is based on FullForm of expressions,> rather than on the size of printed output.>> In[1]:= LeafCount/@{-x, Abs[x]}> Out[1]= {3, 2}>> In[2]:= -x // FullForm> Out[2]//FullForm= Times[-1, x]>> In[3]:= Abs[x] // FullForm> Out[3]//FullForm= Abs[x]>> With a ComplexityFunction attributing additional weight to Abs> Simplify will transform Abs[x] to -x.>> In[4]:= f=1000 Count[#, _Abs, {0, Infinity}]+LeafCount[#]&;>> In[5]:= Simplify[ Abs[x] , x<0, ComplexityFunction -> f ]> Out[5]= -x> Adam Strzebonski> Wolfram Research> Almost certainly an oversight. However, if you replace Abs by >> something equivalent, things work as they should, e.g:>> Simplify[Sqrt[x*Conjugate[x]], x < 0]>> -x>> or>> Simplify[Sqrt[Im[x]^2 + Re[x]^2], x < 0]>> -x>> etc.> Hi,>> Simplify[ Abs[x] , x>0 ] returns x.> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.>> Why is that?>> Uri>>>>>> Andrzej Kozlowski>> Yokohama, Japan>> http://www.mimuw.edu.pl/~akoz/>> http://platon.c.u-tokyo.ac.jp/andrzej/>>>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== =In fact the following ComplexityFunction, (which I have used on this list before to deal with similar problems), works quite well:Simplify[Abs[x], x < 0, ComplexityFunction -> (StringLength[ToString[TraditionalForm[#]]] & )]-xThe only problem is that it penalizes functions with long names, like KroneckerDelta. If one could deal with that problem I think it would be the ideal choice for the default ComplexityFZunction in Simplify.Andrzej Kozlowski> Yes, but although I have known this for years, I kept getting deceived > by this silly point. WOuld it not however be easier if the default > ComplexityFunction in Mathematica reßected more closely the visible > number of characters rather then the Mathematica FullForm? > (LeafCount).> It should be possible to create a VisibleCharacterLength function > that would do that.>> A.>> This is an issue of deciding what is simpler. With the default>> ComplexityFunction -x is not simpler than Abs[x]. Simplify's>> built in complexity measure is based on FullForm of expressions,>> rather than on the size of printed output.>> In[1]:= LeafCount/@{-x, Abs[x]}>> Out[1]= {3, 2}>> In[2]:= -x // FullForm>> Out[2]//FullForm= Times[-1, x]>> In[3]:= Abs[x] // FullForm>> Out[3]//FullForm= Abs[x]>> With a ComplexityFunction attributing additional weight to Abs>> Simplify will transform Abs[x] to -x.>> In[4]:= f=1000 Count[#, _Abs, {0, Infinity}]+LeafCount[#]&;>> In[5]:= Simplify[ Abs[x] , x<0, ComplexityFunction -> f ]>> Out[5]= -x>> Adam Strzebonski>> Wolfram Research>>> Almost certainly an oversight. However, if you replace Abs by > something equivalent, things work as they should, e.g:> Simplify[Sqrt[x*Conjugate[x]], x < 0]> -x> or> Simplify[Sqrt[Im[x]^2 + Re[x]^2], x < 0]> -x> etc.>> Hi,>>>> Simplify[ Abs[x] , x>0 ] returns x.>> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.>>>> Why is that?>>>> Uri>>>>>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>>>>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/>>Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== Dear Mathgroup,>>I have a function defined as>>f = Compile[{{arg1, _Real, 2}, {arg2, _Real}, {arg3, _Real}, Module[ {},>expr]]>>and I want to use a a non-Real assignment to arg2 called x, Mathematica>real, but it still returns the correct symbolic expression for f. How do I>assignment a little more thoroughly inside Compile?>>YasOff[CompiledFunction::cfsa]However, there is more than one type of error that can occur. A better method might be to error check with function overloading.If the arguments are of the right type, use the compiled function.RealQ[x_] := MatchQ[x, _Real]f2[arg1_/;MatrixQ[arg1, RealQ], arg2_Real, arg3_Real] := f[arg1, arg2, arg3]Otherwise, use the uncompiled function.f2[arg1_, arg2_, arg3_] := expr--------------------------------------------------------- -----Omega ConsultingThe final answer to your Mathematica needshttp://omegaconsultinggroup.com ==== =Dear all,I am not sure if this is the right place to post this ad.I am writing a package for financial derivatives, which I am distributingto my students to experiment with.Before I actually distribute it, I am looking for people that can give mesome feedback about the ease of the exposition and possible some tips of amore technical nature. The students typically have no knowledge ofMathematica type software whatsoever.The package does the following:* European style option pricing and greeks for the following models:*** Black Scholes*** Merton jump diffusion*** Heston stochastic volatility*** Bakshi Cao Chen jump diffusion stochastic volatility*** Cox Ross Rubinstein binomial* American style option pricing for the following:*** Binomial*** Barone-Adesi Whaley* Graphical output for trees and exercise regions for the American puts* Graphs of portfolio payoffs (eg. for spread analysis)* Graphs of portfolio greeks (eg. for spreads, volatility trading etc.)The following are in notebook form but will be included soon* Extraction of tree parameters for the Ho Lee model for the short rategiven a yield curve* American/European pricing using the Ho Lee tree version* Simulations for mark-to-market procedures and futures payoffs* Simulations for dynamic delta and delta-gamma hedging* Simulations for VaR and stress testingIf anyone is interested in lending me a few minutes, you can contact me tosend you the package. If you are in London I can even offer you a pint foryour time :)Kyriakos_____+**+____+**+___+**+__+**+_Kyriakos ChourdakisLecturer in Financial EconomicsURL: http://www.theponytail.netURL: http://www.qmul.ac.uk/~te9001tel: (++44) (+20) 7882 5086Dept of EconomicsUniversity of London, QMLondon E1 4NSU.K. ==== Hi,>> Mathematica functions such as LinearSolve, LinearProgramming,> FindMinimum and many others, sometimes cannot perform the> requested task. (The linear system of equations has no solution, the> linear program has no feasible points, etc.) What is the recommended way of calling a function like> LinearProgramming and getting an indication that somethingHad just this problem myself. Solution for me is a two-parter. First, wrapthe FindMinimum[ ] code or other in a Check[ ] function, to act on theerror.Second, wrap this in a Block that redirects the $Messages pipe temporarily.So you get...Block[{$Messages={}, Check[ FindMinimum[blah, blah, blah], OopsWhatToDoIfAnError[ ] ] ]Read the Mathematica help on $Messages and on Check for more info ==== =Uri,I hope that the following experiment will provide some ideas fordevelopment.SilentCheck below is a modification of a posting by Carl Woll. SilentCheckPlus::usage = SilentCheckPlus[expr, failexpr] evaluates exprcase it gives SetAttributes[SilentCheck, HoldAll] SilentCheck[expr_, failexpr_]:= Block[{Message}, Message[f_/;Not[MatchQ[f,_$Off]],___]:= Throw[failexpr,SilentCheck]; Catch[expr,SilentCheck] ]Define a variant of LinearSolve LS[m_,c_]/;c=!={}:= SilentCheck[LinearSolve[m,c],LS[Rest[m],Rest[c]]] LS[{},{}]:= $FailedTEST LS[{{1, 2}, {3, 4}, {5, 6}}, {-1, 2, -3}] {-12, 19/2} LS[{{2,1},{1, 2}, {0,0}, {5, 6}}, {-1, 2, 5,6}] {6/5, 0} LS[{{2,1},{1, 2}, {0,0}, {5, 6}}, {-1, 2, 5,1}] {1/5, 0} LS[{{2,1},{1, 2}, {0,1}, {0, 0}}, {-1, 2, 5,1}] $Failed--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> Hi,>> Mathematica functions such as LinearSolve, LinearProgramming,> FindMinimum and many others, sometimes cannot perform the> requested task. (The linear system of equations has no solution, the> linear program has no feasible points, etc.)>> and then returns the expression it tried to evaluate. This happens,> for example, with LinearSolve[{{1, 2}, {3, 4}, {5, 6}}, {-1, 2, -3}].>> This may be reasonable when only one such calculation is performed.> But, suppose we write a program that has to solve many linear> programs, some of them without a feasible solution. When there is> no solution, we want to take an appropriate action.>> What is the recommended way of calling a function like> LinearProgramming and getting an indication that something>> It is possible to catch errors using ÔCheck'. But, as far as I> using ÔOff'.>> of the expression returned to see if it the name of the function called.> For example:>> Off[LinearSolve::nosol] ;>> If[ SameQ[ Head[sol = LinearSolve[...]] , LinearSolve] ,> (* The calculation failed. *) ,> (* sol is a solution. *) ]>> (Note that we have to put sol = LinearSolve[...] inside>> sol = LinearSolve[...] ;> If[ SameQ[Head[sol],LinearSolve] , ... , ... ]>> then in case of failure, the failed calculation will be> attempted again!)>> Is there a cleaner solution?>> Uri>> ------------------------------------------------------------- --------> | Prof. Uri Zwick | http://www.cs.tau.ac.il/~zwick |> | Dept. of Computer Science | zwick@post.tau.ac.il |> | ISRAEL | FAX: +972 3 6409357 |> ------------------------------------------------------------- -------->> ==== =Uri,The following illustrates a technique I've used. (I'm sure I nicked it from somewhere, but I can't remember where.) soln = x /. Solve[eqn, x]; If[soln ==== x, Message[ progname::err]; Return[$Failed]];---Selwyn Hollis> Hi,>> Mathematica functions such as LinearSolve, LinearProgramming,> FindMinimum and many others, sometimes cannot perform the> requested task. (The linear system of equations has no solution, the> linear program has no feasible points, etc.)>> and then returns the expression it tried to evaluate. This happens,> for example, with LinearSolve[{{1, 2}, {3, 4}, {5, 6}}, {-1, 2, -3}].>> This may be reasonable when only one such calculation is performed.> But, suppose we write a program that has to solve many linear> programs, some of them without a feasible solution. When there is> no solution, we want to take an appropriate action.>> What is the recommended way of calling a function like> LinearProgramming and getting an indication that something>> It is possible to catch errors using ÔCheck'. But, as far as I> using ÔOff'.>> of the expression returned to see if it the name of the function > called.> For example:>> Off[LinearSolve::nosol] ;>> If[ SameQ[ Head[sol = LinearSolve[...]] , LinearSolve] ,> (* The calculation failed. *) ,> (* sol is a solution. *) ]>> (Note that we have to put sol = LinearSolve[...] inside>> sol = LinearSolve[...] ;> If[ SameQ[Head[sol],LinearSolve] , ... , ... ]>> then in case of failure, the failed calculation will be> attempted again!)>> Is there a cleaner solution?>> Uri>> ------------------------------------------------------------- --------> | Prof. Uri Zwick | http://www.cs.tau.ac.il/~zwick |> | Dept. of Computer Science | zwick@post.tau.ac.il |> | ISRAEL | FAX: +972 3 6409357 |> ------------------------------------------------------------- -------->> ==== I'm trying to find roots of the characteristic equation of a> dielectric-loaded waveguide. There are multiple roots of the equation and I> use FindRoot to find them. The sequence of roots is very important in my> further calculations.> Is there a routine or a clever way to (numerically) find all the roots of an> equation in a predefined values?> As it is now I have to look for each individual root manually and it gets a> bit tedious as the number of required modes increases.(attached). This originally appeared in The Mathematica Journal which is a good resource for such applications.[contact the author to get the attachment - moderator]Paul ==== =Here is something similar to Dr Bob's idea for small sample size...(but more accurate, I think)<< Statistics`DescriptiveStatistics`Clear[mihajlo2];mihajlo2[ xlist_, dr_:0.1, error_:0.01] := Module[ {xxlist, gaps, ratios, rationalRatios, lcm, intRatios, xvals, linefit, a, b}, xxlist = Mean /@ Split[Sort[xlist], #2 - #1 < error &]; gaps = ListConvolve[{1., -1.}, xxlist]; ratios = gaps/Min[gaps]; rationalRatios = Rationalize[ratios, dr]; lcm = LCM @@ Denominator[rationalRatios]; intRatios = rationalRatios*lcm; xvals = FoldList[Plus, lcm, intRatios]; linefit = Fit[Transpose[{xvals, xxlist}], {1, x}, x]; {a, b} = CoefficientList[linefit, x]; {Mod[a, b], b, Max[xvals]} ];test:xlist := 0.202 + 1.618 Table[0.001 Random[] + Random[Integer, {3, 17}], {20}];TableForm[Table[{{mihajlo2[xlist]}}, {50}]]andxlist := 0.202 + 1.618 Table[0.001 Random[] + Random[Integer, {3, 17}], {4}];TableForm[Table[{{mihajlo2[xlist]}}, {50}]]Mihajlo************************************************ *************** At 2003-02-10, 01:07:00 ************************************************************* *>Mihajlo's method doesn't work well with small sample sizes, so I'd suggest >this:>><< Statistics`DescriptiveStatistics`>xlist = 0.202 + 1.618 Table[0.001 Random[] + Random[Integer, {3, 17}], >{20}];>error = 0.5;>xxlist = Mean /@ Split[Sort[xlist], #2 - #1 < error &];>Fit[xxlist, {1, x, x^2}, x];>{a, b, c} = CoefficientList[, x];>{Mod[a, b], b}>gaps = Subtract @@@ Transpose@{Rest@xxlist, Drop[xxlist, -1]};>ratios = gaps/Min@gaps;>gcd[ratios_List] := Module[{n = 2, k},> While[n < 10 && (k = n/GCD @@ Round[n*ratios]) .89.81« n, n++];> k> ]>b2 = Min[gaps]/gcd@ratios;>{a2 = Mean@Mod[xxlist, b2], b2}>>{1.18984, 1.39711} (* Mihajlo's method with Mean in place of First *)>{0.207753, 1.6175} (* better *)>>With as few as four samples, this often returns the right period, while the >other method rarely gets it right even with 20 samples.>>You shouldn't make the error estimate too small --- a fourth of the period >is about right. (But you don't know the period in advance.) A more >complete method would adjust the error estimate after estimating the >period, to see if the answer changes.>>Bobby ==== =Dear Friends,I need to use the root of a simple equation in subsequent operations.After extracting the root, it comes in the form ->root. I have not been able to get rid of the symbol -> .Can someone help?Naser MostaghelProfessor, Civil EngineeringT: (419) 530-8131F: (419) 530-8116E: nmostag@utnet.utoledo.edu ==== =Steve,If you operate on an object with a linear transformation the area/volume of the image is the original area/volume multiplied by the determinant of the matrix of the linear transformation.Assume that you have a list of vectors giving the vertices: p1, . . . ,pn. The center of gravity is the average q=(p1+ . . . +pn)/n (vector algebra).1. Translate the figure to the origin by subtracting the centroid from each pi.2. Multiply each translated vertex by the number r. This is a similarity transformation with ratio r and it is linear with matrix r*Identity. So it multiplies area by r^2 in the 2D case and multiplies volume by r^3 in the 3D case.3.Translate back by adding q to each rescaled coordinate.You now have rescaled the object without moving its center of gravity. This is the fix mentioned below.> On Sat, 8 Feb 2003 09:46:12 +0000 (UTC), John Ng > Hi,>> I wish to know how to increase an irregular polygon's area by, say, >> 10%.>> How would I go about doing that? For example, if I have a set of >> (x,y)>> coordinates and figured out an area from that and I get an area X, >> how would>> I increase the polygon's area by X + 10% ? In other words, if X = >> 100, I>> wish to know how to increase X to 110.>> The area of a polygon is defined as: a = 1/2 *>> ((x1+x2)(y1-y2)+(x2+x3)(y2-y3)+...+(xn+x1)(yn-y1)). Is this correct?>> Gray:> Can't you just multiply all coordinates by Sqrt[1.1]? This> will move the polygon as well as enlarge it, but that could be fixed.>Garry HelzerDepartment of MathematicsUniversity of Maryland1303 Math BldgCollege Park, MD 20742-4015 ==== Mathgroup,>> I have an image in the form of nested lists. I would like to rotate thisimage. In the standard package, I can rotate it 90 degrees at a time. Iwould like to rotate the image by non-specific intervals. Does anyone knowhow I can do this with the standard package.>Ann,<< Geometry`Rotations` gr = Show[Graphics[{Hue[0], Polygon[{{0, 0}, {1, 0}, {1, 1}}], Hue[2/3],Thickness[0.02], Line[{{0, 0}, {0, 1}}], PointSize[0.06], Point[{0, 0.5}]}],AspectRatio -> Automatic] grrot = gr /. p:{_?(AtomQ[#1] && Element[#1,Reals] & ), _?(AtomQ[#1] &&Element[#1,Reals] & )} :> Rotate2D[p, Pi/4., {1, 1}]; Show[grrot, Frame -> True, PlotRange -> All]1) The rotations of the objects are clockwise.2) AtomQ is used because for example MatchQ[{{{{2, 3}, 5, 6}}}, x_ /; Element[x ,Reals]] TrueIt seems that MatchQ[expr, x_ /; Element[x ,Reals]] is true if it is anested list or single atom and all atoms of expr are real ( with head, Real,Rational or Integer) and no subpart of expr contains two lists.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 ==== -----Original Message----->Sent: Monday, February 10, 2003 7:08 AM>To: mathgroup@smc.vnet.net>f[x_] := x^2 - 2>Ne[x_] := x - f[x]/f'[x]>ap = NestList[Ne, 1.5, 5]>tang[h_] := f[h] + f'[h](x - h)>t = tang /@ ap>>Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0}, > PlotRange -> {{-5, 5}, {-3, 5}}] >>Now, How can I plot the last command?>>I got the following errors:>>Plot::plnr: !(te[x]) is not a machine-size real number at>!(x) = >!(-9.999999166666667`).>Plot::plnr: !(te[x]) is not a machine-size real number at>!(x) = >!(-9.188660168541684`).>>I want to make a program that will plot the successives tangent>lines of approximations of any function (when possible) using the>Newton Methods... any idea on how can I implement or solve that>problem?>>In[8]:= Attributes[Plot]Out[8]= {HoldAll, Protected}So you have to evaluate your arguments. But, I fear, you'll not see toomuch, as Newton convergences is to rapidly in this case; but here's themethod:With[{delta = 10^-1, x0 = Sqrt[2]}, Plot[Evaluate[Prepend[t, f[x]]], Evaluate[Prepend[x0 + delta*{-1, 1}, x]], PlotStyle -> Prepend[Table[{}, {Length[t]}], {Hue[0], Thickness[.005]}], PlotRange -> {All, Thread[f[x0 + delta*{-1, 1}]]}]]You may play with delta, and pull large the graphics.--Hartmut Wolf ==== =Have to Evaluate t.Plot[Evaluate[t], {x, -10, 10}, AxesOrigin -> {0, 0}, PlotRange -> {{-5, 5}, {-3, 5}}]Yas> f[x_] := x^2 - 2> Ne[x_] := x - f[x]/f'[x]> ap = NestList[Ne, 1.5, 5]> tang[h_] := f[h] + f'[h](x - h)> t = tang /@ ap>> Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0},> PlotRange -> {{-5, 5}, {-3, 5}}]>> Now, How can I plot the last command?>> I got the following errors:>> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.999999166666667`).> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.188660168541684`).>> I want to make a program that will plot the successives tangent> lines of approximations of any function (when possible) using the> Newton Methods... any idea on how can I implement or solve that> problem?> ==== =Plot have property of HoldAllIn[58]:=Attributes[Plot]Out[58]={HoldAll, Protected}So if you plot t={2x+1,-2x+3} with the next sentence,t={2x+1,2x-3};Plot[t,{1,2}]error is returned. Plot uses to number 1 to evaluate t.But t is not a list of function, but only a letter. This happensbecause of the Plot's property of HoldAll. Mathematica regard t as a letter t, not a list of functions {2x+1,2x-3}You can have mathematica know t as a list of function,by using Evaluate in a Plot command.t={2x+1,2x-3};Plot[Evaluate[t], {x,1,2}] Help of Plot and A4.2 might be useful to you.************milkcartmilkcart@m17.alpha-net.ne.jp ==== =Hi: you have to use the command Evaluate for evaluating your list t:Plot[Evaluate[t], {x, -10, 10}]I hope it worksFernando> f[x_] := x^2 - 2> Ne[x_] := x - f[x]/f'[x]> ap = NestList[Ne, 1.5, 5]> tang[h_] := f[h] + f'[h](x - h)> t = tang /@ ap> Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0}, > PlotRange -> {{-5, 5}, {-3, 5}}] > Now, How can I plot the last command?> I got the following errors:> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.999999166666667`).> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.188660168541684`).> I want to make a program that will plot the successives tangent> lines of approximations of any function (when possible) using the> Newton Methods... any idea on how can I implement or solve that> problem?> ==== =Try this,Plot[Evaluate[t], {x, -10, 10}, AxesOrigin -> {0, 0}, PlotRange -> {{-5, 5}, {-3, 5}}]Brian> f[x_] := x^2 - 2> Ne[x_] := x - f[x]/f'[x]> ap = NestList[Ne, 1.5, 5]> tang[h_] := f[h] + f'[h](x - h)> t = tang /@ ap> Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0}, > PlotRange -> {{-5, 5}, {-3, 5}}] > Now, How can I plot the last command?> I got the following errors:> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.999999166666667`).> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.188660168541684`).> I want to make a program that will plot the successives tangent> lines of approximations of any function (when possible) using the> Newton Methods... any idea on how can I implement or solve that> problem?> ==== =Baruch,The basic problem is that Plot decides what kind of expression {t} is beforeevaluating {t}. In this case it decides that Flatten[{t}] must be a list ofone real number for the sample values of x that it uses. This is not so, infact Flatten[{t}] becomes a list of several real numbers.We can supply Plot with information to make the correct decision by causing{t} to evaluate before is makes its decision ( I have included f[x] in theplot, and used df = f' (note =, not :=) to avoid evluating f' at eachiteration).You might like to consider avoiding the use of Plot for the tangent linesby adding fo each approximation,a, Line[{a,f[a]},{b,0}] where {b,0} iswhere the tangent at a meets the x-axis -- Epilog might be used. f[x_] := x^2 - 2 Ne[x_] := x - f[x]/f'[x] ap = NestList[Ne, 4., 5] tang[h_] := f[h] + f'[h]*(x - h) t = tang /@ ap Plot[Evaluate[Prepend[t, f[x]]], {x, -5, 5}, AxesOrigin -> {0, 0}, PlotRange -> {-3, f[4]}]Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198> f[x_] := x^2 - 2> Ne[x_] := x - f[x]/f'[x]> ap = NestList[Ne, 1.5, 5]> tang[h_] := f[h] + f'[h](x - h)> t = tang /@ ap>> Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0},> PlotRange -> {{-5, 5}, {-3, 5}}]>> Now, How can I plot the last command?>> I got the following errors:>> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.999999166666667`).> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.188660168541684`).>> I want to make a program that will plot the successives tangent> lines of approximations of any function (when possible) using the> Newton Methods... any idea on how can I implement or solve that> problem?>> ==== =The problem seems to be that t doesn't have x as an explicit argument. Trythe following (which can perhaps be further simplified):In[1]:=f[x_] := x^2 - 2;Ne[x_] := x - f[x]/f'[x];ap = NestList[Ne, 1.5, 5];In[2] : =Clear[tang];tang[h_, x_] : = f[h] + f'[h] (x - h);In[3]:=Plot[Evaluate[Table[tang[ap[[j]]*j, x], {j, 1, Length[ap]}]], {x, -10, 10}, PlotRange -> {{-5, 5}, {-3, 5}}];Tomas GarzaMexico City----- Original Message ----->> Now, How can I plot the last command?>> I got the following errors:>> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.999999166666667`).> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.188660168541684`).>> I want to make a program that will plot the successives tangent> lines of approximations of any function (when possible) using the> Newton Methods... any idea on how can I implement or solve that> problem?> ==== =Hi Baruch.Try this one:Plot[{#}, {x, -10, 10}, AxesOrigin -> {0, 0}, PlotRange -> {{-5, 5}, {-3, 5}}] &/@tGood luck.> f[x_] := x^2 - 2> Ne[x_] := x - f[x]/f'[x]> ap = NestList[Ne, 1.5, 5]> tang[h_] := f[h] + f'[h](x - h)> t = tang /@ ap> Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0}, > PlotRange -> {{-5, 5}, {-3, 5}}] > Now, How can I plot the last command?> I got the following errors:> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.999999166666667`).> Plot::plnr: !(te[x]) is not a machine-size real number at> !(x) = > !(-9.188660168541684`).> I want to make a program that will plot the successives tangent> lines of approximations of any function (when possible) using the> Newton Methods... any idea on how can I implement or solve that> problem?> ==== =Even for simple examples like: Plot[x, {x, 0, 1}]It only gives me a white empty space (no axes, just nothing).I installed the same version on other Computers as well and everythingworked perfectly there. Now IÇve done nothing different...I already tried to reinstall Win98 and Mathematica.Do anybody of you know this behavior of mathematica 4.0?hopefullyMartin ==== =Why when I save a notebook, the input output disappears? Is there any wayto correct this?Paulo ==== I have a program that generates very large lists as output, each one has>about 20.000 elements. When I try to copy any of these as paste it in an>assignment such as varx = {1,2,2,2,1....., 2,1,1} and evaluate, I get no>complains but the assignment does not happen.Have you tried shorter lists, to see when the problem begins to show up?Sounds like a memory problem.Does this happen with lists 500 elements long?And with one thousand elements?And with 5 thousand?Do you have enough system resources to cope with this operation?just my two cents,Peltio ==== =Dear all,One thing I've noticed that if we have a function which has two differentlimits (given two different directions) at one points , mathematica would bestill give an answer though to my understanding the limit doesn't exist insuch a case.Consider the following example:a[x_]:=1/xLimit[a[x],x->0,Direction->+1] +InfLimit[a[x],x->0,Direction->+1] -InfLimit[a[x],x->0]. +Inf.... Maybe my calculus knowledge is a bitrusty but does the limit exist in this case?? ==== Hi,>> Simplify[ Abs[x] , x>0 ] returns x.> But, Simplify[ Abs[x] , x<0] returns Abs[x], and not -x.>> Why is that?>> UriUri,Mathematica considers Abs[x] to be less complex than -x: FullForm[Abs[x]] Abs[x] FullForm[-x] Times[-1, x]So we have to tell it what our measure of complexity is: Simplify[Abs[x],x<0 , ComplexityFunction->((Count[#,_Abs,Infinity])&)] -x--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 ==== =Group,I have a program with a lot of *Print[Something] * calls imbedded. This calls are there for intermediate computation tracing purposes; in other words, I want this in case I need to trace some points in some instances of some computations, as a (standard) service of my program. But I would like to be able to disable this printing facility by using some standard Mathematica variable/option like *DisplayFunction -> Identitiy* if available. Any clue?E. Martin-Serrano ==== =Andrzej has found one workaround for the problem. Just to note that there isalso another way:Letg = Sqrt[1+x^(2a)]-x^awhere if we put the parameter a to be 2 we recover the original function, f.Now,Integrate[g,{x,0,Infinity}] /. a->2gives the correct answer, in terms of Gamma. Also, we could choose not toset a->2, but just to use the assumption Re[a]>0, and thenIntegrate[g,{x,0,Infinity}, Assumptions->Re[a]>0]gives a (nice) answer for general a (also in terms of Gamma).Another (rather minor and unrelated) question arises: one can write down theresult in many various forms using the identityGamma(1+x) = x * Gamma(x)(I am not using Mathematica notation here), and FullSimplify knows aboutthis identity, but applies it only from right to left, i.e. 1/2 Gamma(1/2)reduces to Gamma(3/2), but never the other way around, which is sometimeswanted (in my case, particularly). Since I am not very familiar withFullSimplify, is there any way to explain to FullSimplify that I want onlyGamma[1/4] to appear in the result?Marko----- Original Message ----->> Integrate[f,{x,0,Infinity}]>> Mathematica 4.0 answers:>> -Infinity>> which is not correct. However,>> NIntegrate[f,{x,0,Infinity}]>> gives the correct (numerical) answer:> 1.23605>> The correct (analytical, i.e.. exact) answer to the integral is:>> Gamma[1/4] Gamma[1/4] / 6 Sqrt[Pi]>> which can be obtained after some paperwork. However, if I ask>> Integrate[1/(Sqrt[1+x^4] + x^2),{x,0,Infinity}]>> (this integrand is equivalent to f) one gets a complicated answer in> terms> of EllipticF. Meanwhile, when I ask Mathematica 3.0 the same set of> questions, I get correct answers, and analytical integration gives> answer in> terms of Gamma. Two questions:>> 1) Why does version 4.0 give so fairly incorrect result -Infinity> for the> first integral?> 2) How can I Ôswitch off' the use of elliptic functions and/or Ôforce'> Mathematica to use Gamma?>> Marko> 1). Well, it's a bug. The problem seems to be that attempts to fix bugs> and improve the capabilities of Integrate in each new version of> Mathematica tend to result in previously good integrals getting> broken. In this case Mathematica's use of elliptic functions seems to> be the culprit.> 2). Unfortunately there is no official way to turn off the use of> elliptic functions or anything else in Integrate. I have always> considered this to be a fundamental error in design: it seems to me> that Integrate should have been designed in such a way that you could> turn off and on the use of certain methods, which expand the number of> integrals Mathematica can manage but at the cost of increasing the risk> of getting incorrect answers.>> Having said that, there is a way that sometimes works, and which> luckily includes your case. Here is how. First we use a limit for> Integrate and force Integrate to generate conditions. Since I do not> wish to see the condition generated (it is simply b>0) I use Simplify> with the appropriate assumption:>> In[1]: Simplify[Integrate[Sqrt[1 + x^4] - x^2, {x, 0, b},> GenerateConditions -> True], b > 0]>> Out[1] -(b^3/3) + b*Hypergeometric2F1[-(1/2), 1/4, 5/4, -b^4]>> Note that we got an answer without elliptic functions (which you would> get if you did not set GenerateConditions to True). So now we try to> use Limit:>> In[2]: Limit[%, b -> Infinity]>> Out[2] -((Gamma[-(3/4)]*Gamma[5/4])/(2*Sqrt[Pi]))>> Numerically this seems to agree with your answer (given by Mathematica> 3.0) although Mathematica 4.2 does not seem to be able to prove that> the two answers are equivalent.>> Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/> ==== =Consider the following integral...Integrate[x^p*E^(-x^2), {x, z, Infinity}]Using the substitution x = t^2 it is easy to show that the an