MaplePrimes Questions

Hi,

I'm trying to create a code that allows me to model a random walk for 50 people. I'm using r[i]= {X[i],Y[i]} where i is the number of steps and r[i] the position in the i-th term.

I have created three possibilities:
2r[i]-r[i-1] - go stright forward

{x[i]+y[i]-y[i-1],y[i]-x[i]+x[i-1]} - turn right

{x[i]-y[i]+y[i-1],y[i]+x[i]-x[i-1]} - turn left

The first step I want them to make is to point (1,0) and from there I want them to take 1500 random steps.

M:=50; N:=1500; R3:=rand(1..3):

for i from 1 to M do
X[i,0]:=0;
Y[i,0]:=0;
R[i,0]:=[X[i,0],Y[i,0]];
for j from 1 to N do
R[i,j]:=[X[i,j],Y[i,j]];
if j=1 then X[i,1]:=1; Y[i,1]:=0;
elif j>1 then
r:=R3();
if r=1 then R[i,j]:=2*R[i,j]-[R[i,j-1];
elif r=2 then R[i,j]:=[X[i,j-1]+Y[i,j-1]-Y[i,j-2],Y[i,j-1]-X[i,j-1]+X[i,j-2]];
elif r=3 then R[i,j]:=[X[i,j-1]-Y[i,j-1]+Y[i,j-2],Y[i,j-1]+X[i,j-1]-X[i,j-2]];
end if;
end if;
end do:
end do:

 

The first and second step works, but from there it seems Maple is having trouble getting the correct digigts, because the formulas coming out are correct.

I have tried putting in different types of X, Y and R reads, but have gotten stuck. If someone could help me spot what this code is missing I would be very gratefull. I think Maple is just missing a way of reading X and Y but i might be wrong.

when the variable is in limits of integration?

hw2_example.mw

there exist an error : 

Error, (in int) unable to compute a numeric answer for symbolic limits, q = -3.141592654+arccos(11./(1.+.1000000000*t)) .. 3.141592654-1.*arccos(11./(1.+.1000000000*t))

How to make this code work?

hello

how to solve lp  on maple when consrtaints are in interval 

eg

0<x<1

 i try to find this on maple,but i could not found my desired ans.

i got an assignment in which 15 constraints are given and all are in interval.

anyone know the ans then plz help me

How many numbers exist which are: less than 1000, multiple of 18 and also multiple of 10? Use Maple to find the answer 

Hello everyone! My English is not very good. 

I have writtien Lucas sequence program:

F := proc (n::nonnegint)

option remember;

if n < 2 then n else F(n-1)+F(n-2) 

end if;

end proc;

L := proc (n::nonnegint)

if n = 0 then return 2 end if;

if n = 1 then return 1 end if;

if n <> 0 and n <> 1 then return

L(n-1)+L(n-2) end if; end proc;

S:=proc(n::nonnegint)

 local i;  

for i from 1 by 1 to n do   S(i)=L(i)^(2)-5*F(i)^(2);

 print("%a",S(i));  end proc: 

 

And Maple notice :error

I don't know call procedure inside another procedure. 
Thank you so much

Regards

sunflower

Hello everyone!

I'd like to as a question that might be very simple, but the thing is that I am completely new to Maple, and I have some homework I need to solve all of a sudden... I tried watching some tutorials and did a lot of search, but I just can't make this one work.
Briefly - my task is to derive the vibrational modal shapes of an annular disk (a circular disk with the center "missing"). So far what I know for sure is, that the radial term of the vibrational deflection is given as a linear combination of 4 types of bessel functions (Jn, Yn, In and Kn) - bessel functions of the 1st and second kind, and modified bessel functions of the 1st and second kind. Something like this:

Rmn(r) = A*Jn(kr) + B*Yn(kr) + C*In(kr) + D*Kn(kr).

Now, I need to find the values for k (the wavenumber), and the coeffitients B, C and D. I don't need coeffitient A, because I'll jus fix that to be 1. To do this, I have the following 4 boundary conditions:

1) Rmn(b) = Jn(kb) + B*Yn(kb) + C*In(kb) + D*Kn(kb) = 0

