MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

According to this site,"It is known that every even number can be written as a sum of at most six primes". http://www.theage.com.au/national/education/christians-goldbachs-magic-sum-20140903-3es2t.html

i wanted to test this using maple.

restart:
> PF := proc (a::integer,N::integer) #N is a nominated nth prime
> local cst,obj,res;
> cst := add(x[i], i = 1 .. N) <= 6;
> obj := add(x[i]*ithprime(i), i = 1 .. N)-a;
> res := Optimization:-LPSolve(obj, {cst ,obj>=0}, assume={nonnegative,integer}); end proc:
> PF(30,10);
[0, [x[1] = 0, x[2] = 0, x[3] = 6, x[4] = 0, x[5] = 0, x[6] = 0,x[7] = 0, x[8] = 0, x[9] = 0, x[10] = 0]]

the third prime is 5 and 6 of them make 30. as an aside, it would be nice to know how to get maple to output "30 = 6x5".

this is obviously pretty limited, because 30 can be written as the sum of two primes (7+23 and 11+19) [GOLDBACH], but using DS's GlobalSearch for all solutions takes a long time to compute. also I have to nominate the highest prime.

any suggestions?

why not maple use NoSQL object database to save objects to prevent out of memory?

i want to use dictionary or hashtable in maple

the key are a function, value are a list of things

 

how to do?

Error, (in combinat:-permute) Maple was unable to allocate enough memory to complete this computation

would like to get all combination of system of polynomials

but got memory error, another alternatives to do this?

 

AllMatrices := proc (A::set, k::posint, n::posint)
local B, C, E:
B := [[]]:
C := proc ()
B := [seq(seq([A[i], op(B[j])], i = 1 .. nops(A)), j = 1 .. nops(B))]:
end proc:
E := (C@@(k*n))(B):
seq(Matrix(k, n, E[m]), m = 1 .. nops(A)^(k*n));
end proc:
mm := AllMatrices({0, 1}, 3, 3);

GetRing := proc(sol)
ringequation := 0;
mono1 := 0;
for j from 1 to 3 do
mono1 := 1;
for i from 1 to nops(sol[1][j]) do
mono1 := mono1*op(i, sol[1][j]);
od:
ringequation := ringequation + mono1;
od:
return ringequation;
end proc;

with(LinearAlgebra):
polylistresult := [];
for i from 1 to nops([mm]) do
sol := MatrixMatrixMultiply(Matrix([[a,b,c]]), op(i,[mm]));
sol := GetRing(sol);
polylistresult := [op(polylistresult), sol];
od:
gaga := polylistresult;
nops(polylistresult);
polylistresult := [op(polylistresult), op(gaga)];
nops(polylistresult);
polylistresult := [op(polylistresult), op(gaga)];
nops(polylistresult);
with(combinat):
gg := permute(polylistresult, 3);
Error, (in combinat:-permute) Maple was unable to allocate enough memory to complete this computation. Please see ?alloc

Hey I have a list of matrices and I want to define a proc that will search through the first matrices entries looking for zeroes, and if it finds one to move on to the next matrix in the list and look for zeroes and so on. if for some reason all matrices in the list have zeroes i would like the proc to answer with 0. otherwise I would like it to answer with the ndex of the first matrix wth all non-zero entries. I've played with things and occasionally made things work. But in general I do not have a solution. This is what I'e tried:

Things like this:

recu:=proc(y,n,q)
options trace;
local f,j,t,k;
t[y]:=y:
k:=y:
for f from 1 to n while y<=q do;
for j from 1 to n do;
if evalb(C[k](f,j)=0) then;
t[y+1]:=t[y]+1;
recu(t[y+1],n,q);
else next;
end if;
end do;
end do;
end proc;

like this:

recu:=proc(y,n,q)
local f,j,t,k;
global S;
options trace;
S:=0;
if y=q then return "no";
end if;
for f from 1 to n do;
for j from 1 to n do;
if evalb(C[y](f,j)=0) then;
recu(y+1,n,q);
S:=S+1;
end if;
end do;
end do;
end proc;

