MaplePrimes Questions

Hi everyone,

I'm trying to define indexed functions inside a for loop. However, after the loop is completed, the indexes of the functions are replaced by the índex of the control variable of the loop plus one. For example, I can make successfully the code:

for i from 1 to n do a[i] := b[i]; od;

However, if I try to define the functions a[i](u), through the code 

for i from 1 to n do a[i] := u-> b[i](u); od;

 I get wrong assignments. For example, Maple returns to me, for any i<=n, a[i](u) = b[n+1](u). 

I'm using Maple 2019 on Windows. Is this a bug? There is a right way to do these function assignments inside a loop?

Best regards for all,

R. S. Vieira.

In a new worksheet

gcd(a,b);
                               1

 

Why is maple computing this? It does it for a lot of functions and I never know if it is giving the correct results. a and be are not defined. I'd expect it to just return gcd(a,b).

 

I put it in formulas but I never know if it is simplifying before computing. I have no idea why. Maple never did this stuff until I upgraded.

 

 

maple save variables is greyed out  would anyone happen to know why this could be the case?

                       tmmp := [1, 10 q]
                            PS1 := 1
                          PS2 := 10 q
                           [1, 10 q]
                        tnmp := [8, 5 q]
                            QS1 := 8
                           QS2 := 5 q

 

gP, gQ, S1, S2, P1, P2, Q1, Q2

(q*x + 9*q + y)^33*(4*q*x + 6*q + y)^16/((x + 3)^48*(x + 10)), (q*x + 9*q + y)^33*(4*q*x + 6*q + y)^16/((x + 3)^48*(x + 10)), 8, 6*q, 1, q, 1, -10*q    

Normal(Eval(gP, {x = QS1, y = QS2})*Eval(gQ, {x = S1, y = -S2})*1/(Eval(gP, {x = PS1, y = PS2})*Eval(gQ, {x = S1, y = -S2}))) mod p;
Error, (in mod/Normal) invalid arguments or not implemented
 

Hello people in mapleprimes,

I could modify an expression e_n_1b to simpler e_n_1e as is in attached file.
Is there any other way to change e_n_1b into e_n_1e?

Dec_22.mw

Thank you in advance.

taro

 

P1 := 1;
Q1 := 1;
P2 := q;
Q2 := -10*q;
p - 11;
                            P1 := 1
                            Q1 := 1
                            P2 := q
                          Q2 := -10 q
                               0
NULL;
if Q2 = P2 mod p then
    return 42;
else
    return 0;
end if;
(P2 - Q2) mod p;
                               0

I don't know why but   (p=11)   here the code below does not return 42  and 

evalb(Q2 = P2 mod p);      returns
                             false   

I am trying to find 6 unknowns A, B, C, L, E, and F and have managed to write down a system of 6 equations involving these unknowns.  However, the equations are long and which I try to put the system together and solve with solve(sys, {A, B, C, E, F, L}) it says `[Length of output exceeds limit of 1000000]`.  Although the equations are long, I feel like something must be going wrong as the output cannot be that long.  The equations are:

C = (((h/(4*Pi*K)*H*e^(-k*h)*I/k - k*h^2/2 + H*A*e^(-k*h)*I/(K*k^2) - B*h - sqrt(Pi/2)*h/(2*Pi)*H*e^(-k*h)*I + sqrt(Pi/2)*K*k*h - sqrt(Pi/2)*H*A*e^(-k*h)*I/k + sqrt(Pi/2)*B*K - sqrt(Pi/2)*K*H*k*h^2*I/2) + sqrt(Pi/2)*H*A*e^(-k*h)*I/k) - sqrt(Pi/2)*H*F*h*K*I - sqrt(Pi/2)*H*A*e^(-k*h)*I/k + sqrt(Pi/2)*K*H*k*h^2/2*I) - sqrt(Pi/2)*H*F*h*K*I,

