acer

30772 Reputation

29 Badges

19 years, 9 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You could use the read() function, in any of the Maple interfaces, to get the BesselJ.mpl file sources into a new session. Or you could use march() to create a new personal .mla Maple library, and then store the routine within that by using savelib(). You could also look at the ?march , ?savelib and ?LibraryTools help-pages. This is a nice way to go, if you are going to write a lot of procedures that you want available in lots of distinct maple sessions. You may also be able to add an option to the Standard GUI icon on your desktop, so that it adds some location of your new .mla libraries to libname upon startup. (For Unix, that is the -b maple option.) Or you could amend libname within your maple.ini file. acer
I use Linux, for which the default initialization file is ~/.mapleinit, but I believe that it mostly gets treated the same as maple.ini for Windows. I have seen variants on these first two, to coerce Maple into using a .mapleinit file local to a particular working directory. try proc() read(`./.mapleinit`) end() catch: end try; try read "./mapleinit" catch: end try; Sometimes I use this line, interface(rtablesize=50): When I'm doing a lot of module development and debugging I sometimes insert this line, kernelopts(opaquemodules=false): Way back before LinearAlgebra, I recall seeing this, eye := n -> array(1..n,1..n,identity): acer
What Jacques says is mostly true. One class of development for which I'd disagree is the so-called application worksheet or document. By that I mean a document that contains not only Maple code and procedures but also presentation graphics. With embedded components, it is possible to construct a document which actively illustrates some ideas in a scientific or educational field. But the more sophisticated of these do have programs buried within them, usually as collapsed blocks. It's convenient to be able to pass these documents on to other people without having to pass along a Maple .mla Library file as well. And sometimes developing the programmatic parts of such documents is rather easily done within the document itself. Having said that, I'll add another reason why the command-line (tty) interface for Maple is great for developing large programming projects. It's the availability of the "include" directives (see ?include). Being able to store the source for each module export in a separate file, each one of which is $include'd in the parent module source, is nice. George, you could try this sort of thing, in the command-line interface. interface(verboseproc=2); writeto("BesselJ.mpl"): eval(BesselJ); writeto(terminal): Following that, you would just need a few edits at the front and back of the code. But were you to do it that way, you shouldn't need to add any colon or semicolon except at the very end, after the `end proc'. acer
If you are writing (or editing) Maple programs then don't use 2D input. Use 1D (maple) input. There are a variety of reasons for this, such as to avoid difficulties with the disambiguator, accurately seeing what's there when you want to edit it later, cut'n'paste, etc. acer
This example below acts inplace on Matrix M. Adjust as desired. A := LinearAlgebra[RandomMatrix](5,outputoptions=[datatype=float]): B := LinearAlgebra[RandomMatrix](5,outputoptions=[datatype=float]): M := A+I*B: Digits:=trunc(evalhf(Digits)): for i from 1 to LinearAlgebra[ColumnDimension](M) do M[1..-1,i]:=LinearAlgebra[Normalize](M[1..-1,i],Euclidean,conjugate=true); od: # for fun LinearAlgebra[Norm](M[1..-1,3],Euclidean,conjugate=true); acer
Would this do? power:=4.6860279761942*x^0.413637849985206863; evalf[3](fnormal(power)); or just, fnormal(power,3); acer
I meant for the second example using LPSolve to be, Optimization:-LPSolve(1,{a1 >= 6, a2 <= 99, a1 <= a2-1}, integervariables=[a1,a2]); I'm sure that you get the picture. Cover a1<=a2-1, and cover a1>=a2+1, and then a1<>a2 is covered. It might be a paint to set up programatically, if there are a lot of inequalities to account for amongst the variables. I can't imagine, offhand, how to cover an inequality (like, say, a logical &or) without making the constraint nonlinear. But NLPSolve doesn't allow the integervar option. acer
Maybe some variant on these, Optimization:-LPSolve(1,{a1 >= 6, a2 <= 99, a1 >= a2+1}, integervariables=[a1,a2]); Optimization:-LPSolve(1,{a1 >= 6, a2 <= 99, a1 <= a2+1}, integervariables=[a1,a2]); acer
Has anyone tried animated ascii art, in this way? Say, a dancing stick-man? acer
It seems to be more and more common in the answers provided on mapleprimes that opinion appears before accuracy. The copy command has worked on tables and arrays for many releases. But of those two structures, it's only really needed for tables. But now consider the help-page for array. Where, up to and including release Maple 10, is the cross-reference to ?copy ? When was the array help-page ever updated to mention the copy() command? How about the vector or matrix help-pages? The lack of properly updated documentation is not so dramatically new. As Joe pointed out, Vector(V) produces a copy of Vector V. Things work similarly for arrays, Matrices, and Arrays. The command array(a) produces a copy of array a, and so on. So maybe it should be this functionality that should be well documented. Moreover, if the help-pages of Vector, Array, Matrix, and rtable are going to get a cross-reference to the copy help-page, then let them *also* mention that those constructors themselves can produce copies. And why not document this difference too, that copy preserves almost all rtable properties, while the constructors themselves may not. Eg, M:=Matrix(2,2,shape=symmetric): N:=copy(M): P:=Matrix(M): MatrixOptions(N); MatrixOptions(P); acer
The general form of your Matrix is not clear. You say that it is nxn, but the portion below the first row is itself nxn. Perhaps one of these below matches what you intend. with(LinearAlgebra): M := n -> Matrix(n,n,[[Vector[row](n,[seq(x||i,i=1..n)])], [Matrix(n - 1, n, Matrix(n-1,n-1,shape=identity))]]): Minv := n -> Matrix(n,n,[[<>], [Vector[row](n,[1/(x||n),seq(-(x||i)/(x||n),i=1..n-1)])]]): Norm(MatrixInverse(M(7))-Minv(7)); Norm(M(7).Minv(7)-IdentityMatrix(7)); MM := n -> Matrix(n,n,[[Vector[row](n,[seq(x||i,i=1..n)])], [<>]]): MMinv := n -> Matrix(n,n,[[Vector[row](n,[1/(x||1),seq(-(x||(i))/(x||1),i=2..n)])], [<>]]): Norm(MatrixInverse(MM(7))-MMinv(7)); Norm(MM(7).MMinv(7)-IdentityMatrix(7)); acer
Once you've created a procedure, you can add option remember to it. Eg, f := proc(x) 2*x; end proc; g := subsop(3=remember,eval(f)); acer
How about this, t:= seq(i*Unit(s),i=100..2000,100); acer
This is probably not near the most efficient way, but... dice := proc(n::posint) local i, N, p, new; new := convert(n, string); N := iquo(StringTools[Length](new) + 1, 3); p := Array(1 .. N); for i to N do p[i] := parse(StringTools[Take](new, 3)); new := StringTools[Drop](new, 3) end do; convert(p, list); end proc: dice(632096185); diceL := proc(l::list(posint)) local i, j, N, p, new, result; result:=Array(1..nops(l)); for j from 1 to nops(l) do new := convert(l[j], string); N := iquo(StringTools[Length](new) + 1, 3); p := Array(1 .. N); for i to N do p[i] := parse(StringTools[Take](new, 3)); new := StringTools[Drop](new, 3); end do; result[j]:=convert(p, list); end do; convert(result,list); end proc: diceL([632096185,123456789,214365879]); acer
p1:=nextprime(10^200); p2:=nextprime(p1); evalf(p1*p2); p1:=nextprime(10^399); p2:=11: evalf(p1*p2); acer
First 317 318 319 320 321 Page 319 of 321