And I think I understand well why these are not workinging however I wondered what I can do that will be syntactically (sp?) correct.

Thanks

Hi I am simply trying to rearange equation X, the steoes I want to do are differentiate X w.r.t t then insert equation Y into the new differentiated form but I am stuck, I am not really sure what to try I have used algsubs but it comes up with an error.

 

here is my code: 

 

X := diff(x(t), t)+(k1+k2+k3)*x(t)-(k4-k1)*y(t)-k1 = 0;
print(`output redirected...`); # input placeholder
/ d \
|--- x(t)| + (k1 + k2 + k3) x(t) - (k4 - k1) y(t) - k1 = 0
\ dt /
Y := diff(y(t), t)+(k4+k5+k6)*y(t)-(k3-k6)*x(t)-k6 = 0;
print(`output redirected...`); # input placeholder
/ d \
|--- y(t)| + (k4 + k5 + k6) y(t) - (k3 - k6) x(t) - k6 = 0
\ dt /
A := diff(X, t);
print(`output redirected...`); # input placeholder
/ d / d \\ / d \
|--- |--- x(t)|| + (k1 + k2 + k3) |--- x(t)|
\ dt \ dt // \ dt /

/ d \
- (k4 - k1) |--- y(t)| = 0
\ dt /
algsubs(Y, A);
%;
Error, (in algsubs) cannot compute degree of pattern in y(t)

 

how to permutate all combination of matrix of each element can only be 0,1,2

although it can be done in other language, and copy to maple

how to do this in maple with combinat package?

I have an indexed equation that contains serval definite integrals in it. I want maple to evaluate the equation for different indices. But when I set the parameter "N=100" in the code, it takes maple lots of time for the evaluation. I am looking for some tricks to make the code numerically more efficient. I will be so thankful for any opinion and help.
you can find my code below. The code is so simple and just contains few lines. I will appreciate any help.

Numerical_Performance.mw

Thanks in advance.

After taking the inverse Laplace transform of a function, I wrote a Maple command to evaluate the result at some specified values of t (for example at t=0), it returned solution in equation (2) . I expected single numerical value for each value of t, but , it gave the result in form of  linear combinations of  delta(2,0), delta(3,0), delta(4,0), etc. See below:

> restart;
> with(Physics);
> Setup(mathematicalnotation = true); complex*number;
[mathematicalnotation = true]
complex number
> k[1] := 139.39; c[1] := .2725; mu[1] := 5.9410; gamm1 := 2;
> P[0] := 1; M := 70; g := 9.8; v := 6.5; L := 6;
> P1 := P[0]*M*g*(-L*s/v)^k/factorial(k);
> Y[1](0), Y[1](1), Y[1](2), Y[1](3) := 0., a, 0., c;
> Y[2](0), Y[2](1), Y[2](2), Y[2](3) := 0., b, 0., d;
> B[k-r] := KroneckerDelta[k, r]-(3/2)*KroneckerDelta[k, r+1]+(3/4)*KroneckerDelta[k, r+2]-(1/8)*KroneckerDelta[k, r+3];
> B1 := -(3/2)*KroneckerDelta[k, r]+(3/2)*KroneckerDelta[k, r+1]-(3/8)*KroneckerDelta[k, r+2];
> B2 := (3/2)*KroneckerDelta[k, r]-(3/4)*KroneckerDelta[k, r+1];
> Q[k-r] := KroneckerDelta[k, r]-(1/2)*KroneckerDelta[k, r+1];
> A1 := sum(B[k-r]*(r+1)*(r+2)*(r+3)*(r+4)*Y[1](r+4), r = 0 .. k)+2*(sum(B1*(r+1)*(r+2)*(r+3)*Y[1](r+3), r = 0 .. k))+sum(B2*(r+1)*(r+2)*Y[1](r+2), r = 0 .. k)+k[1]*(Y[1](k)-Y[2](k))+c[1]*s*(Y[1](k)-Y[2](k))-mu[1]*s*(k+1)*(k+2)*(Y[1](k+2)-Y[2](k+2))+sum(gamm1*s^2*Q[k-r]*Y[1](r), r = 0 .. k) = P1;
> A2 := sum(B[k-r]*(r+1)*(r+2)*(r+3)*(r+4)*Y[2](r+4), r = 0 .. k)+2*(sum(B1*(r+1)*(r+2)*(r+3)*Y[2](r+3), r = 0 .. k))+sum(B2*(r+1)*(r+2)*Y[2](r+2), r = 0 .. k)+k[1]*(Y[2](k)-Y[1](k))+c[1]*s*(Y[2](k)-Y[1](k))-mu[1]*s*(k+1)*(k+2)*(Y[2](k+2)-Y[1](k+2))+sum(gamm1*s^2*Q[k-r]*Y[2](r), r = 0 .. k) = 0;
> m := 12;
> for i from 0 to m do Y[1](i+4) := collect(solve(eval(A1, k = i), Y[1](i+4)), {a, b, c, d}); Y[2](i+4) := collect(solve(eval(A2, k = i), Y[2](i+4)), {a, b, c, d}) end do;
>
> A3 := sum(Y[1](k), k = 0 .. 8) = 0;
> A4 := sum(k*(k-1)*Y[1](k), k = 0 .. 8) = 0;
> A5 := sum(Y[2](k), k = 0 .. 8) = 0;
> A6 := sum(k*(k-1)*Y[2](k), k = 0 .. 8) = 0;
> sol := solve({A3, A4, A5, A6}, {a, b, c, d});
> Y[1] := eval(sum(Y[1](k)*xi^k, k = 0 .. 8), sol);
>
> with(inttrans);
> y[1] := invlaplace(Y[1], s, t);
> y[2] := subs(I = 0, y[1]);

