Items tagged with integer

Feed

Dear friends, I encounter the following problem. Let k and i be two given positive integers such that k>=2i>=4. How to find all nonnegative integers tuples (x_1, x_2, ..., x_i) such that k-2i<=x_1+2x_2+...+ix_i<=k-i? The buildin command "isolve" seems not work. Thanks.

 

with(numtheory):

f := proc (x) options operator, arrow; sum((-1)^n*(n^(1/n)-1), n = x .. infinity) end proc

proc (x) options operator, arrow; sum((-1)^n*(n^(1/n)-1), n = x .. infinity) end proc

(1)

What are the quotients  ot the  continued fration of the sum of f(1)+f(2)+f(3)+f(4)+...

Here are the  quotients  of some partial sums.

``

cfrac(evalf(sum(f(x), x = 1 .. 2)), 'quotients')

[0, 2, 1, 1, 1, 21, 10, 4, 1, 4, 8, `...`]

(2)

cfrac(evalf(sum(f(x), x = 1 .. 3)), 'quotients')

[0, 6, 1, 2, 3, 1, 1, 2, 3, 3, 24, `...`]

(3)

cfrac(evalf(sum(f(x), x = 1 .. 4)), 'quotients')

[0, 2, 1, 2, 1, 4, 2, 1, 3, 1, 1, `...`]

(4)

cfrac(evalf(sum(f(x), x = 1 .. 5)), 'quotients')

[0, 5, 1, 99, 1, 1, 1, 6, 1, 3, 1, `...`]

(5)

cfrac(evalf(sum(f(x), x = 1 .. 6)), 'quotients')

[0, 2, 1, 6, 1, 2, 1, 2, 2, 1, 1, `...`]

(6)

cfrac(evalf(sum(f(x), x = 1 .. 7)), 'quotients')

[0, 5, 1, 1, 142, 1, 1, 1, 1, 19, 1, `...`]

(7)

cfrac(evalf(sum(f(x), x = 1 .. 8)), 'quotients')

[0, 2, 1, 47, 1, 1, 1, 1, 27, 4, 1, `...`]

(8)

cfrac(evalf(sum(f(x), x = 1 .. 9)), 'quotients')

[0, 5, 5, 3, 1, 7, 1, 1, 1, 2, 1, `...`]

(9)

cfrac(evalf(sum(f(x), x = 1 .. 100)), 'quotients')

[0, 3, 1, 1, 1, 11, 2, 2, 1, 1, 4, `...`]

(10)

cfrac(evalf(sum(f(x), x = 1 .. 200)), 'quotients')

[0, 3, 1, 2, 1, 1, 1, 11, 3, 4, 6, `...`]

(11)

cfrac(evalf(sum(f(x), x = 1 .. 400)), 'quotients')

[0, 3, 1, 3, 3, 3, 1, 18, 1, 2, 1, `...`]

(12)

cfrac(evalf(sum(f(x), x = 1 .. 800)), 'quotients')

[0, 3, 1, 3, 1, 4, 16, 14, 3, 23, 2, `...`]

(13)

cfrac(evalf(sum(f(x), x = 1 .. 1600)), 'quotients')

[0, 3, 1, 4, 7, 4, 436, 1, 1, 1, 2, `...`]

(14)

``

Here are the quotients of the  continued fration  of the sum. 

cfrac(evalf(sum(f(x), x = 1 .. infinity)), 'quotients')

[0, 3, 1, 4, 1, 1, 1, 1, 1, 9, 1, `...`]

(15)

With the exception of the leading 0, that is close to the integer squence of pi.

``evalf((65241/65251)*Pi)

3.141111191

(16)

The exponents of 2 that sum the numerator and denominator, in the following way, of that multiple of pi give rise to the integer sequences {0,1,2,3,8,16},numbers such that floor[a(n)^2 / 7] is a square, and {0,2,3,4,8,16},{0,3} union powers of 2.

evalf((2^16-2^8-2^5-2^2-2-2^0)*Pi/(2^16-2^8-2^4-2^3-2^2-2^0))

3.141111191

(17)

We can do the same thing for the first 20 quotients giving rise to the integer sequences {0,1,2,5,6,8,10,13,17,19,22,23,24,28,31} and {0,4,6,9,12, 14,15,16,18,22, 23,24,28,31}. What can be said of these sequences?

cfrac(evalf(sum(f(x), x = 1 .. infinity), 20), 20, 'quotients')``

[0, 3, 1, 4, 1, 1, 1, 1, 1, 9, 1, 3, 1, 2, 1, 1, 1, 5, 1, 3, 11, `...`]

(18)

evalf((1849023129/1849306543)*Pi, 20)

3.1411111913121115131

(19)

````

