MaplePrimes Questions

I'm trying to write a procedure that computes Pollard's P-1 Method for a given integer n, and then outputs the prime factorisation of n.

Here is what I have so far:

Pollard := proc (n)
local i, r, g;
r[1] := `mod`(2^factorial(2), n);
for i from 2 while gcd(`mod`(r[i-1]-1, n), n) = 1 do
r[i] := `mod`(2^factorial(i+1), n) end do;
g[i] := gcd(`mod`(r[i-1]-1, n), n);
if g[i] < n then return g[i]
else return n
end if
end proc;

But my procedure doesn't seem to work for a lot of large values for n.
And also I can't figure out how to make it actually output the factorisation.

Any help would be appreciated.

Maybe this is trivial but could somebody tell me how to get bounds of interval returned by shake? For instance,

shake(sqrt(2)) gives INTERVAL(1.41421356167 .. 1.41421356308), and I would like to store the upper and lower bounds as rational numbers in two variables. 

Hello,

I would like to ask you for your help

I receive this message when trying to export matrix to excel file:

 

> restart; with(ExcelTools); with(LinearAlgebra);

> C := Import("C:/SourceFile.xlsx", "Overview", "AK51:CB94");

> C := convert(C, Matrix);

> B := Import("C:/SourceFile.xlsx", "Overview", "G3:G46");

> B := convert(B, Matrix);

> IM := IdentityMatrix(44, 44);

> NP := 1/(C-IM).(-B);

> NP[6, 1];  //check if there is value. Yes, it works.

> Export(NP, "C:/ResultFile.xlsx", "Sheet1", "A1");

 

Thank you for any help.

I have posted long time ago a patch for Shadebetween and you have transformed it into a hot fix:

http://www.mapleprimes.com/questions/205956-Error-In-Shadebetween

In the last Maple 2015 update, the problem was not fixed.

Just curious: is it fixed in Maple 2016? Because I feel that the Maplesoft team is not "impressed" by such patches.

Edit. This was a comment related to acer's patch for NLPSolve, but it was transformed (I don't know why) into a separate question.

@Carl Love 

i guess that it is this.

actually my goal is 

drawing

 tangent vector field on even-dimensional n-spheres

can vector field plot do this too?

if start from draw vector field on a sphere

 

i find that intersectplot under plot, 

is it possible for fieldplot has this

 

such as the graph in wiki

https://en.wikipedia.org/wiki/Hairy_ball_theorem

 

how draw a line x+y = 1 on a sphere x^2+y^2+z^2 = 1 in maple

Hi guys, I'm currently having a lot of trouble with Maple and can't seem to get stuff to work. I have the task of solving and modelling the Klien Gordon equation, with a chosen potential. The equation I'm trying to solve is:

> KGE := diff(psi(x, t), x, x)-(diff(psi(x, t), t, t))-12*psi(x, t)^5+10*psi(x, t)^4+6*psi(x, t)^3-3*psi(x, t)^2-psi(x, t) = 0   

I'm doing this by changing the pde into an ode via a transformation 

>tr := {t = tau, x = c*tau+z, psi(x, t) = U(z)}

>ode1 := dchange(tr, KGE, [z, tau, U(z)])

 >ode1 := collect(ode1, diff(U(z), z, z))

>c := 1/4

>ode2 := subs({U(z) = U, diff(U(z), z, z) = V(U)*(diff(V(U), U))}, ode1)

>sol := dsolve({ode2, V(0) = 0}, V(U))

>sol1:= sol[2]

>z := -c*t+x = int(1/rhs(sol2), U)

>solwave := psi(x, t) = solve(z, U)

 

I then checked if my solution, solwave actually solved the pde via pdetest(solwave,KGE) and it did. Hence this is what I took as one of the kinks. Although the kink solution looks hideous and I have no idea how to try and take the limit as x goes to infinity, as to show it tends to a vacuum of the potential. I've tried taking the limit but all Maple does is replace all the x with infinity signs... 

I then tried animating it to see if it worked, but it just looks wrong, there are breaks within the curve and also very random spikes which I cannot explain at all.. 

I tried this code exactly for the Sine Gordon equation and it works perfectly, it just all goes wrong when I try to change the potential. 

Here is a picture of the frame: 

