Gillee

237 Reputation

8 Badges

8 years, 22 days

MaplePrimes Activity


These are answers submitted by Gillee

Please try this
 

restart``

action1 := module () export Mproc;  Mproc := proc (n) local y; y := n+2 end proc end module

_m1844886131808

(1)

action1:-Mproc(2)

4

(2)

``


Download Ex1.mw

 
 

This is the last variation I can think of: function operator ->, Array, and the add function. Bottomline: about the same execution time. Thanks for the problem I just started learning how to use this software in July.   

 


 

restart; st := time(); k := 6; h := 1; N := .5; nu := .3; E_m := 7.0*10^10; E_c := 3.80*10^11; rho_m := 2702.; rho_c := 3800.; lambda_m := nu*E_m/((1+nu)*(1-2*nu)); lambda_c := nu*E_c/((1+nu)*(1-2*nu)); mu_m := E_m/(2*(1+nu)); mu_c := E_c/(2*(1+nu)); Z := rho_m+(rho_c-rho_m)*(1/2+z/h)^N; U := lambda_m+(lambda_c-lambda_m)*(1/2+z/h)^N; S := mu_m+(mu_c-mu_m)*(1/2+z/h)^N; d := Matrix([[0, 0, 0, 0, 0, 0, 0, 0], [sqrt(3), 0, 0, 0, 0, 0, 0, 0], [0, sqrt(15), 0, 0, 0, 0, 0, 0], [sqrt(7), 0, sqrt(35), 0, 0, 0, 0, 0], [0, sqrt(27), 0, sqrt(63), 0, 0, 0, 0], [sqrt(11), 0, sqrt(55), 0, sqrt(99), 0, 0, 0], [0, sqrt(39), 0, sqrt(91), 0, sqrt(143), 0, 0], [sqrt(15), 0, sqrt(75), 0, sqrt(135), 0, sqrt(195), 0]]); f := proc (al, b, be) options operator, arrow; -2*S*d[be+1, al+1]*W(be)*sqrt(al+1/2)*orthopoly:-P(al, z)*d[2, b+1]*sqrt(b+1/2)*orthopoly:-P(b, z) end proc; e2X := Array(0 .. 5, 0 .. 5, 0 .. 5, f); e2 := add(e2X[() .. (), () .. (), () .. ()]); int(e2, z = -(1/2)*h .. (1/2)*h); time()-st

.766

(1)

NULL

# Original Ans:                -3.192307692*10^11*W(1)+4.396880662*10^11*W(3)-1.474586301*10^11*W(5)-9.235575669*10^10*W(2)+1.979090105*10^11*W(4);

``

``


 

Download for_(10).mw

You could speed up execution by replacing nested for-do loops. I tried with nested add functions. Compared head to head the execution times were about the same. Unlike the previous version for (4).mw where a procedure was created, I kept the code as close as to the original. As you will notice I suppressed printout to the screen that saves time. Hope these methods helps?


 

restart; st := time(); k := 6; h := 1; N := .5; nu := .3; E_m := 7.0*10^10; E_c := 3.80*10^11; rho_m := 2702.; rho_c := 3800.; lambda_m := nu*E_m/((1+nu)*(1-2*nu)); lambda_c := nu*E_c/((1+nu)*(1-2*nu)); mu_m := E_m/(2*(1+nu)); mu_c := E_c/(2*(1+nu)); Z := rho_m+(rho_c-rho_m)*(1/2+z/h)^N; U := lambda_m+(lambda_c-lambda_m)*(1/2+z/h)^N; S := mu_m+(mu_c-mu_m)*(1/2+z/h)^N; d := Matrix([[0, 0, 0, 0, 0, 0, 0, 0], [sqrt(3), 0, 0, 0, 0, 0, 0, 0], [0, sqrt(15), 0, 0, 0, 0, 0, 0], [sqrt(7), 0, sqrt(35), 0, 0, 0, 0, 0], [0, sqrt(27), 0, sqrt(63), 0, 0, 0, 0], [sqrt(11), 0, sqrt(55), 0, sqrt(99), 0, 0, 0], [0, sqrt(39), 0, sqrt(91), 0, sqrt(143), 0, 0], [sqrt(15), 0, sqrt(75), 0, sqrt(135), 0, sqrt(195), 0]]); e2 := add(add(add(-2*S*d[be+1, al+1]*W(be)*sqrt((2*al+1)*(1/2))*orthopoly:-P(al, z)*d[2, b+1]*sqrt((2*b+1)*(1/2))*orthopoly:-P(b, z), be = 0 .. 5), b = 0 .. 5), al = 0 .. 5); int(e2, z = -(1/2)*h .. (1/2)*h); time()-st

.750

(1)

# Original Ans:                -3.192307692*10^11*W(1)+4.396880662*10^11*W(3)-1.474586301*10^11*W(5)-9.235575669*10^10*W(2)+1.979090105*10^11*W(4);


 

Download for_(10a).mw

 

Using @epostma idea of moving the int(..) outside the loops and turning the your code into a procedure, you can get another reduction in time by almost one half. Of course writing a procedure requires a little work, as you will see below. One advantage of a procedure you run it again with new input parameters.


 

restart

pa := proc (k::integer, h::integer, N::float, nu::float, E_m::float, E_c::float, rho_m::float, rho_c::float) local lambda_m::float, lambda_c::float, mu_m::float, mu_c::float, Z::float, U::float, S::float, d::(Array(datatype = float[8])), e2::float, f::float, b::integer, alpha::integer, beta::integer, i::integer, W::float, z::float; lambda_m := nu*E_m/((1+nu)*(1-2*nu)); lambda_c := nu*E_c/((1+nu)*(1-2*nu)); mu_m := E_m/(2+2*nu); mu_c := E_c/(2+2*nu); Z := rho_m+(rho_c-rho_m)*(1/2+z/h)^N; U := lambda_m+(lambda_c-lambda_m)*(1/2+z/h)^N; S := mu_m+(mu_c-mu_m)*(1/2+z/h)^N; d := Matrix([[0, 0, 0, 0, 0, 0, 0, 0], [sqrt(3), 0, 0, 0, 0, 0, 0, 0], [0, sqrt(15), 0, 0, 0, 0, 0, 0], [sqrt(7), 0, sqrt(35), 0, 0, 0, 0, 0], [0, sqrt(27), 0, sqrt(63), 0, 0, 0, 0], [sqrt(11), 0, sqrt(55), 0, sqrt(99), 0, 0, 0], [0, sqrt(39), 0, sqrt(91), 0, sqrt(143), 0, 0], [sqrt(15), 0, sqrt(75), 0, sqrt(135), 0, sqrt(195), 0]]); e2 := 0; for alpha from 0 to k-2 do for b from 0 to k-2 do for beta from 0 to k-1 do e2 := e2-2*S*d[beta+1, alpha+1]*W(beta)*sqrt(alpha+1/2)*orthopoly:-P(alpha, z)*d[2, b+1]*sqrt(b+1/2)*orthopoly:-P(b, z) end do end do end do; int(e2, z = -(1/2)*h .. (1/2)*h) end proc

