## How do I compare two vectors within a tolerance...

Hello everyone !,

I would like to generate two random complex vectors (x1 and x2) several time and I want to check how these two vectors (j iteration) close to their previous values (j-1 iteration): abs (x1(j)-x1(j-1)) < 10^-4 and abs (x2(j)-x2(j-1)) < 10^-4. Therefore, I want that my program stop when this criteria is satisfied for x1 and x2 simultaneously.

I know how to check that for one element of the vector but not all the elements of the vector.
code:
Comp.vect.mw

## State transition diagram...

How to compute and simulate State transition diagram in markov matrix, long run behavior, statistical test analysis?

MArkov.mw

## How do I solve the system in Maple 18?...

Hi please  help me in this problem in maple 18

How do I solve the system K=B and find values

`x_{0},y_{0},z{0}`

I posed the problem in the form pdf and mw

thank you

problem.mw

problem.pdf

## How to fit this summation from 0 to infinity...

ExpODE4 := Y(1)*(sum(lambda^k*t^(k*d)/factorial(k*d), k = 0 .. infinity))

Statistics[NonlinearFit](ExpODE4, X, Y, t)

## How to integrate the computed values ...

Dear maple users,

A fine day wishes to all.

Here, we have computed the fN(x,t) value by using pdsolve.

We have to integrate the computed value and need to find the values with the sequence of x.

A1:=int(fN(x,1.12),x)

A2:=seq(A1,x=0..1,0.1)

How to integrate the computed values

And, How to find the values for the sequence of x.

 > restart:
 > with(PDEtools):
 > with(plots):
 > fcns := {f(x,t)};
 (1)
 > b1:=1.41:d:=0.5/1:xi:=0.1:ea:=0.5:ra:=2:
 > L:=z->piecewise(d<=z and z<=d+1, 1-2*xi*(cos((2*3.14)*((z-d)*(1/2))-1/4)-(7/100)*cos((32*3.14)*(z-d-1/2))),1):
 > PDE1 :=ra*(diff(f(x,t),t))=+b1*(1+ea*cos(t))+(1/(L(z)^2))*((diff(f(x,t),x,x))+(1/x)*diff(f(x,t),x));
 (2)
 > IBC := {D[1](f)(0,t)=0,f(1,t)=0,f(x,0)=0};
 (3)
 > z:=0.5;
 (4)
 >
 > sol:=pdsolve(eval([PDE1]),IBC ,numeric, time = t,spacestep = 0.025, timestep=0.0001): sol:-value(f(x,t), output=listprocedure);
 (5)
 > fN:=eval( f(x,t), sol:-value(f(x,t), output=listprocedure)):
 >
 > A1:= int(fN(x,t),x);
 (6)
 > A2 := seq(A1(x), x = 0.1 .. 1, 0.1);
 >

## How to execute the piecewise condition in pdsolve...

Dear maple users

A fine day wishes to all

In my problem, L(z) is a piecewise condition.

L(z):

I have to calculate the f(x,t) value at x=0.71,t=1.12 and z=0.71 for L(z)=0..1.

How to calculate the f(x,t) value.JVB1.mw

 > restart:
 > with(PDEtools):
 > with(plots):
 > fcns := {f(x,t)};
 (1)
 > b1:=1.41:d:=0.5/1:xi:=0.1:ea:=0.5:ra:=2:
 > L:=z->piecewise(d<=z,1-2*xi*(cos((2*3.14)*((z-d)*(1/2))-1/4)-(7/100)*cos((32*3.14)*(z-d-1/2))),z<=d+1,1-2*xi*(cos((2*3.14)*((z-d)*(1/2))-1/4)-(7/100)*cos((32*3.14)*(z-d-1/2))),1);
 (2)
 > PDE1 :=ra*(diff(f(x,t),t))=+b1*(1+ea*cos(t))+(1/(L(z)^2))*((diff(f(x,t),x,x))+(1/x)*diff(f(x,t),x));
 (3)
 > IBC := {D[1](f)(0,t)=0,f(1,t)=0,f(x,0)=0};
 (4)
 > z:=0.71;
 (5)
 > sol:=pdsolve(eval([PDE1]),IBC ,numeric, time = t,spacestep = 0.025, timestep=0.0001): sol:-value(f(x,t), output=listprocedure);
 (6)
 > fN:=eval( f(x,t), sol:-value(f(x,t), output=listprocedure)):
 >

## How to change a computed data value ...

Dear maple users,

A fine day wishes to all.

How to replace a value in already computed data value.

