Items tagged with seq seq Tagged Items Feed

RandomCompositions:= module()
local
Compositions, Rand,

RandomCompositions:= module()
local
Compositions, Rand,
ModuleApply:= proc(n::posint, k::posint)
local C;
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))];
Rand:= rand(1..nops(Compositions));
()-> Compositions[Rand()]
end proc;

end module:
R:= RandomCompositions(8,6):
seq(R(),i=1..10);

[0, 0, 2, 6, 0, 0], [1, 0, 0, 3, 4, 0], [0, 3, 3, 2, 0, 0],[1, 2, 4, 0, 1, 0], [0, 4, 0, 1, 3, 0],

[2, 0, 1, 4, 1, 0],[2, 0, 1, 1, 3, 1], [1, 0, 4, 2, 1, 0], [1, 3, 0, 2, 0, 2],[2, 0, 3, 2, 1, 0]

with(Statistics):
Tally(R());
[0 = 1, 1 = 4, 4 = 1]

I want to count the 0 to 8 respectively summation,and divide by i.

 But the  seq command  R() isn't conform  with Tally command R() .

Thanks.

 

Suppose i am trying to do a sequential if command as follows:

seq(`if`(a[i] < b[i], c[i], d[i]), i = 1 .. 10);

now this doesnot evaluate the i's in c[i] and d[i].

please help me with complete evaluation of this statement.

I have a rank 1 array M of 1000 values.

I want to apply a function f on each value of M and its location giving,

[f(1,M[1]), f(2,M[2]), ... , f(1000,M[1000])]

is it possible to get this using map or map2 or map[n] or maptype (without using seq since its slowing down computation).

inotherwords can i access the member location inside a map evaluation?

Hello Hello everybody 
   I have to solve the following differential equation numerically 


``

 

restart:with(plots):

mb:=765 : mp:=587 : Ib:=76.3*10^3 : Ip:=7.3*10^3 : l:=0.92 : d:=10: F:=490: omega:=0.43 :

eq1:=(mp+mb)*diff(x(t),t$2)+mp*(d*cos(theta(t))+l*cos(alpha(t)+theta(t)))*diff(theta(t),t$2)+mp*l*cos(alpha(t)+theta(t))*diff(alpha(t),t$2)+mp*(d*diff(theta(t),t)^2*sin(theta(t))+l*(diff(theta(t),t)+diff(alpha(t),t))^2*sin(alpha(t)+theta(t)))-F*sin(omega*t)=0;

1352*(diff(diff(x(t), t), t))+587*(10*cos(theta(t))+.92*cos(alpha(t)+theta(t)))*(diff(diff(theta(t), t), t))+540.04*cos(alpha(t)+theta(t))*(diff(diff(alpha(t), t), t))+5870*(diff(theta(t), t))^2*sin(theta(t))+540.04*(diff(theta(t), t)+diff(alpha(t), t))^2*sin(alpha(t)+theta(t))-490*sin(.43*t) = 0

(1)

eq2:=(mp+mb)*diff(z(t),t$2)-mp*d*(sin(theta(t)+alpha(t))+sin(theta(t)))*diff(theta(t),t$2)-mp*l*sin(alpha(t)+theta(t))*diff(alpha(t),t$2)+mp*(d*diff(theta(t),t)^2*cos(theta(t))+l*(diff(theta(t),t)+diff(alpha(t),t))^2*cos(alpha(t)+theta(t)))+9.81*(mp+mb)-F*sin(omega*t)=0;

1352*(diff(diff(z(t), t), t))-5870*(sin(alpha(t)+theta(t))+sin(theta(t)))*(diff(diff(theta(t), t), t))-540.04*sin(alpha(t)+theta(t))*(diff(diff(alpha(t), t), t))+5870*(diff(theta(t), t))^2*cos(theta(t))+540.04*(diff(theta(t), t)+diff(alpha(t), t))^2*cos(alpha(t)+theta(t))+13263.12-490*sin(.43*t) = 0

(2)

eq3:=mp*(d*cos(theta(t))+l*cos(alpha(t)+theta(t)))*diff(x(t),t$2)-mp*(l*sin(theta(t)+alpha(t))+d*sin(theta(t)))*diff(z(t),t$2)+(Ip+Ib+mp*(d^2+l^2)+2*mp*d*l*cos(alpha(t)))*diff(theta(t),t$2)+[Ip+mp*l^2+mp*d*l*cos(alpha(t))]*diff(alpha(t),t$2)-mp*sin(alpha(t))*(l*d*diff(alpha(t),t)^2-l*d*(diff(alpha(t),t)+diff(theta(t),t))^2)+mp*9.81*l*sin(alpha(t)+theta(t))+mp*9.81*d*sin(theta(t))=0;

