MaplePrimes Questions

Hello

1)I need some guides to solve my problem. I have attached my file. Could you please help me to understand what's wrong in my code?

2) Is there any option to pause "Loops" and watching results, something like break point.

THank you.

 

 

restart

 

with(ImageTools):``

with(FileTools):````

Input Section

 

NULL

filelocation := "C:\\Users\\Mohammad\\Desktop\\1.jpg":

k := 1:NULL

 

zimage := Read(filelocation):

zwidth := Width(zimage):NULL

kernel__length := VectorCalculus:-`+`(VectorCalculus:-`*`(2, k), 1):````

kernel__data := `~`[`*`](Matrix(1 .. kernel__length, 1 .. kernel__length, 1), 1/kernel__length^2):

imheight := Height(zimage):``

imwidth := Width(zimage):NULLNULL

Width(zimage, lower):

Width(zimage, upper):

View(zimage):``

new1zpic := Convolution(zimage, kernel__data):

View(new1zpic)``NULL

new2zpic := zimage:

dummy := 0:

"for i from (k+1)  to (Width(zimage,upper)-k) do     for j from (k+1)  to (Height(zimage,upper)-k) do           for m from 1 to kernel[length]  do               for n from 1 to kernel[length]  do                         dummy:=dummy+kernel[data] (m, n)*new2zpic(i+m-2, j+n-2)                                         end do;              end do;                      new2zpic(i,j):=dummy:                   dummy:=0:   end do; end do;"

Error, final value in for loop must be numeric or character

 

 

 

 

NULL

 

Download Exercise_II-1.0.mw

restart

 

with(ImageTools):``

with(FileTools):````

Input Section

 

NULL

filelocation := "C:\\Users\\Mohammad\\Desktop\\1.jpg":

k := 1:NULL

 

zimage := Read(filelocation):

zwidth := Width(zimage):NULL

kernel__length := VectorCalculus:-`+`(VectorCalculus:-`*`(2, k), 1):````

kernel__data := `~`[`*`](Matrix(1 .. kernel__length, 1 .. kernel__length, 1), 1/kernel__length^2):

imheight := Height(zimage):``

imwidth := Width(zimage):NULLNULL

Width(zimage, lower):

Width(zimage, upper):

View(zimage):``

new1zpic := Convolution(zimage, kernel__data):

View(new1zpic)``NULL

new2zpic := zimage:

dummy := 0:

"for i from (k+1)  to (Width(zimage,upper)-k) do     for j from (k+1)  to (Height(zimage,upper)-k) do           for m from 1 to kernel[length]  do               for n from 1 to kernel[length]  do                         dummy:=dummy+kernel[data] (m, n)*new2zpic(i+m-2, j+n-2)                                         end do;              end do;                      new2zpic(i,j):=dummy:                   dummy:=0:   end do; end do;"

Error, final value in for loop must be numeric or character

 

 

 

 

NULL

 

Download Exercise_II-1.0.mw

Hi! I'm having trouble with the MapleSim "Equation Extraction" template. I have an extremely simple dynamics scenario with RigidBody at a particular position in a world; when the simulation starts, the body should simply start fallin with a constant acceleration, and I'm looking to extract kinematic equations for this situation.

However, the problem I have with the extracted equations is that they contain some rotational dependent terms that I wish to avoid - a lot of sines and cosines with arguments that I actually cannot match up to any variables in the model, or when I enable quaternion representation, terms like this:

What I don't understand is what exactly these rotation terms represent. The object should be falling straight downwards, and gravitation should be applied straight downwards, and when I start the simulation it does run through, also indicating that there should be no unbound variables. I'm not sure exactly what parameters in the Modelica model do they correspond to? I did not find any such angles in the object settings. And can I ask MapleSim to generate equations without these unbound rotation variables?

Hello,

I'm a bit lost, cause I Have to programm the "Schema A" from Wu/Sun with Maple. It's about Rebalanced-CRT-RSA, and therefore a key generation algorithm.