In my problem, I have evaluated a set of values (with help of #ma1 := evalf(seq((A4(t)), t = 0.0..1, 0.1));)

ma1 := 0., .1941703021, .3203871063, .4089371834, .4712881303, .5145114133, .5435036431, .5617715009, .5718586242, .5756277760, .5744585726

I need to change 0 value as a 1.

I have used subs(ma[1]=1,ma1), but its coming wrong.

## How to correct "Error invalid selector"...

I am solving this question :the line joining the ends of 2 rectangular diameters of an ellipse, remains tangent to a fixed circumference. My code is :

restart; with(geometry); with(plots); unprotect(O);
_EnvHorizontalName := x; _EnvVerticalName := y;
ell := x^2/a^2+y^2/b^2 = 1;
a := 5; b := 3; alpha := (1/6)*Pi; p := sqrt(a^2*b^2/(a^2+b^2));
PQ := x*cos(alpha)+y*sin(alpha)-p; drPQ := solve(PQ, y);
OPQ := x^2/a^2+y^2/b^2-((x*cos(alpha)+y*sin(alpha))/p)^2;
sol := solve({OPQ, ell}, {x, y}, explicit); P := [subs(sol[1], x), subs(sol[1], y)]; Q := [subs(sol[3], x), subs(sol[3], y)];
O := [0, 0];
Ell := implicitplot(ell, x = -a .. a, y = -b .. b, color = red);
DrOPQ := implicitplot(OPQ, x = -a .. a, y = -b .. b, color = magenta, numpoints = 5000);
DrPQ := plot(drPQ, x = -6 .. 6, color = green);
line(OP, 2*x-y); line(OQ, -(1/2)*x-y);

Points := pointplot([O[],P[],Q[]], symbol = solidcircle, color = red, symbolsize = 10):

T := textplot([[O[], "O"],[P[],"P"],[Q[],"Q"]], font = [times, 15], align = {below, right}):
cir := x^2+y^2 = p^2;
Cir := implicitplot(cir, x = -a .. a, y = -b .. b, color = black);
display([Ell, Cir, DrPQ, DrOPQ, Points, T], view = [-6 .. 6, -4 .. 6], axes = normal, scaling = constrained);
Fig := proc (k) local alpha, PQ, drPQ, DrPQ, OPQ, DrOPQ, sol, P, Q, Points, T; global a, b, p, ell, Ell, Cir; alpha := k; PQ := x*cos(alpha)+y*sin(alpha)+p; drPQ := solve(PQ, y); OPQ := x^2/a^2+y^2/b^2-(x*cos(alpha)+y*sin(alpha))^2/p^2; sol := solve({ell, OPQ}, {x, y}, explicit); P := [subs(sol[1], x), subs(sol[1], y)]; Q := [subs(sol[3], x), subs(sol[3], y)]; Points := pointplot([P[], Q[]], symbol = solidcircle, color = red, symbolsize = 10);
T := textplot([[P[], "P"], [Q[], "Q"]], font = [times, 15], align = {below, right}); DrPQ := plot(drPQ, x = -6 .. 6, color = green);µ DrOPQ := implicitplot(OPQ, x = -a .. a, y = -b .. b, color = magenta, numpoints = 5000);
display([Ell, Cir, DrPQ, DrOPQ, Points, T], view = [-a .. a, -b .. b], axes = normal, scaling = constrained) end proc;

Fig((1/4)*Pi);
Error, (in Fig) invalid subscript selector
nframes := 100; plots:-display([seq(Fig(2*Pi*i/nframes), i = 0 .. nframes)], insequence, scaling = constrained);
Error, (in Fig) invalid subscript selector
Explore(Fig(n), n = 0 .. 2*Pi);

## How to find out f'(x,t) and f''(x,t) values...

Dear maple users,

In this code, how to find out the f'(x,t) and f''(x,t) values.
How to export the computed values in the excel file.JVB.mw

 > restart:
 > with(PDEtools):
 > with(plots):
 > fcns := {f(x,t)};
 (1)
 > ra:=2:b1:=1.41:na:=0.7:we:=0.5:eta[1]:=4*0.1:d:=0.5/1:xi:=0.1:m:=na:ea:=0.5:pr:=21: gr:=0.1:
 > R:=0.9323556933;
 (2)
 > PDE1 :=ra*(diff(f(x,t),t))=+b1*(1+ea*cos(t))+(1/(R^2))*((diff(f(x,t),x,x))+(1/x)*diff(f(x,t),x));
 (3)
 > IBC := {D[1](f)(0,t)=0,f(1,t)=0,f(x,0)=0};
 (4)
 > sol :=  pdsolve({PDE1}, IBC, numeric,spacestep = 0.025, timestep=0.0001) ;
 (5)
 > sol:-plot[display](f(x, t), t = 1.2, linestyle = "solid", title = "Velocity Profile", labels = ["r", "f"]);
 >