as you can see it has spikes.. and breaks in the curve as well

----------------------------------------------------------------------------------------------

Another issue I had was with dealing with the potential on it's own, every time I try inputting  

>1/2(u^2)(1-u)^2(1+2u)^2  

into maple it changes the expression into something completely different and wrong, it somehow comes out with an exponential of 8.. This is what I get:

(1/2)*(u(1-u))(1+2*u)^8

 

----------------------------------------------------------------------------------------------

 

I also have a problem integrating, I try and plug in a value, i.e. 

>int(1/(x(1-x))(1+2*x), x)

but all this does is show me what I inputted but with a integral sign...

I'm very very new to Maple and have spent over a week doing this, but it just isn't working out at all :( Please help!! 

I have studied most posts about plot quality, still confused.

 

When I export 2d graphs and import the to microsoft word, the quality is horrible. How can I presents my results in a reseanably good way? 

what command should I add to my code that the quality increase notoceably? 

Any suggestion about 3d plots? 

If I export as an eps file, how can I import that in microsoft word? I did, but I guess they are not compatibble. 

 

thank you 

Hello, I have a somewhat math and Maple question I'm hoping some can help with.

I have this curve,

curve:=alpha^2*beta^10-alpha^2*beta^9+4*alpha*beta^7-2*alpha*beta^6-2*alpha*beta^5-alpha*beta^4+alpha*beta^3-2*beta+1;

and if I solve this system (numerically);

sol:= solve([curve=0,diff(curve,beta)=0],[alpha,beta]);

I get 6 special points (8 actually but two are critical). So I'll refer to them by subscript "i".

If I then do a coordinate transformation by;

alpha=exp(u)

beta=exp(v)

and convert the 6 coordinates and curve, I'll get everything in terms of (u,v) coordinates.

curve2:=subs([alpha=exp(u),beta=exp(v)],curve);

soluv:=map(ln,sol);  (this is just pseudo - I don't know how to do it this way)

So now the 6 points are referred to by (u_i,v_i).

Next, I want to expand this curve locally around these six points, using the following (where "z" is the local coordinate);

u -> u_i + z^2

v -> v_i + sum(a_j*z^j,j=1..n)

where n is reasonable, though around 15.

curve3(i):=subs(u=z^2 + cat(Ubp,i),curve2);

curve4(i,n):=subs(v=cat(Vbp,i)+sum(a[i,j]*z^j,j=1..n),curve3(i));

Here, I'm not sure of the pros/cons of cat() vs a[i,j]....

 

Anyway, I'll then have an equation in terms of only the local coordinate "z". If I then solve each coefficient of "z", at each order, I should then be able to determine the power series v(z). I reason that since the curve is initially equal to zero, that every non-zero power of z will have a coefficient/equation (in terms of unknowns a[i,j]) that should be equal to zero.

This is analagous to solving differential equations with power series...

 

However, I'm a little lost in implementing this,

I am currently trying, for instance,

l1:= series(curve4(1,10),z,0,9);

e1:= seq(coeff(l1,z,i),i=1..4):

s1:=seq(a[1,j],j=1..4):

sol:=solve(e1,s1);

I believe I am doing something wrong though bcause every odd power is zero.

 

Thank you a lot for any suggestions and/or help,

sbh

PS>

Ubp and Vbp are those 6 points - I just kept them as symbols initially because I was still getting odd-powered coefficients as zero, regardless of their actual values. Hence a little bit of the "math" side of the problem...

Hi;

To compute higher-order lie derivatives we need to pass a vector field to LieDerivative(..) function. What follows is the result of LieDerivative(..) command:

 

To compute 2nd-order lie derivative we should first create a vector field as follows:

L1fh := ((1/2)*(x+u)*(-2*y+2*x)/sqrt((y-x)^2+L^2))*D_x + ((1/2)*(y+v)*(2*y-2*x)/sqrt((y-x)^2+L^2))*D_y + (L^2/sqrt((y-x)^2+L^2))*D_L;

 

Is there a function to extraxt components of an expression which is the result of the LieDerivative(..)? For example how we can extract the first term. i.e. :

 

 

sample code:


with(DifferentialGeometry):


DGsetup([x, y, L], R3);

h := sqrt((y-x)^2 + L^2);
 
f := evalDG((x+u)*D_x + (y+v)*D_y + L*D_L);

L1fh := LieDerivative(f, h);

simplify(L1fh);
       
L2fh := LieDerivative(L1fh, h);


L1fh := ((1/2)*(x+u)*(-2*y+2*x)/sqrt((y-x)^2+L^2))*D_x + ((1/2)*(y+v)*(2*y-2*x)/sqrt((y-x)^2+L^2))*D_y + (L^2/sqrt((y-x)^2+L^2))*D_L;

L2fh := LieDerivative(L1fh, h);


simplify(L2fh);


 

Hi!

In a paper due to Borwein

http://www.cecm.sfu.ca/personal/pborwein/PAPERS/P172.pdf

it is shown a (very beautiful) graph of the zeros of a partial sum of the Zeta-Riemann, where he indicates that the plot is "the normalized zeros of the 5th partial sum of the Zeta function". Somebody know how one can plot this with Maple?

Thank you!

✐♦❝❄t✉⑥♠❧❄❞❢❤❡⑦⑧❛❋⑨⑤⑦⑧❛✯ts❝⑩❦✑❝❄❜❚qs❴❇❛ ✈❇❜❶q✉❴❷♥♦❧❄t✇q✉❤❡❧❄❞★❦sr❇⑥✤❝❄❜✫qs❴❇❛❹❸✫❤❡❛⑧⑥✜❧❺✐❇✐❻⑦⑧❛⑧q✉❧❈❼❽❜❀r❇✐♦♣✒qs❤❡❝❄✐

>teksbiasa:=`Hello!`;

teksbiasa:=Hello!

>nilaiASCII:=convert(teksbiasa,bytes);

nilaiASCII:=[72,101,108,108,111,33]

>E:=nilaiASCII+~nops(nilaiASCII);

E:=[78,107,114,114,117,39]

 

Hi, how i need to modify my command so the length of each word can be detected if enter a sentence instead of 1 word ?

For example, if i entered >> `Hello! Bob`, so the length of each word is [6, 3], so what i need is

 

>teksbiasa:=`Hello! Bob`;

teksbiasa:=Hello! Bob

>nilaiASCII:=convert(teksbiasa,bytes);

nilaiASCII:=[72, 101, 108, 108, 111, 33, 32, 66, 111, 98]

and my E will be >> E:=[72+6, 101+6, 108+6, 108+6, 111+6, 33+6, 32, 66+3, 111+3, 98+3] which is >>

E:= [78, 107, 114, 114, 117, 39, 32, 69, 114, 101]

Thanks for help~=]]
Have a nice day~=]]

 

