zz123

45 Reputation

3 Badges

2 years, 250 days

MaplePrimes Activity


These are questions asked by zz123

Hi, 

everyone! I want to define a function with a constant (i. e., 1/3 in the following figure). Actually, I tried it by "proc" or "piecewise", but it does not work.  So could you give me some suggestions? Thanks a lot!

g:=proc(n+1/4)
  if (n=0) then 1
    else 0
  end;
end proc;

Hi,

everyone! I want to get a system of equations (Fig. 1). But my result is a table (Fig. 2), so I wonder how to convert a table into a sequence or a system. And I am very sorry that my code is not concise, since I am a beginner. Thank you very much!

Download Equations.mw

Hello everyone,

I want to use "proc" in a program. Although the original code is good for me, I modify it by "proc" to be convenient. Thank you very much!

With regards


clearall;
restart;
Digits := 15;
## Initial polygon
x[1] := [-1, 1/2, 1, 0, -sqrt(2)/2, -1, 1/2, 1, 0, -sqrt(2)/2, -1, 1/2, 1, 0, -sqrt(2)/2];
y[1] := [0, sqrt(3)/2, 0, -1, -sqrt(2)/2, 0, sqrt(3)/2, 0, -1, -sqrt(2)/2, 0, sqrt(3)/2, 0, -1, -sqrt(2)/2];
s2 := [-1, 1/2, 1, 0, -sqrt(2)/2, -1];
t2 := [0, sqrt(3)/2, 0, -1, -sqrt(2)/2, 0];
assign(a[-6] = 13/1296, a[-5] = -11/648, a[-4] = -1/16, a[-3] = -107/1296, a[-2] = 179/1296, a[-1] = 9/16, a[0] = 137/144, a[1] = 137/144, a[2] = 9/16, a[3] = 179/1296, a[4] = -107/1296, a[5] = -1/16, a[6] = -11/648, a[7] = 13/1296);

L := 3;
N := numelems(x[1]);
## Perform k-1 iterative steps
# L--the number of iterations; nk--the number of refined points after k steps;
for k to L do
    nk := 3^(k - 1)*(N - 6) + 6;
    for i from 3 to nk - 2 do
        x[k + 1][3*i - 8] := a[-6]*x[k][i + 2] + a[-3]*x[k][i + 1] + a[0]*x[k][i] + a[3]*x[k][i - 1] + a[6]*x[k][i - 2];
        y[k + 1][3*i - 8] := a[-6]*y[k][i + 2] + a[-3]*y[k][i + 1] + a[0]*y[k][i] + a[3]*y[k][i - 1] + a[6]*y[k][i - 2];
        x[k + 1][3*i - 7] := a[-5]*x[k][i + 2] + a[-2]*x[k][i + 1] + a[1]*x[k][i] + a[4]*x[k][i - 1] + a[7]*x[k][i - 2];
        y[k + 1][3*i - 7] := a[-5]*y[k][i + 2] + a[-2]*y[k][i + 1] + a[1]*y[k][i] + a[4]*y[k][i - 1] + a[7]*y[k][i - 2];
        x[k + 1][3*i - 6] := a[-4]*x[k][i + 2] + a[-1]*x[k][i + 1] + a[2]*x[k][i] + a[5]*x[k][i - 1];
        y[k + 1][3*i - 6] := a[-4]*y[k][i + 2] + a[-1]*y[k][i + 1] + a[2]*y[k][i] + a[5]*y[k][i - 1];
    end do;
end do;
## Plot the result
s1 := evalf(simplify(convert(x[L+1], list))):t1 := evalf(simplify(convert(y[L+1], list))):
f1 := <<s1> | <t1>>: f2 := <<s2> | <t2>>:
plot([f1, f2], linestyle = [1, 3], color = [black, red]);

T5Scheme:=proc(x[1],y[1],L)          
local i,k,nk,result,N,a[-1],a[7],a[6],a[5],a[4],a[3],a[2],a[1],a[0],a[-2],a[-3],a[-4],a[-5];          N:=numelems(x[1]):         
   for k from 1 to L do              
 nk := 3^(k - 1)*(N - 6) + 6;         
     for i from 3 to nk - 2 do            
      x[k + 1][3*i - 8] := a[-6]*x[k][i + 2] + a[-3]*x[k][i + 1] + a[0]*x[k][i] + a[3]*x[k][i - 1] + a[6]*x[k][i - 2];                       y[k + 1][3*i - 8] := a[-6]*y[k][i + 2] + a[-3]*y[k][i + 1] + a[0]*y[k][i] + a[3]*y[k][i - 1] + a[6]*y[k][i - 2];                  x[k + 1][3*i - 7] := a[-5]*x[k][i + 2] + a[-2]*x[k][i + 1] + a[1]*x[k][i] + a[4]*x[k][i - 1] + a[7]*x[k][i - 2];                  y[k + 1][3*i - 7] := a[-5]*y[k][i + 2] + a[-2]*y[k][i + 1] + a[1]*y[k][i] + a[4]*y[k][i - 1] + a[7]*y[k][i - 2];                   x[k + 1][3*i - 6] := a[-4]*x[k][i + 2] + a[-1]*x[k][i + 1] + a[2]*x[k][i] + a[5]*x[k][i - 1];               
    y[k + 1][3*i - 6] := a[-4]*y[k][i + 2] + a[-1]*y[k][i + 1] + a[2]*y[k][i] + a[5]*y[k][i - 1];                   result[1]:=x[L+1]:           result[2]:=y[L+1]            
  end do;          
     end do;  
     return result  
  end proc:

Hello, everyone. I encountered one question on simplification.

I don't know how to plug the conditions

x1^2+y1^2=r^2, x2^2+y2^2=r^2,x3^2+y3^2=r^2,x4^2+y4^2=r^2

and further simplify the formula

4*x1*x2^2*x3 - 4*x1*x2*x3*x4 + 4*x1*x3*y2^2 - 4*x1*x3*y2*y4 - 4*x2^2*x3^2 - 4*x2^2*y2^2 + 4*x2^2*y2*y4 + 4*x2*x3^2*x4 + 4*x2*x4*y2^2 - 4*x2*x4*y2*y4 - 4*x3^2*y2^2 + 4*x3^2*y2*y4 - 4*y2^4 + 8*y2^3*y4 - 4*y2^2*y4^2.

Thank you very much!

Hello, everyone! The following results about r has many. I want to put the results together(assume they are equal to  zero) and solve them. So my questions are how to put the results together and solve them? Thank you very much! And have a good day!

restart; w:=1/(4*(exp(1/2)+exp(-1/2))+2*(exp(1/2)+exp(-1/2))^2): g1:=x->sum(a[i]*x^i,i=0..50): for j from 0 to 50 do r:=(1/2+w)*(g1(j+1)+g1(j))-w*(g1(j-1)+g1(j+2))-g1(2*j+1): end do

Page 1 of 1