MaplePrimes Questions

For learning, I was trying to implement this in Maple. Given this matrix

m:=<<"foobar"   | 77>,
         <"faabar"   | 81>,
         <"foobaa"  | 22>,
         <"faabaa"  | 8>,
         <"faabian"  |88>,
         <"foobar"  | 27>,
         <"fiijii"      | 52>>;

And list of keys 

keys:={"foo","faa"}:

The idea to find the entries (in first column) which starts with the keys, and sum the corresponding numerical value in the second column. The result will be

r:= <<"foo"|126>,
        <"faa"|177>>

I tried using select, but select, once something is found, does not allow one to do anything more, so it is not very useful. For example  select[flatten](x->x[1..3]="foo",m);  just returns the fields in first column. 

I can extract rows I want like this

f:=x->seq(`if`(m[i,1][1..3]=x,m[i],NULL),i=1..7):
r:=map(f,keys);

Not very useful, but at least I got the parts I want, but still need to process these again.

I could write a loop to do the whole thing, but I am trying to avoid this.

What would be the correct Maple way to do this? I think there might be a command in some package that will do this in one or 2 lines only.

 

Heyho,

I'm pretty new to Maple (started Monday). And I don't know how to solve (or even why it exists) the following error:

S3() generates two integers, one converted from a random 568-Bit-number "e" and one converted from a random 160-bit number "kp1", satisfying gcd(e,kp1)=1.
That works pretty fine so far.

 

Now I need two specific numbers, x and y defined by:

 

And I use the proc S4 to get them:

 

Sometimes, the error occurs "Error, (in S4) the modular inverse does not exist", and I dont get why,... I tried to fix it, with the "while"-loop, but it didnt work out yet.

Someone knows how to solve this problem?
Thanks!

 

Hi

how can solve this system of equations:

-dp/dz=(0.855*(1+2*x))/p

dx/dz=((6.39*10^-3*p*(1-x))/(1+2*x))

that x=f(z) and p=f(z)

and at z=0     p=5 bar  & x=0

Dear all

I want to know, how one can install third party package into Maple13, the package is "wkptest" i downloaded it from link http://cpc.cs.qub.ac.uk/summaries/ADTY. If anyone knows how to do this please help.

When I create a component, here a label component, and set a name property and then click OK, that name seems to go into some list never to be erased. If I then delete the first name and put in a new name and click OK. thus saving it, and the then try to use that name again on a different component, I am told that the name is already in use. Well, no existing component has the name, but it is still in Maple's list of components. If I go to edit an action for any component and input %+command completion, I get a list of components which includes the deleted name which does not belong to any existing component. Since the name is on this list, I cannot reuse the component name.

How do I clean up this erroneous list of component names, so that a mistake in naming one component doesn't forever prevent me from using it on the component for which it was intended?

 

I run the same notebook in Maple 2015 that I used to run in Maple 18.02.

I noticed that it no longer auto-scroll when the print messages reached the bottom of the window as it did with Maple 18.02. This means, I can't see which line the computation is at at the moment, since I can't see the last line printed (it is not visible), without me having to manually use the vertical slider to scroll down trying to catch up with it. But it is hard to do this all the time.  It starts to scroll ok until the last printed message reached the bottom of the window, but then it stops.

This is very annoying, becuase I'd like to see the messages as it is running, so I know which equation is being solved when I look at the screen.  The messages are like this, with some print message I put in the loop

memory used=0.53MiB, alloc change=0 bytes, cpu time=16.00ms, real time=7.00ms, gc time=0ns
*** loop counter 100
etc..

Is there an option one has to configure to make the screen scoll with the output? I looked but do not see one now.

I do not remember having to do anything in Maple 18.02. It seems natural that it should scroll down as messages are being displayed. This is how all apps work.  

I am using Maple 2015, windows 7, 64 bit OS and 64 bit Maple. Using Worksheet, was created in Maple 18.02. Other than this, everything else works ok so far.

interface(version);
Standard Worksheet Interface, Maple 2015.0, Windows 7, February 17 2015 Build ID 1022128

thank you

Hello every one,

 

I am trying to solve a backward induction problem (game theoretic problem) in maple. Lets say we have S rounds. I start from bottom (S-th round) and solve a parametric equation. Then I put the solution in the upper level (S-1). Then, update the functions at level and solve the equation pertatining to this level (S-1). Again, I put the solution ofround S-1 into the equations of S-2 and update the equations and parametrically solve the equation belonging to level S-2 . This process repeats till the first level.

 

The issue is that the solution gradually becomes larger and larger. I guess that's why Maple is not able to solve it. 

 

Have any of you guys faced to a similar problem. Any suggestion?

 

I was thinking of asking maple to reduce its precision in computations. I mean there may not be necessary to store a number with 100 digits precision! However, I don't know how to do that (I don't know the command). Any suggestion?

 

Thank you in advance.

 

Ahmadreza

I've got

f(x,y)= a.exp(1+xy) +( a^2 )*sin(x)+1

for which I've shown that there exists an implicit function x=g(y). ( df/dx <>0)

and df/dx = a*exp(1+xy) +( a^2 )*cosx now in the neighborhood of P=(0,0) for the implicit function to exist I'd need a*exp(1+xy)*y <>0 but at P, wouldn't this be 0?

Given, g(y)=x, how do I find the max,min,saddle points?

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. 

First 1306 1307 1308 1309 1310 1311 1312 Last Page 1308 of 2429