Items tagged with integer integer Tagged Items Feed

I've had considerable difficulty in integrating products of trig functions with Maple. It usually expands the trig functions into forms that just are a mess to deal with. So, I usually handle this by splitting an expression into two parts: a constant term that doesn't depend upon the integration variable and a dependent term. In the past, I've usually done this by hand but have now created a procedure to do this automatically.
Here's an example procedure that I need help with in order to figure out how it produces certain cases of it's output. First, in the case when the argument n is negative does the procedure call itself again in the denominator of the fraction and return the value of the last line of the procedure (inside the inner call to itself)? I also assumed that the special identifier procname was not in unevaluation quotes in order to allow evaluation. Next, I also don't understand how the output for cases when the exponent n is even is produced. What's really confusing is the use of the anonymous mapping (x -> x.x), and also the meaning of the entire expression after the word then. Is that a multiplication of the two expressions in parentheses ? i.e. (x -> x.x)(procname(X, n/2) > Pow := proc(X, n::integer) if n <> x.x)(procname(X, n/2)) else X.procname(X, n-1) end if end:
I define the tower function as base^^(-1)=0, base^^0=1, and base^^1=base. In general, base^^(height+1)=base^(base^^height). My program to calculate it has four inputs: base, iter( number of iterations),h(fractional part of height), and k(integral part of height). Two outputs: answer and prec(precision). For example 1.21^^(1/3)=1.1056691794 and 1.21^^(2/3) =1.1702307336. For this program .20<base<1.44, 0<=h<=1, and iter>=20 an even integer. If base<1 or k<=-2 the answer will be complex. This cannot be used for 1.60^^(7/2)=3.0863796925. I would like to put this in my library.
I'm trying to find the largest prime number in consecutive digits of e but maple seems to have problems with large integers. Does anyone know a way to make this work better? for i from 0 to 100 do a := floor(e*10^i); #e is the natural base e if isprime(a) then print(a); end if end do it finds the first 3, then gives the error: Error, cannot determine if this expression is true or false: isprime(floor(100000000*exp(1))) I believe it is due to precision of integer values.
This is the simple code that I came up with (after some frustration) to solve the problem of separating the sequence of positive integers from 1 to 20 into one sequence of primes and one sequence of nonprimes, and eventually displaying those sequences. I'm just curious to see what other ways this same question could have been solved. >
I have problems with assume integer. Here is a worksheet yielding a wrong solution. Is there something other than assume(integer)? > restart: > assume(k,integer); > is(k,integer); > is(l,integer); > t1:=int(sin(x)*sin(k*x),x=0..Pi); > t2:=int(sin(x)*sin(l*x),x=0..Pi); > limit(t2,l=1);
Has anyone been able to use the statopts option in the Bootstrap command which is in the Statistics package in Maple 10? Note the following sequence of commands > with(Statistics) > Bootstrap('Mean', [1, 2, 3, 4, 5], replications = 6, output = array) print(Matrix(1, 6, {(1, 1) = 2., (1, 2) = 3.39999999999999990, (1, 3) = 2.20000000000000016, (1, 4) = 2.79999999999999982, (1, 5) = 3.60000000000000008, (1, 6) = 2.20000000000000016})); [2., 3.39999999999999990, 2.20000000000000016, 2.79999999999999982, 3.60000000000000008, 2.20000000000000016] According to the documentation which is attached as a PDF file it appears that this command should work.
Hello, contourplot can be given a list of contours levels or a integer specifying the number of evenly spaced contour levels it should plot. In the second case, or even in the default case, is there a way to know what these contour levels are? The legend only shows Curve1, Curve2, ... but to which contour levels do these curves correspond? -- Thanks in advance, Franky.
Hello, I was wondering just how evaluation to n levels works as compared to the default eval statement (Maple 10). As an example, consider this: a := 1; whattype(''a''); // uneval whattype(eval(''a'')); // symbol whattype(eval(eval(''a''))); // integer The same information can be retrieved by adding a number to eval, indicating the level. as in: a := 1; whattype(eval(''a'',1)); // uneval whattype(eval(''a'',2)); // symbol whattype(eval(''a'',3)); // integer So I would expect the same behavior for the following example: whattype(''sin(2.0)''); // uneval whattype(eval(''sin(2.0)'')); // function
Hello Maple experts. How could I generate a way to obtain the lists (Ws) for an arbitrary m (integer +)? (Below I ilustrate for m=1,2 and 3). Probably it is needed to use "apply" and "map".. but I don't see how to do it. #If m:=1, I want to generate the #following list: >W1:= [seq([B(j1)], j1=0..1)]; # the output --> [[B(0)], [B(1)]] #If m:=2, I want to generate the #following list: >W2:= [seq(seq([B(j1,j2)],j1=0..1),j2=0..1)]; #output-> [[B(0, 0)], [B(1, 0)], [B(0, 1)], [B(1, 1)]] #If m:=3, I want to generate the #following list: >W3:= [seq(seq(seq([B(j1,j2,j3)], j1=0..1),j2=0..1),j3=0..1)];
Maple needs better user-level facilities for doing linear algebra over finite fields, particularly the integers mod n. For example there is no good way to solve a linear system Ax=B when B is a matrix. Obviously the LinearAlgebra:-Modular package is very good at what it does. Why can't there be some nice non-programmer routines which call it ? One alternative to using the mod operator is to have all the commands in the main LinearAlgebra package accept an optional last argument for the characteristic. For example: LinearAlgebra:-GaussianElimination(A, n); Then in the GaussianElimination command you could do something like:
I've released a Maple implementation of the F4 algorithm for computing Groebner bases. You can download it from the Maple Application Center here, or from my personal webpage here. The code requires Maple 10. It's faster than the Groebner[Basis] command for total degree orders, and it can be run in non-commutative algebras too. The coefficients are restricted to rational numbers or the integers mod p with p
I am trying to solve (numerically) the following system of differential equations using dsolve (Maple 9): DGLS:=seq(seq(diff(B[i,k](t),t)=add(add(W(j,l,i,k)*B[j,l](t)-W(i,k,j,l)*B[i,k](t),l=1..N),j=1..N),k=1..N),i=1..N); The problem is posed by the coefficients W(i,k,j,l). I want to make the W(i,j,k,l) dependent on the unknown functions B[i,k](t). For that purpose I wrote a Maple program W := proc(i::integer, k::integer, j::integer, l::integer) which calculates a "transition probability" Wtrans. If Wtrans does not depend on the B[j,l] (e.g. Wtrans:=1/N^2;), everything works nice. However, if I try to use the B[i,k] somehow (e.g. if NKrit_jl > B[j,l] then Wtrans := 0.5 fi;), then error messages from the procedure W result like "Error, invalid terms in product".
Suppose you want to sort a list L ( of numbers ) and also determine order of elements as a list of indices corresponding to elements of original list L, that is, you want such a integer list "I" that "seq(L[I[j],j=1..nops(L))" to be equivalent to sorted list. This functionality is present in MATLAB in "[B,IX] = sort(...)" syntax and i come up with this problem while trying to convert a MATLAB function (GaussQuadratureWeights) to maple. The procedure described resolves problem using a few MAPLE commands including MAPLE's built-in sort function.
What is an efficient, robust, way to extract an integer coefficient from a single term? My first thought was using lcoeff, however, it doesn't work if the term contains constants (say Pi) or floats. Currently I'm using patmatch,
icoeff := proc(t)
local k,x,kx;
  return `if`(patmatch(t, k::'nonunit'(integer)*x::anything,kx)
              ,eval(k,kx)
              ,1);
end proc:
map(icoeff, [0, 1, -3.0, -3, -0.,  3.0*Pi, 4*Pi, -12/5*I]);
                           [0, 1, 1, -3, 1, 1, 4, 1]
First 19 20 21 22 Page 21 of 22