acer

32597 Reputation

29 Badges

20 years, 41 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Note the capitalization of Pi. s:=8*cos((sqrt(2)/5)*Pi*t); eval(s,t=0); dsdt := diff(s,t); d2sdt2 := diff(s,t,t); # for fun plot(d2sdt2,t=0..10); acer
If you wish to code this yourself, use `add` instead of `sum`. But you might also use ArrayTools[AddAlongDimension] . acer
> Digits := trunc(evalhf(Digits)): > evalf(e_x0); 0.000272945525314361 > evalf[30](e_x0); .000272945527768874577097831048276 Look at the help-page ?Digits . Other systems may have a different default working precision (or accuracy goal). acer
# Setting Digits higher than this may require fiddling # with the epsilon and digits options of evalf/Int # This is optional, regardless, so only increase if it's needed. Digits := 13; interface(rtablesize=15); # S is a list of the first 11 nonnegative roots of -BesselJ(1,x) ? # If so, then find these using fsolve with avoid={} option, or with plot. S := [0., 0.3831705970, 0.7015586670, 1.017346814, 1.332369194, 1.647063084, 1.68438, 1.961585851, 2.276008438, 2.590367209, 2.904682853, 3.218967991]: B := Vector(11,(i)->`if`(i=1,1,S[i]*coth(S[i]))): A := Vector(11,(i)->2/(100*BesselJ(0,S[i]*10)^2)): C := Matrix(11,11, (i,j)-> B[j]*A[i]/1 * ( evalf(Int(BesselJ(0,S[i]*x)*BesselJ(0,S[j]*x)*x^(15.0/200.0),x=0.0..0.075)) + evalf(Int(BesselJ(0,S[i]*x)*BesselJ(0,S[i]*x)*BesselJ(0,S[j]*x)*x,x=0.076..10.0)) ) ); CI := C + LinearAlgebra[IdentityMatrix](11); LinearAlgebra[MatrixInverse](CI); acer
Setting Digits will change the precision for calculations. If you change it once, at the top-level, then that change persists. Setting interface(rtablesize) changes the cutoff for sizes, above which once sees the "summary" of a Matrix/Vector/Array and below which one sees all the entries printed explicitly. Here too, you only need to set it once, and the change persists until you change it again or restart your session. acer
Try the Tools -> Options -> Precision tab, in the Standard GUI. If you want to control the number of displayed digits without changing the precision of calculations then toggle-on the first choice, labelled "Round screen display to". acer
Try this, kernelopts(display_zero_complex_part=false); to suppress the display of precisely zero imaginary components of the entries of a Matrix, Vector, or Array. You can also get finer control over the mechanism to remove the small imaginary components by mapping fnormal() over the object. This does produce a new object, and does remove such small components rather than just suppress them in printing. ps. I suppose that this kernelopts option could be more correctly named as 'display_zero_imaginary_part'. Also, it might be more appropriate as an interface() option than a kernelopts() option. And should it appear in the Standard GUI's Tools->Options menu? acer
It isn't all clear to me what you are after. I may be misunderstanding it all the way through. I really didn't understand what the ranges of the i and j indices of C_ik are. So I just used all eleven of them. So fix that up. For the rest of it, well, the chances are good that I made at least some transcription error, if not worse. So look for that. # S is a list of the first 11 nonnegative roots of -BesselJ(1,x) ? # If so, then find these using fsolve with avoid={} option, or with plot. S := [0., 0.3831705970, 0.7015586670, 1.017346814, 1.332369194, 1.647063084, 1.68438, 1.961585851, 2.276008438, 2.590367209, 2.904682853, 3.218967991]: B := Vector(11,(i)->`if`(i=1,1,S[i]*coth(S[i]))): A := Vector(11,(i)->2/(100*BesselJ(0,S[i]*10)^2)): C := Matrix(11,11, (i,j)-> B[j]*A[i]/1 * ( evalf(Int(BesselJ(0,S[i]*x)*BesselJ(0,S[j]*x)*x^(15.0/200.0),x=0.0..0.075)) + evalf(Int(BesselJ(0,S[i]*x)*BesselJ(0,S[i]*x)*BesselJ(0,S[j]*x)*x,x=0.076..10.0)) ) ); CI := C + LinearAlgebra[IdentityMatrix](11); LinearAlgebra[MatrixInverse](CI); I don't see how animation comes into it. acer
A routine which would allow efficient iteration over an rtable (Array, Matrix, Vector) as well as allow simultaneous access to the indices as each element is accessed would be very nice. It's unfortunate that it does not exist; using side-effects with rtable_scanblock is inefficient and does not scale well. You can map or Map over an rtable, but not get access to the indices as each element is dealt with. The same goes for syntax like, for x in A do .... od: # for rtable A As for the NULLs in your example, select() and its friends produce the same sorts of objects that they are passed. And it seems that the size of an Array is a quality preserved by select. So, some value is needed, and NULL is better than a default of 0, since 0 might have some special meaning for a given example of selection. acer
You can write a routine to do this, using loops. Or you could have it use rtable_scanblock, which can be made to walk over Arrays, Matrices, and Vectors in all sorts of useful ways. One neat aspect is that, while walking such a structure, rtable_scanblock has access to the indices and so can save them elsewhere as a side-effect. For example, FindIndex := proc(comparison,A) local checkindex,G; checkindex := proc(val,ind) if comparison(val) then G[val] := op(ind); end if; NULL; end proc: rtable_scanblock( A, [rtable_dims(A)], checkindex, [[1],A[1]]); convert(G,list); end proc: foo := Array( 1..10 , i -> i ) * 2; FindIndex( x -> evalb( x mod 3 = 0 ), foo ); You could make it more general, depending on whether you want it to handle rtables of several dimensions or to return something other than a list. acer
Consider this sort of looping, for i from 1 to 100 do cat( "p", convert(5000+i,string) ); od; So, you can produce strings, for names of files, programmatically. acer
It's not clear whether you expect to create elements which have 20 decimal places of information, or whether you just want the Matrix to be able to hold such numbers. Matrix(2,2,(i,j)->evalf[20](1/(i+j+1)),datatype=sfloat); If the datatype of the Matrix is 'sfloat', which stands for software float, then the entries can have any number of digits. The precision of what can be assigned into the entries, after creation of such a Matrix, would depend on the environment variable Digits. See the help-page, ?UseHardwareFloats . Other ways to get a datatype=sfloat Matrix are, restart: UseHardwareFloats:=false: Matrix(2,2,(i,j)->evalf[20](1/(i+j+1)),datatype=float); MatrixOptions(%,'datatype'); restart: Digits := 20: Matrix(2,2,(i,j)->evalf(1/(i+j+1)),datatype=float); MatrixOptions(%,'datatype'); acer
Sorry, I don't know why, but I missed that L is L(x) a function of vector x. Let's have another shot at it, then. There seems to be a missing multiplication sign, in your definition of L, in the [1,1] entry. Should there be a * between exp((x[1]+x[2])/K) and (1-1/a) ? L:= Matrix([[s[1]*exp((x[1]+x[2])/K)*(1-1/a),F],[s[1]*exp((x[1]+x[2])/K)*1/a,s[2]]]); VV := Vector([x[1],x[2]]); Z := L.VV - VV; e1 := isolate(Z[2],x[1]); solve(eval(Z[1],e1),{x[2]}); sol2 := op([%][2]); # pick the non-trivial solution sol1 := op(solve(eval(Z[2],sol2),{x[1]})); op(solve(Z[2],{x[1]})); newZ := eval(Z,{sol1,sol2}); # Now, how to simplify that to zero? # Are there some assumptions on the other unknowns, to give # simplify() a helping hand? # This is crude. evalf[100]( eval( newZ, {K=1/2,s[1]=1,s[2]=2,a=3,F=1/2} ) ); acer
If L-IdentityMatrix(n) has full rank and if its determinant is not zero, then yes, only the trivial solution of the zero-Vector should get returned. I suspect that, in such a case, there is no other solution to be found, by any method. But if L-IdentityMatrix(n) is not of full rank and has a determinant of zero, then NullSpace should give a basis for the solution space, or LinearSolve (or `solve` of your fully formed explicit system) should give parametrized solutions. In other words, I don't think that the method is what's important here. What should be key is whether there exist non-trivial solutions (or not). acer
Alternatively, without having to muck about with the mouse, or assistants, MM := ImportMatrix("4399_p0000000.xls",datatype=anything); Of course, you may need to make the string point directly to the .xls file with its full path, or to change currentdir() before making the call. acer
First 333 334 335 336 337 338 Page 335 of 338