Unfortunately I havn't worked with Maple (or similar programms) yet. So if somebody will help me, that would be really kind :)

Here's the Algorithm (Source: Wu/Sun, Design of Rebalanced RSA-CRT for fast Encryption):

Step 1. Randomly select an odd number e of 568 bits.

Step 2. Randomly select a number kp1 of 160 bits, such that gcd(kp1, e) = 1.

Step 3. Based on Theorem 4.1, we can uniquely determine two numbers dp, k_{p1} < dp < 2k_{p1},
and P , e < P < 2e, satisfying ed_p = k_{p1}P + 1.
Step 4. Factor P as P = k_{p2} · p_0 such that k_{p2} is a number of 56 bits and p (= p_0 +1) is a prime
number. If this is infeasible, then go to Step 2.
Step 5. Randomly select a number k_{q1} of 160 bits, such that gcd(k_{q1}, e) = 1.
Step 6. Based on Theorem 4.1, we can uniquely determine two numbers dq, k_{q1} < d_q < 2k_{q1},
and Q, e < Q < 2e, satisfying ed_q = k_{q1}Q + 1.
Step 7. Factor Q as Q = k_{q2} · q_0 such that k_{q2} is a number of 56 bits and q (= q_0 +1) is a prime
number. If this is infeasible, then go to Step 5.
Step 8. The public key is (N, e); the secret key is (d_p, d_q, p, q).

Thank you for any help!

 

Edit2: I'm a fool, the integers arent of the right form, so they're not 568-bit/160-bitform :/

Edit:

I continued tryin, and I think i got at least Step 1-3:

Step 1+2: 


restart; 
with(RandomTools); 
BeidesGCD := proc () 
local a, b, A, B, C; 
global e, kp1; B := proc () 
b := Generate(nonnegint(range = 2^568)) 
end proc; 
while length(b) <> 171 do B() end do; 
while type(b, odd) = false do B() end do; 
A := proc () 
a := Generate(nonnegint(range = 2^160)) 
end proc; 
while length(a) <> 49 do A() end do; 
while gcd(a, b) <> 1 do A() end do; 
e := b; print(b); 
kp1 := a; 
print(a); 
gcd(e, kp1) 
end proc 

and the numbers needed for Step 3:

x := 1/e mod kp1; 
y := (e*x-1)/kp1; 

dp := x+kp1; 
P := y+e; 

 

But the next step causes problems, is it even possible to tell Maple "sth is infeasible"?

f:=sin((x-1)*(y+3))/(exp((x-1)^2+(y+3)^2)-1);
limit(f,{x=1,y=-3});


On running the above code, I don't get a result. I don't understand why, and what are some of the underlying math principles that I would have to use to evaluate the limit of f at (1,-3) if I were to solve this question on paper?

I need to find where the limit of the function:

{1-cos(x*y^3)}/(x^2+y^6)^(1+a) exists/does not exists for different values of a, given 0<=a<=1 and as (x,y)->(0,0).

I've tried writing a procedure that changes a in particular increments but that is clearly not the most efficient way. Are there any rules of limits that I should be using?

 

I've got a set

E:={(x,y,z): x^2+y^2=-2*z-x, z^2+y^2=1} and need to find points of E which have minimal or maximal distance from (0,0,0). I've set up the Lagrangian as F:=sqrt(x^2+y^2+z^2) + L1(x^2+y^2+2z+x)+L2(z^2+y^2-1)

and consequently obtained the equations:

x/sqrt(x^2+y^2+z^2) + 2*x*L1+L1=0

y/sqrt(x^2+y^2+z^2) + 2*y*L1+2*y*L2=0

z/sqrt(x^2+y^2+z^2)+2*L1+2*L2*z=0

for which I've set up
eqn1,eqn2,eqn3 as the three equations and vars:=x,y,z