>
> for xi from 0 by .1 to 1 do y[xi] := eval(eval(y[2], {t = 0})) end do;
y[0] := 0.
y[0.1] := -335.8210943 - 0.2853134161 delta(1, 0)

- 0.003189135039 delta(2, 0) + 3.215933203 delta(0)

-8 -9
- 2.101888941 10 delta(3, 0) + 8.278917357 10 delta(4, 0)
y[0.2] := -616.5812812 - 0.7286587659 delta(1, 0)

+ 0.003338719654 delta(2, 0) + 2.597336701 delta(0)

-7
- 0.000001136393191 delta(3, 0) + 2.587772223 10 delta(4, 0)
y[0.3] := -787.6445525 - 1.474810997 delta(1, 0)

+ 0.02853884261 delta(2, 0) - 5.517159103 delta(0)

- 0.00001031142443 delta(3, 0) + 0.000001812552944 delta(4, 0)
y[0.4] := -811.1848471 - 2.589947077 delta(1, 0)

+ 0.07684191276 delta(2, 0) - 23.27219517 delta(0)

- 0.00004426296248 delta(3, 0) + 0.000006660566248 delta(4, 0)
y[0.5] := -682.8521581 - 3.984266525 delta(1, 0)

+ 0.1440502970 delta(2, 0) - 49.60730104 delta(0)

- 0.0001229043255 delta(3, 0) + 0.00001666149585 delta(4, 0)
y[0.6] := -441.5562325 - 5.350681306 delta(1, 0)

+ 0.2144868917 delta(2, 0) - 78.78970103 delta(0)

- 0.0002502887215 delta(3, 0) + 0.00003148839539 delta(4, 0)
y[0.7] := -167.0511892 - 6.158350095 delta(1, 0)

+ 0.2612340304 delta(2, 0) - 100.0143657 delta(0)

- 0.0003906180172 delta(3, 0) + 0.00004649544839 delta(4, 0)
y[0.8] := 39.3465739 - 5.754055618 delta(1, 0)

+ 0.2517612354 delta(2, 0) - 99.27848038 delta(0)

- 0.0004565738656 delta(3, 0) + 0.00005214660880 delta(4, 0)
y[0.9] := 94.9253902 - 3.638647825 delta(1, 0)

+ 0.1617018641 delta(2, 0) - 65.09861522 delta(0)

