MaplePrimes Questions

restart;
with(plots):
with(Optimization):
with(LinearAlgebra):
with(Statistics):
with(DEtools):
x11 := <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 := <-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 := <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>;
ICS:=[x1(0)=x11[1],y1(0)=y11[1],z1(0)=z11[1]];
N := Dimension(x11)-1:
sys1 := [Diff(x1(t),t) = k1*x1(t)+ k2*y1(t)+ k3*z1(t), Diff(y1(t),t) = k5*x1(t)+ k6*y1(t)+ k7*z1(t), Diff(z1(t),t) = k9*x1(t)+ k10*y1(t)+ k11*z1(t)];
SS := proc(k1,k2,k3,k5,k6,k7,k9,k10,k11)
local F, V;
if not type([k1,k2,k3,k5,k6,k7,k9,k10,k11],[numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric]) then return 'SS'(k1,k2,k3,k5,k6,k7,k9,k10,k11);
elif k1<0 or k2<0 or k3<0 or k5<0 or k6<0 or k7<0 or k9<0 or k10<0 or k11<0 then return 1e100;
end if;
F := dsolve(eval({Diff(x1(t),t) = k1*x1(t)+ k2*y1(t)+ k3*z1(t), Diff(y1(t),t) = k5*x1(t)+ k6*y1(t)+ k7*z1(t), Diff(z1(t),t) = k9*x1(t)+ k10*y1(t)+ k11*z1(t),x1(0)=x11[1],y1(0)=y11[1],z1(0)=z11[1]},{:-k1=k1,:-k2=k2,:-k3=k3,:-k5=k5,:-k6=k6,:-k7=k7,:-k9=k9,:-k10=k10,:-k11=k11}), [x1(t),y1(t),z1(t)], numeric, output=Array([seq(k,k=0..N)]));
V := convert(Column(F[2,1],2),Vector);
Norm(V-x11,2);
Norm(V-y11,2);
Norm(V-z11,2);
end proc:
params := NLPSolve(SS(k1,k2,k3,k5,k6,k7,k9,k10,k11), method=nonlinearsimplex, initialpoint=[k1=.1, k2=.1, k3=.1, k5=.1, k6=.1, k7=.1, k9=.1, k10=.1, k11=.1],evaluationlimit=200):

Warning, limiting number of function evaluations reached

reference from 

http://www.maplesoft.com/applications/view.aspx?SID=1667

when debug

k1=.1; k2=.1; k3=.1; k5=.1; k6=.1; k7=.1; k9=.1; k10=.1; k11=.1;
F := dsolve({Diff(x1(t),t) = k1*x1(t)+ k2*y1(t)+ k3*z1(t), Diff(y1(t),t) = k5*x1(t)+ k6*y1(t)+ k7*z1(t), Diff(z1(t),t) = k9*x1(t)+ k10*y1(t)+ k11*z1(t),x1(0)=x11[1],y1(0)=y11[1],z1(0)=z11[1]}, [x1(t),y1(t),z1(t)], numeric, output=Array([seq(k,k=0..N)]));

 

Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)
Error, (in dsolve/numeric) Array/array solutions cannot be obtained for ODE containing unassigned global variables {k1, k10, k11, k2, k3, k5, k6, k7, k9}

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]):

 

a1 := Diff(x1(t),t) = k1*x1(t)+ k2*y1(t)+ k3*z1(t) + k4*u(t);

b1 := Diff(y1(t),t) = k5*x1(t)+ k6*y1(t)+ k7*z1(t) + k8*u(t);

c1 := Diff(z1(t),t) = k9*x1(t)+ k10*y1(t)+ k11*z1(t) + k12*u(t);

ICS:=x1(0)=x11[1],y1(0)=y11[1],z1(0)=z11[1];

SOLN := dsolve( { a1,b1,c1, ICS }, {x1(t),y1(t),z1(t)} );

EQ1790 := subs(t= 0, SOLN );

EQ1800 := subs(t=10, SOLN );

PARAMETERS := solve( { EQ1790, EQ1800 }, { k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12 } );

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]):

 

