MaplePrimes Questions

I am trying to write a code to calculate, for a given prime p the string length k of the repunit

R_k=1111111....1111 (with k 1s) such that the number R_kpR_k is prime.  

Example: If p=59, then k=42 is the smallest k such that R_k59R_k is prime. Note that for some primes it can be shown that no such k exists (2,11,37,101..)

I can usually figure out from the factor cycle of a “repunit wrapped” prime whether such a k exists or not. But if the indications are that a k does exist then finding it is very time consuming. Eg for p =71, 167. 

 

What i want to do, for given p is set an upper limit N for k then check to see if R_kpR_k is prime for values of k from 1 to N

The bit I can’t handle is expressing the “wrapped” number for a given p and k, and also indexing from k to k+1, until N is reached or a prime found.

Any assistance gratefully received.

Best regards

David.

 

 

 

 

 

If worksheet execution was started and computer is locked before execution ends, Maple will stop responding and all work is lost. Execution of whole worksheet takes very long time, sometimes over 3 hours, so "do not lock computer during execution" is not solving the problem.

Dear All,
Perhaps my question is basic question, but I want to know more about LPSolve
Is it possible to join 2 solutions from different LPSolve?

For example, I have 2 solutions,
Sol[1] := [72.011122301, [t[4] = -.500000000000000, t[13] = .500000000000000, x[1, 4] = 1, x[1, 13] = 0, x[4, 1] = 0, x[4, 13] = 1, x[13, 1] = 1, x[13, 4] = 0]];
Sol[2] := [53.128387340, [t[6] = -2.00000000000000, t[7] = 0., t[8] = -.999999999999999, x[1, 6] = 1, x[1, 7] = 0, x[1, 8] = 0, x[6, 1] = 0, x[6, 7] = 0, x[6, 8] = 1, x[7, 1] = 1, x[7, 6] = 0, x[7, 8] = 0, x[8, 1] = 0, x[8, 6] = 0, x[8, 7] = 1]].

What I want to achieve is following:

(1) eliminating t variable and join those solution (all values of x). Thus, I got [ x[1, 4] = 1, x[1, 13] = 0, x[4, 1] = 0, x[4, 13] = 1, x[13, 1] = 1, x[13, 4] = 0,x[1, 6] = 1, x[1, 7] = 0, x[1, 8] = 0, x[6, 1] = 0, x[6, 7] = 0, x[6, 8] = 1, x[7, 1] = 1, x[7, 6] = 0, x[7, 8] = 0, x[8, 1] = 0, x[8, 6] = 0, x[8, 7] = 1]].
(2) Extracting the value of X. I know that sol[1][2] indicates the values of right hand side. But I want to get the value of each of x in sequence.
for example: I can get x[1,2]=1, x[1,8]=0, x[7,1]=0 and so on.
In this case, Maybe I can use
eval(x[1,8],sol[1]) for specific x.
But is there any nice way to get all values of x with some procedures?
 

Thanks for reading

 

What are the most efficient way to write and evaluate a procedure in maple? Thank you.

Dear sir,

I am using the Maple to solve pde equations but I am not getting analytical solutions for some of the equations. Can you please help me on how to solve one of the pde, like as I have 

(sin(theta)^2*(diff(a(r, theta), r, r))+cos(theta)^2*(diff(a(r, theta), r))/r-sin(2*theta)*(diff(a(r, theta), theta))/r^2+sin(2*theta)*(diff(a(r, theta), theta, r))/r+cos(theta)^2*(diff(a(r, theta), theta, theta))/r^2)*`α__d`^2+cos(theta)^2*(diff(a(r, theta), r, r))+sin(theta)^2*(diff(a(r, theta), r))/r+sin(2*theta)*(diff(a(r, theta), theta))/r^2-sin(2*theta)*(diff(a(r, theta), theta, r))/r+sin(theta)^2*(diff(a(r, theta), theta, theta))/r^2 = 0

this equation is in polar corrdinates, this is analogous to diff(a(x, y), x, x)+`α__d`^2*(diff(a(x, y), y, y)) = 0

 

in cartesian coordinates

Duo:=proc(a)  #a nombre congruent connu
local u,v,n,m,k,t:
t:=8000:
for m to t do
  for n to m do
    if (igcd(m,n)=1 and m>n) then
      u:=(m^2-n^2-2*m*n)^2:v:=(m^2+n^2)^2:
      k:=op(2,sqrt(v-u))^2: # k nombre congruent réduit
        if k=a then return (m,n): break 
        elif n=t then break fi:
    fi:
  od:
od:
end:

Duo(30);
                              3, 2
Duo(1794);
                             26, 23
Duo(6);
                              2, 1