587*(10*cos(theta(t))+.92*cos(alpha(t)+theta(t)))*(diff(diff(x(t), t), t))-587*(.92*sin(alpha(t)+theta(t))+10*sin(theta(t)))*(diff(diff(z(t), t), t))+(142796.8368+10800.80*cos(alpha(t)))*(diff(diff(theta(t), t), t))+[7796.8368+5400.40*cos(alpha(t))]*(diff(diff(alpha(t), t), t))-587*sin(alpha(t))*(9.20*(diff(alpha(t), t))^2-9.20*(diff(theta(t), t)+diff(alpha(t), t))^2)+5297.7924*sin(alpha(t)+theta(t))+57584.70*sin(theta(t)) = 0

(3)

eq4:=mp*l*cos(alpha(t)+theta(t))*diff(x(t),t$2)-mp*l*sin(alpha(t)+theta(t))*diff(z(t),t$2)+(Ip+mp*l^2+mp*d*l*cos(alpha(t)))*diff(theta(t),t$2)+(Ip+mp*l^2)*diff(alpha(t),t$2)-mp*9.81*l*sin(alpha(t)+theta(t))+l*d*mp*diff(theta(t),t$1)^2*sin(alpha(t))=0;

540.04*cos(alpha(t)+theta(t))*(diff(diff(x(t), t), t))-540.04*sin(alpha(t)+theta(t))*(diff(diff(z(t), t), t))+(7796.8368+5400.40*cos(alpha(t)))*(diff(diff(theta(t), t), t))+7796.8368*(diff(diff(alpha(t), t), t))-5297.7924*sin(alpha(t)+theta(t))+5400.40*(diff(theta(t), t))^2*sin(alpha(t)) = 0

(4)

CI:= x(0)=0,z(0)=0,theta(0)=0,alpha(0)=0,D(x)(0)=0,D(alpha)(0)=0,D(z)(0)=0,D(theta)(0)=0;

x(0) = 0, z(0) = 0, theta(0) = 0, alpha(0) = 0, (D(x))(0) = 0, (D(alpha))(0) = 0, (D(z))(0) = 0, (D(theta))(0) = 0

(5)

solution:=dsolve([eq1,eq2,eq3,eq4, CI],numeric);

Error, (in f) unable to store '[0.]/(0.17571268341557e16+[-0.25659510610770e15])' when datatype=float[8]

 

 

 

I don't know why it says : Error, (in f) unable to store '[0.]/(0.17571268341557e16+[-0.25659510610770e15])' when datatype=float[8]

 

Help pleaase!

thank you !!!

Download systéme_complet.mw

 

I'm taking calculus and my professor introduced us to maple software. The professor asked us to plot the families of curves for this orthogonal equation:

dy/dx = (x^2) - (2y^2) - C = 0

This is what I had so far:

 

restart;

with(DEtools):

with(plots):

 

Function:=unapply(simplify(x^2-2y^2-C),(x,y)):

'Function'(x,y) = Function(x,y);

plotFunction:=C->implicitplot(eval(F(x,y),a=C),x=-5..5,y=5..5,scaling=constrained):

plot1:=display(seq(plotFunction(a),a=-5..5)):

display(plot1);

 

This is only display one family. How do I code for it plot the other families?

(The graph should look like curves converging from left, top and right sides toward to the origin of the axes)

Please help.

Hi,

I have a 4-D function that I have found an analytic expression for in Maple, but I want to generate a numerical 4-D array, which I can export for use in Matlab. However, I don't think I'm using a very good solution, because it is extremely slow (several minutes for even 10x10x10x10 elements). My code is

NumRange:=10:
NumElements:=10:
dx:=2*NumRange/(NumElements-1):
A:=Array(1..NumElements,1..NumElements,1..NumElements,1..NumElements,[seq([seq([seq([seq(evalf(rho(ws1,ws2,ws1p,ws2p)),ws2p=-NumRange..NumRange,dx)],ws1p=-NumRange..NumRange,dx)],ws2=-NumRange..NumRange,dx)] , ws1=-NumRange..NumRange,dx)],datatype=float);

Rho is an exponential with 10 terms in the exponents.

I also tried using four for-loops but that was even slower!

Thanks for any input

I was trying to create a array or table with the following columns

1. angle in radians,

2. angle in grades

3. sinus (x)

4. cosinus (x)

5. tangent(x)

 

for x= 0, pi/12, 2pi/12.. 2pi.

I was trying to use seq()

 

seq([(1*Pi/12*j),sin(1*Pi/12*j)], j=0..24);

 

but I cannot get something nicely "arranged" (like in a table or matrix) to export to latex.

 

could somebody give me a help..please?

 

thanks in advance,

 

Jean

 