a1 := Diff(x1(t),t) = k1*x1(t)+ k2*y1(t)+ k3*z1(t) + k4*u(t);
b1 := Diff(y1(t),t) = k5*x1(t)+ k6*y1(t)+ k7*z1(t) + k8*u(t);
c1 := Diff(z1(t),t) = k9*x1(t)+ k10*y1(t)+ k11*z1(t) + k12*u(t);
d1 := Diff(u(t), t) = 0;
ICS:=x1(0)=x11[1],y1(0)=y11[1],z1(0)=z11[1];
solL:=dsolve({a1,b1,c1,d1,ICS}, numeric, method=rkf45, parameters=[k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12]);
ans:=proc(p1,p2,p3) solL(parameters=[a1=p1,b1=p2,c1=p3]); end proc:
FitParams:=Statistics:-NonlinearFit(ans, x11, y11, z11, x1, y1, z1);

 

Error, (in Statistics:-NonlinearFit) unexpected parameters: Vector(27, {(1) = 1549.88755331800, (2) = -329.861725802688, (3) = 8.54200301129155, (4) = -283.381775745327, (5) = -54.5469129127573, (6) = 1875.94875597129, (7) = -16.2230517860850, (8) = 6084.82381954832, (9) = 1146.15489803104, (10) = -456.460512914647, (11) = 104.533252701641, (12) = 16.3998365630734, (13) = 11.5710907832054, (14) = -175.370276462696, (15) = 33.8045539958636, (16) = 2029.50029336951, (17) = 1387.92643570857, (18) = 9.54717543291120, (19) = -1999.09590358328, (20) = 29.7628085078953, (21) = 2582103.332, (22) = 57.7969622731082, (23) = -6.42551196941394, (24) = -...

So I am working on doing some trajectory simulations in Maple using standard Newton's Laws, some force expressions, and initial conditions.

Anyway, the numerical solution works fine if I let the initial conditions I specified (for z=-1) be actually for z=-0.9. To illustrate, when I give an initial condition like this:

x(-1) = x_0, D(x)(-1) = xd_0, Vz(-1) = v_0

the results don't make any sense. However, when using the same x_0, xd_0, and v_0 and I give initial conditions like this:

x(-.9) = x_0, D(x)(-.9) = xd_0, Vz(-0.9) = v_0,

the solutions at least make a bit of sense.

What's weird is that, when I let z -> 0.93 or so, the solution changes discontinuously. And this shouldn't happen. The initial conditions were calculated for and should work for z = -1. I don't understand why they aren't.

Here is my Maple document. ics1 are the problem.

dsolve_field_traject.mw

Do you guys have any idea what could be going on?

One can do igcd(12,8), and igcd(16,3), etc...

But how to define a list/set/array/vector/matrix, etc... that contains these pair of numbers, and then call/map igcd on this list?

I tried putting the pair of values in a list and set and even a matrix, calling calling map(igcd, lst) but not getting it right.

The confusing part for me with Maple is to know which data structure to use for each function, since there are more than one. Here are my silly attempts:

lst:={{12,8},{16,3}};
map(igcd,lst);

lst:=<<12|8>,<16|3>>;
map(igcd,lst);

lst:=[{12,8},{16,3}];
map(igcd,lst);

I was looking for something like in Mathematica:

lst = {{12, 8}, {16, 3}};
GCD @@ lst

    {4, 1}

I am sure it is possible to do this in Maple (i.e. map igcd to list of pair of numbers), I just can't get the syntax right. I did look at few examples somewhat related, but did not understand what they are doing. They said I need to pass an extra argument for map in this case?

thank you

Sorry for a basic question, but I am not able to find a setting for this, and I am stil newbie in using Maple UI.

A simple problem. When I copy some Maple code from the net, such as a proc() posted here or else where, then paste the code right into my open worksheet, then each line will show up with ">" at the left.

Is there a way to remove these ">" other than the way I do it now, which is manual process.

Having a ">" at start of each line does not seem to affect anything. The proc() gets defined fine, and I can call it. But normally when I write a proc(), there is no ">" to the left of each line, since those come only when hitting a RETURN. And that is what confuses me.

But what I am looking for, is a way to select some lines, and tell Maple to remove all the ">". Here is a screen shot of some code I just pasted to the worksheet:

 

 

the question is as follow:

The partition does not always have to be equal intervals. Consider evaluating f(x)=x3 between 3 and 5, but splitting up the interval into a partition in which the end points of the subintervals are in a geometric progression. The common ratio r has to be chosen so that 3 is the first term and 5 is the last. Also the subintervals must be capable of getting smaller as n the number of subintervals increases. Check that the geometric series

a, ar, ar2, ar3,.....ari, .....arn =b

with r=  and suitable choices for a and b satisfies these criteria. Treating the difference between ari and ar(i-1) as the width of the subinterval and using the right hand endpoint of the subinterval, evaluate the Riemann sum to n terms for f(x)=x3. Find the limit as n tends to infinity to show that the partition does not affect the result.

here is what i have got so far, can anyone check if im doing it right? thanks

>a:=3:

>b:=a*r^10:

>r:=(5/3)^1/10:

>for i from 0 to 5 do a*r^i end do; -> a list of number appear in sequence ie:3, 3.157...,3.323...3.497...etc

>restart;

>a:=3:

>b:=a*r^100:

>r:=(5/3)^1/100:

>dxj:=a*r^i-a*r^i-1

>xj:=i*dxj+a

>f:=x->x^3

>evalf(sum(f(xj^*)dxj,i=1..100)) -> my value is sth like 162.4788870...

I tried to find the limit, but maple 16 freezed so i think i must have done sth seriously wrong?

<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>b</mi><mo>&coloneq;</mo><mi>a</mi><mo>&sdot;</mo><msup><mi>r</mi><mrow><mn>10</mn></mrow></msup><mo>&#x3b;</mo><mo>&nbsp;</mo></mrow></math>

Is there any way to write a function that determines the area of any n-sided polygon determined by a sequence of points? ie [[x_1, y_1]. [x_2, y_2], ... [x_n, y_n]] while returning 0 if any of the 2 segments intersect, otherwise print the area. Thanks for any help

Hello,

would you please help me how can i introduce a probability distribution function to maple in document mode?

I want to calculate integral of x f(x)dx, while I want maple to know f(x) is a probability distribution function.

I do not have any assumption about f(x)(for example normal or exponential distriburion)

Thanks

Hello, everyone!


Last week I’ve encountered problems with integration of Maple 17 in Microsoft Office Excel 2013. The Maplesoft note on the point (http://www.maplesoft.com/support/faqs/detail.aspx?sid=32651) offers some ways of fixing it up, though I’ve run all of them the problem is the same:

While the connection is established, after entering the formula “=Maple(“x+x”)”, the Excel returns “Critical Error in Formula”

Before contacting the Maplesoft Technical Support, I want to ask here whether someone had the same case and managed to solve it.

Many thanks in advance.

I have f1=x, and fn=x+sin(fn-1).

I would like to write a procedure that would allow me to find the first derivative of fn. Thanks.

 

the question is as follow:

1)receive two integers p and q

2)declare two local p1 and q1 and give them intial values and q

3)check if p o q are equal or less to zero print works only with positive integers

