MaplePrimes Questions

I have a piecewise defined linear function, at one point it has a set value. How can i plot it in maple??

How is it possible to stop Maple from running, in specific line of program when using execute the entire worksheet???

Is it possible to capture and convert the output of dismantle to one (long) string?

For example, if I do

r:=dismantle(x+sin(x));

SUM(5)
   NAME(4): x
   INTPOS(2): 1
   FUNCTION(3)
      NAME(4): sin #[protected, _syslib]
      EXPSEQ(2)
         NAME(4): x
   INTPOS(2): 1

I'd like to first capture the output in "r", which now it does not, it just goes to screen and "r" is left empty, and then convert the result to long string. (using convert()) So the result of the above will becomes

r:="SUM(5) NAME(4): x INTPOS(2): 1 FUNCTION(3) NAME(4): sin #[protected, _syslib]..."

The reason I need to capture the output, is so I can more easily look for some specific name/content inside the expression. which is now in a string, using string tools later on, which I think will be easier. For example, if I want to look for "sin" I can now search the above string and see if "sin" is there. Context is not important, just need to see if a name happens to be in the string.  The problem I do not know how to convert output of dismantle to string.

Maple 2016.2 on windows

 

TQ.mw

Can any one help for finding the solution of these differntial equations and then plotting the graph for differnt values of M

(FILE ATTACHED)
 

eqn1 := (R/(R-theta(eta))+Omega)*(diff(f(eta), `$`(eta, 3)))+f(eta)*(diff(f(eta), `$`(eta, 2)))+R*(diff(f(eta), `$`(eta, 2)))*(diff(theta(eta), eta))/(R-theta(eta))^2+Omega*(diff(g(eta), eta))+lambda*theta(eta)*Cos(alpha)-M*(diff(f(eta), eta))^2 = 0; eqn2 := (R/(R-theta(eta))+(1/2)*Omega)*(diff(g(eta), `$`(eta, 2)))-2*Omega*(2*g(eta)+diff(f(eta), `$`(eta, 2)))+(diff(f(eta), eta))*g(eta)+(diff(g(eta), eta))*f(eta)+R*(diff(g(eta), eta))*(diff(theta(eta), eta))/(R-theta(eta))^2 = 0; eqn3 := (1+`ε`*theta(eta))*(diff(theta(eta), `$`(eta, 2)))+`ε`*(diff(theta(eta), eta))^2+Pr*(f(eta)*(diff(theta(eta), eta))-(diff(f(eta), eta))*theta(eta))+Q*theta(eta)+L*exp(-eta) = 0

(R/(R-theta(eta))+Omega)*(diff(diff(diff(f(eta), eta), eta), eta))+f(eta)*(diff(diff(f(eta), eta), eta))+R*(diff(diff(f(eta), eta), eta))*(diff(theta(eta), eta))/(R-theta(eta))^2+Omega*(diff(g(eta), eta))+lambda*theta(eta)*Cos(alpha)-M*(diff(f(eta), eta))^2 = 0

 

(R/(R-theta(eta))+(1/2)*Omega)*(diff(diff(g(eta), eta), eta))-2*Omega*(2*g(eta)+diff(diff(f(eta), eta), eta))+(diff(f(eta), eta))*g(eta)+(diff(g(eta), eta))*f(eta)+R*(diff(g(eta), eta))*(diff(theta(eta), eta))/(R-theta(eta))^2 = 0

 

(1+epsilon*theta(eta))*(diff(diff(theta(eta), eta), eta))+epsilon*(diff(theta(eta), eta))^2+Pr*(f(eta)*(diff(theta(eta), eta))-(diff(f(eta), eta))*theta(eta))+Q*theta(eta)+L*exp(-eta) = 0

(1)

Omega := 2.; M := .5; R := 5; lambda := 20; `ε` := .2; Pr := 1; Q := .5; L := .5; W := .5; n := .1; alpha := (1/6)*Pi

bc := f(0) = W, (D(f))(0) = 0, (D(f))(infinity) = 0, (D(theta))(0) = -1, theta(infinity) = 0, g(0) = -n*(DD(f))(0), g(infinity) = 0

f(0) = W, (D(f))(0) = 0, (D(f))(N) = 0, (D(theta))(0) = -1, theta(N) = 0, g(0) = -n*(DD(f))(0), g(N) = 0

(2)

``


 

Download TQ.mw

 

A lemniscate is a polar curve of the form r^2=a^2*cos(2*theta) or r^2=a^2*sin(2*theta). I have just started using Maple and I wrote the following commands: 

> with(plots):
> polarplot(2*sqrt(cos(2*t)), axiscoordinates = cartesian, angularunit = radian, color = "Black");
 