and used solve() but I'm not getting the right answer( I need to first express x,y,z in terms of L1, L2 and then get values for L1 and L2 by substituting in the constraints and eventually get values of x,y,z.)

How should I implement that?

For example, given a 3d point p(x,y,z), with (x,y,z) as its coordinates. Then it is transformed by rotation and translation, as 

p'=R(p)*p+t(p), where R(p) is a 3x3 rotation matrix that is a matrix of functions of p, and t(p) is a 3x1 vector function of p. 

My question is how to derive dp'/d(as a 3x3 matrix) using maple? 

To make it clear,I want to do it in a way that dp'/dp = ∂p'/∂p + ∂p'/∂R*∂R/∂p +  ∂p'/∂t*∂t/∂p

And I'd like to know each intermediate quantity, such as p'/∂R, R/∂p.


Anyone can help?

Thanks a lot. 

What Maple15 commands will display a Rouleaux tetrahedron or a Meissner tetrahedron?

Hi all,

I'm having a challenge solving an integration that has some error functions associated with it.

Description:

I am trying to find the Riemann midpoint of the integral. All the parameters are known except the u and du terms which came into the expression following a laplace transform.

the output I get from the above input is shown below, and as it can be seen, the u and du terms coupled with a complimentary error function still exist. I have tried the "simplify" function and it returns similar output expression.

 

Any help will really be appreciated.

Thanks :)

 

 

 


plot(x^2, x = -2 .. 2)

Error, (in plot) incorrect first argument x^2

 

plot(2);

 

solve(x-1 = 0, x)

Error, (in coulditbe) invalid input: `coulditbe/internal` uses a 1st argument, obj, which is missing

 

``


Download Maple_Worksheet.mw

Hi,

I'm using Maple 18 and none of my worksheets that I've developed on earlier versions work on it. I tried starting a new worksheet with a very simple command (attached) and even that's giving me problems. As you can see, I have no trouble plotting constant functions, but as soon as I put in a variable it breaks down. It won't solve equations either.

FYI I'm using an HP G72 laptop with Windows 7 and no installation issues came up.

Can anyone tell me what's going on here?

Thanks,

Tom

Hi all,

I'm trying to use logplot but it's very time consuming. Any suggestion please!

Cheers!

restart:with(plots):

S1:=x+x^2*Sum(t^(k*alpha+1)/GAMMA(k*alpha+2),k=0..infinity);

S2:=x+x^2*Sum(t^(k*alpha+1)/GAMMA(k*alpha+2),k=0..n);

alpha:=0.75:x:=0.5:n:=10:

logplot(abs(S1-S2),t=0..1);

 

 

So here is the issue: I have a 50 by 50 tridiagonal matrix. The entries in the first row, first column are -i*x and the last row last column is -i*x; these are along the main diagonal, where i is complex and x is a variable. Everything in between these two entries is 0. Above and below the main diagonal the entries are -1. My issue is that I have to find a conditon on x that makes the eigenvalues real. I am completely new to maple and have no programming experience.. Can someone show me how to this?

Using Maple 18, I solved for minimum and maximum price. Instead of using fsolve I wanna use procedure programming structure in order to get the same results. How can I do it?

min_sol := fsolve([bc_cond, slope_cond, x[G, 1] = w[aggr, 1]], {p = 0 .. 1, x[G, 1] = 0 .. w[aggr, 1], x[G, 2] = 0 .. w[aggr, 2]}); p_min := subs(min_sol, p); max_sol := fsolve([bc_cond, slope_cond, x[G, 2] = w[aggr, 2]], {p = 0 .. 1, x[G, 1] = 0 .. w[aggr, 1], x[G, 2] = 0 .. w[aggr, 2]}); p_max := subs(max_sol, p);
{p = 0.3857139820, x[G, 1] = 127.8000000, x[G, 2] = 38.99045418}
0.3857139820
{p = 0.8841007104, x[G, 1] = 44.30160890, x[G, 2] = 164.2000000}
0.8841007104