4)while p1 not equal to q1 then p1-a1 otherwise q1-p1

5)whenever p1=q1 we have the GCD

note:must use procedure and call it for different values of p and q after the procedure is written

-by following the instruction above this is what i got

GCD:=proc(p,q)

local p1,q1;

p1:=p;

q1:=q;

if p<=0 OR Q<=0 then 'works only with positive integers'
else while p1<>q1 do if q1<p1 then p1-q1 else q1-p1

end if;

end do;

end if;

end proc;

but when I call two integers eg:p=2, q=6 -> GCD(2,6) maple just freeze...evaluating....forever. is it because i got the procedure wrong etc? it would be helpful if anyone can help me with this. thanks

 

 

A square has 36 sub-squares in it. How to Number each sub squares from 1 to 36, to make the sum of vertical, the sum of horizontal, and the sum of cross line are the same .Describe in general if possible.

I am using the ColumnSpace command (from the LinearAlgebra package) to generate a basis for the column space of a matrix. Is there any way to "force" the command to express the basis in terms of columns of A and not in the canonical form with leading 1's?

For example, for

A:=Matrix([[-3,6,-1,1-7],[1,-2,2,3,-1],[2,-4,5,8,-4]]):

I would like to obtain the following basis for the column space:

{[-3,1,2],[-1,2,5]}

 

I want to plot my function f(x)=sin(e^x +1) and its third order taylor polynomial on the same graph. My code so far (which is giving me an error when I try to define i) is:

f:=x->sin(exp(x)+1);

with(Student[NumericalAnalysis]):

g:=TaylorPolynomial(f(x),x,order=3);

unapply(g,x);

h:=plot(f,0..3,-2..2,color=blue);

i:=plot(g,0..3,-2..2,color=red);

with(plots):

display({h,i},axes=boxed,title=`The function f and its Third Order Taylor Polynomial`);

 

Thanks.

 

First 1508 1509 1510 1511 1512 1513 1514 Last Page 1510 of 2427