x11 := Vector([0.208408965651696e-3, -0.157194487523421e-2, -0.294739401402979e-2, 0.788206708183853e-2, 0.499394753201753e-2, 0.191468321959759e-3, 0.504980449104750e-2, 0.222150494088535e-2, 0.132091821964287e-2, 0.161118434883258e-2, -0.281236534046873e-2, -0.398055875132037e-2, -0.111753680372819e-1, 0.588868146012489e-2, -0.354191562612469e-2, 0.984082837373291e-3, -0.116041186868374e-1, 0.603027845850267e-3, -0.448778128168742e-2, -0.127561485214862e-1, -0.412027655195339e-2, 0.379387381798949e-2, -0.602550446997765e-2, -0.605986284736216e-2, -0.751396992404410e-2, 0.633613424008655e-2, -0.677581832613623e-2]):
y11 := Vector([ -21321.9719565717, 231.709204951251, 1527.92905167191, -32.8508507060675, 54.9408176234139, -99.4222178124229, -675.771433486265, 42.0838668074923, -12559.3183308951, 5.21412214166344*10^5, 1110.50031772203, 3.67149699000155, -108.543878970269, -8.48861069398811, -521.810552387313, 26.4792411876883, -8.32240296737599, -1085.40982521906, -44.1390030597906, -203.891397612798, -56.3746416571417, -218.205643256096, -178.991498697065, -42.2468018350386, .328546922634921, -1883.18308996621, 111.747881085748]):
z11 := Vector([ 1549.88755331800, -329.861725802688, 8.54200301129155, -283.381775745327, -54.5469129127573, 1875.94875597129, -16.2230517860850, 6084.82381954832, 1146.15489803104, -456.460512914647, 104.533252701641, 16.3998365630734, 11.5710907832054, -175.370276462696, 33.8045539958636, 2029.50029336951, 1387.92643570857, 9.54717543291120, -1999.09590358328, 29.7628085078953, 2.58210333216737*10^6, 57.7969622731082, -6.42551196941394, -8549.23677077892, -49.0081775323244, -72.5156360537114, 183.539911458475]):

 

> seq({round(x11[k]), round(y11[k]), round(z11[k])}, k = 1 .. 27);
{-21322, 0, 1550}, {-330, 0, 232}, {0, 9, 1528}, {-283, -33, 0}, {-55, 0, 55},

{-99, 0, 1876}, {-676, -16, 0}, {0, 42, 6085}, {-12559, 0, 1146},

{-456, 0, 521412}, {0, 105, 1111}, {0, 4, 16}, {-109, 0, 12}, {-175, -8, 0},

{-522, 0, 34}, {0, 26, 2030}, {-8, 0, 1388}, {-1085, 0, 10},

{-1999, -44, 0}, {-204, 0, 30}, {-56, 0, 2582103}, {-218, 0, 58},

{-179, -6, 0}, {-8549, -42, 0}, {-49, 0}, {-1883, -73, 0}, {0, 112, 184}

 

https://drive.google.com/file/d/0B2D69u2pweEvS0RVTFZWTnVKWms/edit?usp=sharing

{-49, 0}

there is a missing comma in this, is it the built in robot in maple playing human or my window make a joke?

 

this bug make me get an misunderstanding from mathematica stackexchange

 

https://drive.google.com/file/d/0B2D69u2pweEvZXp5WndMN0x5VGs/edit?usp=sharing

 

i can not display web correctly, What's wrong with me?

I have a command in Maple that looks like

Hi all,

I just learned about the with(Threads) package and I wanted to do a bit testing and see if it's 'faster' or more 'efficient'.

Test.pdf

 

This was done on a i7 940X (QuardCore) laptop.

I dont really see how it is better in a sense?

Or am I using Seq for the wrong purpose?

 

Casper

Is there a way to have Maple compute the limit of a recursive sequence? For example, the sequence below

a_n = (a_(n-1) +2)/(a_(n-1) + 3), a_1 =2

is bounded and montonically decreasing, thus has a limit, but Maple is not able to compute the limit. Any ideas?

Dear all,

need to take data(a,u) from eq1 and plug it in eq2

eq1 is:

eq2 is:

Then need to plot data (a,v)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I did that:

points:=seq([a,evalf(solve((alpha+(l+alpha)*u+alpha*k*u^2)*a=u*(alpha+(l+alpha)*u+alpha*k*u^2...

The mysterious `if`...

November 22 2012 PatrickT 1943 Maple


On several occasions, while working with lists or Matrices, I have been drawn to using a combination of seq and if, as in the following:

seq(`if`(a,b,c), i = 1 .. 10 )

This appears to be a powerful approach. Unfortunately, I have not found much documentation on it.

I have been able to pattern-guess to a limited extent for my limited needs.

Would you know of a good place to go for information?

My understanding is: "a" is the conditional...

I have written a procedure to overload a new "Subs" function. It uses a seq of equations as its first argument followed by the object to act upon (yes, it is to have subs functionality on these objects). I find the overloading works when I have just one equation in the argument list, but with more than one it never calls any of the procedures. The code worked with multiple equations before I overloaded it (i.e. the first proc was verified by itself). FWIW the objects (elemt or bm...

I have a somewhat time-consuming numerical integration which is needed for many different parameters so I'd like to parallelize the various integrations. Threads:-Seq should be just the ticket for this; so I write:

respr128:=[Threads:-Seq(evalf(Int(S(ener,Ecrit)*rangeexp(amp,depth/4,t0[128]),ener=0.001..10*Ecrit,method=_d01ajc,epsilon=1.0e-5)),depth=1..36)];

The functions S and rangeexp are defined thus:

S:=(omega,omega_c)->(9*sqrt(3)/(8*Pi)*omega/omega_c...

1 2 3 Page 1 of 3