But I am getting the following graph 

which is not satisfactory since some points are missing. I know that using the square root may have caused this, but I am not sure as to how should I resolve this issue. I used plus/minus symbol before the expression 2(cos(2t))^(0.5) but there was an error and the discontinuity still persisits. Kindly help me in plotting this curve. 

Thank you.

How can i copy paste some differential equations with boundary conditions from maple work sheet to here

I have a big square matrix(1000*1000) having parameter x within some of its entries.

How do you suggest to find close form eigenvalue of such matrix with maple? (eigenvalue will be function of x)

 

Hello

Can Maple compute the weak derivative of piecewise function like

f:=x->piecewise(0<x and x<0.5,x,0.5<x and x<1,1-x,  elsewhere 0);

Many thanks

 

hello agian i have the following problem. i need to fit data using the following model:

ode_sub := diff(S(t), t) = -k1*S(t)-S(t)/T1_s;

ode_P1 := diff(P1(t), t) = 2*k1*S(t)-k2*(P1(t)-P2(t)/keq)-P1(t)/T1_p1;

ode_P2 := diff(P2(t), t) = -k2*(-keq*P1(t)+P2(t))/keq-k4*P2(t)-P2(t)/T1_p2;

ode_P2e := diff(P2_e(t), t) = k4*P2(t)-P2_e(t)/T1_p2_e;

ode_system := ode_sub, ode_P1, ode_P2, ode_P2e

known paramters: s0 := 10000; k2 := 1000; T1_s := 14; T1_p2_e := 35; T1_p2 := T1_p1

initial conditions: init := S(0) = s0, P1(0) = 0, P2(0) = 0, P2_e(0) = 0

using the following data the fitting is fine:

T := [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]

data_s := [10000.00001377746, 7880.718836217512, 6210.572917625112, 4894.377814704496, 3857.121616806618, 3039.689036293312, 2395.493468824973, 1887.821030424934, 1487.738721378254, 1172.445015238064, 923.970970533911, 728.1555148262845, 573.8389058920359, 452.2263410725434, 356.3868133709972, 280.8584641247961, 221.3366863178145, 174.4291648589732, 137.4627967029932, 108.3305246342751, 85.37230370803576, 67.2794974831867, 53.0210755540487, 41.78436556408739, 32.92915589156605, 25.95049906181449, 20.45092590987601, 16.11678944747619, 12.70115104646253, 10.009439492356, 7.888058666357939, 6.216464754698855, 4.899036441885205, 3.860793948052506, 3.042584031379331, 2.397778731385364, 1.889601342133927, 1.489145259940784, 1.173591417634974, .9248694992255094, .7288443588090404, .5743879613705721, .4526024635132348, .3567687570029392, .2810508404011898, .2215650452813882, .174603181767829, .1376243372528356, .1084232889842753, 0.8542884707952822e-1, 0.6738282660463157e-1]

data_p1 := [0.1194335334401124e-4, 244.8746046039949, 374.8721199398692, 430.5392805383767, 439.6598364813143, 421.0353424914179, 387.1842556288343, 346.2646897222593, 303.4377508746471, 261.8283447091155, 223.1996547160051, 188.4213144493491, 157.7924449350029, 131.2622073983344, 108.5771635112278, 89.37951009190863, 73.26979150957087, 59.84578653950572, 48.72563358658898, 39.56010490461378, 32.03855466968536, 25.88922670933322, 20.87834763772145, 16.80708274458702, 13.50774122768974, 10.84014148654258, 8.687656394505874, 6.954093898245485, 5.560224107929433, 4.441209458524726, 3.544128529596104, 2.825755811619965, 2.251247757181308, 1.792233305651086, 1.425861347838012, 1.133566009019768, .90081361320016, .7153496336919163, .5678861241754847, .4505952916932289, .3572989037753538, .2832489239941939, .2244289868248577, .1778450590752305, .1408633578784151, .1114667192753896, 0.8826814044702111e-1, 0.6979315954603076e-1, 0.5526502783606788e-1, 0.4370354298880999e-1, 0.3456334307662573e-1]

