Kitonum

21550 Reputation

26 Badges

17 years, 122 days

MaplePrimes Activity


These are answers submitted by Kitonum

To find the coordinates of a vector  v  in the new basis you need to do two steps:

1) Specify the matrix  A  whose columns are  the coordinates of the basis vectors.

2) Solve the matrix equation  A.X=v where  entries of vector  X  are desired coordinates.

 

The code:

v:= <1,5>; 

A:= <<1,1>|<2,3>>;

X:=LinearAlgebra[LinearSolve](A, v);

 

If parameterization is unknown, and only implicit equation is known, then get the parametric equations as follows:

solve((x^2+y^2)^2=x^2-y^2, {x(s), y(s)});

{x = (1-s^2)^(1/2)/(1+s^2), y = s*(1-s^2)^(1/2)/(1+s^2)}, {x = -(1-s^2)^(1/2)/(1+s^2), y = -s*(1-s^2)^(1/2)/(1+s^2)}

 

To get your parameterization you can make а substitution:

subs(s=sin(t), [%]);

[{x = (1-sin(t)^2)^(1/2)/(1+sin(t)^2), y = sin(t)*(1-sin(t)^2)^(1/2)/(1+sin(t)^2)}, {x = -(1-sin(t)^2)^(1/2)/(1+sin(t)^2), y = -sin(t)*(1-sin(t)^2)^(1/2)/(1+sin(t)^2)}]

u:=unapply(sum((10^k-1)*7/9, k=1..n), n);

   u := n -> -7/9*n-70/81+7/81*10^(n+1)

First, we isolate the N and then find it by bisection of the interval.

restart;

f:=N->sum(1/n, n=1..N):

for k from 0 do

if evalf(f(2^k))>20.12 and  evalf(f(2^(k-1)))<20.12 then break: fi:

od:

a:=2^(k-1): b:=2^k: 

print([a, b]);    # isolation interval

while b-a>=1 do

c:=(a+b)/2:

if (evalf(f(a))-20.12)*(evalf(f(c))-20.12)<=0 then b:=c else a:=c fi:

od:

if evalf[20](f(ceil(b)-1))<=20.12 then print(N=ceil(b)) else

print(N=ceil(b)-1); fi;

                                    [268435456, 536870912] 

                                             N = 307130819

Apparently all the real roots of the equation are in the range  x=-3..3 .

Look at this:

plot([3*sin(x^2), x], x=-3.5..3.5);

These roots can be found by  RootFinding[Analytic]  command.

Instead of nested loops, you can use the composition operator:

S:={1, 2, 3}: l:=5:

f:=T->[seq(seq([op(T[j]), S[i]],i=1..nops(S)), j=1..nops(T))]:

L:=(f @@ l)([[]]);

You get a list of lists . But any list could easily be converted into a vector, for a example:

convert(L[100], Vector);

 

 

V:=Vector([seq(i, i=1..12)]):

L:=convert(V, list):

Matrix(3, 4, L);

HA := Matrix(2, {(1, 2) = f},shape = hermitian);

HAA := Matrix(4, {op(op(HA)[3]), (1, 3) = -t, (2, 4) = -t, (3, 4) = f}, shape = hermitian);

L:=[]:

for a to 20 do

for b to 20 do

if type(a/b, integer) then L:=[op(L), [a, b]]: fi:

od: od:

L;

(a/a)/expand((a+b)/a);

Possible variant:

P:=proc(L::list)

local T, S, a, U, i;

T:=L; S:=[];

while nops(T)>0 do

a:=T[1]; S:=[op(S), a];  U:=[];

for i to nops(T) do

if T[i]=a then U:=[op(U), i]; fi;

od;

T:=subsop(seq(U[k]=NULL, k=1..nops(U)), T);

od;

S;

end proc;

 

Example:

 L:=[1, 5, 4, 1, 2, 4, 5, 1, 6]:

P(L);

    [1, 5, 4, 2, 6]

Draw a circle and parallel lines can be a variety of ways:

1) By plot command.

2) By plots[implicitplot] command if the lines are given as  implicit functions.

3) Using the primitives of the plottools package.

Read help on these commands!

with(Statistics):

X := RandomVariable(Normal(64.3,2.6)):

PDF(X, x); # Probability density function

int(%, x=-infinity..56.5);

This can be done without loops as follows:

DetVanMat:=proc(A::list)

local B;

B:=combinat[choose]({seq(i, i=1..nops(A))}, 2);

mul(A[B[k,2]]-A[B[k,1]], k=1..nops(B));

end proc;

 

Example:

DetVanMat([seq(x[i], i=1..4)]);

      (x[2]-x[1])*(x[3]-x[1])*(x[4]-x[1])*(x[3]-x[2])*(x[4]-x[2])*(x[4]-x[3])

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