A52 == you should fix you StandardForm[] input it is Inverse FourierTransform[ Sum[DiracDelta[1000(-1 + 10^(fHat/c))/b - f], {fHat, 0, N}], f, t]and it is no wonder that Mathematica can't find a result becausea) N[] is used to convert a exact number into a ßoating point valueb) N has no value, espacial in you expression it can be 0 c) Mathematica must Solve[1000(-1 + 10^(fHat/c))/b - f== 0,fhat] and find out if the solution lies between 0 and N and this can't be done without a knowlege about N Jens> Thefollowing input generates no answer (mathematica 4.2) :> (*I re-write it so it is easier to read*)> InverseFourierTransform[> Sum[> DiracDelta[1000(-1 + 10^(fHat/c))/b - f],> (fHat = 0),N],> f,t]> (*Which is the same as*)> Notebook[{> Cell[BoxData[> (> InverseFourierTransform[[Sum]+(fHat = 0)%N DiracDelta[> 1000 (((-1) + 10^(fHat/c)))/b - f], f,> t])], Input]> },> ScreenRectangle->{{0, 1280}, {0, 1024}},> WindowSize->{959, 890},> WindowMargins->{{0, Automatic}, {Automatic, 0}}> ]> Any ideas ?> thanks> Matt> --> http://mffm.darktech.org> WSOLA TimeScale Audio Mod : http://mffmtimescale.sourceforge.net/> FFTw C++ : http://mffmfftwrapper.sourceforge.net/> Vector Bass : http://mffmvectorbass.sourceforge.net/> Multimedia Time Code : http://mffmtimecode.sourceforge.net/ ==== >-----Original Message----->Sent: Wednesday, January 29, 2003 9:38 AM>To: mathgroup@smc.vnet.nethi,>maybe it's a foolish question, but i'm new to mathematica:i want to plot (using Plot3D of course) at least 2 >3D-functions into the>same diagram. how to i have to handle this?thanx in regard.lhuv>Have you seen Help > The Mathematica Book > Principles of Mathematica > The Structure of Graphics > Plotting Three-Dimensional Surfacesand Help > Built-in Functions > Graphics and Sound > Combinations? If so, please be more explicit about your problem!--Hartmut Wolf ==== I want to solve : (1+x)y''[x]-2(x+2)y'[x]+4y[x) == x Could someone can find a way out for this ? ==== En/Na gianpf ha escrit:> I want to solve : (1+x)y''[x]-2(x+2)y'[x]+4y[x) == x Could someone can find a way out for this ?>Jean,y1[x_] = 2x^2 + 6x + 5y[x_]=(2x^2 + 6x + 5)*z[x](1+x)y''[x]-2(x+2)y'[x]+ 4y[x]=(-8-14x-12x^2-4x^3)z'[x] +(5+11x+8x^2+2x^3)z''[x]=0z[x]=1/4 E[2x]/(5+6x+2x^2)y2[x]=1/4 Exp[2x]y[x]=A y1[x]+B y2[x] (homogeneous solution)y[x]=1/2 x+1/2 (particular solution)y[x_]=A ( 2x^2 + 6x + 5 )+1/4 B Exp[2x]+1/2 x+1/2 (general solution)In[50]:=(1+x)y''[x]-2(x+2)y[CapitalO Tilde][x]+4y[x]==x// FullSimplifyOut[50]=True ==== This appears to make my copy of Mathematica 4.2 hang. So we have to hepthings along a bit by hand.Solve the homogeneous differential equation (i.e. r.h.s.=0) thus:DSolve[{(1 + x)y''[x] - 2(x + 2)y'[x] + 4y[x] == 0}, y, x]Use linear combinations of these two solutions to construct the Green'sfunction which solves the inhomogeneous equation (1 + x)y''[x] - 2(x +2)y'[x] + 4y[x] == DiracDelta[x-a]. On either side of the point x=a theGreen's function is a (different) linear combination of the solutions of thehomogeneous differential equation (this is all standard stuff you can findin textbooks). Once you have the Green's function you can find the solutionto the inhomogeneous differential equation for any r.h.s. Mathematica willhelp you do the integrals that occur when you compute the solution by thisroute.--Steve LuttrellWest Malvern, UK> I want to solve : (1+x)y''[x]-2(x+2)y'[x]+4y[x) == x Could someone can find a way out for this ? ==== The rather obvious answer why it doesn't state the domain of convergence is that nobody programmed it to do so. I can only speculate as to why, but the most likely explanation that comes to my mind is that it was not considered worth the necessary programming effort to do this. For a start, to do so in general would be pretty difficult and time consuming. Just take a simple modification of your case:Sum[(1/(p^4 - 3*p^3 + p^2 - 1))^i, {i, 1, Infinity}]1/(-2 + p^2 - 3*p^3 + p^4)if Mathematica wanted to tell you the domain of convergence it would have to solve the inequalities:<< Algebra`InequalitySolve`InequalitySolve[p^4 - 3*p^3 + p^2 - 1 > 1, p]p < 1 - Sqrt[3] || p > 1 + Sqrt[3]InequalitySolve[p^4-3p^3+p^2-1<-1,p]3/2 - Sqrt[5]/2 < p < 3/2 + Sqrt[5]/2The ability to solve such inequalities appeared only in version 4, while Sum is a much older function. But in any case, it is easy to modify this further so that InequalitySolve won't be able to help, e.g.Sum[(1/(p*E^p - p^p*Sin[p] + p^3))^i, {i, 1, Infinity}]-(1/(1 - E^p*p - p^3 + p^p*Sin[p]))or something even more complicated.A good principle in designing mathematical software is that if something can't be done in sufficient generality that includes at least a substantial number of non-trivial cases and not just the ones where you know the answer anyway, then it's better not to do it at all. Besides, Mathematica is not meant to replace mathematical knowledge and skill, only to provide tools to make it easier to apply such knowledge.As for your second (related) point: Sum does not return answers such as Infinity or -Infinity, it considers such series as divergent. For example:In[35]:=Sum[n, {n, 1, Infinity}]Sum::div:Sum does not converge.Out[35]=Sum[n, {n, 1, Infinity}]Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> 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 me the> other result, infinity for p>=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.de> http://www.frank-buss.de, http://www.it4-systems.de> ==== On further reßection, the p in your original question may actually be a non-real complex number e.g.Sum[1/(1+I)^n,{n,1,Infinity}]-ISo in fact the correct domain in your problem is just Abs[1-p]<1 This seems like another good reason why why Mathematica does not try to tell you the domain of convergence. If you want to know it you should determine it separately, using any appropriate assumptions you wish to make (e.g. p is real).Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> The rather obvious answer why it doesn't state the domain of > convergence is that nobody programmed it to do so. I can only > speculate as to why, but the most likely explanation that comes to my > mind is that it was not considered worth the necessary programming > effort to do this. For a start, to do so in general would be pretty > difficult and time consuming. Just take a simple modification of your > case:> Sum[(1/(p^4 - 3*p^3 + p^2 - 1))^i, {i, 1, Infinity}]> 1/(-2 + p^2 - 3*p^3 + p^4) if Mathematica wanted to tell you the domain of convergence it would > have to solve the inequalities: << Algebra`InequalitySolve`> InequalitySolve[p^4 - 3*p^3 + p^2 - 1 > 1, p]> p < 1 - Sqrt[3] || p > 1 + Sqrt[3]> InequalitySolve[p^4-3p^3+p^2-1<-1,p]> 3/2 - Sqrt[5]/2 < p < 3/2 + Sqrt[5]/2 The ability to solve such inequalities appeared only in version 4, > while Sum is a much older function. But in any case, it is easy to > modify this further so that InequalitySolve won't be able to help, > e.g.> Sum[(1/(p*E^p - p^p*Sin[p] + p^3))^i, {i, 1, Infinity}]> -(1/(1 - E^p*p - p^3 + p^p*Sin[p])) or something even more complicated.> A good principle in designing mathematical software is that if > something can't be done in sufficient generality that includes at > least a substantial number of non-trivial cases and not just the ones > where you know the answer anyway, then it's better not to do it at > all. Besides, Mathematica is not meant to replace mathematical > knowledge and skill, only to provide tools to make it easier to apply > such knowledge. As for your second (related) point: Sum does not return answers such > as Infinity or -Infinity, it considers such series as divergent. For > example: In[35]:=> Sum[n, {n, 1, Infinity}] Sum::div:Sum does not converge. Out[35]=> Sum[n, {n, 1, Infinity}] Andrzej Kozlowski> Yokohama, Japan> http://www.mimuw.edu.pl/~akoz/> http://platon.c.u-tokyo.ac.jp/andrzej/> 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 me the> other result, infinity for p>=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.de> http://www.frank-buss.de, http://www.it4-systems.de ==== by searching for solutions to link Fortran code into mathematica i oftenread about a package InterCall. The newest information i found is from1999. Is this package avaiable and can i use it with mathematica 4.1?Or is there another method of using fortran code in mathematica (not usingf2c)?Jan Schmedes ==== Jean,You can use the 4th color directive argument in the parametrization withParametricPlot3D. Here is an example.ParametricPlot3D[{Cos[t]Cos[p], Sin[t]Cos[p], Sin[p], Hue[(1 + Cos[t]Cos[p])/2]}, {p, -Pi/2, Pi/2}, {t, 0, 2Pi}, PlotPoints -> {20, 40}, Lighting -> False, ImageSize -> 450];If you wish, I can show you how to make a nice contour plot with smoothedges on a sphere or other surface.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Evaluate the following in Mathematica In[1]:= BaseForm[3914, 16]and the output looks like (f4a with 16 for a subscript).What if you wanted the output above formatted as one of the following 0xf4a, 0x0f4a, 0xF4A, 0x0F4A which are often used by programmers.As far as I can tell it isn't possible to do that using BaseForm options (there are none), MakeBoxes or Format definitions. I could, without toomuch trouble, make my own function HexForm[n] that would compute the hex digitsand format the output. It would just be more elegant to use the built-in BaseForm if possible.--- Ted Ersek ==== out to be negative. I heard one can repair such matrices and wanted to know how. Any ideas? Tobias ==== It seems to be just the question of the way you input them. If instead of typing typing 20 zeros you simply enter 3.`20 everything works fine:Floor[3.`20]3It also saves you some effort!Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> I realize that we're dealing with the vagaries of internal arithmetic,> but it is highly disquieting that 3.000... (with any number of zeros)> would ever be anything but the binary ßoating-point number .11 * 2^2 ! Selwyn Selwyn, things aren't, what they appear to be: In[2]:= Through[{InputForm, Floor}[#]] & /@> {3.0000000000000000, 3.00000000000000000}> Out[2]= {{3., 3},> {2.999999999999999999999999999991459`17.6021, 2}} You're right, of course, perhaps, except for wow. --> Hartmut> -----Original Message-----> To: mathgroup@smc.vnet.net> Sent: Saturday, January 25, 2003 7:27 AM> To: mathgroup@smc.vnet.net> Wow. But apparently it has nothing to do with Log. Look: Floor[3.0000000000000000] 3 Floor[3.00000000000000000] 2 ---> Selwyn Hollis> With Mathematica 4.1 on Windows98:> N[Log[8]/Log[2]]> 3.> Floor[N[Log[8]/Log[2]]]> 2> Beware!> ==== I'm running Mathematica 4.1 on a compaq tablet PC, and no matter whatI do, it refuses to output the result of a cell calcuation. Somethingas simple as:4./5. (shift-enter)You see what looks like the cell being evaluated (it says Ôrunning')but no visible output. I've checked to make sure all the preferencesare set up appropriately (as far as I can tell).I've never seen this behavior before. Does anyone have anysuggestions? ==== >Occasionally Mathematica 4.2 under MacOS 9.2.2 gives me the following>warning:>Unable to open file>Files:SystemFiles:FrontEnd:TextResources:Macintosh:> UnicodeLanguageFontMapping.tr [snip]I've seen this same warning using Mathematica 4.2 under MacOS X. It happened sporatically when I had Mathematica in a sub folder of the Applications folder. It has not happened since I moved Mathematica back into the Applications folder. This leads me to believe that Mathematica occasionally gets confused about the path to this file when not installed in the default location. Perhaps you have a similar problem. ==== >i want to plot (using Plot3D of course) at least 2 3D-functions into>the same diagram. how to i have to handle this?One way to do this would be as follows:Show[ Plot[g, {x,xmin,xmax},{y,ymin,ymax},DisplayFunction->Identity], Plot[f, {x,xmin,xmax},{y,ymin,ymax},DisplayFunction->Identity], DisplayFunction->$DisplayFunction]; This will result in two surfaces being plotted over the same range in the same graphic. But it may not be what you want and could be quite difficult to interpret visually. Alternatively, you might want to tryShow[ GraphicsArray[ Plot[g, {x,xmin,xmax},{y,ymin,ymax},DisplayFunction->Identity], Plot[f, {x,xmin,xmax},{y,ymin,ymax},DisplayFunction->Identity]], DisplayFunction->$DisplayFunction];This will plot the two surfaces side by side. This makes for easy visual comparison of the two surfaces and avoids the problem where part of one surface hides part of the other surface. ==== Better yet,Off[Solve::ifun]First@Solve[Exp[-(x - m1)/(2*s1)]/Sqrt[s1] == Exp[-(x - m2)/(2*s2) ]/Sqrt[s2], x];PowerExpand[% /. {s1 -> r^2, s2 -> s^2}]BobbyOn Wed, 29 Jan 2003 03:35:35 -0500 (EST), Michal Kvasnicka > Or better: Solve[Exp[-(x - m1)^2/(2s1^2)]/s1 == Exp[-(x - m2)^2/(2s2^2)]/s2, x] Michal> Jens-Peer Kuska p.92Íe v diskusn.92m Solve[Exp[-(x - m1)/(2s1)]/Sqrt[s1] == Exp[-(x - m2)/(2s2)]/Sqrt[s2], x] ?? Jens> Can anyone please tell me how to find the intersection of two > gaussians?> Is there any standard method to do that?> Vaidyanathan.> --> Vaidyanathan Ramadurai> Graduate Student> http://www4.ncsu.edu/~vramadu>-- majort@cox-internet.comBobby R. Treat ==== For s1 = s2 you must obtain x = 1/2(m1+m2), due to the symmetry of theproblem, but your formulation gives nothing.The Gaussian normal distribution has the following form:1/(Sqrt[2Pi]*sigma)*Exp[-(x-mu)^2/(2*sigma^2)]. Am I right?MichalDr Bob p.92Íe v diskusn.92m pÀ.92sp.93vku> Better yet, Off[Solve::ifun]> First@Solve[Exp[-(x - m1)/(2*s1)]/Sqrt[s1] == Exp[-(x - m2)/(2*s2)> ]/Sqrt[s2], x];> PowerExpand[% /. {s1 -> r^2, s2 -> s^2}] Bobby On Wed, 29 Jan 2003 03:35:35 -0500 (EST), Michal Kvasnicka > Or better:> Solve[Exp[-(x - m1)^2/(2s1^2)]/s1 == Exp[-(x - m2)^2/(2s2^2)]/s2, x]> Michal> Jens-Peer Kuska p.92Íe v diskusn.92m> Solve[Exp[-(x - m1)/(2s1)]/Sqrt[s1] == Exp[-(x - m2)/(2s2)]/Sqrt[s2],x]> ??> Jens> Can anyone please tell me how to find the intersection of two> gaussians?> Is there any standard method to do that?> Vaidyanathan.> --> Vaidyanathan Ramadurai> Graduate Student> http://www4.ncsu.edu/~vramadu> --> majort@cox-internet.com> Bobby R. Treat ==== >-----Original Message----->Sent: Wednesday, January 29, 2003 9:35 AM>To: mathgroup@smc.vnet.net>I want plot and color a surface x=f(u,v), y=g(u,v), z=h(u,v) How to create a color function colorfunc[x,y,z] (or colorfunc[u,v])>that associate a color at each point of the surface ??>Scuse for my very bad english language !! Jean P.>A few examples might help:ParametricPlot3D[ Evaluate[With[{r = Sqrt[Sin[u]], s = Hue[Mod[2 v/Pi, 1]]}, {u, r Cos[v], r Sin[v], s}]], {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, PlotPoints -> {25, 25}, Lighting -> False]...coloring according to angle vParametricPlot3D[ Evaluate[With[{r = Sqrt[Sin[u] + 1/2 Sin[3u]], s = Hue[u/Pi]}, {u, rCos[v], r Sin[v], {EdgeForm[], s}}]], {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, PlotPoints -> {50, 25}, Lighting -> False]...coloring according to height uParametricPlot3D[ Evaluate[With[{r = Sqrt[Sin[u] + 1/4 Sin[3u] + 1/3 Sin[7 u]]}, {u, rCos[v], r Sin[v], {EdgeForm[], Hue[1 - r]}}]], {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, PlotPoints -> {125, 50}, Lighting -> False, ViewPoint -> {2., -2.4, 2.}]...coloring according to radiusParametricPlot3D[ Evaluate[With[{r = Sqrt[Sin[u] + 1/4 Sin[3u]]}, {x = u, y = r Cos[v], z = r Sin[v], {EdgeForm[], Hue[{x, y, z}. (ViewPoint /. Options[Graphics3D, ViewPoint])]}}]], {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, PlotPoints -> 100{2, 1}, Lighting -> False]...coloring according to depth from viewpointParametricPlot3D[ Evaluate[With[{r = Sqrt[Sin[u] + 1/4 Sin[3u]]}, {x = u, y = r Cos[v], z = r Sin[v], {EdgeForm[], FaceForm[GrayLevel[0], GrayLevel[Mod[3 {x, y, z}. {0, 1, 2},1]]]}}]], {u, 0, Pi}, {v, 0, 2Pi}, BoxRatios -> {1, 1, 1}, PlotPoints -> 100{2, 1}, Lighting -> False]...coloring according to some direction (takes for a while)As you see, results are best if coloring is done as function of u or valone. So perhaps you might like to transform your parameter space first! --Hartmut WolfReply-To: kaw@rinconresearch.com ==== together look like?the formula for the triangle is: tri(x/b) = 1-|x/b| for -1 < |x/b| < 1, 0 elseand tri(1/b,y/b) is supposed to be tri(x/b) * tri(y/b).It will make a 3-d image with a rectangular base but non-smooth edges.Does anyone know exactly what this image looks like??Karen ==== I think you are first overestimating what Assumptions in Integrate is meant to do and then not surprisingly are disappointed when you discover it does not do it. But actually it is an old and rather primitive mechanism. It essentially only does the following: if Integrate[integrand] without assumptions returns the answer in the form If[ assumption, something, integrand] form Integrate[integrand, Assumptions-> assumption] will (usually) return something. (It actually does a little more but not much). Moreover, you can sometimes use assumptions like Im[z]==0 but not Element[z,Reals], because, Element was introduced later than the Assumptions mechanism in Integrate and the latter was not revised to make use of it.It would be undoubtedly marvelous if every time a new capability was added to Mathematica the entire program was re-written and all function that might benefit form it did so, but this is unrealistic. I know of some parts of Mathematica that have not changed since at least version 2, and I am sure there are parts of the code that nobody working at Wolfram has looked at for years. This is only natural with a program of this size and complexity and with so many specialized functions. I think almost everyone will agree that Integrate badly needs an overhaul but it's clearly not a simple task, the number of people working on it is small, and I suspect we will be lucky if its done by the next version.In any case, I don't expect that you will ever be able to enter any reasonable assumptions into any function you like and have Mathematica take it into account in the answer it returns. But surely, as I noted previously in this thread, Mathematica -- at> least version 4.2 for Windows -- does give a wrong answer for> result = Integrate[ Abs[Sin[k x]]^2, {x,0,1}, Assumptions- Element[k, Complexes]; N[ result /. k->I+1 ]. I do not see how the> incorrectness of this can be debated (other than to say that> Mathematica should be allowed to ignore an _explicitly stated_> assumption!) Coming to think of it, Mathematica could of course also ignore _any_> explicitly stated fact in its input and give the default result 42> to all questions! But version 4.2 is probably still lacking one order> of magnitude in wisdom to do this. :-) -- Jos < Jos.Bergervoet@philips .n_o_spa_m. com Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== Dimitris,Is it possible to supply a simplified example of what you want to do? Thestatement involves many functions is not clear enough to me to attempt ananswer.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== question but it only further confused me. I'm basically trying to take thefirst derivative of (ln(x))^x. Here is my syntax: f = (ln(x))^x. But thenwhen I evaluate f Ô, it says nothing but ((ln(x))^x)' which is nothing new.Is this because I didn't specify bounds and that the function may bediscontinuous over the default bounds in Mathematica? ==== > question but it only further confused me. I'm basically trying to takethe> first derivative of (ln(x))^x. Here is my syntax: f = (ln(x))^x. Butthen> when I evaluate f Ô, it says nothing but ((ln(x))^x)' which is nothingnew.> Is this because I didn't specify bounds and that the function may be> discontinuous over the default bounds in Mathematica?>Steve,This is really to do with mathematics , but here we need to discus it withMathematica syntaxAfter f = Log[x]^x;f is defined to be the expression (formula) Log[x]^x;This can be differentiated with respect to x D[f,x] Log[x]^x*(1/Log[x] + Log[Log[x]])Clear the definition for f. Clear[f]Define f[x_] = Log[x]^x;This defines f as a one-place function f[2] Log[2]^2As such, f can be differentiated with respect to its first (and only) placeand the resulting function can be evaluated at, for example, 2. f'[2] Log[2]^2*(1/Log[2] + Log[Log[2]])The distinction between expessions and functions comes out more when wecompare a formula in two variables with the corresponding functon with twoplacesStart with an expression g= x^3 y; D[g,x] 3*x^2*y D[g,y] x^3 Clear[g]Now define the corresponding function g[x_,y_]=x^3 y;Differentiate g with respect to its first place and then with respect to itssecond place: Derivative[1,0][g][x,y] 3*x^2*y Derivative[0,1][g][x,y] x^3-------------------In fact f' carries its definition around in the form of a *pure function*. f' (Log[Log[#1]] + 1/Log[#1])*Log[#1]^#1 &And we could have defined f using a pure function in two ways Clear[f](1) f= Function[x, Log[x]^x]; f[x] Log[x]^x f' Function[x, Log[x]^x*(1/Log[x] + Log[Log[x]])] f'[2] Log[2]^2*(1/Log[2] + Log[Log[2]]) Clear[f](2) f= Log[#]^#&; f[x] Log[x]^x f' (Log[Log[#1]] + 1/Log[#1])*Log[#1]^#1 & f'[2] Log[2]^2*(1/Log[2] + Log[Log[2]])--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 ==== To begin with, use proper Mathematica syntax to write the body of yourfunction:Log[x]^x not ln(x)^xEven after that, Mathematica is rightfully confused since you don'tspecify the variable of the differentiation (that the expressionshould be differentiated as a function of x).There are two ways to work around this problem:The first is to define f as you do:f=Log[x]^x and then tell Mathematica to explicitly differentiate it as a functionof x:D[f,x]The second way is to define f as a proper Mathematica function:Clear[f] (* to get rid of the previous definition *)f[x_]:=Log[x]^xNow you can write f'[x].You can even go ahead and write f' but that will return a Ôpurefunction' (look it up).Orestis> question but it only further confused me. I'm basically trying to take the> first derivative of (ln(x))^x. Here is my syntax: f = (ln(x))^x. But then> when I evaluate f Ô, it says nothing but ((ln(x))^x)' which is nothing new.> Is this because I didn't specify bounds and that the function may be> discontinuous over the default bounds in Mathematica?> ==== Try this:f=Log[x]^xD[f,x]On my Mathematica, it produces:Log[x]^x*(Log[x]^(-1) + Log[Log[x]])HTHChris RodgersSt John's Collegehttp://rodgers.org.uk/> question but it only further confused me. I'm basically trying to takethe> first derivative of (ln(x))^x. Here is my syntax: f = (ln(x))^x. Butthen> when I evaluate f Ô, it says nothing but ((ln(x))^x)' which is nothingnew.> Is this because I didn't specify bounds and that the function may be> discontinuous over the default bounds in Mathematica?> ==== An easy way to describe a color in Mathematica is to use Hue[col]where col is a number between 0 and 1.Hue[0] and Hue[1] are both red and the values in between describe allthe other colors.Now if you want to color a parametric surface use the following:ParametricPlot3D[{f[u,v],g[u,v],h[u,v],Hue[c[u,v]]} ,{u,u0,u1},{v,v0,v1},opts___]where c[u,v] is a function of u,v that returns a value between 0 and1.Orestis> I want plot and color a surface x=f(u,v), y=g(u,v), z=h(u,v) > How to create a color function colorfunc[x,y,z] (or colorfunc[u,v])> that associate a color at each point of the surface ??> Scuse for my very bad english language !! > Jean P. ==== Here is an example:ParametricPlot3D[{u,v,u^2+v^2,Hue[Abs[u v]]},{u,-1,1},{v,-1,1}, Lighting->False];The trick is to specify a 4-dimensional vector to plot, where the 4thcomponent is the colour function you want to use. This approach makes senseif you regard colour as representing position along the 4th dimension.--Steve LuttrellWest Malvern, UK> I want plot and color a surface x=f(u,v), y=g(u,v), z=h(u,v) How to create a color function colorfunc[x,y,z] (or colorfunc[u,v])> that associate a color at each point of the surface ??> Scuse for my very bad english language !! Jean P.> ==== > I want plot and color a surface x=f(u,v), y=g(u,v), z=h(u,v) How to create a color function colorfunc[x,y,z] (or colorfunc[u,v])> that associate a color at each point of the surface ??> Scuse for my very bad english language !! Jean P.>Jean,The optional fourth coordinate, the style coordinate, s inParametricPlot[{x, y, z, s}, {t, tmin, tmax},{u, umin, umax}] can be used togive directives to individual polygons.To see the colors specfied we have to turn off the lighting.ParametricPlot3D[ {Cos[u](1 + Cos[t]/2), Sin[u](1 + Cos[t]/2), Sin[t], {EdgeForm[Hue[0.7]], Hue[t]} }, {t, 0, 2Pi},{u, 0, Pi}, Lighting ->False, Boxed -> False, Axes->False];ParametricPlot3D[ {Cos[u](1 + Cos[t]/2), Sin[u](1 + Cos[t]/2), Sin[t], {EdgeForm[Hue[0.7]], FaceForm[Hue[t],Hue[2u]]} }, {t, 0, 2Pi},{u, 0, Pi}, Lighting ->False, Boxed -> False, Axes->False];To get detailed coloring you will need to use a large number of smallpolygons (PlotPoints->500, say) and suppress the edges of the polygons(EdgeForm[ ]).Here is a more complex example. Please look up any new terms in the HelpBrowser.First by reßected light and specified light sources.ParametricPlot3D[ {Cos[u](1 + Cos[t]/2), Sin[u](1 + Cos[t]/2), Sin[t], {EdgeForm[Hue[0.7]], FaceForm[ {Hue[t],SurfaceColor[Hue[2u, 0.3, 0.9]]}, {Hue[2u, 0.3, 0.9], SurfaceColor[Hue[t]]} ] } }, {t, 0, 2Pi},{u, 0, Pi}, LightSources -> {{{1, 0, 1}, GrayLevel[1]}}, Boxed -> False, Axes->False];Now, turn off the lighting to see the painted versionShow[%, Lighting -> False];The directives given to a polygon are calculated by a kind of averaging :for example, if s is {RGBColor[r,g,b], EdgeForm[Thickness[t]]}then we gettriples like {RGBColor[ avr, avg, avb ], EdgeForm[Thickness[avt]], polygon},where avr .... denote the averages over the values of the parameters{t,u}that give the vertices of the polygon (not over the coordinates of thevertices). The same rule works for Thickness, GrayLevel and CMYKColor; butnot for Hue, which has to take into account that, for example, Hue[0] andHue[1] both give red. I have not yet worked out how this is done. A singledirective need not be in a list.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198Reply-To: kuska@informatik.uni-leipzig.de ==== a) you can't associate a color with every *point*, because Mathematica colors the polygon and not the vertexb) ParametricPlot3D[ {Cos[phi]*Sin[th], Sin[phi]*Sin[th], Cos[th], SurfaceColor[Hue[4phi/(2Pi)]]}, {th, 0, Pi}, {phi, 0, 2Pi}, PlotPoints -> {30, 60}] may help you. Jens> I want plot and color a surface x=f(u,v), y=g(u,v), z=h(u,v)> How to create a color function colorfunc[x,y,z] (or colorfunc[u,v])> that associate a color at each point of the surface ??> Scuse for my very bad english language !!> Jean P. ==== Why not just define w2=-1-w1(or and get over and done with it?Orestis> when Unprotect[Plus]; Plus[w1,w2] = -1 is commanded> and then the expanding of a product gives a*w1 + a*w2 + ...> that is not collapsed to -a + ... automatically, even> if selecting that a*w1 + a*w1 and> the applying Simplify to it from al palette, does it. What> can be done to automize it? ==== Friedrich Laher schrieb:> when Unprotect[Plus]; Plus[w1,w2] = -1 is commanded> and then the expanding of a product gives a*w1 + a*w2 + ...> that is not collapsed to -a + ... automatically, even> if selecting that a*w1 + a*w1 and> the applying Simplify to it from al palette, does it. What> can be done to automize it?>I got a direct answer from Mihaijlo Vanevic,suggestingusing a rul w2 -> -1-w2butwhat when there is w1+w2+w3+... = -1? ==== > when Unprotect[Plus]; Plus[w1,w2] = -1 is commanded> and then the expanding of a product gives a*w1 + a*w2 + ...> that is not collapsed to -a + ... automatically, even> if selecting that a*w1 + a*w1 and> the applying Simplify to it from al palette, does it. What> can be done to automize it?Friedrich, Unprotect[Plus]; (a_. ) w1+(a_.) w2 = -a; a w1+a w2 -a--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198Reply-To: kuska@informatik.uni-leipzig.de ==== assign the right pattern ? Something likeUnprotect[Plus]; Plus[a_.*w1, a_.*w2] := -a Jens> when Unprotect[Plus]; Plus[w1,w2] = -1 is commanded> and then the expanding of a product gives a*w1 + a*w2 + ...> that is not collapsed to -a + ... automatically, even> if selecting that a*w1 + a*w1 and> the applying Simplify to it from al palette, does it. What> can be done to automize it? ==== Dear Selwyn, dear Andrzej,some further observations: In[46]:= Through[{InputForm, Floor}[#]] & /@ Table[SetPrecision[3, prec], {prec, 10 + Log[10, 3.], 23 + 1, 1}] // TableFormOut[46]//TableForm= 3.`10.4771 3 3.`11.4771 3 3.`12.4771 3 3.`13.4771 3 3.`14.4771 3 3.`15.4771 3 3.`16.4771 3 3.`17.4771 3 3.`18.4771 3 3.`19.4771 3 3.`20.4771 3 3.`21.4771 3 3.`22.4771 3 3.`23.4771 3In[47]:= ToExpression[Take[NestList[# <> 0 &, 3., 23], -14]] // TableFormOut[47]//TableForm= 3.03 3 3.03 3 3.03 3 3.03 3 3.03 3 3.03 3 3.03 3 2.999999999999999999999999999991459`17.6021 2 3 2.999999999999999999999999999994387`18.6021 2 3 2.999999999999999999999999999988124`19.6021 2 3 2.99999999999999999999999999999999997894`20.6021 2 3 2.99999999999999999999999999999999987137`21.6021 2 3 2.999999999999999999999999999999999943`22.6021 2 3 2.99999999999999999999999999999999988492`23.6021 2 3In[48]:= (ii = Interval /@ ToExpression[Take[NestList[# <> 0 &, 3., 23], -14]]) // TableFormOut[48]//TableForm= Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{3., 3.}] Interval[{2.99999999999999999, 3.00000000000000001}] Interval[{2.999999999999999999, 3.000000000000000001}] Interval[{2.9999999999999999999, 3.0000000000000000001}] Interval[{2.99999999999999999999, 3.00000000000000000001}] Interval[{2.999999999999999999999, 3.000000000000000000001}] Interval[{2.9999999999999999999999, 3.0000000000000000000001}] Interval[{2.99999999999999999999999, 3.00000000000000000000001}]In[50]:=InputForm[(10^((#1 + #2)/2))] & @@@ Log[10, Flatten[List @@@ ii, 1]]Out[50]= {2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.9999999999999996, 2.999999999999999999995164569285922`17.6002, 2.999999999999999999999398436196254`18.6003, 2.999999999999999999999997528327083`19.6003, 2.999999999999999999999997528966012`20.6003, 2.999999999999999999999997529010859`21.6003, 2.99999999999999999999999999063078546595`22.6003, 2.99999999999999999999999999063078491591`23.6003}Some differences in detail notwithstanding, this gives an idea of how theinputs are treated! See also the differences for machine numbers. Inparticular this explains Floor[3.0...0] == 2 for any Input with more than 16zeros trailing.Oh, I nearly forgot, look atBaseForm[#, 2] & /@ ToExpression[Take[NestList[# <> 0 &, 3., 23], -14]] // TableForm--Hartmut Wolf>-----Original Message----->Sent: Wednesday, January 29, 2003 3:11 PM>To: Selwyn Hollis; Hartmut.Wolf@t-systems.com>Cc: mathgroup@smc.vnet.net>But at least it seems to be just the question of the way you input >them. If instead of typing typing 20 zeros you simply enter 3.`20 >everything works fine:>Floor[3.`20]3It also saves you some typing!Andrzej Kozlowski>Yokohama, Japan>http://www.mimuw.edu.pl/~akoz/>http:// platon.c.u-tokyo.ac.jp/andrzej/> I realize that we're dealing with the vagaries of internal >arithmetic,> but it is highly disquieting that 3.000... (with any number of zeros)> would ever be anything but the binary ßoating-point number >.11 * 2^2 ! Selwyn Selwyn, things aren't, what they appear to be: In[2]:= Through[{InputForm, Floor}[#]] & /@> {3.0000000000000000, 3.00000000000000000}> Out[2]= {{3., 3},> {2.999999999999999999999999999991459`17.6021, 2}} You're right, of course, perhaps, except for wow. --> Hartmut> -----Original Message-----> To: mathgroup@smc.vnet.net> Sent: Saturday, January 25, 2003 7:27 AM> To: mathgroup@smc.vnet.net> Wow. But apparently it has nothing to do with Log. Look: Floor[3.0000000000000000] 3 Floor[3.00000000000000000] 2 ---> Selwyn Hollis> With Mathematica 4.1 on Windows98:> N[Log[8]/Log[2]]> 3.> Floor[N[Log[8]/Log[2]]]> 2> Beware! ==== I would like to import an eps line drawing with text labels into a notebook document. The Import function works fine, except that the default graphics mode for Mathematica is to keep text size constant when a figure is rescaled in the notebook. This always puts the labels out-of-place. Is there any way to suppress this mode, and have the graphics maintain the same scaling between text and lines. I'm so close to exactly what I want (infinite resolution, device independence, ect), that's it frustrating to have to import multi-megabyte raster images just to get the labels correct.Import also seems to ignore the font-family information of the original file, but I have a couple of options for dealing with that. For one, I can edit the eps information in the cell.Gerry F. ==== for this.(2) Use DSolve on the homogeneous equation (1+x)y''[x]-2(x+2)y'[x]+4y[x) == 0.(3) Add.----Selwyn Hollis> I want to solve : (1+x)y''[x]-2(x+2)y'[x]+4y[x) == x Could someone can find a way out for this ? ==== I think I've found a bug in exporting GIF animationI don't know what the problem is with this. I've trimmed down whatI'm doing to what seems to be the bare minimum that shows the bug.Tiny changes in the value of z or in the step size for the tablewill make the background of the gif dark black or brilliant green,change the resulting file size by a factor of 16x, etc. These threeexamples show a sample of the range of behavior that I've seen with this.This simulates some axes and then draws a moving point which iscolored green at the bottom of each cycle and black elsewhere.All these examples are identical code, except for the value of z.It takes a couple of minutes to generate each example.111 kbytes and what seems to be pretty much a correct plotz = 1; Export[1.gif, Table[Graphics3D[{ Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], Line[{{0, 0, 0}, {4Pi, 0, 0}}], If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], Point[{t, Cos[t], z Sin[t]}]}, PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF]1598 kbytes! with bright green graph and lots of artifacts scatteredacross the entire graph as it displaysz = 2; Export[2.gif, Table[Graphics3D[{ Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], Line[{{0, 0, 0}, {4Pi, 0, 0}}], If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], Point[{t, Cos[t], z Sin[t]}]}, PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF]72 kbytes with entire graph nearly completely blackz = N[[ExponentialE]]; Export[e.gif, Table[Graphics3D[{ Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], Line[{{0, 0, 0}, {4Pi, 0, 0}}], If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], Point[{t, Cos[t], z Sin[t]}]}, PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF]I searched newsgroup postings and Wolfram and didn't find any mentionof such behavior. I presume this is a bug in the gif export code.If anyone can confirm that this is a bug and that it has been fixedthat would be good. If anyone can describe a dependable workaroundfor the moment that would be even better, waiting a good part ofan hour for an animation to grind out and then discovering that itis another black cat in a dark room is getting a little old. ==== Don-I can confirm that I get similar behavior under Windows 2000 using 4.2.0.The following partial workaround may be able to get you there, however.As I investigated the behavior, I found that I could plot up parts of thefull animation without a problem. For example:z = 1; test = Table[Graphics3D[{ Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], Line[{{0, 0, 0}, {4Pi, 0, 0}}], If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], Point[{t, Cos[t], z Sin[t]}]}, PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}]Export[1.gif,Thread[Part[test,Table[i,{i,1,10}]]], GIF]This successfully exports the first 10 frames to an animated GIF. I triedthe same trick with the threading over the full list, however, and gotgarbage out. If you have an editor like Fireworks, Photoshop, etc, youshould be able to stitch the full animation together. If anyone knows moreabout the inner workings of Export, I also would be interested in what'sgoing wrong here.--M. G. BARTLETT> I think I've found a bug in exporting GIF animation I don't know what the problem is with this. I've trimmed down what> I'm doing to what seems to be the bare minimum that shows the bug.> Tiny changes in the value of z or in the step size for the table> will make the background of the gif dark black or brilliant green,> change the resulting file size by a factor of 16x, etc. These three> examples show a sample of the range of behavior that I've seen with this. This simulates some axes and then draws a moving point which is> colored green at the bottom of each cycle and black elsewhere. All these examples are identical code, except for the value of z.> It takes a couple of minutes to generate each example. 111 kbytes and what seems to be pretty much a correct plot z = 1; Export[1.gif, Table[Graphics3D[{> Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}],> Line[{{0, 0, 0}, {4Pi, 0, 0}}],> If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]],> Point[{t, Cos[t], z Sin[t]}]},> PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}},> ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF] 1598 kbytes! with bright green graph and lots of artifacts scattered> across the entire graph as it displays z = 2; Export[2.gif, Table[Graphics3D[{> Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}],> Line[{{0, 0, 0}, {4Pi, 0, 0}}],> If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]],> Point[{t, Cos[t], z Sin[t]}]},> PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}},> ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF] 72 kbytes with entire graph nearly completely black z = N[[ExponentialE]]; Export[e.gif, Table[Graphics3D[{> Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}],> Line[{{0, 0, 0}, {4Pi, 0, 0}}],> If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]],> Point[{t, Cos[t], z Sin[t]}]},> PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}},> ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF] I searched newsgroup postings and Wolfram and didn't find any mention> of such behavior. I presume this is a bug in the gif export code. If anyone can confirm that this is a bug and that it has been fixed> that would be good. If anyone can describe a dependable workaround> for the moment that would be even better, waiting a good part of> an hour for an animation to grind out and then discovering that it> is another black cat in a dark room is getting a little old.> ==== Sergio,1. To get the text inside the legend box you need to be sure that the boxwill be wide enough to fit it, for example by setting the using the optionImageSize or by dragging the box (once you have chosen the font size thesize of the text is fixed and does not alter when the size of the display isaltered).2. To miss out some of the symbols it seems necessary to use the moregeneral way of making legends using the template ShowLegend[graphics objects, {legendspecification}...,opts]Needs[Graphics`Colors`];Needs[ Graphics`Legend`];Make a graphics objectgr = Plot[{E^x, x^x, x!}, {x, 0, 3}, AspectRatio -> 1/2, PlotStyle -> {{Dashing[{.02, .04}], Hue[0]}, Hue[.35], Hue[.7]}, Frame -> True, FrameTicks -> False, FrameStyle -> {Thickness[.01], Red}];and a helpersurface=Plot3D[2Sin[x y],{x,0,3},{y,0,3},Boxed->False,Axes->False, Mesh->False];Define two legend specifications - these are for illustration -they are notrelated to the contents of gr.legspec1=Sequence[{{Hue[0],red},{Graphics[{Hue[0],Line[{ {0,0},{1,0}}]}], red},{Hue[.8],purple},{surface,surface}}, LegendShadow->{0,0},LegendSpacing->0];legspec2=Sequence[Hue[ .7#]&,5,min,max];-use them to add two legends to gr.-notice the blue frame is for the whole displayShowLegend[ gr,{legspec1,LegendPosition->1,-1/2}},{legspec2, LegendPosition->{1,0}},Frame->True,FrameTicks->False, FrameStyle->{Thickness[.01],Blue}];--Allan------------------- --Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 How can one make the symbols labeling in the legend> of the following plot to fix inside the surrounding> box? Would it be possible to turn off the symbols> labeling for the 3rd. and 4th. lines, where no> legend is assigned?>(*------------------------------------------------- -------------------------*)> Needs[Graphics`MultipleListPlot`];> Needs[Graphics`Legend`]; Clear[getPlotInfo];> getPlotInfo[data_,x_] :=> Module[{l2Norm, l2NormToPlot, maxNorm, maxNormToPlot, h , hMin, hMax,> yl2, l2NormFitedData},> l2NormToPlot = Table[{ h[i]=data[[i]][[2]],l2Norm[i]=data[[i]][[3]]},>{i,1,Length[ data]}];> maxNormToPlot = Table[{ data[[i]][[2]],maxNorm[i]=data[[i]][[4]]},>{i,1,Length[data]} ];> h = Log[Table[h[i],{i,1,Length[data]}]];> hMin = Min[h];> hMax = Max[h];> l2Norm = Table[l2Norm[i],{i,1,Length[data]}];> maxNorm = Table[maxNorm[i],{i,1,Length[data]}];> yl2[x1_] := Evaluate[Fit[Log[l2NormToPlot], {1,x1}, x1]];> l2NormFitedData = Table[{i,yl2[i]},{i,hMin,hMax,(hMax-hMin)/20}];> Return[{Log[l2NormToPlot], l2NormFitedData, yl2[x] }]]; dataM1 => {{5., 0.25, 0.00217807, 0.00325421}, {10., 0.111111,0.00042537099999999996,> 0.000712573}, {20., 0.0526316, 0.0000934578, 0.000167083},> {40., 0.025640999999999997, 0.000021898399999999997, 0.0000404748},> {80., 0.0126582, 5.300360000000001*^-6, 9.961790000000001*^-6}}; dataM2 => {{5., 0.25, 0.00880884, 0.010398000000000001},> {10., 0.111111, 0.00190426, 0.00209391}, {20., 0.0526316, 0.000442025,> 0.000473797}, {40., 0.025640999999999997, 0.00010649599999999999,> 0.00011289800000000002}, {80., 0.0126582, 0.0000261382, 0.000027567}}; Clear[M1LogPlotData, M1FitData, Mi2aFit, leg1, y];> {M1LogPlotData, M1FitData, Mi2aFit} = getPlotInfo[dataM1, y];> leg1=StringJoin[Methods 2-2-2 fit: ,> ToString[StringForm[`1`,Mi2aFit /. y ->Ln[x]]]] Clear[M2LogPlotData, M2FitData, MiSOFit, leg2, y];> {M2LogPlotData, M2FitData, MiSOFit} = getPlotInfo[dataM2, y];> leg2=StringJoin[Methods 1-2-1 fit: ,> ToString[StringForm[`1`,MiSOFit /. y ->Ln[x]]]] Clear[sym1,sym2];> sym1 = PlotSymbol[Box,2]> sym2 = PlotSymbol[Star,4] Clear[thePlot];> thePlot :=> MultipleListPlot[M1LogPlotData,> M1FitData,> M2LogPlotData,> M2FitData,> PlotJoined -> {False, True, False, True},> SymbolShape -> {sym1, None, sym2, None},> Axes -> False,> Frame -> True,> FrameLabel -> {Ln(x), Ln(y),> Fitting Test,> Test 1},> PlotLegend -> {leg1,> ,> leg2,> },> LegendSize -> {1.5, .3},> (*> LegendBorder -> 0,> LegendLabelSpace->.5,> LegendTextOffset ->{{-1,0},{-1,0},{-1,0},{-1,0}},> LegendTextOffset -> {3,0},> *)> LegendPosition -> {-.8, -1}> ];> Show[thePlot]> Sergio>Reply-To: kuska@informatik.uni-leipzig.de ==== no, because Mathematica assign absolute font sizes, i.e.,it say draw the text with 10 points and it should saydraw the text with ImageHeight/100 points.So you have to ajust the fontsize by hand for thefinal output size of the graphics.I found it always easyer to make the legend box byhand and to combine the box and the graphics with tworectangles. Because the PlotLegend package is a bit oldand knows nothing about the TextStyle and FormatType optionsof Text[]. Jens> How can one make the symbols labeling in the legend> of the following plot to fix inside the surrounding> box? Would it be possible to turn off the symbols> labeling for the 3rd. and 4th. lines, where no> legend is assigned?_______________ CUT _______________________> SergioReply-To: Diana ==== Dr. Mertig,I guess I did mess up the statements in my post.The algorithm is:Z5[x_,y_,z_,w_]:=(x+y i)(z+w i)Mod[Array[Z5,{5,5,5,5},{0,0,0,0}],5]//TableFormNote that i is the icon for the imaginary number i, and that there is aspace between it and the variables y and w.I will forward you the Excel file.Another interesting file to convert to Excel would be the Alternatingpermutation group of five letters, as follows:<< DiscreteMath`Combinatorica`A5 = AlternatingGroup[5]mult[x_?PermutationQ, y_?PermutationQ] := Permute[x, y]MultiplicationTable[A5, mult] // TableFormExport[C:Cayley5Table.csv, MultiplicationTable[A5, mult], CSV]Diana> Todd, I have a further question on a different type of table. I have written a program to generate a multiplication table for> Z_5[i], or the multiplication table of the additive integer group of> five letters for complex numbers. The program is as follows: Z5[x_,y_,z_,w_] = (x + yi)(z + wi)> Mod[Array[Z5,{5,5,5,5},{0,0,0,0}]//TableForm (The i in the command above is actually the symbol for the imaginary> number i.) When I go to try to export the file to a csv file with the following> command, Export[C:Z5-i-notAField.csv,Mod[Array[Z5,{5,5,5,5},{ 0,0,0,0}], I get a bunch of formating characters in the CSV file, and can't use> it. Can you tell me how I should change the program or restate the export> command?> Diana > Diana,> > Did you do this?> << DiscreteMath`Combinatorica`> A5 = AlternatingGroup[5]> mult[x_?PermutationQ, y_?PermutationQ] := Permute[x, y]> MultiplicationTable[A5, mult] // TableForm> Export[C:tableDELETETHISLATER.csv, MultiplicationTable[A5, mult],CSV]> It works fine for me. I hope you didn't type all that other stuff withthe> quotes in by hand, as it appears from your posting.> Do you know that> dummy = MultiplicationTable[A5, mult] // TableForm> Export[C:tableDELETETHISLATER.csv, dummy], CSV]> won't work, but> (dummy = MultiplicationTable[A5, mult] )// TableForm> Export[C:tableDELETETHISLATER.csv, dummy], CSV]> will?> Todd Rose> Steve,> Well, it took me a few days to catch on to how to extrapolate listdata> from> the table output. I was finally able to take your program, and applyit to> the Cayley Table for A_5.> To keep the size to a minimum for the newsgroup post, I have pasted my> notebook file to export the Cayley Table for A_4.> The notebook command looks like:> Export[C:cayley4table.csv, {{1, 2, 3, 4, 5, 6,> 7, 8, 9, 10, 11, 12}, {2, 3, 1, 7, 9, 8,10,> 12, 11, 4, 5, 6}, {3, 1, 2, 10, 11, 12> , 4, 6, 5, 7, 9, 8}, {4, 6, 5, 1, 3, 2,11,> 10> , 12, 8, 7, 9}, {5, 4, 6, 8, 7, 9, > > 1, 2, 3, 11, 12, 10}, {6, 5, 4, 11, 12, 10,> 8, 9, 7, 1, 3, 2}, {7, 8, 9, 2, 1, 3, > 5, 4, 6, 12, 10, 11}, {8, 9, 7, 5, 6, 4,12,> 11> , 10, 2, 1, 3}, {9, 7, 8, 12, 10, 11> , 2, 3, 1, 5, 6, 4}, {10, 12, 11, 3, 2,1,> 9,> 7, 8, 6, 4, 5}, {11, 10, 12, 6, 4, 5> , 3, 1, 2, 9, 8, 7}, {12, 11, 10, 9, 8,7, > 6, 5, 4, 3, 2, 1}}, CSV]> Diana> Here is a little example of how to export in a format that Excel can> read:> Export[C:table.csv, {{1, 2}, {3, 4}}, CSV]> > Steve Luttrell> Math friends,> If I program Mathematica to calculate a Cayley Table for A_5, for> example,> and it displays on the screen in the notebook, I have not beenable to> figure out how to paste the values into Excel without all theextra> formatting, such as quote marks. Has someone worked this out?> For example, the Cayley Table for A_5 copies as follows intoExcel...> !(*> > TagBox[GridBox[{> {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,> 12,> 13,> 14, 15, 16, 17, 18, 19, 20, 21, 22,23,> > 24,> 25, 26, 27, 28, 29, 30, 31, 32, 33,34,> 35,> 36, 37, 38, 39, 40, 41, 42, 43, 44,45,> 46,> 47, 48, 49, 50, 51, 52, 53, 54, 55,56,> 57,> 58, 59, 60},> {2, 3, 1, 7, 9, 8, 10, 12, 11, 4, 5,> 6,> 14,> 15, 13, 19, 21, 20, 22, 24, 23, 16,17,> 18,> 37, 39, 38, 40, 42, 41, 46, 47, 48,43,> 44,> 45, 49, 51, 50, 52, 54, 53, 58, 59,60,> 55,> 56, 57, 25, 26, 27, 28, 29, 30, 31,32,> 33,> 34, 35, 36},> > {3, 1, 2, 10, 11, 12, 4, 6, 5, 7, 9,> > 8,> 15,> 13, 14, 22, 23, 24, 16, 18, 17, 19,21,> 20,> 49, 50, 51, 52, 53, 54, 55, 56, 57,58,> 59,> > 60, 25, 27, 26, 28, 30, 29, 34, 35,36,> 31,> 32, 33, 37, 39, 38, 40, 42, 41, 46,47,> 48,> 43, 44, 45},> {4, 6, 5, 1, 3, 2, 11, 10, 12, 8, 7,> 9,> 25,> 27, 26, 28, 30, 29, 34, 35, 36, 31,32,> 33,> > 13, 15, 14, 16, 18, 17, 22, 23, 24,19,> 20,> 21, 50, 49, 51, 55, 56, 57, 52, 53,54,> 58,> 60, 59, 38, 37, 39, 43, 44, 45, 40,41,> 42,> > 46, 48, 47},> {5, 4, 6, 8, 7, 9, 1, 2, 3, 11, 12,> 10,> 26,> 25, 27, 31, 32, 33, 28, 29, 30, 34,36,> > 35,> 38, 37, 39, 43, 44, 45, 40, 41, 42,46,> 48,> 47, 13, 14, 15, 16, 17, 18, 19, 20,21,> 22,> 23, 24, 50, 51, 49, 55, 57, 56, 58,60,> 59,> 52, 53, 54},> and so on...> > ==== Several years ago, I found it convenient to do something like this:Unprotect[TeXForm];graphicsCount=0;TeXForm[p_Graphics]:= Module[{epsFileName}, graphicsCount++; epsFileName=graphics<>ToString[graphicsCount++]<>.eps; Export[epsFileName,p,EPS]; includegraphics{<>epsFileName<>} ];Protect[TeXForm];I.e., redefine the way TeXForm deals with Graphics objects. You would needsimilar definitions for any other types of Graphics that you need (e.g.Graphics3D).ThenTeXForm[Plot[Sin[x],{x,0,1}]]creates an EPS file and returns a fragment of LaTeX code that you can pasteinto your document.You might want to improve upon it by adding the options of includegraphicsas options of TeXForm, creating the whole figure environment, etc.Another way is to use File/Save As Special ../TeX to get a TeX form of awhole notebook and then pick out the EPS files and other material that youneed.John Jowett I'm student and using mathematica 4.0.> At the moment I have to write a report for my university. I want to use> LaTeX to write this document. Since I do a lot of calculations with> mathematica I use the TexForm[...] (//HoldForm) command to get a latex> output. I just copy/paste the output; it works quite well.> But then I wanted to include some plots from mathematica in my latex> document. If I apply it to Plot[...]: e.g.: TeXForm[Plot[Sin[x], {x, -Pi,> Pi}]] I get a strange outputs. Is it possible to get a LaTeX package, which compiles these instructions?Or> is this output just nonsense? Are there other possibilities than usingcopy> as bitmap to get my plot into the latex document? Perhaps anyone had similar problems or knows a useful link. Jochen> ==== Does anyone know how I can get the data/coordinates from anImplicitPlot ?Reply-To: Kay.Orgassa@gmx.de ==== Does anyone know, how to extract the data points from an ImplicitPlot? ==== Let's say you have imp=ImplictPlot[...];First use Graphics[imp] to turn the ContourGraphics object into anormal Graphics object.Now with Cases[Graphics[imp],_Line,Infinity] you can collect all theLine expressions that make the ImplicitPlot.I don't know what you want to do with the points, but this returns asimple Ôßat' list with them:Cases[Graphics[imp],l_Line:>Sequence@@l[[1]],Infinity] Orestis> Does anyone know, how to extract the data points from an ImplicitPlot? ==== I suspect within two or three years pocket PCs will have enough power to support Mathematica in toto, and porting the kernel to Palm won't happen before that, if at all.The display is useless for that, but I think somebody will solve that problem, too. A simple built-in projector would be nice.BobbyOn Fri, 31 Jan 2003 04:36:53 -0500 (EST), Orestis Vantzos > I think that simply porting the kernel would not be such a bad idea.> Since the palmtops have fairly complete versions of Java and J/Link> can link to that, I think that there are various interesting> possibilities.> With the kernel running as a service and using Java to create> specialised GUIs, a palmtop with a mathematica kernel could be used as> the ultimate scientific calculator!> It is obvious that you can not program Mathematica with a palmtop, but> you can prepare the Java GUI/Mathematica package at a desktop PC and then> upload it to the palmtop to get specific jobs done. I am confident> that Wolfram could easily create Ômini front-ends' for many things.> Things like the Integrator could easily fit into a palmtop. Input via> the Basic Input Palette could be easily implemented.> Orestis> If I could have mathematica on a palmtop I would be a truly fulfilled > human being. [setting: a cocktail party]> Girl: ...so in the limit you'd find that...> Me: well let's plot that [whips out palmtop with mathematica]> Girl: [swoons]> It's clearly possible in principle since modern palmtops are more> powerful than desktop machines that ran mathematica just fine several> years ago.> Yes, the CPU power is almost there, but the screen size and resolution> simply is not. Mathematica running on my Mac 7100av in the mid-90s still > had> the full effect of a 1024 x 768 color display on a 17-inch monitor.> Trying to do useful work on my Visor Prism or even an iPaq would be> horrible...useful only for the type of situation you fantasize about. Meaning, not worth the effort. I currently have Mathematica 4.1.5 on my 5-lb TiBook. Not small enough > to whip> out at a party to impress a chick (yuk yuk), but perfectly fine for> any mobile use (such as at the library, or at remote sites, or in hotel> rooms) I can plausibly imagine. Wasting time and money on a PDA port would be foolish for Wolfram. --Tim May-- majort@cox-internet.comBobby R. Treat ==== I think that simply porting the kernel would not be such a bad idea.Since the palmtops have fairly complete versions of Java and J/Linkcan link to that, I think that there are various interestingpossibilities.With the kernel running as a service and using Java to createspecialised GUIs, a palmtop with a mathematica kernel could be used asthe ultimate scientific calculator!It is obvious that you can not program Mathematica with a palmtop, butyou can prepare the Java GUI/Mathematica package at a desktop PC and thenupload it to the palmtop to get specific jobs done. I am confidentthat Wolfram could easily create Ômini front-ends' for many things.Things like the Integrator could easily fit into a palmtop. Input viathe Basic Input Palette could be easily implemented.Orestis> If I could have mathematica on a palmtop I would be a truly fulfilled > human being. [setting: a cocktail party]> Girl: ...so in the limit you'd find that...> Me: well let's plot that [whips out palmtop with mathematica]> Girl: [swoons]> It's clearly possible in principle since modern palmtops are more> powerful than desktop machines that ran mathematica just fine several> years ago.> Yes, the CPU power is almost there, but the screen size and resolution> simply is not. Mathematica running on my Mac 7100av in the mid-90s still had> the full effect of a 1024 x 768 color display on a 17-inch monitor.> Trying to do useful work on my Visor Prism or even an iPaq would be> horrible...useful only for the type of situation you fantasize about.> Meaning, not worth the effort.> I currently have Mathematica 4.1.5 on my 5-lb TiBook. Not small enough to whip> out at a party to impress a chick (yuk yuk), but perfectly fine for> any mobile use (such as at the library, or at remote sites, or in hotel> rooms) I can plausibly imagine.> Wasting time and money on a PDA port would be foolish for Wolfram.> --Tim May ==== >-----Original Message----->Sent: Wednesday, January 29, 2003 9:36 AM>To: mathgroup@smc.vnet.net If I could have mathematica on a palmtop I would be a truly >fulfilled > human being. Girl: ...so in the limit you'd find that...> Me: well let's plot that [whips out palmtop with mathematica]> Girl: [swoons]> It's clearly possible in principle since modern palmtops are more> powerful than desktop machines that ran mathematica just fine several> years ago.>Yes, the CPU power is almost there, but the screen size and resolution>simply is not. Mathematica running on my Mac 7100av in the >mid-90s still had>the full effect of a 1024 x 768 color display on a 17-inch monitor.>Trying to do useful work on my Visor Prism or even an iPaq would be>horrible...useful only for the type of situation you fantasize about.Meaning, not worth the effort.I currently have Mathematica 4.1.5 on my 5-lb TiBook. Not >small enough to whip>out at a party to impress a chick (yuk yuk), but perfectly fine for>any mobile use (such as at the library, or at remote sites, or in hotel>rooms) I can plausibly imagine.Wasting time and money on a PDA port would be foolish for Wolfram.--Tim May>Leaving out the more honourable dictionaries right from the beginning, andstarting with Essential American Idioms via Forbidden American English Ifinally dug up in The Pocket Dictionary of American Slang: *swoony.* _n._ An attractive boy. _adj._ Attractive. _Teenage use, c1940. More often in movies and stories about teenagers than used by teenagers._This clearly assigns that all to pure fiction, ... or rather to aspecification for next generation PDAs. As the energy density of amini-ßashlight sized micro-beamer would be too high to hold it in my hands,perhaps an interface to a pair of high resolution VR display spectaclesmight do, one glass for each.--Hartmut ==== The color problems are in the colormap of the GIF. There are ConversionOptions that control the colormap. Either can be used to fix this problem.By default, a single colormap is used for the entire animation. You can create a colormap for each frame withExport[..., ConversionOptions -> {GlobalColorReduction -> False}]Or you can override the automatic colormap with one of your own. Here's an example using web safe colors.Export[..., ConversionOptions -> {ColorReductionPalette -> Table[RGBColor[i, j, k], {i, 0, 1, 0.2}, {j, 0, 1, 0.2}, {k, 0, 1, 0.2}]}]>I think I've found a bug in exporting GIF animationI don't know what the problem is with this. I've trimmed down what>I'm doing to what seems to be the bare minimum that shows the bug.>Tiny changes in the value of z or in the step size for the table>will make the background of the gif dark black or brilliant green,>change the resulting file size by a factor of 16x, etc. These three>examples show a sample of the range of behavior that I've seen with this.This simulates some axes and then draws a moving point which is>colored green at the bottom of each cycle and black elsewhere.All these examples are identical code, except for the value of z.>It takes a couple of minutes to generate each example.111 kbytes and what seems to be pretty much a correct plotz = 1; Export[1.gif, Table[Graphics3D[{> Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}],> Line[{{0, 0, 0}, {4Pi, 0, 0}}],> If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]],> Point[{t, Cos[t], z Sin[t]}]},> PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}},> ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF]1598 kbytes! with bright green graph and lots of artifacts scattered>across the entire graph as it displaysz = 2; Export[2.gif, Table[Graphics3D[{> Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}],> Line[{{0, 0, 0}, {4Pi, 0, 0}}],> If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]],> Point[{t, Cos[t], z Sin[t]}]},> PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}},> ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF]72 kbytes with entire graph nearly completely blackz = N[[ExponentialE]]; Export[e.gif, Table[Graphics3D[{> Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}],> Line[{{0, 0, 0}, {4Pi, 0, 0}}],> If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]],> Point[{t, Cos[t], z Sin[t]}]},> PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}},> ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], GIF]I searched newsgroup postings and Wolfram and didn't find any mention>of such behavior. I presume this is a bug in the gif export code.If anyone can confirm that this is a bug and that it has been fixed>that would be good. If anyone can describe a dependable workaround>for the moment that would be even better, waiting a good part of>an hour for an animation to grind out and then discovering that it>is another black cat in a dark room is getting a little old.>-Dale ==== I'd sure like to find out how to clean up a process I do a lot. Namely, geta solution to some set of equations and then plot the result. For example,I recently didresult = Solve[{a == 1/(1/r2 + 1/50), 50 == 1/(1/(a + r1) + 1/r2)}, r1, a]This gives {{r1 -> (a function of r2) }}Then, I plot it byPlot[ (this function of r2), {r2, startvalue, stopvalue}]where I carefully type in this function. I feel sure you Mathematica prosdon't have to do that so I have made several feeble attempts to automatethis over the years. They fail because I still don't have a clue how Mathematica works.Here's my last attempt:Plot[ result /. %]Mathematica just hisses and prints out tons of error messages, none of which meana thing to me.Surely there is a way to get this plot without having to type the Solve[] resultinto Plot[]. Any hints would be appreciated, as usual.Rob ==== To beginwith, Solve has the nasty habbit of returning a nested list ofrules (since it is designed to work for multiple solution cases); useFlatten to get rid of that:result = Flatten@ Solve[{a == 1/(1/r2 + 1/50), 50 == 1/(1/(a + r1) + 1/r2)}, r1, a]Now result is something like {r1->...function of r2...} which is alist with one rule. (If you are serious about Mathematica, go now tothe Mathematica Book and start reading about rules by the way..)r1/.result returns the expression so simply do Plot[r1/.result,{r2,start,end}]That's it!Orestis> I'd sure like to find out how to clean up a process I do a lot. Namely, get> a solution to some set of equations and then plot the result. For example,> I recently did> result = Solve[{a == 1/(1/r2 + 1/50), 50 == 1/(1/(a + r1) + 1/r2)}, r1, a]> This gives {{r1 -> (a function of r2) }}> Then, I plot it by> Plot[ (this function of r2), {r2, startvalue, stopvalue}]> where I carefully type in this function. I feel sure you Mathematica pros> don't have to do that so I have made several feeble attempts to automate> this over the years. They fail because I still don't have a clue how Mathematica works.> Here's my last attempt:> Plot[ result /. %]> Mathematica just hisses and prints out tons of error messages, none of which mean> a thing to me.> Surely there is a way to get this plot without having to type the Solve[] result> into Plot[]. Any hints would be appreciated, as usual.> Rob ==== Commands always begin with large letter in MathematicaYou can get basic knowledge through reading part 1 of Mathematica Book,wolfram's book, which was attached with Mathematica.In[1]:=D[(Log[x])^x, x]Out[1]=!(Log[x]^x ((1/Log[x] + Log[Log[x]]))) ==== The problem is with your syntax. You must learn about the use ofparentheses, which play specific roles in Mathematica. Furthermore, theassignment f = something doesn't leave f as a function of x, but rather asa name for a symbol. And of course you may not evaluate the derivative of asymbol. What you must do is a proper definition of f as a function of x,such asIn[1]:=f[x_] := Log[x]^xThenIn[2]:=f'[x]Out[2]=Log[x]^x*(1/Log[x] + Log[Log[x]])which is what you want (I presume).I strongly recommend that you spend a few weeks reading, from beginning toend, at least the first part of The Mathematica Book, A PracticalIntroduction to Mathematica. Sections 1.2.5 and 1.7.1 therein are especiallyrelevant to your present problem.Tomas GarzaMexico City----- Original Message -----> discontinuous over the default bounds in Mathematica? ==== You really are new to Mathematica. Parentheses are used for grouping, but square brackets are used for function arguments, and the Log function is, well, Log. Also, the way you entered f, it would be an expression, but not a function (since you don't say what its argument is, or that it has an argument). Here are a few ways to do it:f = Log[#]^# &f'[x]Log[#1]^#1 & Log[x]^x*(1/Log[x] + Log[Log[x]])orD[Log[x]^x, x]Log[x]^x*(1/Log[x] + Log[Log[x]])orf = Log[x]^xD[f, x]Log[x]^x*(1/Log[x] + Log[Log[x]])BobbyOn Fri, 31 Jan 2003 04:36:46 -0500 (EST), Steve Chiang question but it only further confused me. I'm basically trying to take > the> first derivative of (ln(x))^x. Here is my syntax: f = (ln(x))^x. But > then> when I evaluate f Ô, it says nothing but ((ln(x))^x)' which is nothing > new.> Is this because I didn't specify bounds and that the function may be> discontinuous over the default bounds in Mathematica?-- majort@cox-internet.comBobby R. Treat ==== Steve,If you are new to Mathematica and expect to make a substantial use of it,then I strongly recommend working through Part I of The Mathematica Book. Byactually typing in and trying the various Mathematica commands you will savea lot of time in the long run. Steven Wolfram's essay Suggestions aboutLearning Mathematica at the front of the book is very good advice.You can take the derivative of you function in the following ways. First, ifyou don't actually want to define the function you could write...D[Log[x]^n, x](n*Log[x]^(-1 + n))/xOr you could define the function and then write the derivative...f[x_] := Log[x]^nf'[x](n*Log[x]^(-1 + n))/xIf you want to consider n to be a parameter and x to be the variable, thenyou could define your function this was...Clear[f]f[n_][x_] := Log[x]^nYou could then take derivatives with respect to the variable using differentparameters...f[q]'[y](q*Log[y]^(-1 + q))/yorf[5]'[x](5*Log[x]^4)/xAnd there are even more things to know about writing derivatives, but thatshould help you with your immediate question.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ ==== > question but it only further confused me. I'm basically trying to>take the first derivative of (ln(x))^x. Here is my syntax: f =>(ln(x))^x. But then when I evaluate f Ô, it says nothing but>((ln(x))^x)' which is nothing new. I think the issue here is the expression f' does not clearly specify what variable derivative is taken with respect to.Try either D[Log[x]^x,x] or D[f,x] instead ==== You almost had it. Try,Plot[r1 /.result, {r2, startval, stopval}]Yas> I'd sure like to find out how to clean up a process I do a lot. Namely, get> a solution to some set of equations and then plot the result. For example,> I recently did result = Solve[{a == 1/(1/r2 + 1/50), 50 == 1/(1/(a + r1) + 1/r2)}, r1, a] This gives {{r1 -> (a function of r2) }} Then, I plot it by> Plot[ (this function of r2), {r2, startvalue, stopvalue}] where I carefully type in this function. I feel sure you Mathematica pros> don't have to do that so I have made several feeble attempts to automate> this over the years. They fail because I still don't have a clue how Mathematica works. Here's my last attempt:> Plot[ result /. %]> Mathematica just hisses and prints out tons of error messages, none of which mean> a thing to me. Surely there is a way to get this plot without having to type the Solve[] result> into Plot[]. Any hints would be appreciated, as usual. Rob ==== My screen resolution is 1280x1024. Is there a way to make the defaultnotebook size a certain dimension?I've used the object inspector and have gone through the book but i can'tget anything to work right. Cansomebody help me with this small problem?thanksstryderReply-To: Diana ==== Folks,I am trying to come up with a snazzy way to hunt for a prime between n^2 and(n+1)^2.Some ideas?-- ==== ================================================= God made the integers, all else is the work of man.L. Kronecker, Jahresber. DMV 2, S. 19. ==== Kay,If you do a normal plot that produces a -Graphics- object, then the Firstpart of that object contains all the graphics primitives and directives,such as Line, Point, etc., that create the plotted object. The Last partcontains the overall plot options that control things such as the Frame,PlotLabel etc.ImplicitPlot is a little tricky because if you use the single iterator formit produces -Graphics- output. If you use the double iterator form itproduces-ContourGraphics-. You then have to convert that to Graphics.So let's plot an ellipse with the single iterator form. I am going to usecolors later so will load the package now.Needs[Graphics`Colors`]curves = First[ ImplicitPlot[x^2 + 2y^2 == 5, {x, -3, 3}, PlotPoints -> 20, DisplayFunction -> Identity]];We did an ImplicitPlot with the display suppressed, and took the first part.be more than one Line. You could look at curves, but I won't display itNow we extract the points. The argument of each Line is just the points thatare used to plot the Line. So we can use...pts = Cases[curves, Line[pts_] :> Point /@ pts, Infinity];Now we can plot the curves and the points.Show[Graphics[ {Tomato, curves, Cobalt, AbsolutePointSize[4], pts}], AspectRatio -> Automatic, Frame -> True, PlotLabel -> Implicit Curve with Points, Background -> Linen, ImageSize -> 400 ];You can get the actual point coordinates for the two lines by...pts /. Point -> Identitywhich gives two lists of point coordinates for the lower and upper branchesof the ellipse.If you use the two iterator form of ImplicitPlot, then you have to convertit to Graphics before extracting the First part. Also, then Mathematicaembeds a color directive for each Line so if you want a colored line youhave to use PlotStyle. (If you don't specify a PlotStyle it embeds Black.)So you would get the curves by the following statement. The rest would bethe same except that any color directive in the Show statement would notaffect the curves.curves = First[ Graphics[ImplicitPlot[x^2 + 2y^2 == 5, {x, -3, 3}, {y, -2, 2}, PlotPoints -> 20, PlotStyle -> Tomato, DisplayFunction -> Identity]]];If you want to try the DrawGraphics package at my web site below you cancombine everything into one plot statement because the Draw routinesautomatically convert to Graphics, extract the First part and suppress sideplots. You can also mix in curves produced by other types of plotstatements.Needs[DrawGraphics`DrawingMaster`]Draw2D[ {Tomato, curves = ImplicitDraw[x^2 + 2y^2 == 5, {x, -3, 3}, PlotPoints -> 20], Cobalt, AbsolutePointSize[4], pts = Cases[curves, Line[pts_] :> Point /@ pts, Infinity]}, AspectRatio -> Automatic, Frame -> True, PlotLabel -> Implicit Curve with Points, Background -> Linen, ImageSize -> 400];David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Rob,Try this.result = Solve[{a == 1/(1/r2 + 1/50), 50 == 1/(1/(a + r1) + 1/r2)}, r1, a]Plot[r1 /. result // Evaluate, {r2, -100, 100}];You don't strictly need the Evaluate, but it is more efficient with it.I would tend to do something more like the following.Clear[r1]result = Solve[{a == 1/(1/r2 + 1/50), 50 == 1/(1/(a + r1) + 1/r2)}, r1, a][[1,1]];r1[r2_] = r1 /. resultPlot[r1[r2], {r2, -100, 100}];David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/this over the years. They fail because I still don't have a clue howMathematica works.Here's my last attempt:Plot[ result /. %]Mathematica just hisses and prints out tons of error messages, none of whichmeana thing to me.Surely there is a way to get this plot without having to type the Solve[]resultinto Plot[]. Any hints would be appreciated, as usual.RobReply-To: Diana ==== My program, which is not fancy:NRange = Flatten[{n, Range[10, 20, 1]}]NSquared = Flatten[NRange^2]NPlus1Squared = Flatten[(NRange+1)^2]FirstPrimeGreaterNSquared=Flatten[{ Prime>n^2,Table[NestWhile[#1+1&,n^2,!(PrimeQ[#1])&],{n, 10,20}]}]{NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} // TableFormAre there ideas to make this more snazzy, and accomplish the same thing?Diana> Folks, I am trying to come up with a snazzy way to hunt for a prime between n^2and> (n+1)^2. Some ideas? --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19.Reply-To: Diana ==== Folks,I had a problem recently where I tried to determing the PrimePi value of 2times a number minus that number. This is verifying the Bertrand'sPostulate:PrimePi(2x) - PrimePi(x) >=1 for all x >=2, elements of Z.Well,I finally came up with:PrimePi[2*{2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001} -{2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001}]gives:{1, 2, 3, 4, 6, 9, 14, 23, 38, 66, 115, 205, 368, 551}the desired answer.Is there a way to process unrelated numbers with a Do or While or NestWhilestatement?Diana-- ==== =============================== ==== ==============God made the integers, all else is the work of man.L. Kronecker, Jahresber. DMV 2, S. 19.Reply-To: Diana ==== Bob,(PrimePi[2#]- PrimePi[#]&) /@ x {1, 1, 1, 2, 3, 5, 9, 15, 28, 49, 90, 163, 302, 456}I get:{2 x, 3 x, 5 x, 7 x, 13 x, 23 x, 43 x, 83 x, 163 x, 317 x, 631 x, 1259 x, 2503 x, 4001 x}Have I mis-applied your code?> Folks, I had a problem recently where I tried to determing the PrimePi value of 2> times a number minus that number. This is verifying the Bertrand's> Postulate: PrimePi(2x) - PrimePi(x) >=1 for all x >=2, elements of Z. Well, I finally came up with:> PrimePi[2*{2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001} -> {2, 3, 5, 7,> 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001}] gives:> {1, 2, 3, 4, 6, 9, 14, 23, 38, 66, 115, 205, 368, 551}> the desired answer.> Is there a way to process unrelated numbers with a Do or While orNestWhile> statement?> Diana --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19.> ==== Is it possible to have a semi transparent view of surfaces so that onemay verify slopes by ParametricPlot3D for Cauchy-Riemann relations?The following is program for 3 functions Z^2, Z^3, Sin[Z].It wasexpected to check slopes at the line of intersection of Re and Im parts.R1=x^2-y^2 ; I1= 2 x y ;z2r=Plot3D[R1 , {x,-Pi,Pi},{y,-Pi,Pi} ];z2i=Plot3D[I1 , {x,-Pi,Pi},{y,-Pi,Pi} ];Show[z2r,z2i] ; ÔTop view > Re,Im Intxn';Plot[{x ArcTan[-Sqrt[2]+1],x ArcTan[Sqrt[2]+1]}, {x,-Pi,Pi} ];R3=x^3 - 3 x y^2 ; I3= 3 x^2 y - y ^3 ;z3r=Plot3D[R3 , {x,-Pi,Pi},{y,-Pi,Pi} ];z3i=Plot3D[I3 , {x,-Pi,Pi},{y,-Pi,Pi} ];Show[z3r,z3i] ; ÔTop view > Re,Im Intxn';Plot[{x,x (-Sqrt[3]+2) , x (-Sqrt[3]-2) }, {x,-Pi,Pi} ];R2=Cosh[y] Sin[x] ; I2=Sinh[y] Cos[x] ;scr=Plot3D[R2,{x,-Pi/2,Pi/2},{y,-Pi/2,Pi/2}];sci=Plot3D[I2,{ x,-Pi/2,Pi/2},{y,-Pi/2,Pi/2}];Show[scr,sci]; ÔTop view > Re,Im Intxn';Plot[{ArcTanh[Tan[x]]},{x,-Pi/2,Pi/2 }];-- To contact in private, remove ==== I tried some of my Mathematica3.01 programs on a computer withMathematica4.1, there where some differences that I could not explain. Regarding N[]: consider for example:with version 4.1 I got:N[Sqrt[2.],16]->1.4142andN[Sqrt[2.],17]-> 1.4142135623730950and in version 3.01:N[Sqrt[2.],16]->1.414213562373095andN[Sqrt[2.],17]-> 1.4142135623730950Using SetPrecision[Sqrt[2.],16] I could make Mathematica4.1 give me 16digits precision.Ideas?Peter W ==== I have a program which uses a random number in several places - the samenumber in a given run of the program. When I implement the program howeverthe number changes in every new call to it. I've tried to overcome thisusing Which, Hold, Verbatim, and others, all to no avail. Any helpgreatly appreciated. ==== > I have a program which uses a random number in several places - the same> number in a given run of the program. When I implement the program however> the number changes in every new call to it. I've tried to overcome this> using Which, Hold, Verbatim, and others, all to no avail. Any help> greatly appreciated.Use SeedRandom to seed the random number generator in a controlled way.--Steve LuttrellWest Malvern, UK ==== > I have a program which uses a random number in several places - the same> number in a given run of the program. When I implement the program however> the number changes in every new call to it. I've tried to overcome this> using Which, Hold, Verbatim, and others, all to no avail. Any help> greatly appreciated.Donald, SeedRandom[0];n=Random[];{n,n} {0.0318536,0.0318536} SeedRandom[0];n=Random[];{n,n} {0.0318536,0.0318536}--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 ==== I have a rather complicated function that Mathematica can't seem to handlewithNIntegrate, Method->MonteCarlo.This is not my function, but it shows the essence of the problem.Suppose we have ComplicatedF[x_] := Re [NIntegrate [E^(- (I x+y+I)^2), {y,0,1}] ]Then, if you try:NIntegrate[ComplicatedF[x], {x,0,2}, Method->MonteCarlo]Mathematica will complain that the integrand is not numerical.But of course it is numerical and removing the Method->MonteCarlo optionwill generate an answer.Now my actual function is quite complicated which is whyI want to try the MonteCarlo method. Any suggestions? ==== If I activate < If I activate < want real values, how can I get rid of it so I can do a different> calculation involving complex values. In other words, how do I close the> RealOnly function. Is there another way of doing a calculation that will>Ray,Here is a modification of a posting by Bob Hanlon in Sept 2000. RealOnly /: On[RealOnly] := Needs[ Miscellaneous`RealOnly`]; RealOnly /: Off[RealOnly] := (Unprotect[Power, Solve, Roots]; Clear[Power, Solve, Roots]; Protect[Power, Solve, Roots]; Remove[Miscellaneous`RealOnly`Nonreal]; $Post =. )Check (-1.)^(1/3) 0.5 + 0.8660254037844387*I On[RealOnly] (-1.)^(1/3) -1. Off[RealOnly] (-1.)^(1/3) 0.5 + 0.8660254037844387*I--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKhay@haystack.demon.co.ukVoice: +44 (0)116 271 4198 ==== > I have a program which uses a random number in several places - the > same> number in a given run of the program. When I implement the program > however> the number changes in every new call to it. I've tried to overcome > this> using Which, Hold, Verbatim, and others, all to no avail. Any > help> greatly appreciated.>This is what SeedRandom is for, e.g.SeedRandom[5];Table[Random[Integer,{1,10}],{3}]{2,3,2}Now evaluating again:SeedRandom[5];Table[Random[Integer,{1,10}],{3}]{2,3,2} Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== I want to make a matrix of derivations, so I will be able to multiplyit by a matrix of functions and get the result matrixsimple example:|d/dx 0 | |xy x| |y 1|| |.| |=| ||d/dy d/dx| |x+y 3| |x+1 0| thank you ==== One way that is at least simpler and faster then yours is just to use the NextPrime function in the << NumberTheory`NumberTheoryFunctions`In[1]:=< My program, which is not fancy: NRange = Flatten[{n, Range[10, 20, 1]}] NSquared = Flatten[NRange^2] NPlus1Squared = Flatten[(NRange+1)^2] FirstPrimeGreaterNSquared=Flatten[{Prime>n^2,Table[ NestWhile[#1+1&,n^ > 2,!(P> rimeQ[#1])&],{n,10,20}]}] {NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} // > TableForm Are there ideas to make this more snazzy, and accomplish the same > thing?> Diana Folks, I am trying to come up with a snazzy way to hunt for a prime between > n^2> and> (n+1)^2. Some ideas? --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19.Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== I want to make a matrix of derivations, so I will be able to multiplyit by a matrix of functions and get the result matrixsimple example:|d/dx 0 | |xy x| |y 1|| |.| |=| ||d/dy d/dx| |x+y 3| |x+1 0| thank you ==== I don't quite understand what you mean by processing unrelated numbers, but ...first of all , you can just map your test function onto range of integers, e.g.And @@ (PrimePi[2#] - PrimePi[#] çí 1 & /@ Prime/@Range[2,100])TrueOf course if you want to know the actual difference you can use:In[17]:=PrimePi[2#]-PrimePi[#]&/@Prime/@Range[2,100]Out[ 17]={ 1,1,2,3,3,4,4,5,6,7,9,9,9,9,11,13,12,13,14,13,15,15,16,19,20,1 9,19,18,1 8,23, 23,25,25,27,26,28,28,28,28,30,30,32,32,32,32,35,38,38,38,39,39 ,39,41,42, 43,42, 42,42,42,42,44,49,50,49,49,54,54,56,55,55,55,57,58,59,59,60,60 ,60,61,64, 64,66,66,66,67,67,68,68,67,67,70,71,71,73,72,73,77,76,80} and of course lots of different variants of this.Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/> Folks, I had a problem recently where I tried to determing the PrimePi value > of 2> times a number minus that number. This is verifying the Bertrand's> Postulate: PrimePi(2x) - PrimePi(x) >=1 for all x >=2, elements of Z. Well, I finally came up with:> PrimePi[2*{2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, > 4001} -> {2, 3, 5, 7,> 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001}] gives:> {1, 2, 3, 4, 6, 9, 14, 23, 38, 66, 115, 205, 368, 551}> the desired answer.> Is there a way to process unrelated numbers with a Do or While or > NestWhile> statement?> Diana --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19. ==== >My screen resolution is 1280x1024. Is there a way to make the default>notebook size a certain dimension?>I've used the object inspector and have gone through the book but i can't>get anything to work right. Can>somebody help me with this small problem?>thanks>stryderhttp://support.wolfram.com/mathematica /interface/notebooks/setdefaultnotebooksize.html-Dale ==== perhaps the function SeedRandom may help you.GreetingsJan Schmedes> I have a program which uses a random number in several places - the same> number in a given run of the program. When I implement the program however> the number changes in every new call to it. I've tried to overcome this> using Which, Hold, Verbatim, and others, all to no avail. Any help> greatly appreciated. ==== Ray: Ted Ersek has written a package, SwitchableRealOnly, that doeswhat you wish. You can read about it athttp://library.wolfram.com/database/MathSource/560/. Best, HarveyHarvey P. DaleUniversity Professor of Philanthropy and the LawDirector, National Center on Philanthropy and the LawNew York University School of LawRoom 206A110 West 3rd StreetNew York, N.Y. 10012-1074-----Original Message-----Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Diana: This should do it:primeBetween[n_] := Module[{ppn = PrimePi[n^2] + 1, ppn1 = PrimePi[(n +1)^2]}, Prime[Range[ppn, ppn1]]] Best, HarveyHarvey P. DaleUniversity Professor of Philanthropy and the LawDirector, National Center on Philanthropy and the LawNew York University School of LawRoom 206A110 West 3rd StreetNew York, N.Y. 10012-1074-----Original Message-----God made the integers, all else is the work of man.L. Kronecker, Jahresber. DMV 2, S. 19. ==== i have a problem by creating a package. I need routines from anotherpackage, such that i use the followinglines at beginning of the package fileBeginPackage[Seismo`Hazard`PSHA`]Needs[Statistics` ContinuousDistributions`]If i load the package with<< Seismo`Hazard`PSHA`in a notebook everything works, but if i load it a second time (e.g. afterchanging something in the code) and calling one of the modulesthere are error messages produced like the following:Random::randt: Type specificationSeismo`Hazard`PSHA`Private`NormalDistribution[<< 19>, 0.16] in Random[<< 1 >]should be Real, Integer, or Complex.The same message is produced by loading the package the first time andusingBeginPackage[Seismo`Hazard`PSHA`,{Statistics` ContinuousDistributions`}]Does anybody has a hint what i make wrong??Jan Schmedes ==== Donald,Putmyrandom = Random[]and it will be fixed once and for all. But then why use Random at all? Youprobably want to run different cases, each with a different random number.Then use...With[{myrandom = Random[]},code using myrandom]Then myrandom is fixed once and replaced in all its instances in the code.For example...With[{myrandom = Random[]}, {myrandom, myrandom}]{0.655465, 0.655465}David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Peter,This has been a frequent question on MathGroup.Basically the purpose of N is to convert an exact number to an approximatenumber. If the approximate number is machine precision, then by default itnow displays with 6 places. You can change that with the Option Inspector.If the approximation is extended precision, then it displays with theindicated precision.The proper command for output formatting of numbers is NumberForm.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/N[Sqrt[ 2.],16]->1.414213562373095andN[Sqrt[2.],17]-> 1.4142135623730950Using SetPrecision[Sqrt[2.],16] I could make Mathematica4.1 give me 16digits precision.Ideas?Peter W ==== Ray,Ted Ersek has a package called SwitchableRealOnly that can be downloadedfrom MathSource. A nice package.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== > I have a program which uses a random number in several places - the same> number in a given run of the program. When I implement the program however> the number changes in every new call to it. I've tried to overcome this> using Which, Hold, Verbatim, and others, all to no avail. Any help> greatly appreciated.Try using = instead of :=.r = Random[];Then use r throughout the program. Using r := Random[] (or just Random[])instead would cause a fresh random number to be sampled each time r appears.Rob PrattDepartment of Operations Researchhttp://www.unc.edu/~rpratt/ ==== Another in a series of potentially simple questions: What is the difference between using Fit and Interpolation?f[x_]=Fit[data, {1,x},x]-or-f[x_]=Interpolation[data][x]I do know that Fit can take arguments for the independant variablesform like:f[x_]=Fit[data, {1,x},x]f[x_]=Fit[data, {1,x,x^2},x]but that's a bit of guesswork if you have a limited set of points, no?Also, is there a function in Mathematica that allows me to swapdependent and independent variables? e.g. x=2.5y --> y=x/2.5David SeruyangeStudentReply-To: ==== -----Original Message-----funct1[234]Out[3]=54767(Actually NextPrime is very easy to define yourself so you do not even need to use the package, e.g:nextprime[n_]:=If[PrimeQ[n],n,nextprime[n+1]])Here is a little more interesting way to get the same answer:funct2[n_] := Prime[PrimePi[n^2] + 1]funct2[234]54767This is maybe more snazzy but unfortunately it only works for relatively small n.> My program, which is not fancy: NRange = Flatten[{n, Range[10, 20, 1]}] NSquared = Flatten[NRange^2] NPlus1Squared = Flatten[(NRange+1)^2] FirstPrimeGreaterNSquared=Flatten[{Prime>n^2,Table[ NestWhile[#1+1&,n^ > 2,!(P> rimeQ[#1])&],{n,10,20}]}] {NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} // > TableForm Are there ideas to make this more snazzy, and accomplish the same > thing?> Diana Folks, I am trying to come up with a snazzy way to hunt for a prime between > n^2> and> (n+1)^2. Some ideas? --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19.Andrzej KozlowskiYokohama, Japanhttp://www.mimuw.edu.pl/~akoz/http:// platon.c.u-tokyo.ac.jp/andrzej/ ==== >I had a problem recently where I tried to determing the PrimePi value>of 2 times a number minus that number. This is verifying the>Bertrand's Postulate:>PrimePi(2x) - PrimePi(x) >=1 for all x >=2, elements of Z.>I finally came up with: PrimePi[2*{2, 3, 5, 7, 13, 23, 43, 83, 163,>317, 631, 1259, 2503, 4001} - {2, 3, 5, 7, 13, 23, 43, 83, 163, 317,>631, 1259, 2503, 4001}]>gives: {1, 2, 3, 4, 6, 9, 14, 23, 38, 66, 115, 205, 368, 551} the>desired answer. Hmm... Your statement of your problem and the function agree but are not equivalent toPrimePi[2x]-PrimePi[x].Your function is PrimePi[2*list -list] = PrimePi[list] which is not equal to PrimePi[2*list]-PrimePi[list]>Is there a way to process unrelated numbers with a Do>or While or NestWhile statement? Clearly, the answer to your question is yes. A more specific answer depends on exactly what you mean by process.If process feed numbers to a function of n arguements m times then a better solution might beMapThread[f, {list1, list2, .... listn}] ==== > I have a program which uses a random number in several places - the same> number in a given run of the program. When I implement the program however> the number changes in every new call to it. I've tried to overcome this> using Which, Hold, Verbatim, and others, all to no avail. Any help> greatly appreciated.Try using = instead of :=.r = Random[];Then use r throughout the program. Using r := Random[] (or just Random[])instead would cause a fresh random number to be sampled each time r appears.Rob PrattDepartment of Operations Researchhttp://www.unc.edu/~rpratt/Rob - This doesn't work for me. If I tryF[n_]=Table[Random[Real,{-1,1}],{n}]I get a different sequence for F[5] each time I use it. Don Darling ==== << NumberTheory`NumberTheoryFunctions`TableForm[{#, n = NextPrime[#^2], n - #^2, N[n/#^2]} & /@ Range[10, 100, 5], TableAlignments -> Center, TableHeadings -> {None, {n, First Prime > n^2 , Prime minus n^2, Prime/n^2}}]Bobby> << NumberTheory`NumberTheoryFunctions`> primeGTnSquare[n_] := NextPrime[n^2]> primeGTnSquare[5000] 25000009 or TableForm[{#, NextPrime[#^2]} & /@ Range[100],> TableAlignments -> Center,> TableHeadings -> {None, {n, First Prime > n^2}}] or TableForm[{#, NextPrime[#^2]} & /@ Range[10, 100, 5],> TableAlignments -> Center, TableHeadings -> {None, {n, First Prime > n^2}}] Bobby On Sun, 2 Feb 2003 01:13:25 -0500 (EST), Diana My program, which is not fancy: NRange = Flatten[{n, Range[10, 20, 1]}] NSquared = Flatten[NRange^2] NPlus1Squared = Flatten[(NRange+1)^2] FirstPrimeGreaterNSquared=Flatten[{Prime>n^2,Table[ NestWhile[#1+1&,n^2,!(P> rimeQ[#1])&],{n,10,20}]}] {NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} // > TableForm Are there ideas to make this more snazzy, and accomplish the same thing?> Diana Folks, I am trying to come up with a snazzy way to hunt for a prime between > n^2> and> (n+1)^2. Some ideas? --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19.-- majort@cox-internet.comBobby R. Treat ==== << NumberTheory`NumberTheoryFunctions`primeGTnSquare[n_] := NextPrime[n^2]primeGTnSquare[5000]25000009orTableForm[{#, NextPrime[#^2]} & /@ Range[100], TableAlignments -> Center, TableHeadings -> {None, {n, First Prime > n^2}}]orTableForm[{#, NextPrime[#^2]} & /@ Range[10, 100, 5], TableAlignments -> Center, TableHeadings -> {None, {n, First Prime > n^2}}]BobbyOn Sun, 2 Feb 2003 01:13:25 -0500 (EST), Diana > My program, which is not fancy: NRange = Flatten[{n, Range[10, 20, 1]}] NSquared = Flatten[NRange^2] NPlus1Squared = Flatten[(NRange+1)^2] FirstPrimeGreaterNSquared=Flatten[{Prime>n^2,Table[ NestWhile[#1+1&,n^2,!(P> rimeQ[#1])&],{n,10,20}]}] {NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} // TableForm Are there ideas to make this more snazzy, and accomplish the same thing?> Diana Folks, I am trying to come up with a snazzy way to hunt for a prime between n^2> and> (n+1)^2. Some ideas? --> ==== =================================================> God made the integers, all else is the work of man.> L. Kronecker, Jahresber. DMV 2, S. 19.>-- majort@cox-internet.comBobby R. Treat ==== >My program, which is not fancy:>NRange = Flatten[{n, Range[10, 20, 1]}]>NSquared = Flatten[NRange^2]>NPlus1Squared = Flatten[(NRange+1)^2]>FirstPrimeGreaterNSquared=Flatten[{ Prime>n^2,Table[NestWhile[#1+1&,n>^2,!(P rimeQ[#1])&],{n,10,20}]}]>{NRange, NSquared, FirstPrimeGreaterNSquared, NPlus1Squared} //>TableForm>Are there ideas to make this more snazzy, and accomplish the same>thing?<{None,{n,n^2,Prime>n^2,(n+1)^2}}] ==== > I have a program which uses a random number in several places - the same> number in a given run of the program. When I implement the program however> the number changes in every new call to it. I've tried to overcome this> using Which, Hold, Verbatim, and others, all to no avail. Any help> greatly appreciated. Try using = instead of :=. r = Random[]; Then use r throughout the program. Using r := Random[] (or just Random[])> instead would cause a fresh random number to be sampled each time r appears. Rob Pratt> Department of Operations Research> http://www.unc.edu/~rpratt/ Rob - This doesn't work for me. If I try F[n_]=Table[Random[Real,{-1,1}],{n}] I get a different sequence for F[5] each time I use it. Don DarlingThe code I suggested does work for a single random number.Your command to obtain and remember a random n-vector yields an errormessage. Try the code below. The first call to F[5] assigns a random5-vector to F[5]. Subsequent calls to F[5] just look up the stored value.In[1]:= F[n_] := F[n] = Table[Random[Real, {-1, 1}], {n}]In[2]:= F[5]Out[2]= {0.601045, -0.776375, -0.269912, -0.172019, -0.589347}In[3]:= F[5]Out[3]= {0.601045, -0.776375, -0.269912, -0.172019, -0.589347}Rob PrattDepartment of Operations Researchhttp://www.unc.edu/~rpratt/ ==== My friend Rip Pelletier pointed me to a better method to illustrate theCauchy-Riemann relations for analytic functions. He pointed me to TristanNeedham's book Visual Complex Analysis. In Chapter 5, Section I -Cauchy-Riemann Revealed, the CR conditions are related to the complexmapping.If a small patch of squares are mapped by an analytic function, then they gointo another small patch in which all the squares have been amplified androtated in exactly the same way.Fortunately, we have the ComplexMap package in Mathematica and can easilyillustrate this for your functions. For example, for the Sin function...Needs[Graphics`ComplexMap`]With[ {x = 2, y = 2, del = 0.01, f = Sin}, Show[GraphicsArray[{CartesianMap[ Identity, {x - del, x + del, del/5}, {y - del, y + del, del/5}, Axes -> False, DisplayFunction -> Identity], CartesianMap[ f, {x - del, x + del, del/5}, {y - del, y + del, del/5}, Axes -> False, DisplayFunction -> Identity]}], ImageSize -> 500]];A square patch maps into a rotated square patch. Just change f and/or themapping points for other cases. Use a pure function for z^2.For a case that is not analytic, and so the CR relations do not hold, usef = # + 2Abs[#] &. The squares go to parallelograms.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/R3=x^3 - 3 x y^2 ; I3= 3 x^2 y - y ^3 ;z3r=Plot3D[R3 , {x,-Pi,Pi},{y,-Pi,Pi} ];z3i=Plot3D[I3 , {x,-Pi,Pi},{y,-Pi,Pi} ];Show[z3r,z3i] ; ÔTop view > Re,Im Intxn';Plot[{x,x (-Sqrt[3]+2) , x (-Sqrt[3]-2) }, {x,-Pi,Pi} ];R2=Cosh[y] Sin[x] ; I2=Sinh[y] Cos[x] ;scr=Plot3D[R2,{x,-Pi/2,Pi/2},{y,-Pi/2,Pi/2}];sci=Plot3D[I2,{ x,-Pi/2,Pi/2},{y,-Pi/2,Pi/2}];Show[scr,sci]; ÔTop view > Re,Im Intxn';Plot[{ArcTanh[Tan[x]]},{x,-Pi/2,Pi/2 }];--To contact in private, remove