Hi,

I am trying to realize the following calculation in Maple.

$
  \left[\sum_{i=0}^n y_i(x) \partial_x^i , \sum_{j=0}^m z_j(x) \partial_x^j \right]  \\
=   \sum_{i=0}^n \sum_{j=0}^m \sum_{l=0}^i  \binom il y_i(x) \left( \partial_x^{i-l} z_j(x)\right) \partial_x^{l+j} \\
- \sum_{j=0}^m \sum_{i=0}^n \sum_{l=0}^j  \binom jl z_j(x) \left( \partial_x^{j-l} z_i(x)\right) \partial_x^{l+i} \ .

$

 

Is there a way to make maple understand d/dx as a differential opperator and calculate with it? When i for example try to calculate diff(d/dx, x) it should give me d^2/dx^2 as a result. Unfortunately i don't know how to realize this.

Basic problem is i don't know how to realize operator expressions in maple like for example:

f(x) d/dx      ( f(x) is a smooth function of x here )

where when applied to a function h(x) it should result in f(x) d/dx h(x) .

 

Is that possible?

 

Thank you very much in advance.

I am trying to expand out the terms  of equation 13.  The expand command causes the lhs to be zero?


Initialize the metric and tetrad

 

restart; with(Physics); with(Tetrads); with(PDETools)

0, "%1 is not a command in the %2 package", Tetrads, Physics

(1.1)

X = [zetabar, zeta, v, u]

X = [zetabar, zeta, v, u]

(1.2)

ds2 := Physics:-`*`(Physics:-`*`(2, dzeta), dzetabar)+Physics:-`*`(Physics:-`*`(2, du), dv)+Physics:-`*`(Physics:-`*`(2, H(zetabar, zeta, v, u)), (du+Physics:-`*`(Ybar(zetabar, zeta, v, u), dzeta)+Physics:-`*`(Y(zetabar, zeta, v, u), dzetabar)-Physics:-`*`(Physics:-`*`(Y(zetabar, zeta, v, u), Ybar(zetabar, zeta, v, u)), dv))^2)

2*dzeta*dzetabar+2*du*dv+2*H(zetabar, zeta, v, u)*(du+Ybar(zetabar, zeta, v, u)*dzeta+Y(zetabar, zeta, v, u)*dzetabar-Y(zetabar, zeta, v, u)*Ybar(zetabar, zeta, v, u)*dv)^2

(1.3)

declare(ds2)

Ybar(zetabar, zeta, v, u)*`will now be displayed as`*Ybar

(1.4)

NULL

vierbien = Matrix([[1, 0, -Ybar(zetabar, zeta, v, u), 0], [0, 1, -Y(zetabar, zeta, v, u), 0], [Physics:-`*`(H(zetabar, zeta, v, u), Y(zetabar, zeta, v, u)), Physics:-`*`(H(zetabar, zeta, v, u), Ybar(zetabar, zeta, v, u)), 1-Physics:-`*`(Physics:-`*`(H(zetabar, zeta, v, u), Y(zetabar, zeta, v, u)), Ybar(zetabar, zeta, v, u)), H(zetabar, zeta, v, u)], [Y(zetabar, zeta, v, u), Ybar(zetabar, zeta, v, u), -Physics:-`*`(Y(zetabar, zeta, v, u), Ybar(zetabar, zeta, v, u)), 1]])

vierbien = (Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = -Ybar(zetabar, Zeta, v, u), (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = -Y(zetabar, Zeta, v, u), (2, 4) = 0, (3, 1) = H(zetabar, Zeta, v, u)*Y(zetabar, Zeta, v, u), (3, 2) = H(zetabar, Zeta, v, u)*Ybar(zetabar, Zeta, v, u), (3, 3) = 1-H(zetabar, Zeta, v, u)*Y(zetabar, Zeta, v, u)*Ybar(zetabar, Zeta, v, u), (3, 4) = H(zetabar, Zeta, v, u), (4, 1) = Y(zetabar, Zeta, v, u), (4, 2) = Ybar(zetabar, Zeta, v, u), (4, 3) = -Y(zetabar, Zeta, v, u)*Ybar(zetabar, Zeta, v, u), (4, 4) = 1}))

