mm-869 === Subject: Symbolic Calculations with Matrices trivial to most of you. I tried to find an answer to this from the previuos posts but unfortunately I could n't locate any answer. I have to do various matrix operation like derivatives, inverse etc, where each element of the matrix is a matrix/vector. {eg. 1, exp(j2*pi*/N), exp(j3*pi*/N)...., exp(j((N-1)*pi*/N} or it could be an FFT matrix. My question is how can I specify such vectors or matrices with the range of values as symbolic expressions in the range, 0 to N-1. === Subject: Re: Symbolic Calculations with Matrices your question is not very clear, but it all smells very much like discrete FFT. Therefore, I assume you want to calculate the FFT of a given finite time series f[[i]]. Well this is, besides normalization issues: Sum[f[[i]] Exp[-2 Pi I j i /n],{i,0,n-1}] This can efficiently be calculated by a dot product of f with: kernel[j_]:=Table[Exp[- 2 Pi I i j/n],{i,0,n-1}] The FFT at j can then be obtained by: kernel[j].f Or we can calculate the whole transformation matrix at once by: fftmat=Table[kernel[j],{j,0,n-1}] and obtain the fft of f by: fftmat.f === Subject: Re: Is it possible to install the Workbench on a cluster Wolfram Workbench works on various platforms. If they are aggregated into a cluster that will work as well, so long as the machine can run a uset interface. The Workbench also has some features specific to gridMathematica, this needs new versions of Parallel Computing Toolkit and Mathematica http://www.wolfram.com/products/workbench/features/paralleldebugging.html === Subject: Re: Re: No O Reilly Mathematica Cookbook I doubt that. -- http://chris.chiasson.name/ === Subject: Re: Inverse of arbitrary functions like infix operators, such as +, -, /, etc... The main difference is used to join two or more pieces of syntax. After transformation to an expression, the result of 1+a+b is Plus[1,a,b], whcih you can check by using FullForm. The result of 1/;a is Condition[1,a]. -- http://chris.chiasson.name/ === Subject: Sequence as a universal UpValue In his presentation on working with held expressions at http://library.wolfram.com/conferences/devconf99/villegas/UnevaluatedExpress ions/Links/index_lnk_22.html Villegas says: In fact, Sequence itself could almost be implemented as a universal UpValue (maybe Dave Withoff or Roman Maeder remembers if that's not quite true). So, I am wondering, does the following input disprove that Sequence can be implemented as a universal UpValue? How should I think of Sequence? Importantly, why doesn't blocking Sequence work like blocking the arbitrary symbol? In[1]:= blahblah/:h_[l___,blahblah[blahblahArgs___],r___]=h[l,blahblahArgs,r] UpValues@blahblah a[1,blahblah[2,3]] Block[{Sequence},f/@Sequence[1,2,3]] Block[{blahblah},f/@blahblah[1,2,3]] Out[1]= h[l,blahblahArgs,r] Out[2]= {HoldPattern[h_[l___,blahblah[blahblahArgs___],r___]][RuleDelayed] h[l,blahblahArgs,r]} Out[3]= a[1,2,3] Map::nonopt: Options expected (instead of 3) beyond position 3 in Map[f,1,2,3]. An option must be a rule or a list of rules. Out[4]= Map[f,1,2,3] Out[5]= blahblah[f[1],f[2],f[3]] -- http://chris.chiasson.name/ === Subject: Re: Re: Sequence as a universal UpValue -- http://chris.chiasson.name/ === Subject: Re: Re: Sequence as a universal UpValue I would guess that the last two bullet points in the list of A.4.1 are not true. I believe that built in DownValues (which may be hidden by the attribute ReadProtected) and user supplied DownValues are actually part of the same list of DownValues. However, user supplied DownValues are probably more specific than the built in DownValues, which may lead to their higher transformation precedence. -- http://chris.chiasson.name/ === Subject: Re: Sequence as a universal UpValue I'm not sure I understand completely how these things work, but the behaviour of Block does seem to make sense if you read its help page. It says: When you execute a block, values assigned to x, y, ... are cleared. When the execution of the block is finished, the original values of these symbols are restored. When you put blahblah in a Block, the definitions associated with it are cleared, and its arguments are not spliced into Map. You get the expected result. But the definitions associated with Sequence are built-in, so they can not be cleared. ... Hmm ... Now that I experimented some more, Sequence does seem to be special in this respect: In[1]:= Block[{},Print[f/@{a,b}]] Block[{Map},Print[f/@{a,b}]] {f[a],f[b]} f/@{a,b} So built-in definitions can be cleared after all. But the Mathematica book does mention that Sequence is treated in a special way (unlike === Subject: Thread function now working as expected I cannot get the Thread function to work on In[3] and I am forced to do it manually in In[4] Does anyone has any idea why In[3] is not working as I expected? In[1]:= eqn1 = Sqrt[1 + 196*x^4] == 12*x - 1 - 14*x^2 Out[1]= 4 2 Sqrt[1 + 196 x ] == -1 + 12 x - 14 x In[2]:= eqn2 = Thread[(#1^2 & )[eqn1], Equal] Out[2]= 4 2 2 1 + 196 x == (-1 + 12 x - 14 x ) In[3]:= dummy = Thread[Expand[eqn2], Equal] Out[3]= 4 2 2 1 + 196 x == (-1 + 12 x - 14 x ) In[4]:= eqn3 = Equal[ eqn2[[1]] , Expand[ eqn2[[2]] ] ] Out[4]= 4 2 3 4 1 + 196 x == 1 - 24 x + 172 x - 336 x + 196 x In[5]:= Simplify[eqn3] Out[5]= 2 x (6 - 43 x + 84 x ) == 0 === Subject: Re: Thread function now working as expected Copy paste the following as a whole cell in a notebook select the cell and execute it. In[670]:= Print[your equality] eqn = Sqrt[1 + 196*x^4] == 12*x - 1 - 14*x^2 Print[square both sides] (#1^2 & ) /@ %% Print[Expand both sides] Expand /@ %% Print[final equation] (Plus[#2 - #1] & ) @@ %% == 0 Print[product of factors] Factor /@ %% Print[set each factor equal to zero] Print[solution] (Solve[#1, x] & ) /@ %% Print[verification] Block[{Message}, FullSimplify[eqn /. Flatten[List @@ %%, 1]]] Print[solution of eqn by Mathematica directly] Reduce[eqn, x] {ToRules[%]} The extreneous root x=0 is due to the process of squaring. In[690]:= Out[690]= Dimitris =CF/=C7 siewsk@bp.com =DD=E3=F1=E1=F8=E5: === Subject: Re: Thread function now working as expected Expand is evaluated before Thread is applied. Use a dummy head and a transformation rule. For instance, In[1]:= eqn1 = Sqrt[1 + 196*x^4] == 12*x - 1 - 14*x^2; eqn2 = Thread[(#1^2 & )[eqn1], Equal]; Out[3]= 4 2 3 4 1 + 196 x == 1 - 24 x + 172 x - 336 x + 196 x Jean-Marc === Subject: Re: Thread function now working as expected I guess, Expand evaluates before Mathematica sees the Thread, because In[3]:= eqn3 = ReleaseHold[Thread[HoldForm[Expand][eqn2], Equal]] Out[3]= 1 + 196*x^4 == 1 - 24*x + 172*x^2 - 336*x^3 + 196*x^4 evaluates to the desired result. In[4]:= Simplify[eqn3] Out[4]= x*(6 - 43*x + 84*x^2) == 0 But because I'm too lazy to type all these Thread[...,Equal], I would prefer In[5]:= Simplify[(#1^2 & ) /@ eqn1] Out[5]= x*(6 - 43*x + 84*x^2) == 0 Peter === Subject: Re: Thread function now working as expected Expand[1 + 196*x^4 == (-1 + 12*x - 14*x^2)^2] is evaluating to 1 + 196*x^4 == (-1 + 12*x - 14*x^2)^2 before Thread has a chance to act. Use Map: Expand/@eqn2 -- http://chris.chiasson.name/ === Subject: Re: Thread function now working as expected Thread is an ordinary function and its arguments are evaluated. Therefore, Expand[eqn2] does nothing and returns eqn2, what is then fed to Thread. Having said this, what you want can be achieved e.g. by mapping Expand over eqn2: Expand/@eqn2 Daniel === Subject: Re: Definite Integration in Mathematica to this issue.) There are a great many books about Mathematica. Bu definetely if you want a book that combines Mathematica with advanced mathematics for a various scientific fields (even form current research) this book is Trott's Guidebooks. The whole series deserves the money. n the tep along y of the ers of the other tegral, which is continuous along lutions). It's just happen in this case the antiderivative returned by the other CAS to be continuous in the real axis. For other integrals usually discontinuous antiderivatives are returned. For example (*other CAS*) int(1/(5+cos(x)),x); 1/6*6^(1/2)*arctan(1/3*tan(1/2*x)*6^(1/2)) (*mathematica*) Integrate[1/(5 + Cos[x]), x] ArcTan[Sqrt[2/3]*Tan[x/2]]/Sqrt[6] both have jump discontinuity at x=+/- n*Pi, n=odd. See this thread for a clever method by Peter Pein in order to get a continuous antiderivative with Mathematica. But in case of recognizing the jump discontinuity and its position, it is very easy to obtain a continous antiderivative adding the piecewise constant (see the relevant example from Trott's book!) Also based on my experience Mathematica is quantum steps in front of other CAS (no I don't take any money from WRI!) regarding integration capabilities. For an example let f = HoldForm[Integrate[Cos[Log[z]]/(1 + z^2)^Pi, {z, 0, Infinity}]] The indefinite integral first FullSimplify[D[%, z] == Cos[Log[z]]/(1 + z^2)^Pi] (1/4 + I/4)*z^(1 - I)*Hypergeometric2F1[1/2 - I/2, Pi, 3/2 - I/2, - z^2] + (1/4 - I/4)*z^(1 + I)*Hypergeometric2F1[1/2 + I/2, Pi, 3/2 + I/2, - z^2] True The definite integral along with check... Timing[g=ReleaseHold[f]] {145.422*Second, (Pi*(-((Gamma[1/2 - I/2]*Sech[(1/2)*(1 - 2*I*Pi)*Pi])/ Gamma[(3/2 - I/2) - Pi]) - (Gamma[1/2 + I/2]*Sech[(1/2)*(1 + 2*I*Pi)*Pi])/Gamma[(3/2 + I/2) - Pi]))/(4*Gamma[Pi])} {0.142291882821508343786,0.142291882821508343786} In my point of view this is a very tough integral (appeared in another forum). And getting an analytic result clearly demonstrates Mathematica's integration capabilities! Let compare it with the other CAS I used in order to compare sometimes its results with Mathematica and vice versa... The definite integral first int(cos(ln(z))/(1+z^2)^Pi, z= 0..infinity); int(cos(ln(z))/((1+z^2)^Pi),z = 0 .. infinity) and now the indefinite int(cos(ln(z))/(1+z^2)^Pi, z); int(cos(ln(z))/((1+z^2)^Pi),z) No results! A numerical integration is possibly of course evalf(Int(cos(ln(z))/(1+z^2)^Pi, z= 0..infinity);); 0=2E1422918828 Dimitris =CF/=C7 Michael Weyrauch =DD=E3=F1=E1=F8=E5: ealized, Michael Trott to this issue.) of one real functions of a complex n the tep along y of the ers of the other tegral, which is continuous along lutions). n this thread may suggest and in many or a continouus integrand ee if a mathematical ses, it would be n Option the real axis if such an integral Mathematica === Subject: Re: Definite Integration in Mathematica You seem to be implying that Peter's method can be used to produce an antiderivative, continuous on R, for 1/(5 + Cos[x]). I don't see how. Could you please show us? Unfortunately, I don't have Trott's book. Since it's very easy to obtain, could you also please show us the continuous antiderivative for 1/(5 + Cos[x]) obtained by Trott's method? David W. Cantrell === Subject: Re: Re: Definite Integration in Mathematica I am not convinced that there is a genuine need for this. This may be due my lack of knowledge of applied mathematics but I cannot see any advantage in having a complicated (non-analytic) anti-derivative, even a continuous one, on the real axis over simply doing this: g = First[g /. NDSolve[{Derivative[1][g][x] == (4 + 2*x + x^2)/(17 + 2*x - 7*x^2 + x^4), g[0] == 0}, g, {x, 0, 4}]]; You get a smooth function with which you can perform any computations you like with excellent accuracy, as you can see from: Plot[{Derivative[1][g][x], (4 + 2*x + x^2)/(17 + 2*x - 7*x^2 + x^4)}, {x, 0, 4}, What is there that is useful in applications and that you can do with a symbolic anti-derivative but you can't with this interpolating function? (The situation is quite different in the complex case, where having a function that is actually complex analytic even in some part of the complex plane can be a huge advantage over just having an interpolating function). Andrzej Kozlowski === Subject: Re: Re: Re: Definite Integration in Mathematica It's not entirely clear but I believe you are discussing the case of a parametrized antiderivative, as opposed to a parametrized definite integral. If so, how is this analysis affected by the presence of a differential constant in the antiderivative? If not, then it does not seem to matter; either the entiderivative is correct, or it is not, and in the former case the analysis can proceed. But this is all independent of the issue of interval-continuous antiderivatives. Not from anyone who'd actually have to, err, support such a thing. Clearly such a form may be used a la Newton-Leibniz for computing definite integrals with bounds on the real line. As has been pointed out, there are other ways to get such results i.e. by analysis of path singularities. The latter approach certainly has its weaknesses. But I'm not convinced the former is always viable either. That is, I have no idea how to generally construct antiderivatives that are continuous on some specified interval such as the real axis. Well of course. Did you think DSolve had its own integrator different from Integrate? Below one sees how Integrate is called from DSolve in this example. In[1]:= Unprotect[Integrate]; In[2]:= Integrate[a__] := Null /; (Print[InputForm[int[a]]]; False) In[3]:= InputForm[DSolve[Derivative[1][f][x] == (x^2 + 2*x + 4)/(x^4 - 7*x^2 + 2*x + 17), f, x]] int[(4 + 2*x + x^2)/(17 + 2*x - 7*x^2 + x^4), x] Out[3]//InputForm= ArcTan[(1 + x)/(-4 + x^2)]/2 + C[1]]}} I don't see how it can generally do that. It is not given a specific interval but only a start point. So solutions are only correct in a neighborhood of that point. If input involves analytic functions then I think there is a guarantee that the neighborhood is in the complex plane (of the independent variable). I confess I'm out of my area here and there may be issues with singular curves and the like, so the term neighborhood may need to be taken a bit loosely. How could their respective goals be otherwise accomplished? Maybe I do not understand your question. Daniel Lichtblau Wolfram Research === Subject: Re: Re: Definite Integration in Mathematica well, in case that nothing else is available, I am happy with a numerical solution of a problem. And that's what NDSolve produces. After all an interpolating function is only a numerical approximation to the solution looked for -- admittedly in a form easily worked with. However, generally, even if it looks complicated an analytical solution has its specific virtues. Just assume that one of the constants in the integral would actually be a parameter, say a, than I could easily study the parameter dependence of the integral, which may produce further insight, e.g. that a certain term may or may not be neglected in the parameter range of interest. (That's the way physicists often make progress...) (By the way I got a few private messages in response to my post in this newsgroup which strongly supported the idea that Mathematica should support an option in order to ask for the solution which is continouus on the real line.) So, I conclude, (also from reading some of the papers Dimitris suggested) that there is a genuine point to have an explicit (non-numeric) solution of the integral which is continuous and differentiable on the real line if it exists, irrespective how complicated it may look. Nevertheless, your suggestion to use NDSolve spurred my interest, and I tried to use DSolve in order to determine the integral. And here is what I got, (*in*) sol = DSolve[Derivative[1][f][x] == (x^2 + 2*x + 4)/(x^4 - 7*x^2 + 2*x + 17), f, x] (*out*) (1/2)*ArcTan[(1 + x)/(-4 + x^2)] + C[1]]}} It's exactly our good old friend, which is neither continuous nor differentiable at x=2. But Mathematica even provides an integration constant so as to make me believe that this is the solution up to a constant to be determined by an initial condition. On the left hand side of my equation there just is f', and what I exspected is a differentiable solution. Or can I also here excuse myself with singularities in the complex plane?? I definitely thought that DSolve solves differential equations of one or more REAL variables. ?? In contrast, NDSolve exactly does this as Andrzej Kozlowski has shown in his post. So, at least, I learn that DSolve and NDSolve do different things (sometimes) apart from one being analytical and the other numerical. Is that really intended and mathematically sound? I would be grateful for further enlightening. === Subject: Re: Which Mathematica product should I get? David I've not used either CalcCenter or CalculusVIS, but here is my opionated opinion: Buy yourself a copy of Mathematica for Students and get to grips with the full power of the system. My impression of the other products is that, sooner or later you will run into limitations they impose (those limitations being the price of their rather greater ease of use for tasks within their domains) and want the full power anyway. Might as well start off as you mean to go on. Once you've got it, solicit advice on this group for learning resources. The Mathematica front-end has very good typesetting capabilities, certainly should satisfy any student of maths. As to the licensing issues -- you should really address those directly to Wolfram or their representatives. Mark WestwoodOn Mar 26, 8:03 am, David Rees === Subject: Re: Re: Which Mathematica product should I get? I have played a bit with CalcCenter 3. Unfortunately I cannot remember many of the reasons I haven't used it much, but my impressions are: Pros: It's considerably prettier than Mathematica, with well-laid-out menus, a bit of a walkthrough showing its capabilities, etc. The help links pop up some good examples, and you can use some built-in instant calculators to get a good idea of the correct syntax of many of the commands. CalcCenter would probably be quite a bit easier to start using than Mathematica because of the available help and ready (simple) examples. Cons: That being said, I wanted to take one of the demonstrations in a different direction, and couldn't. Things which would be *very* easy in Mathematica are suddenly utterly impossible in CalcCenter. I'm sorry that I can't remember what I wanted to do, but it was something relatively basic (so I thought). I couldn't believe that CalcCenter wouldn't allow one to do it. Also, the instant calculators, though sometimes helpful, are really in the way and (in my opinion) really ugly if one wanted to, say, print out a notebook. A BIG con for me is the inability to use external packages (or write your own?) for CalcCenter. The relatively easy extensibility of Mathematica using packages is a tremendous resource and ability. CalcCenter doesn't (or didn't, w/ version 3) have that. I, personally, don't see the advantage of CalcCenter over Mathematica, unless you're really going to stick with quite basic functionalities (even advanced highschool calculus students might feel crippled by CalcCenter in its current incarnation). If you think you'll want to do more math than basic calculus/trig/linear algebra, then I recommend the Student version of Mathematica. --C.O. -- Curtis Osterhoudt gardyloo@mail.remove_this.wsu.and_this.edu PGP Key ID: 0x088E6D7A Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html === Subject: Re: Integrate (a difficult integral) I should have written... Since Mathematica return unevaluated both Integrate[f[z], {z, - Infinity, Infinity}] and Integrate[f[z], {z, -Infinity, 4 - I, Infinity}] we will use the previous setting with Limits. I apologize for any inconvience! Dimitris =CF/=C7 dimitris =DD=E3=F1=E1=F8=E5: ia= ls= un= so= em= ar= at= ea= me= o= ma= g = ow= l = === Subject: Re: Some questions about vector Do you mean a linear combination of vectors, like this v = a1*v1 + a2*v2 + ... + an*vn where v, v1,...,vn are vectors of a vector space (e.g. R^n ) and a1,a2,...,an are elements of a field ? I don't know if exists any package that treats general vector analysis but it sounds interesting to working around it. Bye, S. === Subject: Re: Some questions about vector Hi Qi, Mathematica treats your command mechanical. It takes the derivative of Sum[i v[i],{i,1,N}] treating v[i] as a variable. Well this gives Sum[i,{i,1,N}] and this evaluates to what you got. Try also D[f[v],v[j]] and you get zero! As far as I know, it is not possible to take the derivative with respect to a not yet determined variable y[j]. To be on the save side, in D[..,x], x should be an atomic symbol. Daniel === into how to properly modify my recent battery power function! Many folks told me the same thing, but from a different angle which really helped drive the major points home. Todd ____________________________________________________________________________ ________ Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html === Subject: Cantor Function problem hi, i am not a member of this group. but i have a difficulty in Mathematica that you may be able to help with. I got the following program from a book but it doesnt work. please help to resolve it. this is for a friend of mine who wants to generate the cantor function for his BSc final year project. thank you very much neelaka seneviratne spawn[{a_Rational, b_rational}] := Block [{w=(b-a)/3}, {{a-2w, a-w}, {b+w, b+2w}}] spawn [intervals_list] := Flatten[Map[spawn, intervals], 1 /; removedintervals[n_]:= Flatten[NestList[spawn, {{1/3, 2/3}}, n-1], 1] f[0] = 1; f[x_] := f[3x]/2 /; x<=1/3; f[x_] := 1-f[1-x] /; 2/3<=x; connect [{a_, b_}] := Block [{y=f[a]}, Line[{{a,y}, {b,y}}]] CantorFunction[levels_] := show[Graphics[{Thickness[.001], Map[connect, removedintervals[levels]]}], === Subject: Re: Cantor Function problem Hi Neelaka, consider: f[0] = 1; f[x_] := f[3x]/2 /; x<=1/3; f[x_] := 1-f[1-x] /; 2/3<=x; this produces an infinite recursion because in general the end criterion is never reached. Here is a working approach. Define f[n,x], that f[0, x_] = x; f[n_, x_] := Piecewise[{{0.5*f[n - 1, 3*x], Inequality[0, LessEqual, x, Less, 1/3]}, {0.5, Inequality[1/3, LessEqual, x, Less, 2/3]}, {0.5 + 0.5*f[n - 1, 3*(x - 2/3)], 2/3 <= x <= 1}}] Damiel === Subject: Re: Cantor Function problem -----------------------^ Syntax error : must be Rational -------------------^ Syntax error : must be List ----------------------------------^ Missing close square bracket ----^^^^^ Should be AxesOrigin You will find below your code with the corrections added. In[1]:= spawn[{a_Rational, b_Rational}] := Block[{w = (b - a)/3}, {{a - 2*w, a - w}, {b + w, b + 2*w}}]; spawn[intervals_List] := Flatten[spawn /@ intervals, 1] /; removedintervals[n_] := Flatten[NestList[spawn, {{1/3, 2/3}}, n - 1], 1]; f[0] = 1; f[x_] := f[3*x]/2 /; x <= 1/3; f[x_] := 1 - f[1 - x] /; 2/3 <= x; connect[{a_, b_}] := Block[{y = f[a]}, Line[{{a, y}, {b, y}}]]; CantorFunction[levels_] := Show[Graphics[{Thickness[0.001], In[9]:= CantorFunction[5]; [...graphic deleted...] Jean-Marc === Subject: Re: Self-teaching snag To speed recursions up, add memory to the function definition so that it doesn't repeat prior recursions. Clear[charge1]; charge1[0]=1; charge1[day_Integer?Positive]:= charge1[day]=0.95charge1[day-1]; charge1[20] 0.358486 charge1[35] 0.166083 However, the recursion can be avoided with Clear[charge2,rate]; charge2[day_,rate_:0.95]:=rate^day; Off[Solve::ifun]; d=day/.Solve[charge2[day]==0.15,day][[1]] 36.9857 Plot[charge2[day],{day,0,40}, Point/@Table[{n,charge1[n]},{n,0,40,4}], Blue,AbsoluteDashing[{5, 10}], Line[{{0,0.15},{d,0.15},{d,0}}]}, If the result for charge2 is not obvious it can be obtained from RSolve Clear[charge,day,rate]; charge[day]/.RSolve[{charge[day]==rate* charge[day-1],charge[0]==1},charge[day],day][[1]] rate^day Bob Hanlon === Subject: Solving a nasty rational differential equation I have this nasty differential equation: ( Lorentz invariant elliptical invariant Klein-Gordon) -(hbar2/(2*m))*Sum[D[Phi[x[i]],{x(i),2}],{i,1,4}]+2*m*c2*J{Sqrt[m/m0]]=0 The substition I'm working with is the Kerr mass one of: and J as an elliptical invariant like: J[x_]=(-x20+228*x15-494*x10-228*x5-1)3/(1728*x5*(x10+11*x5-1)5) I isolate the radial part of the second differential ( in a polar four sopace the angular part isn't importyant mostly to mass radial solutions) The Phi part is straight forfowd so I'm left with a double interagation f[x_]=(-x20+228*x15-494*x10-228*x5-1)3/(1728*x*(x10+11*x5-1)5) or if g[x_]=(-x20+228*x15-494*x10-228*x5-1)3/(1728*x^7 *(x10+11*x5-1)5) What I tried after the Integration wouldn't stop in my Mathematica was doing a term wise integration ( 64 terms, every 5th one non-zero). === Subject: Re: Solving a nasty rational differential equation For some reason my software strips out the ^ powers characters in the post. I'll try again : ( various versions of this elliptic invariant are well known in Mathematics) The Point group dodecahedron/ icosahedron symmetry is a dual on exchange of vertices with sides in a Euler topology. J[x_]=(-x^20+228*x^15-494*x^10-228*x^5-1)^3/(1728*x^5*(x^10+11*x^5-1)^5) f[x_]=x^4*J[x] g[x]=x^2*J[x] Using an r0=1 relative radius I get an answer. I just tried it again with r0=1 and I did get an answer ( for r0 as a variable it won't solve), but that won't solve for a radius. The Log[r] and r Log[r] seem to prevent solution in Mathematica. It is necessary to get relative r radial levels as energy levels of the I attached my working file. The maximum power seems to be x^22 as with the upper polynomial integration ( x11 and Sqrt[x] relatively). The model involves the E8 dodecahedron/ icosahedron symmetry of the early universe. r0=1 assumes a scale of one relative to some singularity radius in the Unification field at alpha =1. The symmetry breaking to produce charge and gravity is wave function that comes out is Exp[solution] ; this symmetry breaking would seem to cause the inflationary era. I have already integrated the D4 elliptic Invariant Klein -Gordon. It is a model for pre -standard model symmetry breaking in the early era big bang. It agrees with a Dynkin diagram / graph breaking of the group/ lie algebras. === Subject: Re: Solving a nasty rational differential equation Ho Roger, if you want a clear cut answer, then do not give details that are irrelevant and can not be understood without context , but concentrate on the question. I can only guess what your problem is. Do you want to integrate g[x] twice, like Integrate[Integrate[g[x],x],x]? What does x20, x15 e.t.c. mean, are these constants or should it read x^20 ...? Anyway in both cases Mathematica will integrate without problems. Daniel === Subject: Pattern evaluation depending on order of definitions Hello Mathematica experts, please consider the following 2 examples: _g[1] := -1; _g[n_Integer] := 1; g[something][1] _h[n_Integer] := 1; _h[1] := -1; h[something][1] The first example is what I want: Objects with head g applied to 1 should return -1 and applied to other integers should return +1. The only difference in the second example is the order of the definitions. It appears that Mathematica does not check for further definitions matching h[something][1] more accurate. This is different in the following two examples: gg[1] := -1; gg[n_Integer] := 1; gg[1] hh[n_Integer] := 1; hh[1] := -1; hh[1] Here, the order of the definitions has no influence. Mathematica checks all definitions and chooses the best matching one. What is the reason for this different behaviour? Hannes Kessler === Subject: Re: Pattern evaluation depending on order of definitions Stopping the pattern matching search as soon as a match is found is the normal behavior of Mathematica. Mathematica natural mechanism is to sort the definitions from the most specific to the most general. However, the first set of definitions (for g and h) blocks this mechanism, and this is now the user's responsibility to give the desired or correct order. The second set of definitions (gg and hh), the usual way of defining functions indeed, allows Mathematica to sort them as expected. You can check the order in which the definitions will be checked by using the Information command (short cut ?). _g[1] := -1; _g[n_Integer] := 1; g[something][1] -1 Global`g _g[1] := -1 _g[n_Integer] := 1 _h[n_Integer] := 1; _h[1] := -1; h[something][1] 1 Global`h _h[n_Integer] := 1 _h[1] := -1 gg[1] := -1; gg[n_Integer] := 1; gg[1] -1 Global`gg gg[1] := -1 gg[n_Integer] := 1 hh[n_Integer] := 1; hh[1] := -1; hh[1] -1 Global`hh hh[1] := -1 hh[n_Integer] := 1 Jean-Marc === Subject: Re: Pattern evaluation depending on order of definitions Hi Hannes, Mathematica stores UpValues according to the creterion of increasing generality. More specific rules are stored first. Convince yourself by: ??hh and ??gg. During evaluation, Mathematica uses the first matching rule it finds. Now Mathematica has obvioulsy difficulties to determine that _h[1] is more specific than _h[n_Integer] as you can see by ??h. I consider this a bug and Wolfram should take not. What you can do is to make your definition in the correct order. Daniel === Subject: Re: Self-teaching snag The difference is use of ch[1]==1 rather than ch[0]==1 Bob Hanlon === Subject: Re: Thread function now working as expected eqn1 = Sqrt[1+196*x^4] == 12*x-1-14*x^2; To square both sides of an equation just use Map (/@) eqn2 = #^2& /@ eqn1 196*x^4 + 1 == (-14*x^2 + 12*x - 1)^2 To expand both sides of an equation use ExpandAll eqn3 = eqn2//ExpandAll 196*x^4 + 1 == 196*x^4 - 336*x^3 + 172*x^2 - 24*x + 1 eqn3//Simplify x*(84*x^2 - 43*x + 6) == 0 However, you do not need to expand eqn2 to get this result eqn2//Simplify x*(84*x^2 - 43*x + 6) == 0 Bob Hanlon === Subject: Re: Re: No O Reilly Mathematica Cookbook Yes,I too would go with the book: Heikki Ruskeepaa's _MATHEMATICA NAVIGATOR: Mathematics, Statistics, and Its an excellent introduction.I tried consulting the Mathematica guidebooks of Micheal Trott but they are too hard for a newbie.But for experienced users it would be a terrific book. Nabeel -- Nabeel Butt LUMS,Lahore === Subject: Is this a problem in mathematica? Let's say I wanna solve this problem: Determine point(s) on y = x^2 +1 that are closest to (0,2). So in mathematica: minDist = (x - 0)^2 + (y - 2)^2; Minimize[minDist, y == 1 + x^2, {x, y}] but x also has another answer: +1/Sqrt[2]. Is this a problem in mathematica or can my code be changed to output the other value of x for the minimum distance? === Subject: Re: Re: Is this a problem in mathematica? Even easier: minDist = (x - 0)^2 + (y - 2)^2; Andrzej Kozlowski= === Subject: Re: Is this a problem in mathematica? Minimize searches the global minimum and if you read the manual, there you find: Even if the same minimum is achieved at several points, only one is returned. To get both x values, you can e.g. write the distance as a function of x: dist = x^2 + ((x^2 + 1) - 2)^2 and search extremal points like: Solve[{D[dist,x]==0,D[dist,y]==0},{x}] Daniel === Subject: Re: Is this a problem in mathematica? Minimize just searches for a minimum, if there are two or more minima it will only find one at most. If you want general solutions use Solve to find the minima of the first derivative. In[4]:= Solve[D[x^2 + (1 + x^2 - 2)^2, x]== 0, x] Out[4]= Checking the distance for each point will allow you to reject the point at 0 as a minimum. Ssezi === Subject: Re: Is this a problem in mathematica? traz skrev: The help browser page on Minimize says Even if the same minimum is achieved at several points, only one is returned. I think the problem might be solved by using FindMinimium, and starting from several different points. / johan === Subject: Re: Is this a problem in mathematica? (2nd) Execute the following command also FrontEndExecute[{HelpBrowserLookup[RegGuide, Maximize]}] and see the Furter Examples. For your needs the following will give you waht you want. (Minimize[(x + 0)^2 + (y - 2)^2, y == x^2 + 1 && #1[x, 0], {x, y}] & ) /@ {Greater, Less} 3/2}}} Dimitris =CF/=C7 traz =DD=E3=F1=E1=F8=E5: ca or can my code be changed to output the other value of x for the minimum= distance? === Subject: Re: Is this a problem in mathematica? (2nd) Or remember that the derivative of the distance has to be zero and the second In[1]:= distsquare[x_] := (#1 . #1 & )[{x, 1 + x^2} - {0, 2}]; Out[2]= x == -(1/Sqrt[2]) || x == 1/Sqrt[2] PÓ === Subject: Re: Is this a problem in mathematica? No problem. I copy from the Help Browser... Even if the same minimum is achieved at several points, only one is returned. An important feature of Minimize and Maximize is that they always find global minima and maxima. Often functions will have various local minima and maxima at which derivatives vanish. But Minimize and Maximize use global methods to find absolute minima or maxima, not just local extrema. Let see an example f[x_] := x + 2*Sin[x] The function has many local maxima and minima. Plot[f[x], {x, -10, 10}]; Minimize and NMInimize find the global minimum. Minimize[{x + 2*Sin[x], -10 <= x <= 10}, x] N[%] NMinimize[{x + 2*Sin[x], -10 <= x <= 10}, x] Maximize and NMaximize find the global minimum. Maximize[{x + 2*Sin[x], -10 <= x <= 10}, x] N[%] NMaximize[{x + 2*Sin[x], -10 <= x <= 10}, x] If you want to find all the local extremums, then you can work as follows: Reduce[Derivative[1][f][x] == 0 && -10 <= x <= 10, x] {ToRules[%]} f[x] /. % N[%] x == -((8*Pi)/3) || x == -((4*Pi)/3) || x == -((2*Pi)/3) || x = == (2*Pi)/3 || x == (4*Pi)/3 || x == (8*Pi)/3 {-Sqrt[3] - (8*Pi)/3, Sqrt[3] - (4*Pi)/3, -Sqrt[3] - (2*Pi)/3, Sqrt[3] + (2*Pi)/3, -Sqrt[3] + (4*Pi)/3, Sqrt[3] + (8*Pi)/3} {-10.109631217141658, -2.4567393972175133, -3.8264459099620725, 3=2E8264459099620725, 2.4567393972175133, 10.109631217141658} Or << NumericalMath`IntervalRoots` IntervalBisection[Derivative[1][f][x], x, Interval[{-10., 10}], 0.001, List @@ % (FindRoot[Derivative[1][f][x] == 0, {x, #1[[1]], #1[[2]]}] & ) /@ % f[x] /. % Interval[{-8.377685546875014, -8.377075195312507}, {-4.188842773437508, -4.188232421875004}, {-2.0947265625000053, -2.0941162109375036}, {2.0941162109375, 2=2E0947265625000018}, {4.188232421875, 4.1888427734375036}, {8.3770751953125, 8.377685546875007}] {{-8.377685546875014, -8.377075195312507}, {-4.188842773437508, -4.188232421875004}, {-2.0947265625000053, -2.0941162109375036}, {2.0941162109375, 2=2E0947265625000018}, {4.188232421875, 4.1888427734375036}, {8.3770751953125, 8.377685546875007}} {-10.10963121714166, -2.4567393972175138, -3.8264459099620725, 3=2E8264459099620725, 2.4567393972175138, 10.10963121714166} The following code finds additionally which local extremum is minimum and which is maximum. Reduce[Derivative[1][f][x] == 0 && -10 <= x <= 10, x] ext = x /. {ToRules[%]} ({#1, f[#1]} & ) /@ ext ({#1, Derivative[1][f][#1]} & ) /@ ext ({#1, Derivative[2][f][#1]} & ) /@ ext maxm = Cases[%, {(x_)?NumericQ, (y_)?NumericQ} /; y < 0] x == -((8*Pi)/3) || x == -((4*Pi)/3) || x == -((2*Pi)/3) || x = == (2*Pi)/3 || x == (4*Pi)/3 || x == (8*Pi)/3 {-((8*Pi)/3), -((4*Pi)/3), -((2*Pi)/3), (2*Pi)/3, (4*Pi)/3, (8*Pi)/3} {{-((8*Pi)/3), -Sqrt[3] - (8*Pi)/3}, {-((4*Pi)/3), Sqrt[3] - (4*Pi)/ 3}, {-((2*Pi)/3), -Sqrt[3] - (2*Pi)/3}, {(2*Pi)/3, Sqrt[3] + (2*Pi)/3}, {(4*Pi)/3, -Sqrt[3] + (4*Pi)/3}, {(8*Pi)/3, Sqrt[3] + (8*Pi)/3}} {{-((8*Pi)/3), 0}, {-((4*Pi)/3), 0}, {-((2*Pi)/3), 0}, {(2*Pi)/3, 0}, {(4*Pi)/3, 0}, {(8*Pi)/3, 0}} {{-((8*Pi)/3), Sqrt[3]}, {-((4*Pi)/3), -Sqrt[3]}, {-((2*Pi)/3), Sqrt[3]}, {(2*Pi)/3, -Sqrt[3]}, {(4*Pi)/3, Sqrt[3]}, {(8*Pi)/3, -Sqrt[3]}} {{-((4*Pi)/3), -Sqrt[3]}, {(2*Pi)/3, -Sqrt[3]}, {(8*Pi)/3, -Sqrt[3]}} {{-((8*Pi)/3), Sqrt[3]}, {-((2*Pi)/3), Sqrt[3]}, {(4*Pi)/3, Sqrt[3]}} Dimitris =CF/=C7 traz =DD=E3=F1=E1=F8=E5: ca or can my code be changed to output the other value of x for the minimum= distance? === Subject: Re: Is this a problem in mathematica? =C9 mean global maximim. It's the hot weather here in Greece that cause now and then mistakes like this in my posts! I apologize! Dimitris =CF/=C7 dimitris =DD=E3=F1=E1=F8=E5: = = ti= um= === Subject: Re: Self-teaching snag Some of us ended up with 37 days and some with 38 days. This is bad. -- http://chris.chiasson.name/ === Subject: Re: Self-teaching snag Your question solicited a lot of responses, including mine below that was not entirely correct. While everyone noted the problem with the efficiency of recursive definitions, I wanted to add simply that even the case of trying to solve for the time when the battery is at .95 (obviously after 1 day) fails because of the problem with machine precision that I suggested in my original reply. In[1]:=charge[0]=1.0 (*100%*); charge[day_]:=(charge[day-1]-(0.05*charge[day-1])); In[3]:=Solve[charge[day][Equal]0.15,day] RowBox[{($RecursionLimit::reclim), ((:)( )),