d-11 I was wondering whether there's a way to provide mathematica with x and y coordinates of a point from a c++ program (with mathlink or otherwise) and have it graph it out point by point, perhaps even erasing the previous image as it goes along. For example, if the correct points are supplied as output, can mathematica show me the movement of a planet in its orbit or SHM, etc. (whatever the code is meant to generate). Currently I output the points to a file in the ListPlot form, but then I just get the orbit drawn out instead of the groups, but I read somewhere that realtime plotting of points can't be done on mathematica. is this true? and if it can than how? Any help would be greatly appreciated ==== ok, it is not perfect but what is with DynamicFrame[t_Integer, range_] := Module[{arg, gr}, arg = 2Pi*t/18; gr = Graphics[{{Hue[Mod[t/18, 1]], AbsolutePointSize[8.0], Point[{Cos[arg], Sin[arg]}]}, Line[{{0, 0}, {Cos[arg], Sin[arg]}}]}, PlotRange -> range, AspectRatio -> Automatic]; DisplayString[gr] ] and nb = NotebookCreate[]; Do[ NotebookFind[nb, MyAnimationFrame, Previous, CellTags]; NotebookDelete[nb]; NotebookWrite[nb, Cell[GraphicsData[PostScript, DynamicFrame[i, {{-1.5, 1.5}, {-1.5, 1.5}}] ] , Graphics, CellTags -> MyAnimationFrame] ], {i, 18}] > > I was wondering whether there's a way to provide mathematica with x > and y coordinates of a point from a c++ program (with mathlink or > otherwise) and have it graph it out point by point, perhaps even > erasing the previous image as it goes along. For example, if the > correct points are supplied as output, can mathematica show me the > movement of a planet in its orbit or SHM, etc. (whatever the code is > meant to generate). Currently I output the points to a file in the > ListPlot form, but then I just get the orbit drawn out instead of the > groups, but I read somewhere that realtime plotting of points can't be > done on mathematica. is this true? and if it can than how? > Any help would be greatly appreciated > aatish > aatish@mac.com ==== 1) With the up/down keys I can cycle repeatedly in either direction with no problem, without having to add any extra cells. 2) However, the control strip keys behave erratically for single stepping. Or else, I don't know the proper way to use them for single stepping. Adding a Text cell after the animation frames did not improve it. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ take you up to the k=4 plot, but will NOT loop back down to the k=1 plot (although the free-running animation does seem to loop around OK). Adding another cell (even a header or text cell) at the end of the notebook, however, so that there is another cell after the k=4 plot, will enable cyclic single-step looping in either direction around the loop. [Mac PB G3, OS 9.1, Mathematica 4.1] ==== Is something like this what you're after: In[1]:= soln = y /.First[NDSolve[{y'[t]==y[t], y[0]==1}, y, {t,0,10}, StoppingTest->(y[t]>2)]] Out[1]= InterpolatingFunction[{{0., 0.696495}}, <>] In[2]:= soln[[1, 1, 2]] Out[2]= 0.696495 In[3]:= soln[soln[[1, 1, 2]]] Out[3]= 2.00672 ? --- htp://www.math.armstrong.edu/faculty/hollis > I am using StoppingTest in NDSolve, as a consequence the > terminal value of the independent variable is unknown prior > to NDSolve finishing. How does one extract this number from > the Interpolation object? ==== findTimeRange[expr_] := First[Union[ Cases[expr, InterpolatingFunction[___][_], Infinity] /. InterpolatingFunction[a_, b__][_] :> First[a]]] ff = NDSolve[{y''[x] == -y[x], y[0] == 1, y'[0] == 0}, y[x], {x, 0, 2Pi}] and the endpoint is: Last[findTimeRange[ff]] > > I am using StoppingTest in NDSolve, as a consequence the > terminal value of the independent variable is unknown prior > to NDSolve finishing. How does one extract this number from > the Interpolation object? ==== This works: polyCoeff = CoefficientList[(-m + x)^5*(a + b*x + c*x^2 + d*x^3 + e*x^4 + f*x^5),{x}]; Sum[polyCoeff[[k]]Integrate[Exp[-const (x-m)^2] x^(k-1),{x,-Infinity,Infinity},Assumptions->const>0],{k,1,11}] Maurice I'm trying to compute the 5th moment of a tweak to the normal pdf. Here's what I have: F[a_, b_, c_, d_, e_, f_, X_] := (a + b X + c X^2 + d X^3 + e X^4 + f X^5)* > Exp[-(((X - m)/sd)^2)/2]/(Sqrt[2Pi]sd). The strange thing, and I'd appreciate someone shedding some light on this, is that this:Integrate[F[p_0, p_1, p_2, p_3, p_4, p_5, > X]*((((X - m))/sd))^5, {X, -Infinity, Infinity}, Assumptions -> {sd > 0}]) (I cut and pasted that it looks like it works) Anyway, THAT gives me an answer really quickly... (within 5 minutes on > my box) JUST changing it from p0..5 to a,b,c,d,e,f like so: Integrate[F[a, b, c, d, e, f, X]*((X - m)/sd)^5, {X, -Infinity, > Infinity},Assumptions -> {sd > 0}] Causes mathematica to go into an infinite loop (seemingly after 6 hours). This ... sucks. How am I to know if a certain equation is solvable, if only I choose the right variables?? Binesh Bannerjee does sem to be a bug here, but it is not quite what you think. It's the first answer that you get that is probably wrong. On the other hand, in the second case it is very unlikely that Mathematica enters an infinite loop, rather it is still trying to arrive at the answer and there is no guarantee that it will reach one after, say a week or a month. As for first case, the reason why the answer is probably this. Evaluate the formula: formula=Integrate[F[Subscript[p, 0], Subscript[p, 1], Subscript[p, 2], Subscript[p, 3], Subscript[p, 4], Subscript[p, 5], X]*((X - m)/sd)^5, {X, -Infinity, Infinity}] Now set Evaluate[Table[Subscript[p, i], {i, 1, 5}]] = Table[Random[], {5}] and also sd = Random[]; m = Random[]; Now evaluate again Integrate[F[Subscript[p, 0], Subscript[p, 1], Subscript[p, 2], Subscript[p, 3], Subscript[p, 4], Subscript[p, 5], X]*((X - m)/sd)^5, {X, -Infinity, Infinity}] and formula You will almost certainly get different answers, while they clearly ought to be the same. It seems that it is nto the fact that the names you are suing are different that leads to different results in both of your integrals but the fact that the names of the parameters in the first case are not symbols. Officially there is no reason why they should be, but in practice using non-symbols in formulas makes them more complicated and is more likely to result in errors. The really bad news as far as your problem is concerned is that it is the 6 hour fruitless computation that appears to be the correct one ... Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ ==== > According your theory, I think, klasse1 should be defined in Global` and > klasse only in Rechteck But this is not the case. Therefore - excuse me - > I doubt, that your theory is correct. I have added some comments to your code about how I think that this happens: oo`hfield = klasse1; oo`newContext[ctxp_] := ($ContextPath = Join[ctxp, $ContextPath]; BeginPackage[ctxp[[1]]]; If[Length[ctxp] > 1, $ContextPath = Join[ctxp, Rest[$ContextPath]];]) oo`resumeContext[] := (EndPackage[]; $ContextPath = Drop[$ContextPath, 1];) oo`new11[x_] := (Print[Anfang new11]; klassnam = x; tsx = ToString[klassnam]; oo`dat = D:Math_OOclasses <> tsx <> .cl; ctx = klassnam <> `; oo`newContext[{ctx}];) oo`new12[] := (Print[Name klasse - Anfang]; Print[$Context: , $Context]; ToExpression[oo`hfield]; (* the symbol klasse1 is created when oo`new12[] is evaluated*) Print[Context von klasse: , Context[klasse]]; (*klasse is created as Global`klasse when this rule is read*) oo`resumeContext[]; Print[Name klasse - Ende];); Print[Anfang Programm:]; Print[$Context: , $Context]; oo`new11[Rechteck]; Print[nach new11:]; Print[$Context: , $Context]; oo`hfield = klasse; oo`new12[];(*klasse and klass1 are created as in context Rechteck` when this is evaluated, because context, contextpath are Rechteck`, {Rechteck`, System`}*) Print[nach new12:]; Print[AH3]; Print[$Context: , $Context]; -- > I have a new program: oo`hfield = klasse1; > oo`newContext[ctxp_] := ( $ContextPath = Join[ctxp, $ContextPath]; > BeginPackage[ctxp[[1]]]; > If[Length[ctxp]>1, > $ContextPath = Join[ctxp, Rest[$ContextPath]]; > ] > ) > oo`resumeContext[] := ( > EndPackage[]; > $ContextPath = Drop[$ContextPath, 1]; > ) > oo`new11[x_] := ( > Print[Anfang new11]; > klassnam = x; > tsx = ToString[klassnam]; > oo`dat = D:Math_OOclasses <> tsx <> .cl; > ctx = klassnam <> `; > oo`newContext[{ctx}]; > ) > oo`new12[] := ( > Print[Name klasse - Anfang]; > Print[$Context: , $Context]; > ToExpression[oo`hfield]; > Print[Context von klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - Ende]; > ); > Print[Anfang Programm:]; > Print[$Context: , $Context]; > oo`new11[Rechteck]; > Print[nach new11:]; > Print[$Context: , $Context]; > oo`hfield = klasse; > oo`new12[]; > Print[nach new12:]; > Print[$Context: , $Context]; and the results: Anfang Programm: > $Context: Global` > Anfang new11 > nach new11: > $Context: Rechteck` > Name klasse - Anfang > $Context: Rechteck` > klasse > klasse::shdw: Symbol klasse appears in multiple contexts {Rechteck`, > Global`} > ; definitions in context Rechteck` > may shadow or be shadowed by other definitions.Context von klasse: > Global` > Name klasse - Ende > nach new12: > $Context: Global` > In[19]:= According your theory, I think, klasse1 should be defined in Global` and > klasse only in Rechteck But this is not the case. Therefore - excuse me - > I doubt, that your theory is correct. ----- Original Message ----- > > My question is: > Why is the variable klasse also defined in the context Global? > > klasse is created in the context Global` when the assignment > > oo`new12[] := (Print[Name klasse - Begin]; > Print[$Context: , $Context]; > ToExpression[klasse]; > Print[Context of klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - End];) > > is converted into internal form (with contexted symbols) prior to > evaluation. > > This is before > oo`new11[Rechteck]; > is evaluated > > -- > Allan > > --------------------- > Allan Hayes > Mathematica Training and Consulting > Leicester UK > www.haystack.demon.co.uk > hay@haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > > I have the following program: > > oo`newContext[ctxp_] := ( > BeginPackage[ctxp[[1]]]; > ) > oo`resumeContext[] := ( > EndPackage[]; > $ContextPath = Drop[$ContextPath, 1]; > ) > oo`new11[x_] := ( > Print[Begin new11]; > klassnam = x; > ctx = klassnam <> `; > oo`newContext[{ctx}]; > ); > oo`new12[] := ( > Print[Name klasse - Begin]; > Print[$Context: , $Context]; > ToExpression[klasse]; > Print[Context of klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - End]; > ); > Print[Begin Programm:]; > Print[$Context: , $Context]; > oo`new11[Rechteck]; > oo`new12[]; > Print[after new12:]; > Print[$Context: , $Context]; > > I get the following results: > > Begin Programm: > $Context: Global` > Begin new11 > Name klasse - Begin > $Context: Rechteck` > klasse > klasse::shdw: Symbol klasse appears in multiple contexts {Rechteck`, > Global`} > ; definitions in context Rechteck` > may shadow or be shadowed by other definitions.Context of klasse: > Global` > Name klasse - End > after new12: > $Context: Global` > In[14]:= > > My question is: > Why is the variable klasse also defined in the context Global? ==== according to Allan's an my explanation Mathematica *must* parse the definition of oo`new12[] *before* it is evaluated. Because you don't like local variables you write oo`new12[] := ( Print[Name klasse - Anfang]; Print[$Context: , $Context]; ToExpression[oo`hfield]; Print[Context von klasse: , Context[klasse]]; oo`resumeContext[]; Print[Name klasse - Ende]; ); and parsing this create a global symbol klasse because the parser see the line Print[Context von klasse: , Context[klasse]]; If you wish to avoid this you can use oo`new12[] := Module[{UsingObjectsIsDaft`class}, Print[Name klasse - Anfang]; Print[$Context: , $Context]; UsingObjectsIsDaft`class = ToExpression[oo`hfield]; Print[Context von klasse: , Context[Evaluate[UsingObjectsIsDaft`class]]]; oo`resumeContext[]; Print[Name klasse - Ende]; ]; > > I have a new program: > > oo`hfield = klasse1; > oo`newContext[ctxp_] := ( $ContextPath = Join[ctxp, $ContextPath]; > BeginPackage[ctxp[[1]]]; > If[Length[ctxp]>1, > $ContextPath = Join[ctxp, Rest[$ContextPath]]; > ] > ) > oo`resumeContext[] := ( > EndPackage[]; > $ContextPath = Drop[$ContextPath, 1]; > ) > oo`new11[x_] := ( > Print[Anfang new11]; > klassnam = x; > tsx = ToString[klassnam]; > oo`dat = D:Math_OOclasses <> tsx <> .cl; > ctx = klassnam <> `; > oo`newContext[{ctx}]; > ) > oo`new12[] := ( > Print[Name klasse - Anfang]; > Print[$Context: , $Context]; > ToExpression[oo`hfield]; > Print[Context von klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - Ende]; > ); > Print[Anfang Programm:]; > Print[$Context: , $Context]; > oo`new11[Rechteck]; > Print[nach new11:]; > Print[$Context: , $Context]; > oo`hfield = klasse; > oo`new12[]; > Print[nach new12:]; > Print[$Context: , $Context]; > > and the results: > > Anfang Programm: > $Context: Global` > Anfang new11 > nach new11: > $Context: Rechteck` > Name klasse - Anfang > $Context: Rechteck` > klasse > klasse::shdw: Symbol klasse appears in multiple contexts {Rechteck`, > Global`} > ; definitions in context Rechteck` > may shadow or be shadowed by other definitions.Context von klasse: > Global` > Name klasse - Ende > nach new12: > $Context: Global` > In[19]:= > > According your theory, I think, klasse1 should be defined in Global` and > klasse only in Rechteck But this is not the case. Therefore - excuse me - > I doubt, that your theory is correct. > > ----- Original Message ----- > > Hermann, > > My question is: > Why is the variable klasse also defined in the context Global? > > klasse is created in the context Global` when the assignment > > oo`new12[] := (Print[Name klasse - Begin]; > Print[$Context: , $Context]; > ToExpression[klasse]; > Print[Context of klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - End];) > > is converted into internal form (with contexted symbols) prior to > evaluation. > > This is before > oo`new11[Rechteck]; > is evaluated > > -- > Allan > > --------------------- > Allan Hayes > Mathematica Training and Consulting > Leicester UK > www.haystack.demon.co.uk > hay@haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > > I have the following program: > > oo`newContext[ctxp_] := ( > BeginPackage[ctxp[[1]]]; > ) > oo`resumeContext[] := ( > EndPackage[]; > $ContextPath = Drop[$ContextPath, 1]; > ) > oo`new11[x_] := ( > Print[Begin new11]; > klassnam = x; > ctx = klassnam <> `; > oo`newContext[{ctx}]; > ); > oo`new12[] := ( > Print[Name klasse - Begin]; > Print[$Context: , $Context]; > ToExpression[klasse]; > Print[Context of klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - End]; > ); > Print[Begin Programm:]; > Print[$Context: , $Context]; > oo`new11[Rechteck]; > oo`new12[]; > Print[after new12:]; > Print[$Context: , $Context]; > > I get the following results: > > Begin Programm: > $Context: Global` > Begin new11 > Name klasse - Begin > $Context: Rechteck` > klasse > klasse::shdw: Symbol klasse appears in multiple contexts {Rechteck`, > Global`} > ; definitions in context Rechteck` > may shadow or be shadowed by other definitions.Context of klasse: > Global` > Name klasse - End > after new12: > $Context: Global` > In[14]:= > > My question is: > Why is the variable klasse also defined in the context Global? > > > > > > Reply-To: ==== I agree. I had a graduate math course in non-standard analysis years ago, and I recall that it was just as formally logical as the usual way. Integrals became finite (transfinite) sums and the usual proofs of calculus became much simpler, once the groundwork was laid. It could be tricky to incorporate it in Mathematica, but no more so than intervals or complex numbers. The synthesis of integration with summation could be very powerful, too, as each can build on the other. Ditto for differentiation and finite differences, differential equations and difference equations, etc. Bobby Treat -----Original Message----- symbolic algebra. (For more see Abraham Robinson, Non-standard Analysis, Princeton Landmarks in Mathematics, 1996). Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ Actually on second thoughts I began to suspect that this question is > related to another one posted by Heather, concerning simplifying > expressions in which x is much larger than y. I am not at all sure if > a sensible calculus of this kind can be developed but obviously > Simplify > will not do this. It seems to me that this is essentially a (capital-C) Calculus > problem, > and unless a simple /.y->0 is what's wanted, the correct tool is > Limit[]. > Berkeley's critique of 18th century Calculus applies here: while it was > essentially antiscientific, his reasoning was flawless and should warn > us > against trying to solve this sort of problem by mindless algebra. Of course, Limit[] is a tricky and somewhat unreliable power tool, > requiring caution. This reflects the mathematical subtlety of this kind > of problem. It is generally essential to formulate the problem in such a > way that the direction of the approach to the limit is unambiguous. -- > | John Doty You can't confuse me, that's my job. > | Home: jpd@w-d.org > | Work: jpd@space.mit.edu > ==== Since switching to Mac OSX almost a year ago, I have suffered with ugly on-screen FrameLabels on 2D graphs. The ordinates' labels are supposed to rotate, but on screen they don't. Wolfram places the blame on your system's default font manager and singled out Macintosh systems, http://support.wolfram.com/mathematica/graphics/textfonts/rotatedtext.html in a FAQ response last updated January 2000. So this is a long-standing issue. The most recent helpful discussion I found in the mathgroup archives is far older, http://library.wolfram.com/mathgroup/archive/1997/Mar/msg00257.html and the status of the issue apparently remains unchanged since then. But as on-screen documents become more important and post-script documents (which do rotate text) less important, this issue is getting increasingly serious. The failing contaminates exported PDF files (on screen), too. So I am (without much hope) raising this issue once again: Wolfram's FAQ response cited above refers the failing of the DEFAULT font manager. Can I perhaps install another font manager that would correct the problem? Or shall I suffer the fate of poor Mr. Zacher in 1997, who on a wild goose chase installed various font managers on Mac without success? Tom Burton ==== I tried to evaluate the expression with j ranging from 0 to 20000 step of 1. Something obviously periodic seems to be going on (just plot the sim data). anyone interested) a flat text file with the output of Mark's program (the sim data for j ranging from 0 to 20000 in steps of 1). It is my understanding that the period of the rule 30-cellular automata RNG (if any) used by MATHEMATICA has not been extensively studied. Could we use the data geenrated to do so ? Christos Argyropoulos > There is some real weirdness with Random[Integer, j] for some large > values of j but not others (for both 4.1 and 4.2 versions). < n = 1000; > sim = Table[{j, (2/2^j) * Mean[Table[Random[Integer, 2^j], {n}]]}, > {j, 45, 65, 1/8}]; > ListPlot[sim]; All the points should be near one if the random number generator were > working properly. What gives? Is this just a (very stark) symptom of > what Daniel Lichtblau mentioned in his May 2000 post? > The other failure only is apparent in very large big > integers, and I do not know exactly how to categorize it. I just find this very troubling. --Mark. > Reply-To: ==== That IS bizarre. The following works much better, though it may have other statistical problems: sim = Table[{j, Mean[Table[Ceiling[Random[]2^j], {n}]] 2^(1 - j)}, {j, 45, 65, 1/8}]; ListPlot[sim]; Bobby Treat -----Original Message----- working properly. What gives? Is this just a (very stark) symptom of what Daniel Lichtblau mentioned in his May 2000 post? > The other failure only is apparent in very large big > integers, and I do not know exactly how to categorize it. I just find this very troubling. --Mark. ==== I understand you, the line Print[Context von klasse: , Context[klasse]]; causes the definition of klasse to be created in the Context Global` I thank you for your help! I exerted much effort without finding the cause! I do dislike local variables because they mean more writing effort, I think they are often not necessary for tests. This test had the aim to define klasse in the context Rechteck`, where the context will be a variable in the final program.. ----- Original Message ----- > oo`new12[] := ( > Print[Name klasse - Anfang]; > Print[$Context: , $Context]; > ToExpression[oo`hfield]; > Print[Context von klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - Ende]; > ); and parsing this create a global symbol klasse because > the parser see the line Print[Context von klasse: , Context[klasse]]; If you wish to avoid this you can use oo`new12[] := Module[{UsingObjectsIsDaft`class}, > Print[Name klasse - Anfang]; > Print[$Context: , $Context]; > UsingObjectsIsDaft`class = ToExpression[oo`hfield]; > Print[Context von klasse: , > Context[Evaluate[UsingObjectsIsDaft`class]]]; > oo`resumeContext[]; > Print[Name klasse - Ende]; > ]; > > > I have a new program: > > oo`hfield = klasse1; > oo`newContext[ctxp_] := ( > > $ContextPath = Join[ctxp, $ContextPath]; > BeginPackage[ctxp[[1]]]; > If[Length[ctxp]>1, > $ContextPath = Join[ctxp, Rest[$ContextPath]]; > ] > ) > oo`resumeContext[] := ( > EndPackage[]; > $ContextPath = Drop[$ContextPath, 1]; > ) > oo`new11[x_] := ( > Print[Anfang new11]; > klassnam = x; > tsx = ToString[klassnam]; > oo`dat = D:Math_OOclasses <> tsx <> .cl; > ctx = klassnam <> `; > oo`newContext[{ctx}]; > ) > oo`new12[] := ( > Print[Name klasse - Anfang]; > Print[$Context: , $Context]; > ToExpression[oo`hfield]; > Print[Context von klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - Ende]; > ); > Print[Anfang Programm:]; > Print[$Context: , $Context]; > oo`new11[Rechteck]; > Print[nach new11:]; > Print[$Context: , $Context]; > oo`hfield = klasse; > oo`new12[]; > Print[nach new12:]; > Print[$Context: , $Context]; > > and the results: > > Anfang Programm: > $Context: Global` > Anfang new11 > nach new11: > $Context: Rechteck` > Name klasse - Anfang > $Context: Rechteck` > klasse > klasse::shdw: Symbol klasse appears in multiple contexts {Rechteck`, > Global`} > ; definitions in context Rechteck` > may shadow or be shadowed by other definitions.Context von klasse: > Global` > Name klasse - Ende > nach new12: > $Context: Global` > In[19]:= > > According your theory, I think, klasse1 should be defined in Global` and > klasse only in Rechteck But this is not the case. Therefore - excuse me - > I doubt, that your theory is correct. > > > > ----- Original Message ----- > > Hermann, > > My question is: > Why is the variable klasse also defined in the context Global? > > klasse is created in the context Global` when the assignment > > oo`new12[] := (Print[Name klasse - Begin]; > Print[$Context: , $Context]; > ToExpression[klasse]; > Print[Context of klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - End];) > > is converted into internal form (with contexted symbols) prior to > evaluation. > > This is before > oo`new11[Rechteck]; > is evaluated > > -- > Allan > > --------------------- > Allan Hayes > Mathematica Training and Consulting > Leicester UK > www.haystack.demon.co.uk > hay@haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > > > I have the following program: > > oo`newContext[ctxp_] := ( > BeginPackage[ctxp[[1]]]; > ) > oo`resumeContext[] := ( > EndPackage[]; > $ContextPath = Drop[$ContextPath, 1]; > ) > oo`new11[x_] := ( > Print[Begin new11]; > klassnam = x; > ctx = klassnam <> `; > oo`newContext[{ctx}]; > ); > oo`new12[] := ( > Print[Name klasse - Begin]; > Print[$Context: , $Context]; > ToExpression[klasse]; > Print[Context of klasse: , Context[klasse]]; > oo`resumeContext[]; > Print[Name klasse - End]; > ); > Print[Begin Programm:]; > Print[$Context: , $Context]; > oo`new11[Rechteck]; > oo`new12[]; > Print[after new12:]; > Print[$Context: , $Context]; > > I get the following results: > > Begin Programm: > $Context: Global` > Begin new11 > Name klasse - Begin > $Context: Rechteck` > klasse > klasse::shdw: Symbol klasse appears in multiple contexts {Rechteck`, > Global`} > ; definitions in context Rechteck` > may shadow or be shadowed by other definitions.Context of klasse: > Global` > Name klasse - End > after new12: > $Context: Global` > In[14]:= > > My question is: > Why is the variable klasse also defined in the context Global? > > > > > > > > ==== Sorry for 'refreshing' this message but does anyone know if I can define the assumption below. I don't want to write specific assumptions for each term in Limit since I have many different variables and forms of a. Is it possible to generalise the assumption? it would really help me (and I really don't want to have to buy any additional maths software). > I am also interesting in the solution of how to make an asumption > in Mathematica. I can't find any method in Mathematica. If anybody has > > I know that this should be 0 but why can't I get mathematica to think > likewise. > In[4]:= Limit[Sin[a*x]/(a*x),x->Infinity] Sin[a x] > Out[4]= Limit[--------, x -> Infinity] > a x > > Is the problem a? How can I specify the properties of or assumptions > that may be made about a? ==== I used to use the add-on package Utilities`CleanSlate` all the time, but it seems to be missing from version 4.2 of Mathematica (at least, I can't find it anywhere). Has it been replaced by something else with the same functionality? -Tom ==== Is there a Mathematica function or package that generates random vectors according to a n-dimensional normal distribution ? Etienne ==== In[1]:= x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) In[2]:= Plot[x, {t, 0, 8000*Pi}] Plot::plnr: x is not a machine-size real number at t = 0.0010471975511965976 Plot::plnr: x is not a machine-size real number at t = 1019.5597016296903 Plot::plnr: x is not a machine-size real number at t = 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed during this calculation I am trying to plot the function x(t) defined above, same thing happens when i try to plot other similar functions always get an error saying that the machine size number is nor real, I have tried to find an answer in this message group, as well as the mathematica help online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of consequence. Windows XP pro Any help would be appreciated ==== Rick, You need square brackets not round ones - standard Mathematica syntax with functions: x[t_] := 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t] This can be tracked down by evaluating x[0.0010471975511965976] -- > In[1]:= > x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) In[2]:= > Plot[x, {t, 0, 8000*Pi}] Plot::plnr: x is not a machine-size real number at t = > 0.0010471975511965976 Plot::plnr: x is not a machine-size real number at t = > 1019.5597016296903 Plot::plnr: x is not a machine-size real number at t = > 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed > during this calculation I am trying to plot the function x(t) defined above, same thing > happens when i try to plot other similar functions always get an error > saying that the machine size number is nor real, I have tried to find > an answer in this message group, as well as the mathematica help > online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of > consequence. Windows XP pro Any help would be appreciated ==== > > In[1]:= > x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) x[t_] := 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t] marek ==== > MultCol[f_,x_,y_]:= > Select[ Import[f, Table][[All, {x, y}]], NumberQ[First[#]]& ] > should work. (when being online again) I didn't recocnize Allan's previous post with the really good idea to use n__ instead of x_, y_. So sorry for repeating solutions. -- ==== Mechnical Engineering fans will be able to tell me where to find a ready-made for a vibrating circular membrane. I need to be able to change locally (as a function of radius) the stiffness and mass of the membrane and visualise the vibrational modes. dr.Lass ==== Here's is a simple example where the wave speed is 1 and the radius is 2: << NumericalMath`BesselZeros`; r12= .5 BesselJZeros[1,2][[2]]; r31= .5 BesselJZeros[3,1][[1]]; u[t_,r_,theta_]:= Cos[r12*t] BesselJ[1,r12*r] Cos[theta] + Sin[r31*t] BesselJ[3,r31*r] Cos[3theta]; Do[ ParametricPlot3D[Evaluate[{r*Cos[theta], r*Sin[theta], u[t,r,theta]}], {r, 0, 2}, {theta, 0, 2*Pi}, PlotPoints->{10, 45}, PlotRange->{-1,1}, Ticks->None], {t, 0, 4, 0.1}]; ---- slhollis@mac.com http://www.math.armstrong.edu/faculty/hollis > Mechnical Engineering fans > will be able to tell me where to find a ready-made for a vibrating circular > membrane. I need to be able to change locally (as a function of radius) the > stiffness and mass of the membrane and visualise the vibrational modes. ==== Is there a way to produce text that rotates with a graphic in Mathematica? I can only imagine of producing a 2-D text graphic, then displaying it in a rectangle in 3D, and rotating the result. This works only as long as you stay in front of (on the picture side) of the rectangle. Any ideas? Nicholas ==== When writing a series of equations in mathematica (in a text cell) is there any way to align the equations at the = similar to what can be done in the equation editor made by math type (used in word etc.)? thanks Mike ==== > When writing a series of equations in mathematica (in a text cell) is there > any way to align the equations at the = similar to what can be done in the > equation editor made by math type (used in word etc.)? Two ways 1) Start an inline cell in your text cell (menu>Edit>Expression Input>Start Inline Cell) Type in your equations with the alignment marker (Esc am Esc) in after each equal sign. Close the inline cell (menu>Edit>Expression Input>End Inline Cell). Select the text cell (or the inline cell, though this is a delicate operation, do it by repeatedly double clicking in it}. Use menu> Format>Text Alignment>On Alignment Marker. -- you will find that all single letters are now italic - you can select individual letters and change this - alternatively you can select the inline cell and use the option inspector (menu>Format>Option Inspector) to set SingleLetterItalics->False) -- you can put existing text in an inline cell by selcting it and using menu>Edit>Expression Input>Start Inline Cell, but you may have to adjust the line breaks after this. 2) use a grid box with a column for the equal sign and set the column alignments appropriately - but this maay give problems if you want text to run over columns. -- ==== Umm... Use tab or count the number of characters to each = sign. Yas > When writing a series of equations in mathematica (in a text cell) is there > any way to align the equations at the = similar to what can be done in the > equation editor made by math type (used in word etc.)? thanks ==== x := 1 + Cos[2000 Pi t] + Sin[2000 Pi t] Plot[x, {t, 0, 8000 Pi}] works fine for me. Notes : - use [ and ] for functions ; - x and x[t] are different ! > x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) > > In[2]:= > Plot[x, {t, 0, 8000*Pi}] ==== You have to use [ ] , not ( ) , for the argument of the function. And you have to tell him to draw x[t], not just x... In[1]:= x[t_] := 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t] In[2]:= Plot[x[t], {t, 0, 8000*Pi}] works... But 8000*Pi is a bit to much... You should draw until Pi/2000. Much more interesting ! -----Message d'origine----- Objet : machine size real numbers? In[1]:= x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) In[2]:= Plot[x, {t, 0, 8000*Pi}] Plot::plnr: x is not a machine-size real number at t = 0.0010471975511965976 Plot::plnr: x is not a machine-size real number at t = 1019.5597016296903 Plot::plnr: x is not a machine-size real number at t = 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed during this calculation I am trying to plot the function x(t) defined above, same thing happens when i try to plot other similar functions always get an error saying that the machine size number is nor real, I have tried to find an answer in this message group, as well as the mathematica help online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of consequence. Windows XP pro Any help would be appreciated ==== I am looking for a feature in the mathematica front end editor that behaves like e.g vi in case of an OS crash: vi offers the option to recover the currently edited file at the time of the crash. So additionaly to your last saved version you can recover the latest changes that you incoperated and have not saved so far. Is there a similar feature in the mathematica front end, and how would I activate this? Simply using save is irritating since at times I wish to rearrange greater pieces of code without saving the change until the code does what it is supposed to. thanks for any help and hints, ==== This works: x[t_] := 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t] (with square brackets for function arguments) followed by Plot[x[t], {t, 0, 8000*Pi}] (with the function argument specified). The plot looks like white noise, but do not blame Mathematica for that! If you change the options for Plot, you surely could produce a printout that tests the blackness of your printer toner :) Use Plot[x[t], {t, 0, 0.002}] instead. Then you will see 2 periods of your function. -----Original Message----- Plot::plnr: x is not a machine-size real number at t = 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed during this calculation I am trying to plot the function x(t) defined above, same thing happens when i try to plot other similar functions always get an error saying that the machine size number is nor real, I have tried to find an answer in this message group, as well as the mathematica help online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of consequence. Windows XP pro Any help would be appreciated ==== >In[1]:= >x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) > >In[2]:= >Plot[x, {t, 0, 8000*Pi}] > >Plot::plnr: x is not a machine-size real number at t = >0.0010471975511965976 > >Plot::plnr: x is not a machine-size real number at t = >1019.5597016296903 > >Plot::plnr: x is not a machine-size real number at t = >2131.4776207838036 > >General::stop: Further output of Plot :: plnr will be suppressed >during this calculation > >I am trying to plot the function x(t) defined above, same thing >happens when i try to plot other similar functions always get an error >saying that the machine size number is nor real, I have tried to find >an answer in this message group, as well as the mathematica help >online and built in, if someone knows what is going on please help me. > >My computer is an AMD 1Gig with 256MG of ram, if that is of >consequence. Windows XP pro x[t_] := 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t]; Plot[x[t], {t, 0, 8000*Pi}]; Although for this many cycles you need to increase the PlotPoints to get an accurate Plot at which point it would be quicker to draw a filled rectangle. Bob Hanlon Chantilly, VA USA ==== Square brackets around the Sin and Cos or indeed around any other function (e.g. Tan[x], ArcSin[2.0*t], f[x]) e.g. x[t_]:= 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t] and vvv Plot[x[t], {t, 0, 8000*Pi}] ^^^ Yas > In[1]:= > x[t_] := 1 + Cos(2000*Pi*t) + Sin(4000*Pi*t) In[2]:= > Plot[x, {t, 0, 8000*Pi}] Plot::plnr: x is not a machine-size real number at t = > 0.0010471975511965976 Plot::plnr: x is not a machine-size real number at t = > 1019.5597016296903 Plot::plnr: x is not a machine-size real number at t = > 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed > during this calculation I am trying to plot the function x(t) defined above, same thing > happens when i try to plot other similar functions always get an error > saying that the machine size number is nor real, I have tried to find > an answer in this message group, as well as the mathematica help > online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of > consequence. Windows XP pro Any help would be appreciated > ==== How do I set up a function that behaves like the Mathematica function Sum vis-a-vis its treatment of dummy variables? For example I can define i=6 and then enter Sum[f[i],{i,1,n}] and mathematica will not make the substitution i->6 even though the output generally still involves the dummy variable i. I figure this has something to do with Modules, Blocks, and Holds but I'm not sure how to put it all together. Any help would be greatly appreciated. -chris ==== I have a question about the structure of the binary files generated by the DumpSave command. Because the speed with which binary files generated with the DumpSave command can be read into Mathematica in comparison with the text files generated by the Save command, I would like to be able to let my own C program generate binary files with the same structure as the DumpSave generated binary files. For that, I have been looking for a description of the binary file structure. Unfortunately, I could not find such a description in the Mathematica book or the Wolfram website. Therefore, I would like to know if there exists a document outlining the structure of the binary file as generated by DumpSave (assuming that this is an 'open' file format). The version of Mathematica that I am using is 4.1 Windows, on a Windows NT system. -- ==== You should consider working through as much of Part I of The Mathematica Book as you can to become familiar with Mathematica syntax. In Mathematica the function arguments are always enclosed in square brackets, not parentheses. x[t_] := 1 + Cos[2000*Pi*t] + Sin[4000*Pi*t] In your plot statement you must plot x[t] and not just x. The following will plot, but I don't think it is what you intended. Plot[x[t], {t, 0, 8000*Pi}]; You probably want something more like... Plot[x[t], {t, 0, Pi/1000}]; David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed during this calculation I am trying to plot the function x(t) defined above, same thing happens when i try to plot other similar functions always get an error saying that the machine size number is nor real, I have tried to find an answer in this message group, as well as the mathematica help online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of consequence. Windows XP pro Any help would be appreciated ==== At present this is a deficiency in Mathematica 3D graphics. You can write a Text statement and attach it to a 3D point. If you rotate the graphics, say with SpinShow, the text does rotate with the object. But Mathematica always renders it, so the text still shows even when the point it is attached to is hidden behind a surface. It would be nice if Mathematica turned the text rendering on and off according as to whether the point it was attached to was hidden or not. One solution might be to use colored points to mark features and then identify them by text outside the rotating plot. ==== In Mathematica 4.2, Help says in part ...Limit therefore makes no explicit assumptions about symbolic functions. Same for the Package NLimit. Therefore, I think we're out of luck here. As an newbe observation, the only option for Limit (For Mathematica 4.2) is Direction. However, if you type ??Limit, there is another Option listed that appears not to be documented. That option is Analytic. I thought maybe this would solve this type of problem, but it does not. I do not know for sure what this option does. Anyone else?? Information[Limit, LongForm -> True] Limit[expr, x->x0] finds the limiting value of expr when x approaches x0... Attributes[Limit] = {Listable, Protected} Options[Limit] = {Analytic -> False, Direction -> Automatic} As a possible workaround, would substituting many values for a work? Here is what I am thinking... v = Table[Random[Real, {0, 2*Pi}], {100}]; Union[(Limit[Sin[#1*x]/(#1*x), x -> Infinity] & ) /@ v] I get all zero's like you predicted for many values of a. {0} If you try Integers, then I get an Indeterminate because the limit does not like a being 0. v = Table[Random[Integer, {-4, 4}], {10}]; Union[(Limit[Sin[#1*x]/(#1*x), x -> Infinity] & ) /@ v] {0, Indeterminate} -- Windows XP & Mathematica 4.1 = = = = = = = = = = = = = = = = = > Sorry for 'refreshing' this message but does anyone know if I can > define the assumption below. > > I don't want to write specific assumptions for each term in Limit > since I have many different variables and forms of a. Is it possible > to generalise the assumption? > > it would really help me (and I really don't want to have to buy any > additional maths software). > I am also interesting in the solution of how to make an asumption > in Mathematica. I can't find any method in Mathematica. If anybody > you all .. > > I know that this should be 0 but why can't I get mathematica to > think likewise. > In[4]:= Limit[Sin[a*x]/(a*x),x->Infinity] Sin[a x] > Out[4]= Limit[--------, x -> Infinity] > a x > > Is the problem a? How can I specify the properties of or > assumptions that may be made about a? > Reply-To: ==== There are many values of a for which the limit doesn't exist... a==I and a==0, for instance. You can eliminate the first possibility by setting a=Re[b] where b is unknown, but that still leaves the second possibility, so Mathematica still doesn't find the limit you want. Here's an answer, in which we assume a is greater than or equal to some small delta (surrogate for greater than zero). delta = 10^(-25); a = Abs[b] + delta; Limit[Sin[a*x]/(a*x), x -> Infinity] 0 This also works, though it shouldn't: delta = 10^-25; a = Re[b] + delta; Limit[Sin[a*x]/(a*x), x -> Infinity] 0 Perhaps THIS is the best way to assume a>0: a = Exp[Re[b]]; Limit[Sin[a*x]/(a*x), x -> Infinity] 0 -----Original Message----- > I am also interesting in the solution of how to make an asumption > in Mathematica. I can't find any method in Mathematica. If anybody has all .. > > I know that this should be 0 but why can't I get mathematica to think > likewise. > In[4]:= Limit[Sin[a*x]/(a*x),x->Infinity] Sin[a x] > Out[4]= Limit[--------, x -> Infinity] > a x > > Is the problem a? How can I specify the properties of or assumptions > that may be made about a? Reply-To: ==== x isn't a number; it's a function. x[t] is a number. Bobby -----Original Message----- Plot::plnr: x is not a machine-size real number at t = 2131.4776207838036 General::stop: Further output of Plot :: plnr will be suppressed during this calculation I am trying to plot the function x(t) defined above, same thing happens when i try to plot other similar functions always get an error saying that the machine size number is nor real, I have tried to find an answer in this message group, as well as the mathematica help online and built in, if someone knows what is going on please help me. My computer is an AMD 1Gig with 256MG of ram, if that is of consequence. Windows XP pro Any help would be appreciated ==== Header says it all. ==== The line below is from the 'Extra Examples' in the help browser for the BitAnd function. On my computer the resulting graphic flickers rapidly. Do others have the same results, and does anyone have an explanation for the flickering? I suspect this is demonstrating a limitation of my monitor/graphics card. In[1] := ListDensityPlot[Table[Sign[BitAnd[x,y]],{x,127},{y,127}]]; ==== > >I downloaded the SpreadOptions package and modified it so that it will work >like a standard package. The package file is attached. (Other readers can >modify the package as I describe below.) > >To use it, create a new Finance folder in ExtraPackages. Put the >SpreadOption.m file there. Then you can simply load the package with: > >Needs[Finance`SpreadOption`] > >All I did was change the name of the package in the BeginPackage statement >to Finance`SpreadOption. Anyone can do this by editing the package file. > >This, it seems to me, is the method that should be used for third party >packages. If this method is used, the packages behave just like standard >packages. However, probably because it is not clearly presented in the WRI >documentation, very few people use the method. The result is a lot of >confusion in connecting to packages. Also, it seems to me that packages >should be in a standard place and the StandardPackages and ExtraPackges >folders that WRI provides are those places. > >David Park >djmp@earthlink.net >http://home.earthlink.net/~djmp/ ExtraPackages is a fine place to put packages if your package consists solely of *.m files. However, in general I would recommend the Applications directory. The front end has its own sets of paths (for finding palettes, stylesheets, and documentation). With the default settings, the front end looks in the Applications and Autoload directories, not the ExtraPackages directory. -------------------------------------------------------------- Omega Consulting The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== > >I have a problem with using the function ToExpression to make a string >into an expression that can then be evaluated. Something goes wrong with >the evaluation - when I type the same expression in by hand, then it >evaluates properly. Either I am totally off in my understanding of how >ToExpression works, or there is a potential bug (I am using version >(sheubac@calstatela.edu) rather than to the mathgroup, as I am >travelling and cannot subscribe to the mathgroup right now - it would > >Silvia ******************************** > >i = {1, 0, 0}; j = {0, 1, 0}; k = {0, 0, 1}; zero = {0, 0, 0}; >a = {i, j, k} > >str1 = (((..)(..))(..)) > >The function insertx is to convert this string of parentheses and dots >into a cross product, where each dot represents a different variable, >and the parentheses indicate the groupings of the cross product. > >insertx[str_] := Module[{foo = str, vars, n, pos}, > foo = > StringReplace[ > foo, {)( -> ),(, .( -> .,(, ). -> ),., .. -.,.}]; > foo = StringReplace[foo, {) -> ], ( -> Cross[}]; > n = Length[StringPosition[foo, .]]; > Do[pos = StringPosition[foo, .][[1]]; > foo = StringReplacePart[foo, ToString[Slot[i]], pos] > (*Print[foo]*) , {i, n}]; > ToExpression[foo]] > >The function properly converts the string into the associated cross >product, but does not evaluate correctly. Checking whether what is >returned by the function is still a string gives a false, and it should, >as the function should return an expression. (the output is indented) > >insertx[str1] ((#1[Cross]#2)[Cross](#3[Cross]#4))[Cross](#5[Cross]#6) > >insertx[str1] &[j, k, i, k, k, i] ((#1[Cross]#2)[Cross](#3[Cross]#4))[Cross](#5[Cross]#6) > >StringQ[insertx[str1]] False > >Typing in the corresponding cross product by hand and evaluating it >returns the correct result. > >Cross[Cross[Cross[#1, #2], Cross[#3, #4]], Cross[#5, #6]] &[j, k, i, k, >k, i] {1, 0, 0} > >What is wrong??? I have spent many hours on trying to understand this, >so either I am completely off or there is a bug. This is an improper use of Slot. Instead, I would specify the vectors in the definition. Then you can use the vectors with Part: In[1]:= insertx[str_][lst_] := Module[{foo = str, n, pos}, foo = StringReplace[ foo, {)( -> ),(, .( -> .,(, ). -> ),., .. -> .,.}]; foo = StringReplace[foo, {) -> ], ( -> Cross[}]; n = Length[StringPosition[foo, .]]; Do[pos = StringPosition[foo, .][[1]]; foo = StringReplacePart[foo, ToString[lst[[i]]], pos] (*Print[foo]*) , {i, n}]; ToExpression[foo]] In[2]:= insertx[str1][{j, k, i, k, k, i}] Out[2]= {1,0,0} Or with a list operation like Fold: In[3]:= myinsertx[str_][ lst_] := Module[{foo = str}, foo = StringReplace[ foo, {)( -> ),(, .( -> .,(, ). -> ),., .. -> .,.}]; foo = StringReplace[foo, {) -> ], ( -> Cross[}]; foo = Fold[replace,foo,lst]; ToExpression[foo]] In[4]:= replace[str_, item_]:= Module[{pos}, pos=First[StringPosition[str,.]]; StringReplacePart[str, ToString[item], pos] ] In[5]:= insertx[str1][ {j, k, i, k, k, i}] Out[5]= {1,0,0} -------------------------------------------------------------- The final answer to your Mathematica needs Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html ==== I am glad that some discussion of this is being generated. In general I disagree with your recommendation. If palettes and StyleSheets go along with a package, why not put them in ConfigurationFrontEndPalettes and ConfigurationFrontEndStyleSheets, which seem to be the places made for them? Then they automatically appear in the menu listings. (And you as a package writer would also know where to expect to find them.) I am not certain if I completely understand your approach and would appreciate further explanation. If you have a set of packages, stylesheets, palettes and documentation, where precisely would you put them? At the top level of the Applications directory? Or would you put them in a subdirectory within the Applications folder? If they are in a subdirectory, will Mathematica automatically find them? What if you want to call them from another subdirectory in the Applications folder? What about having several documentation folders for different packages? Can you have two DocumentationEnglish folders in one directory? I don't think so. Suppose you provide a package with documentation and I supply a package with documentation. Is the user supposed to merge the BrowserCatergories files together? Would he know how to do it? In providing software to a user, I think it is a great advantage if the user does not have to specify or alter any paths. That may be simple for you, but it is a major hurdle to many users. If one puts the various objects in the places that WRI provided for them, it is never neccessary to specify paths. (Perhaps you want some commands in your package to automatically open a palette. If the palette has been placed in ConfigurationFrontEndPalettes, you as the programmer can automatically write the path to open it. The user shouldn't have to worry about it. And he could also open the palette from the menu.) I don't claim to be the greatest expert on this subject. I would be glad to learn more. But, so far, all the arguments I have heard for putting packages somewhere other than an ExtraPackages subfolder have been unconvincing to me. http://www.wz.com/internet/Mathematica.html ==== 1. There is no way to make assumptions inside Limit. I very much doubt that buying any other software will help. 2. There is no need to use Mathematica or any other computer program to do solve this problem. It is exactly the kind of thing that is trivial to do with a little knowledge of mathematics and a bit of intelligence but is not suitable for a computer. Computer software should be used to deal with problems that are *computationally* difficult but do not require any intelligence. There is no computer software today (and there won't be for quite a long time) that can replace the latter . http://platon.c.u-tokyo.ac.jp/andrzej/ > Sorry for 'refreshing' this message but does anyone know if I can > define the assumption below. I don't want to write specific assumptions for each term in Limit > since I have many different variables and forms of a. Is it possible > to generalise the assumption? it would really help me (and I really don't want to have to buy any > additional maths software). > I am also interesting in the solution of how to make an asumption > in Mathematica. I can't find any method in Mathematica. If anybody has > all .. I know that this should be 0 but why can't I get mathematica to think > likewise. > In[4]:= Limit[Sin[a*x]/(a*x),x->Infinity] Sin[a x] > Out[4]= Limit[--------, x -> Infinity] > a x Is the problem a? How can I specify the properties of or assumptions > that may be made about a? > ==== If we want to contract two tensor arrays S and T in Mathematica we can write S.T. We could also use the Inner product. This will contract the last level of S with the first level of T. I would like to know how to contract more than one pair of levels. Suppose S and T are 3rd order tensors and I want to contract the last two levels of S with the first two levels of T. How can I do that? Or suppose I wanted to contract all three levels. For example with... Smat = Array[S, {3, 3, 3}] Tmat = Array[T, {3, 3, 3}] I would like to obtain the answer... Smat Transpose[Tmat, {3, 2, 1}] Plus @@ Flatten[%] but by a more general method. That is, I would like to contract any number of adjacent levels in two tensors. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ ==== You need to copy: :Wolfram ResearchMathematica4.1SystemFilesFontsType1Math1Mono.pfb to :fontstype1adobeMath1Mono.pfb You then need to click on: Start Menu -> All Programs -> MikTeX 2 -> MikTeX Options and then click Refresh Now under the General tab to refresh the file name database. Vince > I am a new user of Mathematica and I have currently encountered a > problem. In fact, I plotted a graph which contains arrows ( for this I > called up on the to Tex as an EPS file but when compiling in Miktex, I am getting the > following error message: Header file Math1Mono.pfb couldn't be found. > Is there a way to solve the problem? ==== I am new myself, and trying to learn. I went to http://search.wolfram.com and searched Trig->True under The Document Center. There was only 1 result. It pointed to a Mathematica 3 example. Denominator[Cos[3*x]/Sin[2*x]] 1 Denominator[Cos[3*x]/Sin[2*x], Trig -> True] Sin[2*x] Apparently, this can make a big difference on what one is expecting for an answer. I think it is because Mathematica is not using Denominator directly, but Times & Power instead. -- Dana Windows XP & Mathematica 4.1 = = = = = = = = = = = = = = = = = The usage message for Trig says: Trig is an option for algebraic manipulation functions which specifies > whether trigonometric functions should be treated as rational functions of > exponentials. > --------- The built-in functions that have the Trig option are: > Apart, ApartSquareFree, Cancel, Coefficient, CoefficientList, Collect, > Denominator, Expand, ExpandAll, ExpandDenominator, ExpandNumerator, > Exponent, Factor, FactorList, FactorSquareFree, FactorSquareFreeList, > FactorTerms, FactorTermsList, FullSimplify, Numerator, PolynomialGCD, > PolynomialLCM, PolynomialMod, Resultant, Simplify, Together. > After searching all available documentation I can't find a single example of > where > f[expr, Trig->True] would give a different result than > f[expr, Trig->False], and I can't come up with one on my own. Can you give > some examples. An example for each function above is not necessary. --------- > Ted Ersek > Get Mathematica tips, tricks from > http://www.verbeia.com/mathematica/tips/Tricks.html ==== When exporting graphs to EPS, I find that the Micro character (upright Mu, used as an abbreviation for the micro in micrometre) isn't displayed. I'm loathe to replace [Micro] in my graph labels with [Mu], because I want to be consistent and reserve italicized symbols for math variables. Does anyone know which Mathematica font package contains the Micro character, or some other way I can export [Micro] to EPS? ==== the [Micro] in Math3 at 0xD0 but it's optical difference to [Mu] is only visible for a trainied eye :-) When exporting graphs to EPS, I find that the Micro character (upright > Mu, used as an abbreviation for the micro in micrometre) isn't > displayed. I'm loathe to replace [Micro] in my graph labels with > [Mu], because I want to be consistent and reserve italicized symbols > for math variables. Does anyone know which Mathematica font package contains the Micro > character, or some other way I can export [Micro] to EPS? > Vince Reply-To: ==== One could use the Rectangle function. An example of this is given in Section 5.2 (pages 114-116) of the book Applied Mathematica, Getting It Started Getting It Done, by Shaw and Tigg. An example: Plot1=Plot[Sin[x],{x,0,2Pi}]; Plot2=Plot[2x^2+5x, {x,0,2Pi}]; Show[Graphics[{Rectangle[{0,0},{1,1},Plot1], Rectangle[{0.55,0.45},{0.95,0.9},Plot2]}]]; -----Original Message----- ==== I have the following function and it is called many many times in a program I have written. This is a bracket operator for a certain type of Lie Algebra I am looking at and it must be called over and over to test whether or not the Jacobi is actually 0 as it should be. With very low numbers for n, my program runs in a second or less. If n is around 20+ or if the coefficients are large, the program takes nearer a minute or two. That's not a long time, but I have a feeling that it's having to calculate the same Bracket many times in the program and I'm hoping to get rid of that somehow. However, I don't understand the differences between := and = enough. I've read the help files, but I don't understand the subtle differences such as I can call Bracket[stuff, something]:= somethingelse more than once, but it doesn't seem as if I can use = more than once. Bracket[a_.*e[i_], b_.*e[j_]] := Which[ i + j > n, 0, i == j, 0, i == 1, a*b*e[j + 1], i == 2 && j == 3, 14a*b*e[7], i == 3 && j == 4, 0, i < j, -a*b*Bracket[e[i + 1], e[j - 1]] + Bracket[e[1], Bracket[e[i], e[j - 1]]], i > j, -a*b*Bracket[e[j], e[i]] ]; (* bilinear function *) Bracket[mul_, expr_Plus] := Map[Bracket[mul, #] &, expr]; Bracket[expr_Plus, mul_] := Map[Bracket[#, mul] &, expr]; Bracket[0, x_] := 0 Bracket[x_, 0] := 0 Any help would be much appreciated. Geoff Tims ==== How about this? t = Table[Sin[(x + y)], {x, 0, 100}, {y, 0, 100}]; plot1 = First[ Graphics[ListDensityPlot[t, Mesh -> False, DisplayFunction -> Identity]]]; plot2 = Show[Graphics[plot1], AspectRatio -> Automatic, PlotRange -> {{-0.25, 101}, {0.25, 101}}, ImageSize -> 500]; Try exporting plot2. ListDensityPlot doesn't allow you to adjust the PlotRange directly. At least, it didn't work for me. By converting from DensityGraphics to Graphics we can adjust the PlotRange to just meet the edges of the grid. (The values I used seem a little strange, but that is what seemed to work best. I made the image size larger to more easily see what is happening.) This can be done more directly with the DrawGraphics package. Needs[DrawGraphics`DrawingMaster`] Draw2D[ {ListDensityDraw[t, Mesh -> False]}, AspectRatio -> Automatic, PlotRange -> {{-0.25, 101}, {0.25, 101}}, ImageSize -> 500]; David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ > I want to calculate some patterns but I always get artifacts. The reason > seems to be the white border around the plots. If I calculate 100 > x 100 points > and plot or export them (see example below), the picture is > really 100 x 100 > pixels but with a white border. So my calculations are 'squeezed' > (some lines > and rows are missing!). > Does anyone have an idea how to get rid of this white border or will I > really have to export my tables to a textfile and use another > software zu produce > a bitmap-file?? > Example: > t = Table[Sin[(x + y)], {x, 0, 100}, {y, 0, 100}]; > Export[test.tif, > ListDensityPlot[t, Frame -> False, Mesh -> False, ImageSize -> {100, > 100}]] ==== I hava some trouble with Mathematica 4 image import. Usually one should import an image with: myImage = Import[image.jpg] The image is a valid jpg and can be found via $Path. But Mathematica can't load it. Wenn I type $InputFormats I get $InputFormats as the answer. This should be something like {AIFF, AU, BMP, Dump, EPS, EPSI, EPSTIFF, Expression, PNM, PPM, PSImage, RawBitmap, SND, Table, Text, TIFF, UnicodeText, WAV, Words, XBitmap} I guess. The help says these formats should be build in. So why they aren't visible? -- ==== Mathematica search packages in the $Path and *not* an arbitary file. Give the full path an all will work fine. > I hava some trouble with Mathematica 4 image import. Usually one should > import an image with: myImage = Import[image.jpg] The image is a valid jpg and can be found via $Path. But Mathematica can't load it. Wenn I type $InputFormats I get $InputFormats as the answer. This should be something like {AIFF, AU, BMP, Dump, EPS, EPSI, EPSTIFF, Expression, > PNM, PPM, PSImage, RawBitmap, SND, Table, Text, TIFF, > UnicodeText, WAV, Words, XBitmap} I guess. The help says these formats should be build in. So why they aren't visible? ==== I want to calculate some patterns but I always get artifacts. > The reason > seems to be the white border around the plots. If I calculate > 100 x 100 points > and plot or export them (see example below), the picture is > really 100 x 100 > pixels but with a white border. So my calculations are > 'squeezed' (some lines > and rows are missing!). > Does anyone have an idea how to get rid of this white border or will I > really have to export my tables to a textfile and use another > software zu produce > a bitmap-file?? > Example: > t = Table[Sin[(x + y)], {x, 0, 100}, {y, 0, 100}]; > Export[test.tif, > ListDensityPlot[t, Frame -> False, Mesh -> False, ImageSize -> {100, > 100}]] I don't know whether this is of any help. The white margin you see is the rest of the plot region not filled by your density plot. You may recognize this, when you specify Background -> Hue[0] (now beeing red). Deplorably the Option Background -> None is only effective for Text objects. So I played for a while with the option PlotRange to have filled all of the range but nothing cut off from your plot, e.g. In[91]:= graph2 = ListDensityPlot[t, Frame -> False, Mesh -> False, PlotRegion -> {{0 - #1, 1 + #2}, {0 - #3, 1 + #4}}, Background -> Hue[0]] &[0.019, 0.019, 0.3, 0.3] The effects where not predictable (to me), especially I couldn't get rid off a small margin at the top or at the bottom. If #3 and #4 are great enough and equal (you can make them arbitrarily great) there remains a small margin at top and bottom as seen from Mathematica rendering. Exporting this as a .tif and looking at that from Microsoft Photo Editor, I saw the margins at bottom and right. Exporting to .eps and displaying with Ghostview gave a similar appearance to rendering within Mathematica . A short inspection of the .eps file makes me guess that there is some slight imprecision with the calculation of the bounding box and/or the scaling factor. Perhaps it is possible to fix the postscript and convert it to another format. But then it may appear to be easier to extract the gray values form the RasterGraphics and generate your graphic file by different means (perhaps not too difficult in your case). Possibly you will be content with the smallest margin possible (when you color it white, or better adapt it to the background of you final application). ==== Dear all, I hope someone can give me advice concerning the following Mathematica I am trying to produce an animation of a circular walk around a 3D plot. I get the animation, but it looks like sometimes I get nearer to the plot and sometimes the plot looks more distant, so that I don't get the impression of walking on a circle. My guess is that I have not yet understood how the options ViewCenter and ViewPoint work. For [alpha = 0.0, alpha < 2 Pi, alpha = alpha + 0.1, Plot3D[ Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, {ViewCenter -> {0, 0, 0}, ViewPoint -> {5 Cos[alpha], 5 Sin[alpha], 0.5}}]] So all viewpoints should lie on a circle of radius 5 around the origin and with a constant height of 0.5. But the visual impression is different, as decribed above. Anyone knows what's wrong? Tobi ====