E = (((h/(4*Pi*K)*J*e^(-k*h)*I/k - k*h^2/2 + J*A*e^(-k*h)*I/(K*k^2) - L*h - sqrt(Pi/2)*h/(2*Pi)*J*e^(-k*h)*I + sqrt(Pi/2)*K*k*h - sqrt(Pi/2)*J*A*e^(-k*h)*I/k + sqrt(Pi/2)*L*K - sqrt(Pi/2)*K*J*k*h^2*I/2) + sqrt(Pi/2)*J*A*e^(-k*h)*I/k) - sqrt(Pi/2)*J*F*h*K*I - sqrt(Pi/2)*J*A*e^(-k*h)*I/k + sqrt(Pi/2)*K*J*k*h^2/2*I) - sqrt(Pi/2)*J*F*h*K*I

0 = -H*(k*z^2/2 - H*A*e^(-k*z)*I/(K*k^2) + B*z + C)*I - J*(k*z^2/2 - J*A*e^(-k*z)*I/(K*k^2) + L*z + E)*I + k*z + A*e^(-k*z)/K + F

0 = ((-H*A*e^(-k*z)*I - H*I*(-2*K*(-H*k*z^2*I/2 - H^2*A*e^(-k*z)/(K*k^2) - H*B*z*I - H*C*I)) - J*I*(-2*K*1/2*(((-J*k*z^2*I/2 - J*H*A*e^(-k*z)/(K*k^2) - J*B*z*I - J*C*I - H*k*z^2*I/2) - J*H*A*e^(-k*z)/(K*k^2)) - H*L*z*I - i*H*E)) - K*k) + H*A*e^(-k*z)*I) + K*H*z*k*I + H*A*e^(-k*z)*I + K*H*F*I

0 = ((-J*A*e^(-k*z)*I - H*(((K*J*k*z^2*I/2 + J*H*A*e^(-k*z)/k^2 + K*J*B*z*I + k*h*K*z^2*I/2) + J*H*A*e^(-k*z)/k^2) + K*H*L*z*I + K*H*E*I)*I - J*I*(-2*K*(-J*k*z^2*I/2 - J^2*A*e^(-k*z)/(K*k^2) - J*L*z*I - J*E*I)) - K*k) + J*A*e^(-k*z)*I) + K*J*z*k*I + J*A*e^(-k*z)*I + K*J*F*I

0 = (-k*A*e^(-k*z) - H*I*(-2*K*1/2*(((k*z + H*A*e^(-k*z)*I/(K*k) + B - H*k*z^2*I/2) + H*A*e^(-k*z)*I/(K*k)) - H*F*z*I - H*G*I)) - J*I*(-2*K*1/2*(((k*z + J*A*e^(-k*z)*I/(K*k) + L - J*k*z^2*I/2) + J*A*e^(-k*z)*I/(K*k)) - J*F*z*I - J*G*I)) - 2*K*k) + 2*k*A*e^(-k*z)

where h takes a constant value, H and J are constants, k is the square root of H^2 + J^2, I is the imaginary unit, and z also takes some value as a parameter.

I'm new to maple and numerical analysis in general and I have a problem, I'm not sure how to assign variables into a function with the submethod rk4, the equation is very simple:

dy/dx=10(y-a)/b, where a and b serve as functions of x, and are given different values with the change of x.How do I assign these values?

Thanks.

 

Error, invalid subscript selector
WeilP:
   7       PS1 := temp[1];
============================================

WeilP:=proc(m, P1, P2, Q1, Q2, f, p) 
local S1, S2, gP, gQ, temp, PS1, PS2, QS1, QS2;
    if [P1,P2] = [Q1, Q2] mod p then
        return 1 ;
        else  
            # [S1, S2] := EAdd( f, x, P1, P2, Q1, Q2); 
            temp := EAdd( f, x, p, P1, P2, Q1, Q2);
            S1:= temp[1];
            S2:=temp[2];
        temp := EAdd( f, x, p, P1, P2, S1, -S2);   #represents P-S  
            PS1:= temp[1];
            PS2:=temp[2];
        temp := EAdd( f, x, p, Q1, Q2, S1, S2);    #Q+S
        QS1:=temp[1];
        QS2:=temp[2];
    #        gP:=Weil( m, P1,P2, f, p ); 
    #        gQ:=Weil( m, Q1,Q2, f, p );
    return 0