u, v, w sont des carrés en progression arithmétique dont la raison est un nombre congruent
Procédure permettant de trouver un triplet pythagoricien primitif correspondant au nombre congruent a connu
TriPy:=proc(m,n)# triangles pythagoriciens
local a,a1,b1,c1,d,k,q,u,v,w:
 if (igcd(m,n)=1 and m>n) then
 u:=(m^2-n^2-2*m*n)^2:v:=(m^2+n^2)^2:w:=(m^2-n^2+2*m*n)^2:
 a:=(op(2,sqrt(v-u)))^2:#nombre congruent réduit
 a1:=2*m*n:b1:=(m^2-n^2):c1:=m^2+n^2:
 q:=sqrt((v-u)/a)/2:#rapport de réduction
 print(a1/q,b1/q,c1/q):fi
end:
TriPy(Duo(34));
                              17  145
                          24, --, ---
                              6    6 

TriPy(Duo(39));
                          156  5  313
                          ---, -, ---
                           5   2  10 

TriPy(Duo(111));
                         444  35  1513
                         ---, --, ----
                         35   2    70 
TriPy(Duo(1794));
                         1196      1205
                         ----, 21, ----
                          7         7  
TriPy(Duo(23));don't work, "part dans les choux"

Hi, how can you in maple take the derivitve of a function that consists of sum terms in it? (preferable in document mode)

For example I have this expression (from a math book):

f = N+k*(sum(ln(x__i-B), i = 1 .. N))-N*k*(sum((x__i-B)^k*ln(x__i-B), i = 1 .. N))/(sum((x__i-B)^k, i = 1 .. N))

What I then want to do is to derive this function with respect to k.
However just writing the expression like above it seems like mable doesn't keep the summation terms but evaluates them in a sense. So not sure how to set it up correctly in order to make the derivitive.

Taking the derivitive of f with respect to k, the solution should give something like this:

 

 

How  I can use from equations 1-6 and repleacing them into equation 7 to remove qx,qy,qz?

Thank you

simpl2.mw
 

A := q__x(x, y, z, t)+`τ__q`*(diff(q__x(x, y, z, t), t))+(1/2)*`τ__q`^2*(diff(q__x(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), x))-k*`τ__T`*(diff(T(x, y, z, t), x, t))-(1/2)*k*`τ__T`^2*(diff(T(x, y, z, t), x, t, t))
NULL

q__x(x, y, z, t)+tau__q*(diff(q__x(x, y, z, t), t))+(1/2)*tau__q^2*(diff(diff(q__x(x, y, z, t), t), t)) = -k*(diff(T(x, y, z, t), x))-k*tau__T*(diff(diff(T(x, y, z, t), t), x))-(1/2)*k*tau__T^2*(diff(diff(diff(T(x, y, z, t), t), t), x))

(1)

A__x := diff(A, x)

diff(q__x(x, y, z, t), x)+tau__q*(diff(diff(q__x(x, y, z, t), t), x))+(1/2)*tau__q^2*(diff(diff(diff(q__x(x, y, z, t), t), t), x)) = -k*(diff(diff(T(x, y, z, t), x), x))-k*tau__T*(diff(diff(diff(T(x, y, z, t), t), x), x))-(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), x), x))

(2)

NULL

B := q__y(x, y, z, t)+`τ__q`*(diff(q__y(x, y, z, t), t))+(1/2)*`τ__q`^2*(diff(q__y(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), y))-k*`τ__T`*(diff(T(x, y, z, t), y, t))-(1/2)*k*`τ__T`^2*(diff(T(x, y, z, t), y, t, t))

q__y(x, y, z, t)+tau__q*(diff(q__y(x, y, z, t), t))+(1/2)*tau__q^2*(diff(diff(q__y(x, y, z, t), t), t)) = -k*(diff(T(x, y, z, t), y))-k*tau__T*(diff(diff(T(x, y, z, t), t), y))-(1/2)*k*tau__T^2*(diff(diff(diff(T(x, y, z, t), t), t), y))

(3)

B__y := diff(B, y)

diff(q__y(x, y, z, t), y)+tau__q*(diff(diff(q__y(x, y, z, t), t), y))+(1/2)*tau__q^2*(diff(diff(diff(q__y(x, y, z, t), t), t), y)) = -k*(diff(diff(T(x, y, z, t), y), y))-k*tau__T*(diff(diff(diff(T(x, y, z, t), t), y), y))-(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), y), y))

(4)

NULL

C := q__z(x, y, z, t)+`τ__q`*(diff(q__z(x, y, z, t), t))+(1/2)*`τ__q`^2*(diff(q__z(x, y, z, t), t, t)) = -k*(diff(T(x, y, z, t), z))-k*`τ__T`*(diff(T(x, y, z, t), z, t))-(1/2)*k*`τ__T`^2*(diff(T(x, y, z, t), z, t, t))

q__z(x, y, z, t)+tau__q*(diff(q__z(x, y, z, t), t))+(1/2)*tau__q^2*(diff(diff(q__z(x, y, z, t), t), t)) = -k*(diff(T(x, y, z, t), z))-k*tau__T*(diff(diff(T(x, y, z, t), t), z))-(1/2)*k*tau__T^2*(diff(diff(diff(T(x, y, z, t), t), t), z))

(5)

C__z := diff(C, z)