- 0.0003369182899 delta(3, 0) + 0.00003737844304 delta(4, 0)
-7
y[1.0] := -0.00034023 + 5.342230828 10 delta(1, 0)

-8
- 2.395810153 10 delta(2, 0) + 0.000005214637385 delta(0)

-9 -11
- 1.077399852 10 delta(3, 0) + 1.681923081 10 delta(4, 0)


restart:

k:=75.11: m:=2: L:=3: with(plots):

Warning, the name changecoords has been redefined

a:=(m*L)+k-1:

b:=k-(m*L):

p:=((((k*m)/snr)^((a+1)/2))*MeijerG([[-a/2,(1-a)/2],[]],[[b/2,-b/2],[-(1+a)/2]],((k*m)/snr)))/(2*sqrt(Pi)*GAMMA(m*L)*GAMMA(k)):

result:=[seq([i,evalf(eval(p,snr=i))],i=1..30)];

result := [[1, -0.6330041673e120], [2, -0.4613210864e64], [3, 0.3668245238e39], [4, 0.1139121839e25], [5, 0.3579973839e14], [6, -206229.5169], [7, -0.3974877718e-1], [8, 0.9674643749e-5], [9, 0.5391296818e-5], [10, 0.3196265870e-5], [11, 0.1976463916e-5], [12, 0.1266745865e-5], [13, 0.8372952650e-6], [14, 0.5684795395e-6], [15, 0.3951633407e-6], [16, 0.2804713655e-6], [17, 0.2027996228e-6], [18, 0.1491013191e-6], [19, 0.1112814841e-6], [20, 0.8419420597e-7], [21, 0.6449585541e-7], [22, 0.4997027323e-7], [23, 0.3912177900e-7], [24, 0.3092406713e-7], [25, 0.2466212008e-7], [26, 0.1983074835e-7], [27, 0.1606835720e-7], [28, 0.1311299491e-7], [29, 0.1077276000e-7], [30, 0.8905591111e-8]]

plots:-pointplot(result);

Error, `plots` does not evaluate to a module

 

 


Download ak_BER_9sep.mw

need to plot these values for various values of i.

any help??

For two angles a and b, and functions f and g, I have a system of two equations,

diff(a(t),t$2) = f(a(t), b(t), diff(a(t),t), diff(b(t),t)) and diff(b(t),t$2) = g(a(t), b(t), diff(a(t),t), diff(b(t),t)).

The actual equations (i.e. not in terms of f and g) are known but are ommitted because they are very long.

 

I need not the solutions but simply the time t at which a(t) = b(t). While I have inputted the full equations into Maple, I do not know how to ask it to find an expression for t in terms of the constants of the equation.

How would I ask Maple to find this time?

Hi all

I have written the following code in maple to approximate arbitrary functions by hybrid of block-pulse and bernstein functions but it doesn't work properly especially for f(t)=1.0, so what is the matter?

bb1.mws

 


best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Using Maple 18.01 on windows 7.

When setting typesetting level to extended, I get this (which is what I want):

restart;
diff(x(t),t);

But I also wanted to use alias, to make the above show just as \dot(x), i.e. without the (t) as well, since the equations are long, and not having (t) printed next to each letter would make them easier to read. But I found out that if I use an alias as follows

alias(x=x(t))

then now the typesetting level extended no longer works:

restart;
alias(x=x(t));
diff(x,t);

What do I need to make Maple display  only \dot(x) without the argument (t) everywhere?

 

 

 

 

I have written a code that computes the fourier-bessel series of a function over the period [a,b].
When I wanted to get some numerical results, I noticed that it takes lots of time for maple to numerically compute the coefficients of the series. Each coefficient of the series is expressed in terms of some integrals that I was expecting maple to compute them in few seconds, however, when  I want to compute "N=100" terms of the series, it takes lots of time.

I was wondering if there is any way to boost up the numerical computation time. I will appreciate any help.

Below you can find my code.

Example_2.mw

Many many thanks for your attentions! :)

can maple 17 make serial communication with arduino such as i wan to get data from accelerometer then the data will display in maple 17

3 4 5 6 7 8 9 Last Page 5 of 1052