30350 Reputation

29 Badges

18 years, 258 days
Ontario, Canada

Social Networks and Content at

MaplePrimes Activity

These are answers submitted by acer

Is this the sort of thing that you're after? sys := {diff(y(x), x) = x, y(0) = 1}: sol0 := dsolve(sys, numeric, output = listprocedure): s := subs(sol0, y(x)): s(1); SS := proc(t) global s; if type(t,numeric) then s(t) else 'procname'(t); end if; end proc; sys2 := {diff(U(x), x) = SS(x), U(0) = 1}: sol1 := dsolve(sys2, numeric, output = listprocedure, known=[SS]): s2 := subs(sol1, U(x)): s2(1); It seemed that this also worked, sys2 := {diff(U(x), x) = 's'(x), U(0) = 1}: sol1 := dsolve(sys2, numeric, output = listprocedure, known=[s]): acer
If you set infolevel[LinearAlgebra]:=2 then you will see that external compiled routines are already in use. The names appear to be NAG function names, each equivalent to some BLAS name, according to NAG online docs. Experience with performance testing shows that these must be linked to fast 3rd party BLAS, ie. ATLAS. Consider this internal routine: kernelopts(opaquemodules=false); showstat(LinearAlgebra:-LA_Main:-`MatrixExponential/complexfloat`); It is all Matrix functions to do multiplications, norms, and additions, in NAG/BLAS calls. I have some edits to the original posting, which cut out some copying and maple library function call overhead. But after a certain extent, further optimization is difficult. For example, one could take that internal routine and squeeze it. By calling it directly, a few more function calls could be avoided. Also, look at how it uses temp1 and temp2. It only ever Copies data into them, and so keeps maple from creating any unnecessary Matrix garbage. It might be possible to make its temp1 and temp2 global instead of local, so that they get re-used for each exponential computation. Using private workspace is an extreme optimization step (acknowledging that maple's rtable memory management can be bettered in special cases). One could also do it in C, and link to it. But the objective to work entirely at the maple library level is appealing. Let me cut n' paste my code edits, in a followup. I found this problem instructive. acer
Are the Matrix entries exact quantities (integers, rationals, symbolic quantities with exact coefficients, etc) or approximate floating-point values (7.3, etc) ? It makes a difference, as to what is a good way to compute the rank. If the entries are floats, then a singular value decomposition would do. If not, then row reduction and counting the non-zero rows could do. It might depend on whether you are, say, taking a class in numerical analysis or basic linear algebra. I'd first guess that it's the latter. But I thought that I'd check. acer
Could you upload the Matrix example? It's more difficult to discern what's happening without it. acer
Can you not use limit(Opl,hoekvers=2*Pi) ? That's just a thought. You might also temporarily change the division-by-zero default numeric event behaviour, see ?NumericEventHandler acer
Do Ctl-t, Ctl-m, and Ctl-r work for you, to switch to text, 1D maple input, and 2D Math input modes respectively? acer
Why use all the heavy machinery of function-creation, to do a mere evaluation of an expression? It's not known whether the procedure will do evaluations of the expression at many points, or whether the procedure itself might be called for many distinct expressions. One could probably construct examples where each were "worthwhile". Argument checking is good to add, of course. Almost every example procedure posted here on mapleprimes could do with more robust validation of arguments. A user who does not understand that an expression is not a maple function probably will find the simplest example most clear to begin with. My point was that using eval() is likely what the poster should use here, as opposed to subs(). And I would suggest that the original poster appeared unclear as to whether x^2 were an expression or a function. It is good of the first responder to show the difference, as far as evaluation goes. acer
That second approach is so much better than the first, djc, if I might offer an opinion. Consider that Sandor used the term "function", and yet the example clearly shows an expression not any function. Indeed, if he had not used the term function, you might well have not considered that first solution at all. :) And good job on using eval(). There's been a bit too much suggestion to use subs(), when 2-argument eval() is what's called for, around here. It does appear that Sandor is after mathematical evaluation, and not substituton into a structure. acer
1) Could you compute with `assuming` instead of `assume`? Eg, > sqrt((a+b)^2) assuming positive; a + b Or, could you try something like, assume( seq(a[i]>0,i=1..10) ) 2) Maybe the generated results would be shorter if the expression, whose real and imaginary parts are to be extracted, contained I instead of i (to represent the imaginary unit)? See earlier posts in which T22 := subs(i=I,t22) was suggested. 3) Could you not let us know what JJ15 is? 4) Try using add() instead of sum(). acer
The default imaginary unit in Maple is I, not i. You might try issuing T22:=subs(i=I,t22) and work with T22 instead. acer
You can change the prettyprinting level, even in Document mode. interface(prettyprint = 1): That should make a:=b+c come out as you described. On the other hand, it should also disable some of the typesetting. For example, gamma would come out as the full word, gamma, rather than as the nice greek letter symbol. Does anyone know of another way? acer
Please ignore this. Sorry, somehow this dummy post got submitted, and I can only edit it but not delete it. acer
It does look like a bug. It doesn't appear to me to be fixed in 11.01. acer
Compare, (3+4*y^4)/(12*y); diff((3+4*y^4)/(12*y),y); with, (3+4*y^4)/12*y; diff((3+4*y^4)/12*y,y); acer
Do you mean like this? > changecoords(x^2+y^2,[x,y],polar): > lprint(%); x^2*cos(y)^2+x^2*sin(y)^2 > changecoords(x*y*z,[x,y,z],spherical,[r,theta,phi]): > lprint(%); r^3*sin(phi)^2*cos(theta)*sin(theta)*cos(phi) acer
First 307 308 309 310 311 312 313 Page 309 of 316