data_p2_p2e := [-0.1821397630630296e-4, 1000.40572909871, 1568.064904416198, 1848.900129881268, 1944.147939710225, 1923.352973299286, 1833.705314342611, 1706.726235937363, 1563.036042115902, 1415.741121363331, 1272.825952816517, 1138.833091575137, 1016.03557293539, 905.2470623752856, 806.3754051707843, 718.7979384094563, 641.6091822001032, 573.7825966275556, 514.2718125966452, 462.0710416682647, 416.2491499591012, 375.9656328260581, 340.4748518743264, 309.124348579787, 281.3484612079911, 256.6599441255977, 234.6416876403397, 214.9378461256197, 197.2453333305823, 181.3059798685686, 166.90059218783, 153.8422174795751, 141.9717783871606, 131.1529759058513, 121.2692959115991, 112.2199678247825, 103.9187616370328, 96.29007054510998, 89.26877137303566, 82.79743967408479, 76.82586273439793, 71.30944943617081, 66.2085909515396, 61.48838150744805, 57.11714763242225, 53.06666224006544, 49.31130738219119, 45.82807853990728, 42.59597194910467, 39.59575450632008, 36.81013335261527]

the fitting is done the following way: 

P1fu, P2fu, P2e_fu, Sfu := op(subs(res, [P1(t), P2(t), P2_e(t), S(t)]))

making residuals:

Q := proc (T1_p1, k1, keq, k4) local P1v, P2v, P2e_v, Sv, resid; option remember;

res(parameters = [T1_p1, k1, keq, k4]);

try P1v := `~`[P1fu](T); P2v := `~`[P2fu](T); P2e_v := `~`[P2e_fu](T); Sv := `~`[Sfu](T); resid := [P1v-data_p1, P2v+P2e_v-data_p2_p2e, Sv-data_s]; return [seq(seq(resid[i][j], i = 1 .. 3), j = 1 .. nops(T))] catch: return [1000000$3*nops(T)] end try end proc;
q := [seq(subs(_nn = n, proc (T1_p1, k1, keq, k4) Q(args)[_nn] end proc), n = 1 .. 3*nops(T))];

finding inital point for the LSsolve:

L := fsolve(q[2 .. 5], [10, 0.2e-1, 4, 4])

fitting the data with the intial point: 

solLS := Optimization:-LSSolve(q, initialpoint = L)

this is all good however, when i used the following data it did not turn out so well (using the same approch as above):

data_s := [96304.74567, 77385.03700, 62621.83067, 51239.94333, 42663.82367, 35084.74100, 28480.28367, 23066.01467, 18774.73700, 15179.13700, 12278.50767, 9937.652000, 8046.848333, 6521.242000, 5287.811667, 4277.779000, 3466.518333, 2835.467000, 2297.796333, 1861.249667, 1529.654000, 1235.353000, 999.6626667, 826.2343333, 667.9480000, 559.9230000, 449.2790000, 376.4860000, 289.1203333, 236.1483333]

data_p1 := [0.86e-1, 3.904, 26.975, 31.719, 41.067, 46.779, 52.115, 43.101, 44.344, 41.094, 36.523, 27.742, 26.543, 28.062, 22.178, 21.303, 14.951, 17.871, 11.422, 12.051, 9.232, 6.817, 6.1, .717, 1.215, 6.146, .772, .375, 2.595, .518]

data_p2_p2e := [-3.024, 22.238, 61.731, 103.816, 132.695, 159.069, 167.302, 160.188, 158.398, 152.943, 146.745, 135.22, 132.145, 120.413, 107.864, 95.339, 90.775, 81.828, 71.065, 70.475, 62.872, 49.955, 40.858, 42.938, 41.311, 35.583, 31.573, 29.841, 29.558, 21.762]

the known parameters is the case are:

s0 := 96304.74567; k2 := 10^5; T1_s := 14; T1_p2_e := 35; T1_p2 := T1_p1

additionally the following fuction affects the solution: 

K:=t->cos((1/180)*beta*Pi)^(t/Tr)

i included this by doing this:

P1fu_K := proc (t) options operator, arrow; P1fu(t)*K(t) end proc;

P2fu_K := proc (t) options operator, arrow; P2fu(t)*K(t) end proc;

P2e_fu_K := proc (t) options operator, arrow;

P2e_fu(t)*K(t) end proc;

Sfu_K := proc (t) options operator, arrow; Sfu(t)*K(t) end proc

resulting in the following residuals:

Q := proc (T1_p1, k1, keq, k4) local P1v, P2v, P2e_v, Sv, resid; option remember;

res(parameters = [T1_p1, k1, keq, k4]);

try P1v := `~`[P1fu_K](T); P2v := `~`[P2fu_K](T); P2e_v := `~`[P2e_fu_K](T); Sv := `~`[Sfu_K](T); resid := [P1v-data_p1, P2v+P2e_v-data_p2_p2e, Sv-data_s]; return [seq(seq(resid[i][j], i = 1 .. 3), j = 1 .. nops(T))] catch: return [1000000$3*nops(T)] end try end proc;
q := [seq(subs(_nn = n, proc (T1_p1, k1, keq, k4) Q(args)[_nn] end proc), n = 1 .. 3*nops(T))];

