Items tagged with integer integer Tagged Items Feed

Hello, everyone! I have a very nice, very sparse linear system (only containing 1s and -1s, with at most 2 entries per column). Thus, I immediately thought to take advantage the SparseIterative (or SparseDirect) methods associated with LinearAlgebra,LinearSolve, but alas, it isn't quite working. This is what I loosely do: gen_linear_system := proc(... some parameters ...) ... ls_m := Matrix(len, total_var, datatype='integer[1]', storage='sparse'); ... (fill matrix with appropriate 1s and -1s) return ls_m; end proc; solve_linear_system := proc(system_matrix::Matrix)
Consider the following three problems: 1) given a list [a,b,c,d,e], return the list [a=1,b=2,c=3,d=4,e=5] 2) given a nested list [a, [b, [c, [d, [e]]]]] return the list [a,b,c,d,e] 3) given an integer in base 10, compute it's base b representation First I will show you what not to do:
L := [a,b,c,d,e];
M := [];
for i from 1 to nops(L) do
  M := [op(M), L[i]=i];
end do;
Building up lists (and sets) incrementally is quadratic time, because each iteration of the loop allocates linear storage to hold the new list. The standard solution is a loop with a temporary variable, assigning to a table:
In response to a question about collecting symbolic powers of polynomials, I suggested a few lines of code that solved the particular problem. Following is a procedure that enhances the technique to mimic, to some degree, the abilities of Maple's collect procedure, which handles integral powers. This enhanced version can take a list of indeterminates. It also permits use of an optional third argument, func, that is applied to the collected coefficients of a power.
i have a program to write and i dont know how to do it. if anybody could hwlp me cheers. Q implement a computer program which fora given positive integer n, a given square matrix A of order n and given vector b which n components, decides whether A is a band matrix with p=2=q and in the positive case solves the system of equations Ax=b by simplification of Gauss Elimination for a band matrices with p=2=q
Please could somebody explain the process Maple uses to factor integers so quickly? Thanks Matthew
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)];
First 19 20 21 22 23 Page 21 of 23