#    return Normal(  ( Eval(gP, { x=QS1, y=QS2 } ) * Eval(gQ, {x=S1, y= -S2} ) )  / ( Eval(gP, { x=PS1, y=PS2 } ) * Eval(gQ, {x=S1, y= -S2} ) )   )  mod p;    # ( f_P(Q+S) f_Q(-S)  ) / ( f_Q(P-S) f_P(S)  )
    end if ;

Here EAdd is elliptic curve addition   

I tried evaluating the code outside the code edit region and it seemed to work okay  temp ends up being the vector 

p.s. how do I get maple to save the values of a procedure rather than deleting them? 

how do I view variable values during debugging? 

 

How do I get the line number of where the error occurred? 
The errors messages in maple tell you nothing.

p.s. How do I get the debugger to keep the display of code after it hits an error? 
 Where does the copy results on exit copy to? 
How do I know where I am in the code? (e.g. the matlab debugger just goes into the code you wrote  but when do outfrom it's not clear where I am now  )
How do I view variable values whilst debugging? How do I quit the debugger and save variables?  Can I set a procedure to quit and return variables? 

can I set a break in a procedure to quit and keep variable values?

I have 4 ode equations. i just want to know can i use any option or simplification to have a analytical solution or NOT? Thanks in Advance

 

``

restart:

ode1 := -2*diff(lambda(t),t)*y1(t) - lambda(t)*diff((y1)(t),t)-0*diff(eta(t),t) - diff((y1)(t),t$3) + diff((y1)(t),t)*(y1(t)^2 + y2(t)^2) +4*y1(t)*sqrt(y1(t)^2 + y2(t)^2)*diff(sqrt(y1(t)^2 + y2(t)^2),t)+diff((y1)(t),t)/r^2
+ y1(t)^2*diff(y1(t),t) + y1(t)*y2(t)*diff(y2(t),t) - 2*diff(y1(t),t)/r^2 ;

 

-2*(diff(lambda(t), t))*y1(t)-lambda(t)*(diff(y1(t), t))-(diff(diff(diff(y1(t), t), t), t))+(diff(y1(t), t))*(y1(t)^2+y2(t)^2)+2*y1(t)*(2*y1(t)*(diff(y1(t), t))+2*y2(t)*(diff(y2(t), t)))-(diff(y1(t), t))/r^2+y1(t)^2*(diff(y1(t), t))+y1(t)*y2(t)*(diff(y2(t), t))

(1)

ode2 := diff((lambda)(t),t$2) + lambda(t)*(y1(t)^2 + y2(t)^2) - 2*y1(t)*diff((y1)(t),t$2) - y1(t)^2*(y1(t)^2 + y2(t)^2) - y1(t)^2/r^2 - diff((y1)(t),t)^2 - 2*diff(sqrt(y1(t)^2 + y2(t)^2),t)^2 - 2*sqrt(y1(t)^2 + y2(t)^2)*diff(sqrt(y1(t)^2 + y2(t)^2),t$2) - diff((y2)(t),t)^2 - 2*y2(t)*diff((y2)(t),t$2) - y2(t)^2*(y1(t)^2 + y2(t)^2)

diff(diff(lambda(t), t), t)+lambda(t)*(y1(t)^2+y2(t)^2)-2*y1(t)*(diff(diff(y1(t), t), t))-y1(t)^2*(y1(t)^2+y2(t)^2)-y1(t)^2/r^2-(diff(y1(t), t))^2-(1/2)*(2*y1(t)*(diff(y1(t), t))+2*y2(t)*(diff(y2(t), t)))^2/(y1(t)^2+y2(t)^2)-2*(y1(t)^2+y2(t)^2)^(1/2)*(-(1/4)*(2*y1(t)*(diff(y1(t), t))+2*y2(t)*(diff(y2(t), t)))^2/(y1(t)^2+y2(t)^2)^(3/2)+(1/2)*(2*(diff(y1(t), t))^2+2*y1(t)*(diff(diff(y1(t), t), t))+2*(diff(y2(t), t))^2+2*y2(t)*(diff(diff(y2(t), t), t)))/(y1(t)^2+y2(t)^2)^(1/2))-(diff(y2(t), t))^2-2*y2(t)*(diff(diff(y2(t), t), t))-y2(t)^2*(y1(t)^2+y2(t)^2)

(2)

ode3 := 2*diff((lambda)(t),t)*y2(t) + lambda(t)*diff((y2)(t),t) - y1(t)*y2(t)*diff((y1)(t),t) - 4*y2(t)*sqrt(y1(t)^2 + y2(t)^2)*diff((sqrt(y1(t)^2 + y2(t)^2)),t) - y2(t)^2*diff((y2)(t),t) - (y1(t)^2 + y2(t)^2)*diff((y2)(t),t) - diff((y2)(t),t$3) ;

2*(diff(lambda(t), t))*y2(t)+lambda(t)*(diff(y2(t), t))-y1(t)*y2(t)*(diff(y1(t), t))-2*y2(t)*(2*y1(t)*(diff(y1(t), t))+2*y2(t)*(diff(y2(t), t)))-y2(t)^2*(diff(y2(t), t))-(y1(t)^2+y2(t)^2)*(diff(y2(t), t))-(diff(diff(diff(y2(t), t), t), t))

(3)

ode4 := lambda(t)*y1(t)/r + mu(t)*r - diff((y1)(t),t$2)/r -1/r*y1(t)*(y1(t)^2 + y2(t)^2) - y1(t)/r^3-2/r*diff(y1(t),t$2)

lambda(t)*y1(t)/r+mu(t)*r-3*(diff(diff(y1(t), t), t))/r-y1(t)*(y1(t)^2+y2(t)^2)/r-y1(t)/r^3

(4)

sys := [ode1, ode2, ode3, ode4]:

dsolve(sys,[y1(t),y2(t),lambda(t),mu(t)],'implicit')

``

``


 

Download 1.1.mw

###(*         test code 
test:=proc(aa,bb)

P1:=1; 
P2:=2;  

    P1:=aa; 
    P2:=bb;
 
f:=x^3+x+2;
p:=13; 
k:=2;
tmp:=field(p,k);
q:=tmp[1];
Po:=tmp[2];
L1:=P1; 
L2:= P2;
m:=1; 
while (L1 <> infinity) and (m < 25 ) do
temp:= EAdd(f, x, p, P1,P2,L1,L2) ;
L1:=temp[1];
L2:=temp[2];
m:=m+1;
end;

return 0;
end proc ;
#    *)


stopat(test, 24);

Error, (in stopat) statement number out of range  

Line 24 is the line after m:=m+1 so why is it out of range???

Hello,

I have the following expression

Ve*k21*ke*x1+Ve*k21*x1^2+k12*ke^2*x1[t]+2*k12*ke*x1*x1[t]+k12*x1^2*x1[t]+k21*ke
^2*x1[t]+2*k21*ke*x1*x1[t]+k21*x1^2*x1[t]+Ve*ke*x1[t]+ke^2*x1[t,t]+2*ke*x1*x1[t
,t]+x1^2*x1[t,t]


and I want to convert it to

x1[t,t]*(x1+ke)^2+(k12+k21)*x1[t]*(x1+ke)^2+Ve*x1[t]*ke+(k21*Ve)*x1*(x1+ke)

 

How can I do this opperation? This is just a simple example of a more general problem I am facing. Thanks in advance for your help

In graph theory, the crossing number cr(G) of a graph G is the lowest number of edge crossings of a plane drawing of the graph G. I'd like to use maple to compute crossing number of some graphs (any graphs is ok,  for example: cr(K5)=1 ). Someone can help me ? thanks. 

I know the problem of computing the crossing number is NP, but I guess we have some good  ways to compute in some small graphs.

First 612 613 614 615 616 617 618 Last Page 614 of 2434