diff(q__z(x, y, z, t), z)+tau__q*(diff(diff(q__z(x, y, z, t), t), z))+(1/2)*tau__q^2*(diff(diff(diff(q__z(x, y, z, t), t), t), z)) = -k*(diff(diff(T(x, y, z, t), z), z))-k*tau__T*(diff(diff(diff(T(x, y, z, t), t), z), z))-(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), z), z))

(6)

NULL

expand(simplify(-A__x-B__y-C__z+Q = rho*c__p*(diff(T(x, y, z, t), t))))

(-(diff(q__x(x, y, z, t), x))-tau__q*(diff(diff(q__x(x, y, z, t), t), x))-(1/2)*tau__q^2*(diff(diff(diff(q__x(x, y, z, t), t), t), x))-(diff(q__y(x, y, z, t), y))-tau__q*(diff(diff(q__y(x, y, z, t), t), y))-(1/2)*tau__q^2*(diff(diff(diff(q__y(x, y, z, t), t), t), y))-(diff(q__z(x, y, z, t), z))-tau__q*(diff(diff(q__z(x, y, z, t), t), z))-(1/2)*tau__q^2*(diff(diff(diff(q__z(x, y, z, t), t), t), z))+Q = k*(diff(diff(T(x, y, z, t), x), x))+k*tau__T*(diff(diff(diff(T(x, y, z, t), t), x), x))+(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), x), x))+k*(diff(diff(T(x, y, z, t), y), y))+k*tau__T*(diff(diff(diff(T(x, y, z, t), t), y), y))+(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), y), y))+k*(diff(diff(T(x, y, z, t), z), z))+k*tau__T*(diff(diff(diff(T(x, y, z, t), t), z), z))+(1/2)*k*tau__T^2*(diff(diff(diff(diff(T(x, y, z, t), t), t), z), z))+Q) = rho*c__p*(diff(T(x, y, z, t), t))

(7)

NULL

``


 

Download simpl2.mw

 

with(plots);
for x to 10 do Disp[x] := plot([x+cos(a), sin(a), a = 0 .. 2*Pi], colorscheme = ["Red", "Green"]) end do;

display(seq(Disp[i], i = 1 .. x-1), insequence = true, scaling = constrained);
 

What coding in the color or colorscheme parameter in the plot command above would rotate the circle's colors in conjunction with the circle's movement along the x axis to give the appearance of a rolling wheel? 

I am submitting a maple job written in vim editor through windows 10 command line. but no result is obtained.I found maple gui version hang most of the time. So i decided to submit through command line by writing codes using an editor. Thank you

I'm trying to plot a function involving exp but keep getting warnings.

How can i avoid this?

plot(2*cos(t)/sqrt((1+exp(-eps*t))*(4/a^2-1)))

but getting the warning message

"Warning, unable to evaluate the function to numeric values in the region; complex values were detected"

I have made a document to give the results for a problem in table form and graph form.

The tables work out well. The graph results also come out well when I have that section alone in the document. But it does not give the updated curve here. Please correct me where I made mistake.
 

``

 

 

restart

 

Cost in $:     

Present Value:   

Interest in % per year:         ``

``

 Period in years:  

````

``

Additional Months

``

 

 

NULL

NULL

 

Principal $

NULL

Interest % per year

NULL

Year

Present value at the year end

0

``

1

``

2

``

3

``

4

``

5

``

 

 

 

UpdateExpr procedure does not update equation, instead turns out a value on LHS

 

 

Cost:  

Interest % per year (float)  

``

``

 

 

 

``

NULL


Startup Code Region contains all the codes.

Download Doubt_x_symbolic_required.mw

Thanks.

​​​​

RC-Circuit:         (dv_c)/dt=((V(t)-v_c ))/RC 

 

Assume thatV(t)=2 cos⁡(3t),R=4 ,C=0.5 . Use Euler’s method with a step size ofΔt=0.1to approximate the solution of IVP with initial conditionv_c (0)=2over the interval0≤t≤10 .

I can't find anything online on how to use Maple to solve this question, I have attempted it but want to make sure I did it correctly. 

 

Use Maple to plot the approximate solution, the slope field, and (if possible) the exact solution on the same axes. Also compute the error between the approximate solution obtained from Euler’s Method and the exact solution at the right end-point of the given interval.

 1.      dy/dt=(3-y)(y+1)   ,   y(0)=4 ,        0≤t≤5 ,        Δt=1.0

 

 

LP_Matrix.pdf

Hello!

I'm missing something basic here, I'm sure, and would love to know how to proceed.

I have extracted solutions to a particular optimization problem using LPSolve and have obtained the binary solutions in matrix form, for matrices, say .. X and Y.

The solutions are obtained using the routine in the attached pdf; these outputs are sufficient for the basic problem.

Now, I wish to use directed graphs to illustrate the solutions, so I need to take the output matrices to draw the graphs. However, I cannot seem to find a way to do this. The solutions are given, in this case, by 'X' and 'Y'. 

Can anyone advise me on how to extract the matrices that can be used to draw the graphs using with(Graph Theory)?

Thanks in advance ...

First 719 720 721 722 723 724 725 Last Page 721 of 2434