2) R'mn(b) = k(Jn'(kb) + B*Yn'(kb) + C*In'(kb) + D*Kn'(kb)) = 0

3) R''mn(a) = k2(Jn''(ka) + B*Yn''(ka) + C*In''(ka) + D*Kn''(ka)) = 0

4) R'''mn(a) = k3(Jn'''(ka) + B*Yn'''(ka) + C*In'''(ka) + D*Kn'''(ka)) = 0

So, four equations in four unknowns (k, B, C and D) - and I can't get it to work.

I did the following, and it gives me some totally wrong values (complex wavenumbers and such). Again, I am completely new to Maple, so I might have done something completely silly without even noticing...

b := 0.17e-1;
a := 0.8e-1;
n := 1;

R(r) := BesselJ(n,k r) + B BesselY(n, k r) + C BesselI(n, k r)  + D BesselK(n, k r) ;

eq1 := R(b) = 0;
eq2 := eval(diff(R(x), x), x = b) = 0;
eq3 := eval(diff(R(x), x, x), x = a) = 0;
eq4 := eval(diff(R(x), x, x, x), x = a) = 0;

solve([eq1, eq2, eq3, eq4], [k, B, C, D])

What is it, that I am not doing right?

Thank you very very much for the help in advance!
Andras



Hi everyone,

I am trying to copy a 178x2 matrix into maple. the data is in a .dat file in two columns. For example the first few lines:

+2.000000E-10 +1.636232E-05

+3.017707E-05 +4.531920E-05

+6.065973E-05 +7.586885E-05

+9.096636E-05 +1.059570E-04

+1.208671E-04 +1.357189E-04

I have in mind

.

My unsuccessful trials are

evalf(Int(cos(log(x)/x)/x, x = 0 .. 1, method = _d01akc));

Error, (in evalf/int) NE_QUAD_MAX_SUBDIV:
  The maximum number of subdivisions has
  been reached: max_num_subint = 500

and

evalf(Int(cos(log(x)/x)/x, x = 0 .. 1, method = _d01akc, methodoptions = [maxintervals = 2000]));

Error, (in evalf/int) NE_QUAD_MAX_SUBDIV:
  The maximum number of subdivisions has
  been reached: max_num_subint = 2000

and

evalf(Int(cos(log(x)/x)/x, x = 0 .. 1, method = _d01ajc));

Error, (in evalf/int) NE_QUAD_NO_CONV:
  The integral is probably divergent or slowly convergent.

Mathematica cracks it without any options, producing 0.323367.

 

restart;

with(DETools, diff_table);

kB := 0.138064852e-22;

R := 287.058;

T := 293;

p := 101325;

rho := 0.1e-2*p/(R*T);

vr := diff_table(v_r(r, z));

vz := diff_table(v_z(r, z));

eq_r := 0 = 0;

eq_p := (vr[z]-vz[r])*vr[] = (vr[]*(vr[r, z]-vz[r, r])+vz[]*(vr[z, z]-vz[z, r]))*r;

eq_z := 0 = 0;

eq_m := r*vr[r]+r*vz[z]+vr[] = 0;

pde := {eq_m, eq_p};

IBC := {v_r(1, z) = 0, v_r(r, 0) = 0, v_z(1, z) = 0, v_z(r, 0) = r^2-1};

sol := pdsolve(pde, IBC, numeric, time = z, range = 0 .. 1);

 

what am I doing wrong?

it's telling me: Error, (in pdsolve/numeric/par_hyp) Incorrect number of boundary conditions, expected 3, got 2
but i did just as in the example :-/

Hello,

I tried to solve below equation, but it gives me zeros result. Please help me to find their inverse laplace. 

 It will be clearer if was pasted on Maple:

 

restart

Ps := [P[0], P[1], P[2], P[3], P[4]]:

eqs := [P[0](s) =~ (P[1](s)*mu[1]+P[2](s)*mu[2]+P[3](s)*mu[3]+P[4](s)*mu[4])/(s+lambda[1]+lambda[2]+lambda[3]+lambda[4]), P[1](s) = lambda[1]*P[0](s)/(s+mu[1]), P[2](s) = lambda[2]*P[0](s)/(s+mu[2]), P[3](s) = lambda[3]*P[0](s)/(s+mu[3]), P[4](s) = lambda[4]*P[0](s)/(s+mu[4])];

Ls := solve(eqs, Ps(s))[];

P(t)=~inttrans[invlaplace]~(rhs~(Ls), s, t);

 

Thank you

 

 

Hello everyone!

Prime:= proc (a, b)

local i, p, r;

p := ();

r :=() ;

for i from a to b do

   if isprime(i) then p := p union (i) end if;

     if type(sqrt(p[i]-1), integer) then r := r union (p[i]) end if;

end do

end proc;

Prime(1, 10)

My English is not very good. I don't know what erros I get in my program. Thank everyone

I'm trying to run c code generated from a simple MapleSim example (Spin Up Beam). To makes things even simpler, I set the input real expression to just time, and changed the input function in my c code to:

static void inpfn(double T, double *U)
{
U[0] = T;
}

I set all the state variables to 0 for the initial conditions. I ran the code and my output doesn't resemble the MapleSim output at all, and I'm getting errors. So my question is about the state variables, which I initially set to 0:

* State variable(s):
* x[ 0] = `Main.SpinUpBeam.FB3.uf1`(t)
* x[ 1] = diff(`Main.SpinUpBeam.FB3.uf1`(t),t)
* x[ 2] = `Main.SpinUpBeam.FB3.uf2`(t)
* x[ 3] = diff(`Main.SpinUpBeam.FB3.uf2`(t),t)
* x[ 4] = `Main.SpinUpBeam.FB3.vf1`(t)
* x[ 5] = diff(`Main.SpinUpBeam.FB3.vf1`(t),t)
* x[ 6] = `Main.SpinUpBeam.FB3.vf2`(t)
* x[ 7] = diff(`Main.SpinUpBeam.FB3.vf2`(t),t)

What do these represent for this flexible beam (FB3)? I.e. what is uf1, uf2, vf1, vf2? Should they be set to 0, or no?

Thanks.

I have several *.mw files which I have built seperately. Now, for readability reasons, I would like to create a Master document, which will ues the first files, and then generate a PDF document.
I tried the read command, but it does not recognize the files.

Any help is appreciated.

 

Let say I want to perform symmetry analysis of ODE, taking into account parameters.
In order to do it I must generate system of determining equations and them to split it for different cases.
But if I use PDETools, actually it gives me only 1 case (worksheet PDETools.mw is attached).
In that case, surely it is very easy to do it by hand and to determine that A=0 and A<>0 are two different cases.

But automatic procedure of PDETools seems to me that somewhere allows to divide by parameter...

Hi

 

I'm trying to solve this in maple:

 

solve({0.001=x*exp(0.6/(n*0.026)), 0.01=x*exp(0.68/(n*0.026))},{x,n})

solve({0.001=x*exp(0.6/(n*0.026)), 0.01=x*exp(0.68/(n*0.026))},{x,n})

 

Wolfrom alpha can do it: http://www.wolframalpha.com/input/?i=solve%28%7B0.001%3Dx*exp%280.6%2F%28n*0.026%29%29%2C+0.01%3Dx*exp%280.68%2F%28n*0.026%29%29%7D%2C%7Bx%2Cn%7D%29

 

Why can't i get maple to do it?

 

Thanks in advance!

 

Best regards

Emil

First 1205 1206 1207 1208 1209 1210 1211 Last Page 1207 of 2429