Kitonum

21550 Reputation

26 Badges

17 years, 122 days

MaplePrimes Activity


These are answers submitted by Kitonum

The procedure finds the Nth term of the sequence of lists defined by the recurrence

f(0)=[0., 0]

f(n)=[f(n-1)[1]+1/n, n]

in lines:

1)   ftn:=arg[1];

2)  srtpt:=args[2];

3)  print('please change another starting point');

4)  error solution 'not' found;  

  

Right-click on the animation and choose  Export As -> GIF .  The created file can look in any modern browser or player, or download here as below:

plots[animate](plot, [a*(2*x^3 + x^2 - 3*x), x=-2..2, thickness=2], a=1..10, frames=100 );

r :=t->(cos(t)+t*sin(t))*i+(sin(t)-t*cos(t))*j+5*k:

 D(r)(t);  # Vector T

r1 := t->(3*cos(t))*i+(3*sin(t))*j+2*t^(3/2)*k:

D(r1)(t):

 int(sqrt(coeff(%, i)^2+coeff(%, j)^2+coeff(%, k)^2), t=0..3);  # Length of the curve

                t cos(t) i + t sin(t) j

                           14

First, using the command  combinat [choose](A, 10) , you create a list of all subsets of A, containing 10 elements. Then, in a loop checking all these subsets.

A simple example: to find all the subsets of 5 elements of the set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} such that the sum of their elements is 20.

Solution:

A:={seq(i, i=1..10)}:

L:=combinat[choose](A, 5):

S:=[]:

for k in L do

if add(k[i], i=1..5)=20 then S:=[op(S), k]: fi:

od:

S;

beta := 0.25:

alpha0 := 0.2580:

alphad := 0.545:

Bmax := 0.7:

Alpha := 0..Pi/2:

A := plot((1-beta-beta*cos((Pi*alpha)/(0.8*alpha0)))*Bmax, alpha=0..0.8*alpha0, color=red, thickness=3):

B := plot(Bmax, alpha=0.8*alpha0..alphad, color=blue, thickness=3): 

plots[display](A, B, scaling=constrained, view=[Alpha, -0.2..1]);

Markiyan Hirnyk

1) Why condition if ... end if?

restart; a(1) := 4; a(2) := -2; a(3) := 1; N := 50;

for n from 3 to N do  a(n+1) := a(n)-5*a(n-1)+a(n-2) end do: a(N);

 

2) Your code is slower in 2 - 3 times. Compare for N = 100000.

a:=4:  b:=-2:  c:=1:

for i to 47 do

d:=c:  c:=d-5*b+a:  a:=b:  b:=d:

od:

c;

             43463309239573150

a:=n->((-1)^(n+1)+4*n-1)/2:

seq(a(n), n=1..8);

           2, 3, 6, 7, 10, 11, 14, 15

eliminate({x-lambda*p=0, y-lambda=0}, lambda):

p=solve(op(%[2]), p);

           p=x/y

Example:

S:={[1, 1], [2, 1], [2, 2], [3, 1], [3,2]}:

f:=proc(x,y)

x^2+y^2:

end proc:

seq(f(op(S[i])), i=1..nops(S));

              2, 5, 8, 10, 13

If you frequently use the symbol perpendicularity it makes sense to write a special procedure. Formal arguments: L - a list of the coordinates of the center of the character, l - length of a stick, th - thickness, c - color, alpha - angle of the vertical stick from the positive direction of the horizontal axis.

PerpSymb:=proc(L, l, th, c, alpha)

local A, B;

uses plottools;

A:=line(L,[L[1]+l*cos(alpha), L[2]+l*sin(alpha)], color=c, thickness=th);

B:=line([L[1]-l*sin(alpha)/2, L[2]+l*cos(alpha)/2], [L[1]+l*sin(alpha)/2, L[2]-l*cos(alpha)/2], color=c, thickness=th);

A, B;

end proc;

 

Example:

plots[display](PerpSymb([1,0.7], 0.15, 2, red, 2*Pi/3), PerpSymb([1.5,1], 0.2, 4, black, Pi/2), PerpSymb([2,0.7], 0.25, 6, blue, Pi/3), view=[0..3, 0..2], scaling=constrained);

 

with(LinearAlgebra):

do M:=RandomMatrix(3, 3, generator=1..9):

if Determinant(M)<>0 then break: fi:

od:

v:=RandomVector(3, generator=1..9):

'M'=M, 'v'=v;

x=LinearSolve(M, v);

The easiest way to solve this problem is by generating functions, noting that the number of integer and positive roots of the equation is the number of non-negative integer roots of the equation

2a +3 b +10 c = 2010 - (2 +3 +10) = 1995

coeff(convert(series(1/(1-x^2)/(1-x^3)/(1-x^10),  x=0,  1996), polynom),  x^1995);

                                                              33367

 

The problem can be also solved programmatically as follows:

restart:

n:=0:

for a from 1 to floor(2010/2) do

for b from 1 to floor((2010-2*a)/3) do

for c from 1 to floor((2010-2*a-3*b)/10) do

if 2*a+3*b+10*c=2010 then n:=n+1: fi:

od: od: od:

n;

                                                       33367

 

Maple incorrectly decided your example 3. This equation has only one root, and this root is positive.

First 275 276 277 278 279 280 281 Last Page 277 of 290