Hello,

 

I am trying to find the interpolation of a 3D function.

I have the vector x, the vector y and a matrix M at my disposition.
I know how to do the pointplot3d , but I can not find the function: f(x,y) 

any suggestion?

 

Thank you for help

Hello,

 

I tried to rearrange below set of equations to have the equations in term of P[0], P[1], P[2], P[3], P[4], P[5] and P[6]. I used the symbol := for function definition for all Ps except one of them. Thus maple will rearrange that excepted one. However, I got error massage stating "Error, (in P[3]) too many levels of recursion" when I tried to rearranged equations for P[0].

Can I get help to rearranged them. 

P[0](s) = (P[1](s)*mu[1]+P[2](s)*mu[2]+1)/(s+3*lambda+3*sigma)

P[1](s) = (3*P[0](s)*lambda+3*P[3](s)*mu[1]+P[4](s)*mu[2])/(s+mu[1]+2*lambda+2*sigma)

P[2](s) = (3*P[0](s)*sigma+P[4](s)*mu[2]+P[3](s)*mu[1])/(s+mu[2]+2*lambda+2*sigma)

P[3](s) = 2*lambda(P[1](s)+P[2](s))/(s+2*mu[1]+lambda)

P[4](s) = 2*sigma(P[1](s)+P[2](s))/(s+2*mu[2]+sigma)

P[5](s) = lambda(P[3](s)+P[4](s))/s

P[6](s) = sigma(P[3](s)+P[4](s))/s

Thank you for your help

Is it possible to create a sumif function, like the one in excel?

First 1148 1149 1150 1151 1152 1153 1154 Last Page 1150 of 2434