evalf((2^31-2^28-2^24-2^23-2^22-2^19-2^17-2^13-2^10-2^8-2^6-2^5-2^2-2-2^0)*Pi/(2^31-2^28-2^24-2^23-2^22-2^18-2^16-2^15-2^14-2^12-2^9-2^6-2^4-2^0), 20)

3.1411111913121115131

(20)

``


 

Let a sequence( an  ) defined by an=1,3,6,12,33,51,...and n=1,2,3,.... Find formula an?

HI,

 

I want to create a Textbox which will be opened in the beginning of a Maple code. In this Textbox I want to write an integer, which will be used for a following calculation.

I already found this code:

 

> restart; with(Maplets[Elements]);
print(`output redirected...`); # input placeholder
> maplet := Maplet([["Insert Text", BoxCell(TextBox['IB1'](1 .. 10))], [Button("OK", Shutdown(['IB1'])), Button("Cancel", Shutdown())]]);

HI,

 

at first I have to admit, that I'm totaly new to maple and have only few experience with the programm.

 

That's the problem. I've got an old maple-code which I want to rewrite in the 2d-Math-syntax. In the code there are a lot of variables of the type "numerical integer" with a form like

"rho_a"

"N_A"

....

--> with index in the name

It's a code for a physical-/chemical- process so the...

Hi,

I am new to Maple, so sorry for asking this TRIVIAL question but I got quite frustrated after so much time unsuccessfully trying to figure out how to perform integer computations.

Lets take the simple example below:

3k - 5 = 0

I wanna get k=1 not 5/3

Isolve doesn’t work  for this as I would like. Introduced assumptions re ignored:

Solve(3*k -5=0, k, useassumptions) assuming k :: nonnegint

If I have 

F = x + 2π_Z1~

Is there a function/operator I can apply to F which returns only x, discarding 2π_Z1~?  That is, I want to return only the base angle, and dump the added integer multiple of 2π term.

Hi,

I am trying to simplify the expression s as given below. (I am not sure why it comes up with all the vector caclulus notation in it but it should display okay when you enter it)

Because of the presence of the exponential imaginary fucntions I thought evalc might be useful but when I use it I get a huge expression with csgn appearing in it. To my knowledge csgn appears when assumptions are not correctly specified - is this so? I can't see any assumption...

Test.mw

If I use a binary {0,1} linear program the cardinal constraint ie control the
number of 1's (long positions in portfolio) works beautiful. See attached worksheet.

The problem starts when I convert the problem into a constrained integer {-1,0,1}
linear problem where -1= short position, 0=no position and 1=long position.

In the first example when we add the constraint  add(w[i], i = 1 .. NC) = 4

I can solve a [0,1] linear programming problem by using:

LPSolve(Ob, con, assume = binary);


I managed to solve [-1,1] linear programming problem by using the transformation
2*w[i]-1 ie   2*0-1=-1 and 2*1-1=1 as follows:

LPSolve(add(PP[i]*(2*w[i]-1), i = 1 .. NC)-add(Draw[i]*(2*w[i]-1), i = 1 .. NC), {add(w[i], i = 1 .. NC) = PS}, maximize = true, assume = binary);


Now my question is how can I solve a [-1,0,1] problem?
I tried to use:

 x := proc (i::integer)

      return i^2;

end proc:

sum(x(m),m=1..3);

Error, invalid input: x expects its 1st argument, i, to be of type integer, but received i.

 

If I want to reserve the ::integer declaration, How to solve this problem. I know if there is no

I have the simplified version of what I want to do:

restart: with(LinearAlgebra):
d:=4:

product(MatrixExponential(I*Matrix(d,{(l,l)=1})*A[l,l]),l=1..d):

 

But I get the following error:

Error, (in Matrix) integer indices required for Matrix

Help appreciated.

 

 

 

Hi e-friends,

I want to minimize a function subject to a set of S restrictions.

The restrictions are related to matrices V, W, X and Y:

 

V = [v1, .., vS]  order L x S

W = [w1, .., wS] order L x S

 

X = [x1, .., xS]  order LxS

Y = [y11,.. yS] order L x S

 

How may I write in MAPLE in compact form  the following S inequalities (for any arbitrary integers L and S)?. ...

Hey peeps

 

I'm quite new to maple, and to this site, so I hope I do this properly.

I'm trying to make a procedure, that througout the procedure divides 2 numbers. But I need it to round down to the nearest integers, at all time, as I need an integer as output. I have searched quite a lot, and haven't found anything that helps me to do this.

The procedure is the following:

walla := proc (x) local y, z, w;

y := x;

i have an image and would like to perform a canny edge detection. one of the first steps is the convolution of the image with a smoothed derivative filter, i.e. a gaussian. the problem is, that i don`t know, how to convolve my collection of discrete pixels (the image) with a 2D gaussian. how do i get an integer-valued convolution kernel that approximates a Gaussian with a variable sigma?

1 2 3 4 5 6 7 Last Page 3 of 21