sadeq

20 Reputation

4 Badges

5 years, 249 days

MaplePrimes Activity


These are questions asked by sadeq

can anyone run my code?
please do it and send it for me.
thanks.

restart;
with(plottools): with(LinearAlgebra): with(plots):
ode := `assuming`([diff(Y(X), `$`(X, 2))+2*alpha*(diff(Y(X), X))+beta^2*Y(X) = 0], [alpha >= 0, beta >= 0, alpha+beta > 0]):
F := unapply(solve(subs({X = x, Y(X) = y, diff(Y(X), X) = yp, diff(Y(X), `$`(X, 2)) = yz}, ode), yz), x, y, yp):
Fp := unapply(solve(subs({X = x, Y(X) = y, diff(Y(X), X) = yp, diff(Y(X), `$`(X, 2)) = yz, diff(Y(X), `$`(X, 3)) = yt}, diff(ode, X)), yt), x, y, yp, yz):
Ni := seq(i, i = 0 .. 9), 15, 20:
for ni in Ni do
print(ni);
st := time[real]();
f[0, ni] := F(x[0], y[0, ni], yp[0, ni]);
fp[0, ni] := Fp(x[0], y[0, ni], yp[0, ni], f[0, ni]);
f[1, ni] := F(x[1], y[1, ni], yp[1, ni]);
fp[1, ni] := Fp(x[1], y[1, ni], yp[1, ni], f[1, ni]);
y[2, 0] := y[0, ni]+2*h*yp[0, ni]+(6/5)*f[0, ni]*h^2+(4/15)*fp[0, ni]*h^3+(4/5)*f[1, ni]*h^2+(4/15)*fp[1, ni]*h^3;
yp[2, 0] := yp[0, ni]+2*f[0, ni]*h+(2/3)*fp[0, ni]*h^2+(4/3)*fp[1, ni]*h^2;
for j to ni do
f[2, j-1] := F(x[2], y[2, j-1], yp[2, j-1]);
fp[2, j-1] := Fp(x[2], y[2, j-1], yp[2, j-1], f[2, j-1]);
y[2, j] := y[1, ni]+h*yp[1, ni]+(7/20)*f[1, ni]*h^2+(1/20)*fp[1, ni]*h^3+(3/20)*f[2, j-1]*h^2-(1/30)*fp[2, j-1]*h^3;
yp[2, j] := yp[1, ni]+(1/2)*f[1, ni]*h+(1/12)*fp[1, ni]*h^2+(1/2)*f[2, j-1]*h-(1/12)*fp[2, j-1]*h^2;
end do:
Ms := Matrix(4, 4); Ms[1, 3] := 1; Ms[2, 4] := 1;
y[2, ni] := collect(algsubs(h*alpha = H1, expand(algsubs(h*beta = H2, expand(y[2, ni])))), {y[0, ni], y[1, ni], yp[0, ni], yp[1, ni]});
Ms[3, 1] := coeff(y[2, ni], y[0, ni]);
Ms[3, 2] := coeff(y[2, ni], yp[0, ni])/h;
Ms[3, 3] := coeff(y[2, ni], y[1, ni]);
Ms[3, 4] := coeff(y[2, ni], yp[1, ni])/h;
hyp[2, ni] := collect(algsubs(h*alpha = H1, expand(algsubs(h*beta = H2, expand(h*yp[2, ni])))), {y[0, ni], y[1, ni], yp[0, ni], yp[1, ni]});
Ms[4, 1] := coeff(hyp[2, ni], y[0, ni]);
Ms[4, 2] := coeff(hyp[2, ni], yp[0, ni])/h;
Ms[4, 3] := coeff(hyp[2, ni], y[1, ni]);
Ms[4, 4] := coeff(hyp[2, ni], yp[1, ni])/h;
sol := Eigenvalues(Ms);
print(time[real]()-st);
st := time[real]();
SR[ni, 1] := implicitplot(max(seq(abs(sol[ii]), ii = 1 .. numelems(sol))) <= 1, H1 = 0 .. 3, H2 = 0 .. 3, filledregions, gridrefine = 3, axes = Boxed, view = [-2 .. 3, -3 .. 3], labels = [H[1], H[2]], labeldirections = ["horizontal", "vertical"]);
SR[ni, 2] := implicitplot(max(seq(abs(sol[ii]), ii = 1 .. numelems(sol))) <= 1, H1 = -2 .. 3, H2 = -2 .. 3, gridrefine = 3, axes = Boxed, view = [-2 .. 3, -3 .. 3], labels = [H[1], H[2]], labeldirections = ["horizontal", "vertical"]);
print(time[real]()-st);
end do;
for i in Ni do
i;
display({SR[i, 1], SR[i, 2], line([-1, 0], [3, 0], color = red, linestyle = dash), line([0, -3], [0, 3], color = red, linestyle = dash)});
end do;
display({seq(SR[i, 2], i = 0 .. Ni)});