(1.5)

``

NULL

Setup(tetrad = rhs(vierbien = Matrix(%id = 18446744078213056502)), metric = ds2, mathematicalnotation = true, automaticsimplification = true, coordinatesystems = (X = [zetabar, zeta, v, u]), signature = "+++-")

[automaticsimplification = true, coordinatesystems = {X}, mathematicalnotation = true, metric = {(1, 1) = 2*H(X)*Y(X)^2, (1, 2) = 1+2*H(X)*Y(X)*Ybar(X), (1, 3) = -2*H(X)*Y(X)^2*Ybar(X), (1, 4) = 2*H(X)*Y(X), (2, 2) = 2*H(X)*Ybar(X)^2, (2, 3) = -2*H(X)*Ybar(X)^2*Y(X), (2, 4) = 2*H(X)*Ybar(X), (3, 3) = 2*H(X)*Y(X)^2*Ybar(X)^2, (3, 4) = 1-2*H(X)*Y(X)*Ybar(X), (4, 4) = 2*H(X)}, signature = `+ + + -`, tetrad = {(1, 1) = 1, (1, 3) = -Ybar(X), (2, 2) = 1, (2, 3) = -Y(X), (3, 1) = H(X)*Y(X), (3, 2) = H(X)*Ybar(X), (3, 3) = 1-H(X)*Y(X)*Ybar(X), (3, 4) = H(X), (4, 1) = Y(X), (4, 2) = Ybar(X), (4, 3) = -Y(X)*Ybar(X), (4, 4) = 1}]

(1.6)

gamma_[4, 1, 1] = 0

diff(Ybar(X), zeta)-(diff(Ybar(X), u))*Ybar(X) = 0

(1)

gamma_[4, 2, 2] = 0

diff(Y(X), zetabar)-(diff(Y(X), u))*Y(X) = 0

(2)

gamma_[1, 4, 4] = 0

(diff(Ybar(X), u))*Y(X)*Ybar(X)-Y(X)*(diff(Ybar(X), zeta))-Ybar(X)*(diff(Ybar(X), zetabar))-(diff(Ybar(X), v)) = 0

(3)

gamma_[2, 4, 4] = 0

(diff(Y(X), u))*Y(X)*Ybar(X)-Y(X)*(diff(Y(X), zeta))-(diff(Y(X), zetabar))*Ybar(X)-(diff(Y(X), v)) = 0

(4)

gamma_[3, 4, 4] = 0

0 = 0

(5)

gamma_[4, 4, 4] = 0

0 = 0

(6)

shearconditions := {diff(Y(X), zetabar)-(diff(Y(X), u))*Y(X) = 0, diff(Ybar(X), zeta)-(diff(Ybar(X), u))*Ybar(X) = 0, (diff(Y(X), u))*Y(X)*Ybar(X)-Y(X)*(diff(Y(X), zeta))-(diff(Y(X), zetabar))*Ybar(X)-(diff(Y(X), v)) = 0, (diff(Ybar(X), u))*Y(X)*Ybar(X)-Y(X)*(diff(Ybar(X), zeta))-Ybar(X)*(diff(Ybar(X), zetabar))-(diff(Ybar(X), v)) = 0}:

 

 

RicciT := proc (a, b) options operator, arrow; SumOverRepeatedIndices(Ricci[mu, nu]*e_[a, `~mu`]*e_[b, `~nu`]) end proc

