Kitonum

21435 Reputation

26 Badges

17 years, 29 days

MaplePrimes Activity


These are answers submitted by Kitonum

1) To emphasize the symmetries of the graphs, the center of the composition take the point (-1,1).

2) For greater clarity, the range along y-axis is reduced.

3) In order to estimate "by eye" the slopes of the graphs, selected the same scales on axes.

 

plot([seq(1+2*(1+x)^n, n = 1 .. 4)], x = -3 .. 1, -2 .. 4, color = [red, blue, yellow, green], thickness = 2, legend = [n = 1, n = 2, n = 3, n = 4], scaling = constrained);

 

 

 

 

restart;

a:=Vector([2,3,4,5]): l:=[]:

for k to ArrayNumElems(a) do

if a[k]>=3 then l:=[op(l), k] fi:

od:

l;

                        [2, 3, 4]

Try first all equations lead to a uniform form.

 

Example:

A := y - x = 0:

k := lcoeff(lhs(A), [x, y]);

A/k;

                k := -1                

               x - y = 0

Carl, you are right. I was inattentive. New procedure   SpiralMatrix1  solves the original problem:

restart;

SpiralMatrix1:=proc(A)

local n, A1, SpiralMatrix, a;

uses LinearAlgebra;

n:=RowDimension(A);

SpiralMatrix:=proc(A::Matrix)

local n, Turn, L, C, k;

uses LinearAlgebra;

n:=RowDimension(A);

Turn:=proc(B::Matrix)

local n;

uses LinearAlgebra;

n:=RowDimension(B);

[[seq(B[1,j],j=1..n),seq(B[i,n],i=2..n),seq(B[n,j],j=n-1..1,-1),seq(B[i,1],i=n-1..2,-1)], Matrix([seq([seq(B[i,j],j=2..n-1)],i=2..n-1)])];

end proc;

L:=[]; C:=A;

for k to floor(n/2) do

L:=[op(L),op(Turn(C)[1])]; C:=Turn(C)[2];

od;

if type(n,even) then Matrix(n,n,L) else Matrix(n,n,[op(L),C[1,1]]) fi;

end proc; 

A1:=SpiralMatrix(Matrix(n,n,symbol=a));

assign(seq(seq(A1[i,j]=A[i,j],j=1..n),i=1..n));

Matrix([seq([seq(a[i,j],j=1..n)],i=1..n)]);

end proc;

 

Example:

A:=Matrix([seq([i $ 5], i=1..5)]);

SpiralMatrix1(A);

 

 

SpiralMatrix:=proc(A::Matrix)

local n, Turn, L, C, k;

uses LinearAlgebra;

n:=RowDimension(A);

Turn:=proc(B::Matrix)

local n;

uses LinearAlgebra;

n:=RowDimension(B);

[[seq(B[1,j],j=1..n),seq(B[i,n],i=2..n),seq(B[n,j],j=n-1..1,-1),seq(B[i,1],i=n-1..2,-1)], Matrix([seq([seq(B[i,j],j=2..n-1)],i=2..n-1)])];

end proc;

L:=[]; C:=A;

for k to floor(n/2) do

L:=[op(L),op(Turn(C)[1])]; C:=Turn(C)[2];

od;

if type(n,even) then Matrix(n,n,L) else Matrix(n,n,[op(L),C[1,1]]) fi;

end proc;

 

Example:

A:=Matrix([seq([i $ 5], i=1..5)]);

SpiralMatrix(A);

 

 

restart;

f(x) = 2.25*f(x-1)-0.5*f(x-2);

convert(%, rational);

f := unapply(rsolve({%, f(1) = 1/3, f(2) = 1/12}, f(x)), x);

plots[display](<plot(f, 1 .. 40, color = red) | plots[logplot](f, 1 .. 40, color = red)>);

 

 

Left - the usual plot, right - logplot.

 

Here is the simplest code, generating the first  N  rows of Pascal's Triangle:

PascalTriangle:=proc(N)

local n;

for n from 0 to N-1 do print(seq(binomial(n,k), k=0..n)) od;

end: 

 

Example:

PascalTriangle(10);

 

 

Line:=plot(x^2-2*x+2, x=-0.5..2.5, -0.5..3.5, thickness=2):

Point:=plottools[disk]([1,1],0.04, color=blue):

plots[display](Line, Point, scaling=constrained);

 

 

For such a simple task we don't need in Maple (and it will not help if, for example, instead of 1000 we take 10 ^ 10). Instead the range 1 .. 1000 consider the range 0 .. 999, adding zeros in front if the number of digits is less than 3:  000, 001, 002, etc. Total used 3 * 1000 = 3000 digits and because of the equality of all digits  the answer will be 3000/10 = 300

The procedure  MultiAdd  solves your problem:

MultiAdd:=proc(f::procedure, L::list(range))

local M, T, m, S;

uses combinat;

M:=map(i->[$ i], L);

T:=cartprod(M);  S:=0;

while not T[finished] do

m:=T[nextvalue]();  S:=S+f(op(m))

end do;

S;

end proc:

Example:

MultiAdd((i,j,k)->1/(i*j*k), [1..5, 2..8, 3..7]);

                              3360747/784000

 

 

Replace  Diff  by  diff :

restart: with(DEtools):

DEexp1:=2*y(x)*(y(x)-4):

DE:=diff(y(x),x)=DEexp1: 

DEplot(DE, y(x), x=-1..1, y=-2..7.4);

You can not substract a vector from a number. You can use the formula:

theta:=Vector(m, i->90) - lambda;  # m is the numbers of rows

 

Example:

m:=4:  theta:=Vector(m, i->90) - lambda:

lambda:=<10, 90, 0, -60>:

theta;

                   <80, 0, 90, 150>

 

For longitude all is similar only use  `if`  command.

 

 

RealRange(0, 2*Pi)  minus  `union`(solve({x >= 0, cos(x) = 0, x <= 2*Pi}, AllSolutions, explicit));

 

 

 is already implemented in Maple (version 16). See  ?worksheet,plotinterface,zoom

 

Addition: in older versions zooming can be done by scaling along axes.

Example of zooming of the plot  y=x*sin(7*x)  in 10 times:

plots[animate](plot, [(x/k)*sin(7*x/k)*k, x = -Pi .. Pi,thickness=2, tickmarks=[0,0]], k=1..10, frames=200);

 

p1:=a*n1+b/n2+c*(n1+n2)^2:

subs(n1+n2=1, p1);

                       a*n1+b/n2+c

First 237 238 239 240 241 242 243 Last Page 239 of 289