hello friend

please run this code and resend result to me.

thank you.

 

restart;
with(LinearAlgebra); with(plots);
c[1] := 0; c[2] := 1/2;
a[2, 1] := 1/8;
b[-1] := -1/3; b[1] := 2/3; b[2] := 5/6;
bb[2] := 5/12;
s := 2;
e[1] := Matrix(s+1, 1); e[2] := Matrix(s+1, 1); e[3] := Matrix(s+1, 1); e[4] := Matrix(s+1, 1);
c[0] := 0;
for ii to s+1 do e[1][ii, 1] := 1; e[2][ii, 1] := -1; e[3][ii, 1] := c[ii-1] end do;
e[1][1, 1] := 0; e[2][2, 1] := 0; e[4] := -e[3];
A := Matrix(s+1, s+1);
for i from 3 to s+1 do for j from 2 to i-1 do A[i, j] := a[i-1, j-1] end do; A[i, 1] := A[i, 2] end do;
Id := Matrix(s+1, s+1, shape = identity);
N := Matrix(s+1, s+1);
for i to s+1 do for j to s+1 do N[i, j] := -H*A[i, j]+Id[i, j] end do end do;
Bb := Matrix(s+1, 1);
for i from 3 to s+1 do Bb[i, 1] := bb[i-1] end do;
B := Matrix(s+1, 1);
for i from 2 to s+1 do B[i, 1] := b[i-1] end do; B[1, 1] := b[-1];
Z := Multiply(Transpose(Bb), 1/N);
for i to s+1 do Z[1, i] := H*Z[1, i] end do;
Q := Multiply(Transpose(B), 1/N);
for i to s+1 do Q[1, i] := H*Q[1, i] end do;
Dh := proc (H) options operator, arrow; Matrix([[1+Multiply(Z, e[1]), Multiply(Z, e[2]), 3/2+Multiply(Z, e[3]), -1/2+Multiply(Z, e[4])], [1, 0, 0, 0], [Multiply(Q, e[1]), Multiply(Q, e[2]), 1+Multiply(Q, e[3]), Multiply(Q, e[4])], [0, 0, 1, 0]]) end proc;
k := Matrix(4, 4);
for i to 4 do for j to 4 do if i = j then k[i, j] := ep-Dh(H)[i, j] else k[i, j] := -Dh(H)[i, j] end if end do end do;
sp := unapply(collect(Determinant(k), ep), H, ep);
sol := solve(sp(H, ep), ep, explicit);
sol := simplify(map(allvalues, {sol}));
l := numelems(sol);
inequal({evalc(abs(subs(H = x+I*y, sol[1]))) <= 1, evalc(abs(subs(H = x+I*y, sol[2]))) <= 1, evalc(abs(subs(H = x+I*y, sol[3]))) <= 1, evalc(abs(subs(H = x+I*y, sol[4]))) <= 1}, x = -3 .. 3, y = -3 .. 3, color = "Nautical 1");

 

hello

I have a equation of 4th degree with two variable (x,y) that i want to solve my equation according to one of variable (y).

myeq:= y^4 +(-(5/96)*x^2 -(5/6)*x -2) *y^3 +(-(55/288)*x^2 -(7/12)*x +1) *y^2 +((65/288)*x^2 +(2/3)*x) *y +(5/288)*x^2 -(1/4)*x;

i use "solve(myeq,y)" but can't solve. how can i solve this equation?

hello

i have some implicit plot that i want intersect between them.

for example:


implicitplot(x^2+y^2<1,x=-3..3,y=-3..3);
implicitplot((x-1)^2+y^2<1,x=-3..3,y=-3..3);

how can i do intersect between them!?

thanks for guidance

Hello
I need to plot this region :

Page 1 of 1