MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

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

Hi,

I need to transfer an array of size (M,N) from maple to matlab. But i dont know how to make it. Please help me for this. Thanx in advance.

Regards

Sunit

Free/Rooted Vector Norms...

September 07 2014 mablecat 10

In using the Maple 17 VectorCalculus package I was suprised to find that the Norm of a free vector is not the same as the Norm of a "corresponding" RootedVector, i.e.the same vector with a different root. Am I missing something ? Thanks for an explanation.

 

restart;
with(VectorCalculus):

P:=<1,2,3>; # free vector
PP:=RootedVector(root=[-1,2,-3],P)

Norm(P);
Norm(PP);

Hi all,

I have a problem when creating package by using 'read' function to concatenate package's elements

Case1: Create package normally, Proc1 and Proc2 are exported

restart;
###################################
# Define package Test contains 2 proc: Proc1 and Proc2
##################################
Test := module()
    option package;
    export Proc1, Proc2;

    Proc1 := proc()
        description "Proc1() is an element of package Test";
        printf("In Proc1\n");
    end proc;
    Proc2 := proc()
        description "Proc2 is an element of package Test";
        printf("In Proc2\n");
        Proc1();
    end proc;
end module;

#################################
# Try to call Proc1 from Proc2
#################################
Test:-Proc2();

Console output:

> Test:-Proc2();
In Proc2
In Proc1

==> The result looks OK

 

Case2: Split Proc1 into another file and include it into master file by using 'read' function, Proc1 and Proc2 are exported

restart;
###################################
# Define package Test contains 2 proc: Proc1 and Proc2
##################################
Test:= module()
    option package;
    export Proc1, Proc2;

    ###########################
    # Code to concatenate "Proc1.maple" here
    ###########################

    read "Test/Proc1.maple";

    Proc2 := proc()
        description "Proc2 is an element of package Test1";
        printf("In Proc2\n");
        Proc1();
    end proc;


end module;


#################################
# Try to call Proc1 from Proc2
#################################
Test:-Proc2();

Console output:

> Test:-Proc2();
In Proc2
                                    Proc1()

==> The Proc1 seem does not execute or evaluate

 

Case3: Split Proc1 into another file and include it into master file by using 'read' function, just export Proc2, not export Proc1

restart;

###################################
# Define package Test contains 2 proc: Proc1 and Proc2
##################################
Test:= module()
    option package;
    export Proc2;

    ###########################
    # Code to concatenate "Proc1.maple" here
    ###########################

    read "Test/Proc1.maple";

    Proc2 := proc()
        description "Proc2 is an element of package Test1";
        printf("In Proc2\n");
        Proc1();
    end proc;


end module;


#################################
# Try to call Proc1 from Proc2
#################################
Test:-Proc1();

Console output:

> Test:-Proc2();
In Proc2

In Proc1

==> The result looks good

 

Please help to explain the problem from case 2 and case 3. If I want to split package proc into many files, how can I do?

 

Hi! I'm trying to solve a system of four non-linear equations in Maple 17 but it doesn't work.

Equations are: F, Fw, Ft, Fk and varibles are T,w,k,ki.

Parametars are Mn=10, Ms=2, alfa=0.2 and Tf=(k*T^(alfa)/Mn)^(1/alfa).

Solutions must be positive. 

This is maple script:

restart;
> assume (w>0):
> assume (T>0):
> assume (k>0):
> assume (ki>0):
> assume (Mn>0):
> assume (Ms>0):
> assume (Tf>0):
> assume (alfa>0):


> Gp:=1/exp(sqrt(w*I));

> Cf:=((T*w*I+1)/(Tf*w*I+1));

> Cpi:=(k*w*I+ki)/(w*I);

> L:=Cf*Cpi*Gp;
> L:=evalc(L):
> F:=subs(Ms=2,Tf=(k*T^(alfa)/Mn)^(1/alfa),evalc(abs(1+L)^2-1/Ms^2));
> F:=subs(Mn=10,alfa=0.2,evalc(F));

> Fw:=diff(F,w):
> Fk:=diff(F,k):
> Ft:=diff(F,T):
> fsolve({F,Fw,Fk,Ft},{w,k,ki,T});

Thanks in advance for any help. Dragoslav

Hi there

I've got an 18*18 matrix which almost all of its elements are in parametric form. I Need to export this matrix to MATLAB to do some numerical alnalysis on that But when I click on  " export as MATLAB", the following error appears:

"can not convert matrix elements to float[8] datatype"

I wonder if thre's a solution to that or anyother way to move the matrix(as it is) to MATLAB.

I'll be appreciated your help

This seems such a simple/basic question I'm almost too embarassed to ask.

Anyway. this is causing me some headaches

 

> A := <0|0>;

         A:= [0 0 ]

> B := A:

> A(1,1) := 2 ;

         A:= [2 0 ]

> B;

         B:= [2 0 ]

What do I do to prevent the elements of B changing if A changes, after using the assignment B:=A (or should I not be using this assignment?)  I mean, I would like the same behaviour as 

> a := 0;

         a:=0

> b := a;

         b:=0

> a := 2;

         a:=2

> b;

         b:=0

which seems to work as I "expect"...

I'm used to Mathcad, and I am very new to Maple. Something I cannot figure out right now is how to define multiple elments of a matrix using a function.


Input Data

Define system dimensions as n:=2;

i:=1..n;

j:=1..n;

lambda:=Matrix(n);

Lambda:=Matrix(n);

upsilon:=vector(n); 

Minor side note: I originaly had upsilon defined using the syntax "Vector[row](ncomp)", but this was giving me an 'exponentiation' operation error, so I changed it to what it is now (basically a list/array, which I guess has different type definitions that no longer cause the error?).

lambda[1,2]:=471.0433;

lambda[2,1]:=883.7530;

upsilon[1]:=58.69;

upsilon[2]:=18.07;

The Problem I'm Having

Now I just want to define Lambda using a function to define all elements (like I would in Mathcad).

Lambda[i,j]:= (upsilon[j]/upsilon[i]) * exp (-lambda[i,j]/2853);

which gives me an extremely long error message:

Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Matrix(2, 2, {(1, 1) = -0.3504976272e-3, (1, 2) = -.16509955895845776, (2, 1) = -.30975332953088164, (2, 2) = -0.3504976272e-3}, datatype = float[8]

As far as I can tell (keep in mind that this is my very first Maple project) that it doesn't like lambda as a matrix? But shouldn't it just evaluate to the element? and why is (2,2) and (1,1) giving values, because it should intialize to zero, so exp(0) = 1 in these cases??

I tried to simplify further by just trying

Lambda[i,j]:=(upsilon[j]/upsilon[i]);

but then it just gives me 1, and when I look into Lambda all the elements are now 1 when only the diagnol elements should be 1 (the rest some fractional amount)??

I am at a complete loss. I thought about doing something like For i = 1 to n etc. but then it just looks like coding, which defeats the purpose of trying to make a calculation sheet documenting the procedure...

Any help and/or insights into what I am doing wrong here would be most welcomed :)

P.S. I've just noticed that there is an upload option :/ Wilson_Equation.mw.

 

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