proc (a, b) options operator, arrow; Physics:-SumOverRepeatedIndices(Physics:-`*`(Physics:-`*`(Physics:-Ricci[mu, nu], Physics:-Tetrads:-e_[a, `~mu`]), Physics:-Tetrads:-e_[b, `~nu`])) end proc

(7)

SlashD := proc (f, a) options operator, arrow; SumOverRepeatedIndices(D_[b](f)*e_[a, `~b`]) end proc

proc (f, a) options operator, arrow; Physics:-SumOverRepeatedIndices(Physics:-`*`(Physics:-D_[b](f), Physics:-Tetrads:-e_[a, `~b`])) end proc

(8)

SlashD(f(X), 1)

diff(f(X), zeta)-Ybar(X)*(diff(f(X), u))

(9)

SlashD(f(X), 2)

diff(f(X), zetabar)-Y(X)*(diff(f(X), u))

(10)

SlashD(f(X), 3)

(1+H(X)*Y(X)*Ybar(X))*(diff(f(X), u))-H(X)*((diff(f(X), zeta))*Y(X)+Ybar(X)*(diff(f(X), zetabar))+diff(f(X), v))

(11)

SlashD(f(X), 4)

-Y(X)*Ybar(X)*(diff(f(X), u))+Ybar(X)*(diff(f(X), zetabar))+(diff(f(X), zeta))*Y(X)+diff(f(X), v)

(12)

NULL

  simplify(RicciT(1, 2), shearconditions) = 0

H(X)*(diff(diff(Y(X), zeta), zetabar))*Ybar(X)-H(X)*Ybar(X)*Y(X)*(diff(diff(Ybar(X), u), zetabar))-H(X)*Ybar(X)^2*(diff(diff(Y(X), u), zetabar))-H(X)*Y(X)^2*(diff(diff(Ybar(X), u), zeta))-2*H(X)*Y(X)*Ybar(X)*(diff(diff(Y(X), u), zeta))+H(X)*Y(X)^2*Ybar(X)*(diff(diff(Ybar(X), u), u))-H(X)*Y(X)*(diff(diff(Ybar(X), u), v))+H(X)*Y(X)*Ybar(X)^2*(diff(diff(Y(X), u), u))-H(X)*(diff(diff(Y(X), u), v))*Ybar(X)+H(X)*(diff(Ybar(X), zetabar))^2+(-3*H(X)*Y(X)*(diff(Ybar(X), u))-(diff(H(X), u))*Y(X)*Ybar(X)+(diff(H(X), zeta))*Y(X)+(diff(H(X), zetabar))*Ybar(X)+diff(H(X), v))*(diff(Ybar(X), zetabar))+H(X)*(diff(Y(X), zeta))^2+(-4*H(X)*(diff(Y(X), u))*Ybar(X)-(diff(H(X), u))*Y(X)*Ybar(X)+(diff(H(X), zeta))*Y(X)+(diff(H(X), zetabar))*Ybar(X)+diff(H(X), v))*(diff(Y(X), zeta))+2*H(X)*Y(X)^2*(diff(Ybar(X), u))^2-Y(X)*(-(diff(H(X), u))*Y(X)*Ybar(X)+(diff(H(X), zeta))*Y(X)+(diff(H(X), zetabar))*Ybar(X)+diff(H(X), v))*(diff(Ybar(X), u))+2*(diff(Y(X), u))*Ybar(X)*(H(X)*(diff(Y(X), u))*Ybar(X)+(1/2)*(diff(H(X), u))*Y(X)*Ybar(X)-(1/2)*(diff(H(X), zeta))*Y(X)-(1/2)*(diff(H(X), zetabar))*Ybar(X)-(1/2)*(diff(H(X), v))) = 0

(13)

``

0 = 0

0 = 0

(14)

``

Why does the expand command cause the lhs to be zero?

NULL


Download Question_R12.mw

First 1241 1242 1243 1244 1245 1246 1247 Last Page 1243 of 2364