k := 6; h := 1; N := .5; nu := .3; E_m := 7.0*10^10; E_c := 3.80*10^11; rho_m := 2702.; rho_c := 3800.

time(pa(k, h, N, nu, E_m, E_c, rho_m, rho_c))

.671

(1)

pa(k, h, N, nu, E_m, E_c, rho_m, rho_c)

0.4396880665e12*W(3)-0.1474586298e12*W(5)+0.1979090107e12*W(4)-0.9235575677e11*W(2)-0.3192307694e12*W(1)

(2)

# Original Ans:                -3.192307692*10^11*W(1)+4.396880662*10^11*W(3)-1.474586301*10^11*W(5)-9.235575669*10^10*W(``2)+1.979090105*10^11*W(4);


 

Download for(4).mw

 

You could use DeleteColumn() and DeleteRow() after determining if the sum of the elements in the column or row add up to zero.


 

restart; with(LinearAlgebra)

``

M := Matrix([[0, 0, sqrt(66), 45, 0, 0, exp(-23), 0], [tanh(3), 0, 0, 0, 0, 3^4, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [sqrt(7), 0, sqrt(35), 0, 0, 0, cos(56), 0], [0, sqrt(27), 0, sqrt(63), 0, 0, sin(12), 0], [sqrt(11), 0, sqrt(55), 0, 0, 0, 0, 0], [0, sqrt(39), 0, sqrt(91), 0, sqrt(43), 0, 0], [sqrt(15), 0, sqrt(75), 0, 0, 0, sqrt(195), 0]])

Matrix(%id = 18446746093103943062)

(1)

``

ColumnDimension(M); RowDimension(M)

8

(2)

``

``

for i from ColumnDimension(M) by -1 to 1 do if add(M[() .. (), i]) = 0 then M := DeleteColumn(M, i) end if end do; M
NULL

Matrix(%id = 18446746093124955182)

(3)

``

for i from RowDimension(M) by -1 to 1 do if add(M[i, () .. ()]) = 0 then M := DeleteRow(M, i) end if end do; M

Matrix(%id = 18446746093124947230)

(4)

ColumnDimension(M); RowDimension(M)

7

(5)

``

``


 

Download DeleteZeroColumnsRows.mw

You may have already found this solution. In Maple 2017 there is a debug the current operation icon on the menu bar. Click on it and then a new window appears with many options, click on quit. The Maple worksheet or document is as if it was before the execution button was invoked. 

Would you accept rewriting your equation in terms of fractions?

 

with(NumberTheory);
with(padic);
InhomogeneousDiophantine([[5^(1/3), 1.3^(1/2), 3^(1/2)], [1.4^(1/5), 4^(1/5), 3^(1/3)]], [5^(1/5), 2^(1/2)], [10^(-3), 10^(-3)]);
                   [[56, 47, 26], [193, 158]]

Add infolevel command. Sorry I do not know how to fix it.

pdsolve_information.mw

I am new to Maple. I was wowed by LSSolve arriving at a solution without initial guesses. What happens when you add the D values from the results of repl1 as initialpoints to repl2? Except for D36, it was set equal 0. Maples returned a smaller mimimum value. May be it was just lucky.worksheet_help_GL.mw
 

list_1 := [-0.777253031437943e-1+6.57999999999998*D2+(276.680000000000-Phi12_17)*D17, .978053142243381-633.614000000000*D2+(-6.58400000000000-Phi23_17)*D17, -0.178064883733416e-1+253.738100000000*D2+(-5.34190000000000-Phi34_17)*D17, -0.353869747788979e-2+39.4444000000000*D2+(-1.06160000000000-Phi45_17)*D17, -0.884707703096015e-3+9.86159000000000*D2+(-.265410000000000-Phi56_17)*D17, -0.226985309680582e-1+190.480500000000*D2+(-6.80950000000000-Phi67_17)*D17, -0.862540843423853e-3+2.15544000000000*D2+(-.258760000000000-Phi78_17)*D17, -0.141061228211511e-2+2.10972000000000*D2+(-.423180000000000-Phi89_17)*D17, -0.163814759658455e-2+2.45006000000000*D2+(-.491440000000000-Phi910_17)*D17, -0.525504575536290e-2+6.99450000000000*D2+(-1.57650000000000-Phi1011_17)*D17, -0.305389325672901e-1+28.4964000000000*D2+(-9.16160000000000-Phi1112_17)*D17, -0.987175261941468e-1+25.7100000000000*D2+(-29.6150000000000-Phi1213_17)*D17, -0.493604297782517e-2+1.28550000000000*D2+(-1.48080000000000-Phi1314_17)*D17, -0.522437882168112e-1+6.41700000000000*D2+(-15.6730000000000-Phi1415_17)*D17, -.141614566362726+13.9970000000000*D2+(-42.4840000000000-Phi1516_17)*D17, 0.777253031360147e-1-42.4900000000000*D15+(155.450000000000-Phi12_17)*D28, 0.219470855957043e-1-13.9960000000000*D15+(43.8940000000000-Phi23_17)*D28, 0.178065694473007e-1-12.8320000000000*D15+(35.6130000000000-Phi34_17)*D28, 0.353886380190268e-2-2.92230000000000*D15+(7.07770000000000-Phi45_17)*D28, 0.884703450426918e-3-.730700000000000*D15+(1.76940000000000-Phi56_17)*D28, 0.226985885266366e-1-20.8670000000000*D15+(45.3970000000000-Phi67_17)*D28, 0.862553364039491e-3-.965300000000000*D15+(1.72510000000000-Phi78_17)*D28, 0.141060550149453e-2-1.62670000000000*D15+(2.82120000000000-Phi89_17)*D28, 0.163815638896446e-2-1.88900000000000*D15+(3.27630000000000-Phi910_17)*D28, 0.525502049507568e-2-6.09000000000000*D15+(10.5100000000000-Phi1011_17)*D28, 0.305386191034954e-1-35.8000000000000*D15+(61.0770000000000-Phi1112_17)*D28, 0.987153849993141e-1-117.980000000000*D15+(197.430000000000-Phi1213_17)*D28, 0.493586925035572e-2-5.89830000000000*D15+(9.87170000000000-Phi1314_17)*D28, 0.522452037612234e-1-62.6800000000000*D15+(104.490000000000-Phi1415_17)*D28, -.858384447685986+609.990000000000*D15+(283.230000000000-Phi1516_17)*D28, 0.133722502645145e-2-5.34000000000003*D3+(264.760000000000-Phi12_19)*D19, 0.492898645263975e-1-253.740000000000*D3+(373.290000000000-Phi23_19)*D19, -.792605146598487+1386.78000000000*D3+(1127.70000000000-Phi34_19)*D19, .132715839620078-165.954000000000*D3+(-206.460000000000-Phi45_19)*D19, 0.331294375945810e-1-41.4870000000000*D3+(-51.6140000000000-Phi56_19)*D19, .512857041219517-749.640000000000*D3+(-946.930000000000-Phi67_19)*D19, 0.345803892354315e-2-6.58880000000000*D3+(-9.00300000000000-Phi78_19)*D19, 0.253797811562394e-2-5.18510000000000*D3+(-7.71800000000000-Phi89_19)*D19, 0.294701900455624e-2-6.02140000000000*D3+(-8.96290000000000-Phi910_19)*D19, 0.754969755588153e-2-15.8980000000000*D3+(-24.4690000000000-Phi1011_19)*D19, 0.181312716670633e-1-44.7810000000000*D3+(-82.4390000000000-Phi1112_19)*D19, 0.133647518064223e-1-35.1810000000000*D3+(-90.5060000000000-Phi1213_19)*D19, 0.667987641718040e-3-1.75900000000000*D3+(-4.52530000000000-Phi1314_19)*D19, 0.217080361770671e-2-6.75400000000000*D3+(-28.8440000000000-Phi1415_19)*D19, 0.365299883394169e-2-12.8320000000000*D3+(-69.3130000000000-Phi1516_19)*D19, -0.130020251659236e-2+6.81000000000000*D6+(263.430000000000-Phi12_19)*D20, -0.493576878414119e-1+190.470000000000*D6+(323.980000000000-Phi23_19)*D20, -.207482316974689+749.650000000000*D6+(920.260000000000-Phi34_19)*D20, -.132570648903326+410.334000000000*D6+(461.-Phi45_19)*D20, -0.329843798422150e-1+102.583000000000*D6+(115.250000000000-Phi56_19)*D20, .487420161727992-1880.19000000000*D6+(-1459.80000000000-Phi67_19)*D20, -0.345553822678983e-2+26.0430000000000*D6+(-12.4610000000000-Phi78_19)*D20, -0.254139584204717e-2+18.7200000000000*D6+(-10.2570000000000-Phi89_19)*D20, -0.295045955688278e-2+21.7400000000000*D6+(-11.9110000000000-Phi910_19)*D20, -0.755117615405593e-2+55.1470000000000*D6+(-32.0200000000000-Phi1011_19)*D20, -0.181178219908242e-1+124.980000000000*D6+(-100.570000000000-Phi1112_19)*D20, -0.133520796896221e-1+89.6200000000000*D6+(-103.870000000000-Phi1213_19)*D20, -0.668104062372097e-3+4.48110000000000*D6+(-5.19340000000000-Phi1314_19)*D20, -0.217033804692734e-2+13.3910000000000*D6+(-31.0150000000000-Phi1415_19)*D20, -0.365556938318863e-2+20.8670000000000*D6+(-72.9670000000000-Phi1516_19)*D20, 0.135489886901528e-2-.259999999999991*D7+(256.360000000000-Phi12_21)*D22, 0.680675384195741e-2-2.16000000000000*D7+(131.350000000000-Phi23_21)*D22, 0.167104193845212e-1-6.59000000000000*D7+(164.020000000000-Phi34_21)*D22, 0.655190381659506e-2-2.76600000000000*D7+(47.9000000000000-Phi45_21)*D22, 0.163878244157080e-2-.692000000000000*D7+(11.9750000000000-Phi56_21)*D22, 0.603897781618217e-1-26.0400000000000*D7+(394.350000000000-Phi67_21)*D22, -.981708865268294+89.7700000000000*D7+(51.2660000000000-Phi78_21)*D22, .286945758784479-5.67000000000000*D7+(-34.6470000000000-Phi89_21)*D22, .333288992029305-6.58400000000000*D7+(-40.2350000000000-Phi910_21)*D22, .115166403866294-14.3630000000000*D7+(-101.530000000000-Phi1011_21)*D22, 0.796486977999666e-1-12.5100000000000*D7+(-238.060000000000-Phi1112_21)*D22, 0.513893785319347e-1-8.19999999999999*D7+(-201.690000000000-Phi1213_21)*D22, 0.257108190144080e-2-.409500000000000*D7+(-10.0840000000000-Phi1314_21)*D22, 0.486795807939043e-2-.850999999999999*D7+(-45.2570000000000-Phi1415_21)*D22, 0.524862014258993e-2-.965000000000003*D7+(-94.7990000000000-Phi1516_21)*D22, -0.136101769174909e-2+1.57999999999998*D10+(255.450000000000-Phi12_21)*D23, -0.680508845874531e-2+6.99000000000001*D10+(126.790000000000-Phi23_21)*D23, -0.167210744986313e-1+15.9000000000000*D10+(152.820000000000-Phi34_21)*D23, -0.654955044315159e-2+6.04100000000000*D10+(43.5110000000000-Phi45_21)*D23, -0.163599881722489e-2+1.51050000000000*D10+(10.8780000000000-Phi56_21)*D23, -0.603847441196420e-1+55.1500000000000*D10+(353.890000000000-Phi67_21)*D23, -0.182876336377057e-1+14.3600000000000*D10+(39.0120000000000-Phi78_21)*D23, -.286946970814718+35.7040000000000*D10+(83.0820000000000-Phi89_21)*D23, -.333290206967530+41.4630000000000*D10+(96.4820000000000-Phi910_21)*D23, .884841237755273-359.510000000000*D10+(-178.690000000000-Phi1011_21)*D23, -0.796889746454705e-1+94.6100000000000*D10+(-291.440000000000-Phi1112_21)*D23, -0.513575859600819e-1+60.8700000000000*D10+(-236.110000000000-Phi1213_21)*D23, -0.256926809156710e-2+3.04300000000000*D10+(-11.8060000000000-Phi1314_21)*D23, -0.486633264478440e-2+5.69300000000000*D10+(-48.5180000000000-Phi1415_21)*D23, -0.524686208104891e-2+6.08500000000001*D10+(-98.3150000000000-Phi1516_21)*D23, 0.740538677273994e-2-9.16000000000000*D11+(244.710000000000-Phi12_23)*D25, 0.642783571664902e-2-28.4970000000000*D11+(91.3030000000000-Phi23_23)*D25, 0.879545937424008e-2-44.7820000000000*D11+(92.1380000000000-Phi34_23)*D25, 0.267263958813606e-2-14.5080000000000*D11+(22.9620000000000-Phi45_23)*D25, 0.668159897034014e-3-3.62700000000000*D11+(5.74050000000000-Phi56_23)*D25, 0.224071702943972e-1-124.980000000000*D11+(173.760000000000-Phi67_23)*D25, 0.204975705587393e-2-12.5020000000000*D11+(12.1500000000000-Phi78_23)*D25, 0.398190796934755e-2-24.6980000000000*D11+(22.6800000000000-Phi89_23)*D25, 0.462414151228524e-2-28.6810000000000*D11+(26.3380000000000-Phi910_23)*D25, 0.152190448689061e-1-94.6100000000000*D11+(86.2100000000000-Phi1011_23)*D25, -.905930086863230+912.110000000000*D11+(526.060000000000-Phi1112_23)*D25, .687841196392981-376.270000000000*D11+(-673.250000000000-Phi1213_23)*D25, 0.343937963386998e-1-18.8130000000000*D11+(-33.6620000000000-Phi1314_23)*D25, 0.305873475333330e-1-34.1060000000000*D11+(-88.3170000000000-Phi1415_23)*D25, 0.294965405620479e-1-35.8000000000000*D11+(-140.200000000000-Phi1516_23)*D25, -0.740003311264899e-2+15.6700000000000*D14+(213.610000000000-Phi12_23)*D26, -0.643002877220721e-2+6.41700000000000*D14+(64.3070000000000-Phi23_23)*D26, -0.879503935483085e-2+6.75400000000000*D14+(55.1990000000000-Phi34_23)*D26, -0.267001194740175e-2+1.73800000000000*D14+(11.7380000000000-Phi45_23)*D26, -0.668002989087778e-3+.434300000000000*D14+(2.93440000000000-Phi56_23)*D26, -0.224051002552570e-1+13.3910000000000*D14+(79.6550000000000-Phi67_23)*D26, -0.205000917309872e-2+.851000000000000*D14+(3.54140000000000-Phi78_23)*D26, -0.398201781818492e-2+1.50890000000000*D14+(5.95680000000000-Phi89_23)*D26, -0.462402069093096e-2+1.75230000000000*D14+(6.91760000000000-Phi910_23)*D26, -0.152200681046646e-1+5.69300000000000*D14+(22.2930000000000-Phi1011_23)*D26, -0.941004210676048e-1+34.1030000000000*D14+(130.980000000000-Phi1112_23)*D26, -.687853077910222+122.340000000000*D14+(437.750000000000-Phi1213_23)*D26, -0.344056792915157e-1+6.11800000000000*D14+(21.8880000000000-Phi1314_23)*D26, .969399863074721-383.950000000000*D14+(-216.780000000000-Phi1415_23)*D26, -0.295001320031278e-1+62.6800000000000*D14+(-264.080000000000-Phi1516_23)*D26]; list_2 := [-0.444299277411586e-2+(270.100000000000-Phi12_18)*D18, -.264819908561346+(627.030000000000-Phi23_18)*D18, .191242220011840+(-259.080000000000-Phi34_18)*D18, 0.269723795794403e-1+(-40.5060000000000-Phi45_18)*D18, 0.674200455699644e-2+(-10.1270000000000-Phi56_18)*D18, .109534122562258+(-197.290000000000-Phi67_18)*D18, 0.481462872723211e-3+(-2.41420000000000-Phi78_18)*D18, -0.346014532189641e-4+(-2.53290000000000-Phi89_18)*D18, -0.402474969346295e-4+(-2.94150000000000-Phi910_18)*D18, -0.632005430249463e-3+(-8.57100000000000-Phi1011_18)*D18, -0.105749265697549e-1+(-37.6580000000000-Phi1112_18)*D18, -0.116305497595306e-1+(-55.3250000000000-Phi1213_18)*D18, -0.581547498854927e-3+(-2.76630000000000-Phi1314_18)*D18, -0.371408130367776e-2+(-22.0900000000000-Phi1415_18)*D18, -0.886173700610320e-2+(-56.4810000000000-Phi1516_18)*D18, -0.478846208996643e-1+(262.447651185421-Phi12_18)*D29+(262.447651185421-Phi12_24)*D36, .348429199898355+(62.3165310883292-Phi23_18)*D29+(62.3165310883292-Phi23_24)*D36, .237294781239637+(41.8563477700905-Phi34_18)*D29+(41.8563477700905-Phi34_24)*D36, 0.356987380524040e-1+(6.12136413036823-Phi45_18)*D29+(6.12136413036823-Phi45_24)*D36, 0.892515544035472e-2+(1.53042068810978-Phi56_18)*D29+(1.53042068810978-Phi56_24)*D36, .163733792213247+(26.7554245920538-Phi67_18)*D29+(26.7554245920538-Phi67_24)*D36, 0.917897899527287e-3+(-0.110562085900856e-3-Phi78_18)*D29+(-0.110562085900856e-3-Phi78_24)*D36, 0.242480164562623e-4+(-.283316330467957-Phi89_18)*D29+(-.283316330467957-Phi89_24)*D36, 0.281967728090880e-4+(-.329007391842407-Phi910_18)*D29+(-.329007391842407-Phi910_24)*D36, -0.812318100863302e-3+(-1.22850243118112-Phi1011_18)*D29+(-1.22850243118112-Phi1011_24)*D36, -0.174002698946928e-1+(-9.57006175329410-Phi1112_18)*D29+(-9.57006175329410-Phi1112_24)*D36, -.125540933056649+(-44.2197489328973-Phi1213_18)*D29+(-44.2197489328973-Phi1213_24)*D36, -0.627722694977691e-2+(-2.21106159188713-Phi1314_18)*D29+(-2.21106159188713-Phi1314_24)*D36, -0.739424545575381e-1+(-24.8403831529913-Phi1415_18)*D29+(-24.8403831529913-Phi1415_24)*D36, -.203976357415920+(-68.0132712014090-Phi1516_18)*D29+(-68.0132712014090-Phi1516_24)*D36, 0.196522429267177e-1+(197.940000000000-Phi12_24)*D27, 0.368371276889244e-2+(57.8900000000000-Phi23_24)*D27, 0.144256702539785e-2+(48.4450000000000-Phi34_24)*D27, -0.115630146715321e-3+(10.-Phi45_24)*D27, -0.283028527731083e-4+(2.50010000000000-Phi56_24)*D27, -0.300476205822746e-2+(66.2640000000000-Phi67_24)*D27, -0.653509876948917e-3+(2.69040000000000-Phi78_24)*D27, -0.126753046978926e-2+(4.44790000000000-Phi89_24)*D27, -0.147212636486122e-2+(5.16530000000000-Phi910_24)*D27, -0.484316181019253e-2+(16.6000000000000-Phi1011_24)*D27, -0.298854531528585e-1+(96.8770000000000-Phi1112_24)*D27, -.120604432493978+(315.410000000000-Phi1213_24)*D27, -0.603334119632106e-2+(15.7700000000000-Phi1314_24)*D27, -0.664471982996522e-1+(167.170000000000-Phi1415_24)*D27, 0.786913003105101e-1+(-326.760000000000-Phi1516_24)*D27]

with(Optimization); rep1 := LSSolve(list_2); rep2 := LSSolve(list_2, initialpoint = {D18 = 0.494039997191269e-3, D27 = 0.312302205569569e-3, D29 = 0.120530795465849e-1, D36 = 0})

Warning, limiting number of iterations reached

 

[0.173158517170151e-3, [D18 = HFloat(4.940399971912688e-4), D27 = HFloat(3.123022055695685e-4), D29 = HFloat(0.012053079546584859), D36 = HFloat(-0.02877258006663398), Phi1011_18 = HFloat(-10.047440876654184), Phi1011_24 = HFloat(-4.89440481171543), Phi1112_18 = HFloat(-58.20988683846057), Phi1112_24 = HFloat(-29.338754572925264), Phi1213_18 = HFloat(-83.08949138713488), Phi1213_24 = HFloat(-56.12110719411204), Phi12_18 = HFloat(260.26860758672166), Phi12_24 = HFloat(263.20617377185454), Phi1314_18 = HFloat(-3.4457440384526827), Phi1314_24 = HFloat(-2.5087129560312764), Phi1415_18 = HFloat(-32.549935720740386), Phi1415_24 = HFloat(-25.48888809044497), Phi1516_18 = HFloat(-72.10104065466892), Phi1516_24 = HFloat(-62.675427552811946), Phi23_18 = HFloat(89.12923249096826), Phi23_24 = HFloat(61.483196901345444), Phi34_18 = HFloat(125.54530604503496), Phi34_24 = HFloat(68.67880838477211), Phi45_18 = HFloat(13.68255794893495), Phi45_24 = HFloat(8.04368413990329), Phi56_18 = HFloat(2.919597731660753), Phi56_24 = HFloat(1.8129257306833229), Phi67_18 = HFloat(24.210838638941365), Phi67_24 = HFloat(20.01451125467167), Phi78_18 = HFloat(-1.4701283478035998), Phi78_24 = HFloat(-0.6483549804256254), Phi89_18 = HFloat(-2.559740721298145), Phi89_24 = HFloat(-1.2378238951622822), Phi910_18 = HFloat(-2.938954535723053), Phi910_24 = HFloat(-1.4230779501001942)]]

 

[0.108728397209465e-8, [D18 = HFloat(5.550242913366132e-4), D27 = HFloat(3.333776103758913e-4), D29 = HFloat(0.00335001517681394), D36 = HFloat(0.008322924505869923), Phi1011_18 = HFloat(-9.707620057058488), Phi1011_24 = HFloat(2.0867581447593966), Phi1112_18 = HFloat(-56.69996075701075), Phi1112_24 = HFloat(7.309171472498412), Phi1213_18 = HFloat(-76.2860351899076), Phi1213_24 = HFloat(-46.39660816758547), Phi12_18 = HFloat(262.08774850173666), Phi12_24 = HFloat(256.83925254335867), Phi1314_18 = HFloat(-3.813049899436829), Phi1314_24 = HFloat(-2.3204747213843686), Phi1415_18 = HFloat(-28.78079184741024), Phi1415_24 = HFloat(-32.13855259799835), Phi1516_18 = HFloat(-72.44997549263607), Phi1516_24 = HFloat(-90.73522347564658), Phi23_18 = HFloat(149.89635440180788), Phi23_24 = HFloat(68.92906304447428), Phi34_18 = HFloat(85.49019103563359), Phi34_24 = HFloat(52.804460088308275), Phi45_18 = HFloat(8.085922875293559), Phi45_24 = HFloat(9.619879678946582), Phi56_18 = HFloat(2.018913003354457), Phi56_24 = HFloat(2.4061728766441095), Phi67_18 = HFloat(0.049472120155097526), Phi67_24 = HFloat(57.17743782256111), Phi78_18 = HFloat(-1.5463854324429922), Phi78_24 = HFloat(0.7325537583372637), Phi89_18 = HFloat(-2.5946471179417476), Phi89_24 = HFloat(0.6499117077885084), Phi910_18 = HFloat(-3.0132475851556157), Phi910_24 = HFloat(0.7547909476868273)]]

(1)

``


 

Download worksheet_help_GL.mw

    

Hopefully this is the same problem that you posted last week. I am not sure I answered it to anyone's satisfaction. Thanks for the fun.


 

restart

I tried three methods to solve the inverse Laplace transform of two starting functions. The first two methods allowed the two constants to be arbitary. The first method was to break up the starting function into two or three parts, determine there inverse Laplace transform, and use the convolution integral to arrive at the inverse Laplace transform. The second method was to convert the starting functions into series expansions and determine the inverse Laplace transforms. The third method was to set the two constants to finite values and determine the inverse Laplace transform.

 

The results were mixed. The first method (convolution) did not work for either starting function, because the convolution did not result in the inverse Laplace transform. The second method (series expansions) work for one of the starting but not the other. The third method (picking specific values for a and b) worked for certain values of a and b. As a question to the public, are there other methods to try that were missed here?

 

The first method will presented.

 

As you know, this is not a good answer by taking the inverse Laplace transform for your function:

 

inttrans[invlaplace](sqrt((s+a)*(s+b))/s, s, t) = invlaplace(((s+a)*(s+b))^(1/2)/s, s, t)NULL

 

As an alternative, you could use convolution operation to get the inverse transform from the product

of the transforms in terms of their time functions. The tricky part is finding two or three transforms from

the your function such that:

 

L-1{ f(s) g(s) } = F(t) * G(t), where * is convolution symbol or

 

L-1{ f(s) g(s) h(s) } = F(t) * G(t) * H(t).

 

 

Find two or three transforms from the first starting function below

NULL``

sqrt((s+a)*(s+b))/s= (s+a)*(s+b)/(s*sqrt(s+a)*sqrt(s+b))

``

Start with these two transforms

 

inttrans[invlaplace](sqrt(s+a)/s, s, t) = exp(-t*a)/(Pi*t)^(1/2)+a^(1/2)*erf((t*a)^(1/2)) 

``

inttrans[invlaplace](sqrt(s+b), s, t) = invlaplace((s+b)^(1/2), s, t)NULL

````

``

No inverse. How about:

 

inttrans[invlaplace](1/(sqrt(s+a)*sqrt(s+b)), s, t) = exp(-(1/2)*(a+b)*t)*BesselI(0, (1/2)*(a-b)*t)NULL

``

``

inttrans[laplace](exp(-(1/2)*(a+b)*t)*BesselI(0, (1/2)*(a-b)*t), t, s) = 1/((s+a)*(s+b))^(1/2)NULL

NULL

The remaining terms:

 

inttrans[invlaplace]((s+a)*(s+b)/s, s, t) = Dirac(1, t)+a*b+Dirac(t)*(a+b)NULL

``

inttrans[laplace](Dirac(1, t)+a*b+Dirac(t)*(a+b), t, s) = "(=)"(s+a)*(s+b)/s

``

Do the convolution

 

 

int(exp(-(1/2)*(a+b)*tau)*BesselI(0, (1/2)*(a-b)*tau)*(Dirac(1, t-tau)+a*b+Dirac(t-tau)), tau = 0 .. t) = int(exp(-(1/2)*(a+b)*tau)*BesselI(0, (1/2)*(a-b)*tau)*(Dirac(1, t-tau)+a*b+Dirac(t-tau)), tau = 0 .. t) 

``

``

The convolution did not work. It is interesting to note that removing term a b from the Dirac portion of the equation you can get the convolution to work.

``

int(exp(-(1/2)*(a+b)*tau)*BesselI(0, (1/2)*(a-b)*tau)*(Dirac(1, t-tau)+Dirac(t-tau)), tau = 0 .. t) =
-(1/2)*exp(-(1/2)*(a+b)*t)*((a+b-2)*BesselI(0, (1/2)*(a-b)*t)-BesselI(1, (1/2)*(a-b)*t)*(a-b))*(-1/2+Heaviside(t))
NULL

 

Moving on to the second starting function

 

inttrans[invlaplace](sqrt(s*(s+b))/(s+a), s, t) = invlaplace((s*(s+b))^(1/2)/(s+a), s, t) 

``

``

Find two transform to ge their inverse

 

sqrt(s*(s+b))/(s+a) = s*(s+b)/((s+a)*sqrt(s*(s+b)))

``

``

Let's try this combination:

inttrans[invlaplace](s/sqrt(s*(s+b)), s, t) = Dirac(t)+(1/2)*(-BesselI(0, (1/2)*b*t)+BesselI(1, (1/2)*b*t))*exp(-(1/2)*b*t)*bNULL

``

``

inttrans[laplace](Dirac(t)+(1/2)*(-BesselI(0, (1/2)*b*t)+BesselI(1, (1/2)*b*t))*exp(-(1/2)*b*t)*b, t, s) = s/(s*(s+b))^(1/2)NULL

``

``

``

inttrans[invlaplace]((s+b)/(s+a), s, t) = Dirac(t)+(-a+b)*exp(-t*a)NULL

``

``

inttrans[laplace](Dirac(t)+(-a+b)*exp(-t*a), t, s) = (s+b)/(s+a)NULL

``

Do the convolution

 

int((Dirac(tau)+(1/2)*(-BesselI(0, (1/2)*b*tau)+BesselI(1, (1/2)*b*tau))*exp(-(1/2)*b*tau)*b)*(Dirac(t-tau)+(-a+b)*exp(-(t-tau)*a)), tau = 0 .. t) =
int((Dirac(tau)+(1/2)*(-BesselI(0, (1/2)*b*tau)+BesselI(1, (1/2)*b*tau))*exp(-(1/2)*b*tau)*b)*(Dirac(t-tau)+(-a+b)*exp(-(t-tau)*a)), tau = 0 .. t)
NULL

``

Oh well that did not work. Let's go the second method.

 

The second method of converting to a series expansion is presented below. The results for the first starting function are shown.

 

series(sqrt((s+a)*(s+b))/s, s = 0)

series(((a*b)^(1/2))/s+(1/2)*(a*b)^(1/2)*(a+b)/(a*b)+((a*b)^(1/2)*((1/2)/(a*b)-(1/8)*(a+b)^2/(a^2*b^2)))*s+((a*b)^(1/2)*(-(1/4)*(a+b)/(a^2*b^2)+(1/16)*(a+b)^3/(a^3*b^3)))*s^2+((a*b)^(1/2)*(-(1/8)/(a^2*b^2)+(3/16)*(a+b)^2/(a^3*b^3)-(5/128)*(a+b)^4/(a^4*b^4)))*s^3+((a*b)^(1/2)*((3/16)*(a+b)/(a^3*b^3)-(5/32)*(a+b)^3/(a^4*b^4)+(7/256)*(a+b)^5/(a^5*b^5)))*s^4+O(s^5),s,5)

(1)

``

Determine the inverse Laplace transform of the first three terms

 

inttrans[invlaplace](sqrt(a*b)/s+sqrt(a*b)*(a+b)/(2*a*b)+sqrt(a*b)*(1/(2*a*b)-(a+b)^2/(8*a^2*b^2))*s, s, t) = (1/8)*(8*a^2*b^2-Dirac(1, t)*(a-b)^2)*(a*b)^(1/2)/(b^2*a^2)+(1/2)*Dirac(t)*(a+b)/(a*b)^(1/2)NULL

NULLNULL

Evaluate the tranform for different values of a and b:

NULL

eval((8*a^2*b^2-Dirac(1, t)*(a-b)^2)*sqrt(a*b)/(8*a^2*b^2)+Dirac(t)*(a+b)/(2*sqrt(a*b)), {a = 1, b = 1}) = 1+Dirac(t) 

NULL

NULL

eval((8*a^2*b^2-Dirac(1, t)*(a-b)^2)*sqrt(a*b)/(8*a^2*b^2)+Dirac(t)*(a+b)/(2*sqrt(a*b)), {a = 2, b = 2}) = 4^(1/2)+(1/2)*Dirac(t)*4^(1/2)NULL

NULL

NULL

eval((8*a^2*b^2-Dirac(1, t)*(a-b)^2)*sqrt(a*b)/(8*a^2*b^2)+Dirac(t)*(a+b)/(2*sqrt(a*b)), {a = -1, b = -1}) = 1-Dirac(t)NULL

NULL

NULL

eval((8*a^2*b^2-Dirac(1, t)*(a-b)^2)*sqrt(a*b)/(8*a^2*b^2)+Dirac(t)*(a+b)/(2*sqrt(a*b)), {a = 1, b = 2}) = (1/32)*(32-Dirac(1, t))*2^(1/2)+(3/4)*Dirac(t)*2^(1/2)NULL

NULL

NULL

eval((8*a^2*b^2-Dirac(1, t)*(a-b)^2)*sqrt(a*b)/(8*a^2*b^2)+Dirac(t)*(a+b)/(2*sqrt(a*b)), {a = 1, b = 4}) = (1/128)*(128-9*Dirac(1, t))*4^(1/2)+(5/8)*Dirac(t)*4^(1/2)NULL

NULL

This appears to work. One can compare the results here with the third method.  

NULL

 

The results for the second starting function are presented.

````

series(sqrt(s*(s+a))/(s+b), s = 0)

a^(1/2)*csgn(a^(1/2)*s^(1/2))*s^(1/2)/b+((1/2)*csgn(a^(1/2)*s^(1/2))/a^(1/2)-a^(1/2)*csgn(a^(1/2)*s^(1/2))/b)*s^(3/2)/b+(-(1/8)*csgn(a^(1/2)*s^(1/2))/a^(3/2)+(1/2)*csgn(a^(1/2)*s^(1/2))*(2*a-b)/(a^(1/2)*b^2))*s^(5/2)/b+((1/16)*csgn(a^(1/2)*s^(1/2))/a^(5/2)-(1/8)*csgn(a^(1/2)*s^(1/2))*(8*a^2-4*a*b-b^2)/(a^(3/2)*b^3))*s^(7/2)/b+(-(5/128)*csgn(a^(1/2)*s^(1/2))/a^(7/2)+(1/16)*csgn(a^(1/2)*s^(1/2))*(16*a^3-8*a^2*b-2*a*b^2-b^3)/(a^(5/2)*b^4))*s^(9/2)/b+((7/256)*csgn(a^(1/2)*s^(1/2))/a^(9/2)-(1/128)*csgn(a^(1/2)*s^(1/2))*(128*a^4-64*a^3*b-16*a^2*b^2-8*a*b^3-5*b^4)/(a^(7/2)*b^5))*s^(11/2)/b+O(s^(13/2))

(2)

``

Determine the inverse Laplace transform of the first two terms of the series expansion.

``

inttrans[invlaplace](sqrt(a)*csgn(sqrt(a)*sqrt(s))*sqrt(s)/b+(csgn(sqrt(a)*sqrt(s))/(2*sqrt(a))-sqrt(a)*csgn(sqrt(a)*sqrt(s))/b)*s^(3/2)/b, s, t)

(1/2)*invlaplace(s^(3/2)*csgn(a^(1/2)*s^(1/2)), s, t)/(a^(1/2)*b)+a^(1/2)*(invlaplace(csgn(a^(1/2)*s^(1/2))*s^(1/2), s, t)*b-invlaplace(s^(3/2)*csgn(a^(1/2)*s^(1/2)), s, t))/b^2

(3)

 

This is not working. How about setting a and b to specific values and taking the inverse Laplace transform. Let's try a =1 and b = 1

NULL

NULL

eval(sqrt(a)*csgn(sqrt(a)*sqrt(s))*sqrt(s)/b+(csgn(sqrt(a)*sqrt(s))/(2*sqrt(a))-sqrt(a)*csgn(sqrt(a)*sqrt(s))/b)*s^(3/2)/b, {a = 1, b = 1}) = s^(1/2)-(1/2)*s^(3/2)NULL

NULL

 

inttrans[invlaplace](sqrt(s)-(1/2)*s^(3/2), s, t) = invlaplace(s^(1/2), s, t)-(1/2)*invlaplace(s^(3/2), s, t) 

 

Did not work. Let's try a = 2 and b = 2

 

eval(sqrt(a)*csgn(sqrt(a)*sqrt(s))*sqrt(s)/b+(csgn(sqrt(a)*sqrt(s))/(2*sqrt(a))-sqrt(a)*csgn(sqrt(a)*sqrt(s))/b)*s^(3/2)/b, {a = 2, b = 2}) = (1/2)*2^(1/2)*s^(1/2)-(1/8)*2^(1/2)*s^(3/2)NULL

``

 

inttrans[invlaplace]((1/2)*sqrt(2)*sqrt(s)-(1/8)*sqrt(2)*s^(3/2), s, t) = (1/2)*2^(1/2)*invlaplace(s^(1/2), s, t)-(1/8)*2^(1/2)*invlaplace(s^(3/2), s, t)NULL

NULL

Oh well, not so good.``

``

The results for the third method by setting a and b to specific values are presented.

 

Two procedures were deveolped that allow one to enter values for a and b. The printout shows the starting function, the inverse Laplace transform of the starting function, and the Laplace transform of the inverse result. If the starting function agrees with Laplace transform of the inverse result, then one would have some confidence in the inverse Laplace transform of the starting function is correct.

 

When a not equal b, then you will see invlaplace(starting function,s,t), for example, (3)

 

The results for the first starting function.

 

IL := proc (a, b) local s, t, g, ig1, glt; g := sqrt((s+a)*(s+b))/s; ig1 := inttrans[invlaplace](g, s, t); glt := inttrans[laplace](ig1, t, s); print(starting*function, g); print(inverse*Laplace*transform, ig1); print(Laplace*transform, glt) end proc

IL(1, 1)

starting*function, ((s+1)^2)^(1/2)/s

 

inverse*Laplace*transform, 1+Dirac(t)

 

Laplace*transform, 1+1/s

(4)

IL(2, 2)

starting*function, ((s+2)^2)^(1/2)/s

 

inverse*Laplace*transform, Dirac(t)+2

 

Laplace*transform, 1+2/s

(5)

IL(1, 2)

starting*function, ((s+1)*(s+2))^(1/2)/s

 

inverse*Laplace*transform, invlaplace(((s+1)*(s+2))^(1/2)/s, s, t)

 

Laplace*transform, ((s+1)*(s+2))^(1/2)/s

(6)

IL(4, 4)

starting*function, ((s+4)^2)^(1/2)/s

 

inverse*Laplace*transform, Dirac(t)+4

 

Laplace*transform, 1+4/s

(7)

IL(-1, -1)

starting*function, ((s-1)^2)^(1/2)/s

 

inverse*Laplace*transform, -1/2+exp(t)*Dirac(t)

 

Laplace*transform, 1-(1/2)/s

(8)

IL(-2, -2)

starting*function, ((s-2)^2)^(1/2)/s

 

inverse*Laplace*transform, exp(2*t)*Dirac(t)-1

 

Laplace*transform, 1-1/s

(9)

IL(-1, 1)

starting*function, ((s-1)*(s+1))^(1/2)/s

 

inverse*Laplace*transform, -(1/2)*t*hypergeom([1/2], [3/2, 2], (1/4)*t^2)

 

Laplace*transform, -(1/2)*laplace(t*hypergeom([1/2], [3/2, 2], (1/4)*t^2), t, s)

(10)

IL(1, -1)

starting*function, ((s+1)*(s-1))^(1/2)/s

 

inverse*Laplace*transform, -(1/2)*t*hypergeom([1/2], [3/2, 2], (1/4)*t^2)

 

Laplace*transform, -(1/2)*laplace(t*hypergeom([1/2], [3/2, 2], (1/4)*t^2), t, s)

(11)

NULL

 

The results for the second starting function.

 

IL2 := proc (a, b) local s, t, gg, gg1, lgg; gg := sqrt(s*(s+a))/(s+b); gg1 := inttrans[invlaplace](gg, s, t); lgg := inttrans[laplace](gg1, t, s); print(starting*function, gg); print(inverse*Laplace*transform, gg1); print(Laplace*transform, lgg) end proc

IL2(1, 1)

starting*function, (s*(s+1))^(1/2)/(s+1)

 

inverse*Laplace*transform, (1/2)*(-BesselI(0, (1/2)*t)+BesselI(1, (1/2)*t))*exp(-(1/2)*t)+Dirac(t)

 

Laplace*transform, (s/(s+1))^(1/2)

(12)

IL2(1, 2)

starting*function, (s*(s+1))^(1/2)/(s+2)

 

inverse*Laplace*transform, invlaplace((s*(s+1))^(1/2)/(s+2), s, t)

 

Laplace*transform, (s*(s+1))^(1/2)/(s+2)

(13)

IL2(2, 2)

starting*function, (s*(s+2))^(1/2)/(s+2)

 

inverse*Laplace*transform, Dirac(t)+exp(-t)*(-BesselI(0, t)+BesselI(1, t))

 

Laplace*transform, (s/(s+2))^(1/2)

(14)

IL2(-1, -1)

starting*function, (s*(s-1))^(1/2)/(s-1)

 

inverse*Laplace*transform, Dirac(t)+(1/2)*exp((1/2)*t)*(BesselI(0, (1/2)*t)+BesselI(1, (1/2)*t))

 

Laplace*transform, s/(s*(s-1))^(1/2)

(15)

IL2(-2, -2)

starting*function, (s*(s-2))^(1/2)/(s-2)

 

inverse*Laplace*transform, Dirac(t)+exp(t)*(BesselI(0, t)+BesselI(1, t))

 

Laplace*transform, s/(s*(s-2))^(1/2)

(16)

IL2(1, -1)

starting*function, (s*(s+1))^(1/2)/(s-1)

 

inverse*Laplace*transform, invlaplace((s*(s+1))^(1/2)/(s-1), s, t)

 

Laplace*transform, (s*(s+1))^(1/2)/(s-1)

(17)

IL2(-2, 2)

starting*function, (s*(s-2))^(1/2)/(s+2)

 

inverse*Laplace*transform, invlaplace((s*(s-2))^(1/2)/(s+2), s, t)

 

Laplace*transform, (s*(s-2))^(1/2)/(s+2)

(18)

IL2(-1, -3)

starting*function, (s*(s-1))^(1/2)/(s-3)

 

inverse*Laplace*transform, invlaplace((s*(s-1))^(1/2)/(s-3), s, t)

 

Laplace*transform, (s*(s-1))^(1/2)/(s-3)

(19)

NULL

NULL

NULL


 

Download InvLaplace-2a.mw

 

I was expecting to see a damped sine wave so I changed your y-axis limits of your plot. There is the damped response, see plot below. So I changed the upper limit of Duhamel's from t to 8, see the new plot. I hope this is your answer you were looking for. I am not sure why it works. It may be that the F(t) is not a continous function e.g. sin(kt) or step function, but a spline fitted function. Then you are performing a convolution on it. I actually tried a step function for F(t) and got the damped sine response.
 

restart

with(plots)

with(ExcelTools)

K := 148593.75

M := 1000

`ω__d` := omega*sqrt(-xi^2+1)

omega := sqrt(K/M)

xi := 0.5e-1

Q := Import("D:/New folder (2)/1.xlsx")

Q := Matrix(11, 2, {(1, 1) = 0., (1, 2) = 4500.0, (2, 1) = 0.2e-2, (2, 2) = 5000.0, (3, 1) = 0.4e-2, (3, 2) = 3000.0, (4, 1) = 0.6e-2, (4, 2) = 1500.0, (5, 1) = 0.8e-2, (5, 2) = 750.0, (6, 1) = 0.1e-1, (6, 2) = 100.0, (7, 1) = 0.12e-1, (7, 2) = -1000.0, (8, 1) = 0.14e-1, (8, 2) = -800.0, (9, 1) = 0.16e-1, (9, 2) = 2000.0, (10, 1) = 0.18e-1, (10, 2) = 500.0, (11, 1) = 0.2e-1, (11, 2) = 0.})

(1)

F := proc (t) options operator, arrow; evalf(piecewise(t < 0, 0, t <= 0.2e-1 and 0 <= t, CurveFitting:-Spline(Q[() .. (), 1], Q[() .. (), 2], t, degree = 3), 0.2e-1 < t, 0)) end proc

proc (t) options operator, arrow; evalf(piecewise(t < 0, 0, t <= 0.2e-1 and 0 <= t, CurveFitting:-Spline(Q[() .. (), 1], Q[() .. (), 2], t, degree = 3), 0.2e-1 < t, 0)) end proc

(2)

g := proc (t) options operator, arrow; (1/(M.`&omega;__d`).exp(-xi*omega*t))*sin(`&omega;__d`*t) end proc

d := proc (t) options operator, arrow; int(F(tau)*g(t-tau), tau = 0 .. t) end proc

proc (t) options operator, arrow; int(F(tau)*g(t-tau), tau = 0 .. t) end proc

(3)

plot(d(t), t = 0 .. 8)

 

d := proc (t) options operator, arrow; int(F(tau)*g(t-tau), tau = 0 .. 8) end proc

proc (t) options operator, arrow; int(F(tau)*g(t-tau), tau = 0 .. 8) end proc

(4)

plot(d(t), t = 0 .. 8)

 

plot([F(t), Q], t = -0.5e-1 .. 0.5e-1, style = point)

 

``


 

Download 1a.mw

 

  


 

 

The previous answer from seq was very clever. I was interested in finding the bugs in

your code. Here is what I found. I corrected the code in the downloaded file

and I noticed the code was in text format.  The same error showed up when I executed the

modified code.NULL

``

make_PSI := proc(nplanets);
local psin,i;
psin :=(Pi*2)/nplanets;
for i from 1 to nplanets-1 do
 printf("%f   ",psin*i);
end do;
end:

 

 

Error, reserved word `for` unexpected

 

``

 

I rentered the above code in Math format then it worked.

 

make_PSI := proc (nplanets) local psin, i; psin := 2*Pi/nplanets; for i from 0 to nplanets-1 do printf("%f   ", psin*i) end do end proc:

make_PSI(4)

0.000000   1.570796   3.141593   4.712389   

 

make_PSI(8)

0.000000   0.785398   1.570796   2.356194   3.141593   3.926991   4.712389   5.497787   

 

``

``

``

Interesting about the output from print and and printf. I could get printf to output on one line, but not as

fractions like in print. But the output of print was in a column, see below. How can I get the best of both worlds?   

``

make_PSI := proc (nplanets) local psin, i; psin := 2*Pi/nplanets; for i from 0 to nplanets-1 do print(psin*i) end do end proc

make_PSI(4)

0

 

(1/2)*Pi

 

Pi

 

(3/2)*Pi

(1)

``


 

Download planetspace.mw

1 2 Page 2 of 2