i think my problem is that the inital point in this case is not known. all i know is that all the fitted parameters should be positive and that k1<1, k4>10, keq>1 and T1_p1>100 (more i do not know) - is there a way to determin the inital point without guessing?

i also know the results, which should be close to these values:

k1=0.000438, k4=0.0385, keq=2.7385 and T1_p1=36.8 the output fit should look something like this

where the red curve is (PP2(t)+PP2_e(t))*K(t)

the blue cure is PP1(t)*K(t) 

anyone able to help - i've tried for 2 days now. it might be that  ode_P1 := diff(P1(t), t) = 2*k1*S(t)-k2*(P1(t)-P2(t)/keq)-P1(t)/T1_p1 should be changed into ode_P1 := diff(P1(t), t) = k1*S(t)-k2*(P1(t)-P2(t)/keq)-P1(t)/T1_p1;

i've tried this but it didnt seem to do much 

anyone able to help?:)

NB stiff=true can be used within the dsolve to speed up the process if needed:)

 

 

 

 


 

 

Hi, here a maple newbie... I'm trying to obtain de coordinates of the "double points" of a planar Lissajous curve, but I have no idea how =S.

I have two symmetric real matrices as below (Mt,Kk).

I multilpy them in Mt.Kk.Mt.

But the result is not symmetric.!!!!why????

 

``

restart; with(LinearAlgebra)

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received shareman

 

Mt := ImportMatrix("C:/Mt.mpl"); -1; Norm(Mt-LinearAlgebra:-HermitianTranspose(Mt), 2)

0.

(1)

Kk := ImportMatrix("C:/Kk.mpl"); -1; Norm(Kk-LinearAlgebra:-HermitianTranspose(Kk), 2)

0.

(2)

Aa := Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Mt, Kk), Mt); -1; Norm(Aa-LinearAlgebra:-HermitianTranspose(Aa))

4608.00000953674316

(3)

Aa

RTABLE(18446744074182082558, complex[8], Matrix, rectangular, Fortran_order, [], 2, 1 .. 45, 1 .. 45)

(4)

``

``

``

``

``

``

``

``

``

``

``

``

``

Download question.mw

I couldnt upload Kk.mlp and Mt.mlp so changed their extensions to mw. for using please change them to .mlp

Download Kk.mw

Download Mt.mw

 

I have been looking at a method for computing the inverse of a periodic, tridiagonal, matrix (tridiagonal with non-zero elements in (1,n) and (n,1), where n is the order of the matrix).

Using test matrices with rational elements I get a good improvement in execution time compared to Maple's MatrixInverse procedure from LinearAlgebra. However when I use algebraic elements I get faster times with small orders but from around
n=25 (for a particular example matrix) my method is running slower than MatrixInverse.

If I look at the element (1,1) of the inverse returned by both procedures I see that the Maple inverse is quite compact while the value returned by my procedure is very complex (on printing Maple extracts 17 subexpressions of varying complexity). I
have a check in the test rig to determine if the two inverses are the same; this uses

evalb(simplify(AinvMaple[i,j]-Ainv[i,j])==0)

and all the elements do agree.

The Maple MatrixInverse appears to be able to simplify the elements of the inverse; is this a feature of the algorithm that's being used or is there some mechanism I should be using to achieve this?

The source code of the procedure I've written (first 100 odd lines) and the test rig are attached. The file is set up to run the algebraic test (Test4) for n=20 and to print the (1,1) inverse elements generated by both the Maple and my procedures.

Any help in improving my code to produce simplified forms of the elements would be greatfully received.

Maple source as text file: KilicInv.txt

I have two figures that's generated in Maple (by plot), then pasted them to a worksheet, which I would like to export them to PDF format with exactly the same as it seems on Maple, meaning that these two figures need to be on the same row.

However, in the exported PDF, these two figures are always in two rows: see Fig_1.mw and Fig_1.pdf 

What I tried was: to really resize these two figures into very small size, and the export works, however, I also need three figures or four figures in one row. See Fig_2.mw and Fig_2.pdf

So there is actually two questions:

1. Can I specify some parameters in Maple such that the exported PDF is exactly 'what I see is what I get'?

2. If #1 is impossible, where can I get the information on: width of the exported PDF, how to specify the precise size of plot command etc

Thanks,

does anybody know how to copy a rtable structure in a worksheet and paste it on the other worksheet?

I copy it by right click and paste on the other one but no data transfered.

How to express a chemistry equation in prefix expression

1 2 3 4 5 6 7 Last Page 3 of 1437