kencom1

110 Reputation

6 Badges

8 years, 225 days
UNIVERSITY OF LAGOS, AKOKA YABA, LAGOS
LAGOS, Nigeria

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are questions asked by kencom1

Good day everyone,

          I am trying to write a code for the loop of the equations below such the Theta[k] and Phi[k] start from 2 to M while F[k] starts from 4  to M.

         Anyone with good informations should please.
         Below is the link.

Thanks in anticipation

Solution_1.mw

Good day everyone,

I am trying to write a finite difference Method solution for an ODE and its giving me problem solving the algebraic simplifications generated. Please, any one with useful informations. Below is the attached file

FDM1.mw
 

restart

with(ODETools)

with(student)

with(plots)

with(plottools)

xmin := 0; xmax := 6

n := 60

`σ__1` := .5

ode:=diff(f(eta),eta$3)+f(eta)*diff(f(eta),eta$2)=0

diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta)) = 0

(1)

bc1:=df(xmin)=2*sigma__1;

df(0) = 1.0

(2)

bc2:=d2f(xmin)=0;

d2f(0) = 0

(3)

bc3:=d3f(xmax)=2;

d3f(6) = 2

(4)

dfde:=proc(h)(f[k+1]-f[k-1])/2/h;end proc:

dfde(h);

(1/2)*(f[k+1]-f[k-1])/h

(5)

d2fde2:=proc(h)(f[k+1]-2*f[k]+f[k-1])/h^2;end proc:

d2fde2(h);

(f[k+1]-2*f[k]+f[k-1])/h^2

(6)

d3fde3:=proc(h)(f[k+1]-3*f[k]+3*f[k-1]-f[k-2])/h^3;end proc:

d3fde3(h);

(f[k+1]-3*f[k]+3*f[k-1]-f[k-2])/h^3

(7)

d2fde2f:=proc(h)(f[k+2]-2*f[k+1]+f[k])/h^2;end proc:

d2fde2f(h);

(f[k+2]-2*f[k+1]+f[k])/h^2

(8)

d2fde2b:=proc(h)(f[k]-2*f[k-1]+f[k-2])/h^2;end proc:

d2fde2b(h);

(f[k]-2*f[k-1]+f[k-2])/h^2

(9)

 

dfdef:=proc(h)(f[k+1]-f[k])/h;end proc:

dfdef(h);

(f[k+1]-f[k])/h

(10)

h:=xmax/(n-1)

6/59

(11)

stencil:=subs(diff(f(eta),eta$3)=d3fde3(h),f(eta)=f[k],diff(f(eta),eta$2)=d2fde2,ode);

(205379/216)*f[k+1]-(205379/72)*f[k]+(205379/72)*f[k-1]-(205379/216)*f[k-2]+f[k]*(diff(diff(f[k], eta), eta)) = 0

(12)

bcEqs:=[subs(k=0,dfdef(h))=rhs(bc1),subs(k=0,d2fde2f(h))=rhs(bc2),
subs(k=n-1,d2fde2b(h))=rhs(bc3)];

[(59/6)*f[1]-(59/6)*f[0] = 1.0, (3481/36)*f[2]-(3481/18)*f[1]+(3481/36)*f[0] = 0, (3481/36)*f[59]-(3481/18)*f[58]+(3481/36)*f[57] = 2]

(13)

eqs:=Vector(n-2):
cnt:=0:

for k from 1 to n-2 do
    cnt:=cnt+1:
    eqs(cnt):=stencil;
end do:

eqs:

eqs := [op(convert(eqs, list)), op(bcEqs)]; vars := [seq(f[k], k = 0 .. n-1)]; map(print, eqs)

(205379/216)*f[2]-(205379/72)*f[1]+(205379/72)*f[0]-(205379/216)*f[-1] = 0

 

(205379/216)*f[3]-(205379/72)*f[2]+(205379/72)*f[1]-(205379/216)*f[0] = 0

 

(205379/216)*f[4]-(205379/72)*f[3]+(205379/72)*f[2]-(205379/216)*f[1] = 0

 

(205379/216)*f[5]-(205379/72)*f[4]+(205379/72)*f[3]-(205379/216)*f[2] = 0

 

(205379/216)*f[6]-(205379/72)*f[5]+(205379/72)*f[4]-(205379/216)*f[3] = 0

 

(205379/216)*f[7]-(205379/72)*f[6]+(205379/72)*f[5]-(205379/216)*f[4] = 0

 

(205379/216)*f[8]-(205379/72)*f[7]+(205379/72)*f[6]-(205379/216)*f[5] = 0

 

(205379/216)*f[9]-(205379/72)*f[8]+(205379/72)*f[7]-(205379/216)*f[6] = 0

 

(205379/216)*f[10]-(205379/72)*f[9]+(205379/72)*f[8]-(205379/216)*f[7] = 0

 

(205379/216)*f[11]-(205379/72)*f[10]+(205379/72)*f[9]-(205379/216)*f[8] = 0

 

(205379/216)*f[12]-(205379/72)*f[11]+(205379/72)*f[10]-(205379/216)*f[9] = 0

 

(205379/216)*f[13]-(205379/72)*f[12]+(205379/72)*f[11]-(205379/216)*f[10] = 0

 

(205379/216)*f[14]-(205379/72)*f[13]+(205379/72)*f[12]-(205379/216)*f[11] = 0

 

(205379/216)*f[15]-(205379/72)*f[14]+(205379/72)*f[13]-(205379/216)*f[12] = 0

 

(205379/216)*f[16]-(205379/72)*f[15]+(205379/72)*f[14]-(205379/216)*f[13] = 0

 

(205379/216)*f[17]-(205379/72)*f[16]+(205379/72)*f[15]-(205379/216)*f[14] = 0

 

(205379/216)*f[18]-(205379/72)*f[17]+(205379/72)*f[16]-(205379/216)*f[15] = 0

 

(205379/216)*f[19]-(205379/72)*f[18]+(205379/72)*f[17]-(205379/216)*f[16] = 0

 

(205379/216)*f[20]-(205379/72)*f[19]+(205379/72)*f[18]-(205379/216)*f[17] = 0

 

(205379/216)*f[21]-(205379/72)*f[20]+(205379/72)*f[19]-(205379/216)*f[18] = 0

 

(205379/216)*f[22]-(205379/72)*f[21]+(205379/72)*f[20]-(205379/216)*f[19] = 0

 

(205379/216)*f[23]-(205379/72)*f[22]+(205379/72)*f[21]-(205379/216)*f[20] = 0

 

(205379/216)*f[24]-(205379/72)*f[23]+(205379/72)*f[22]-(205379/216)*f[21] = 0

 

(205379/216)*f[25]-(205379/72)*f[24]+(205379/72)*f[23]-(205379/216)*f[22] = 0

 

(205379/216)*f[26]-(205379/72)*f[25]+(205379/72)*f[24]-(205379/216)*f[23] = 0

 

(205379/216)*f[27]-(205379/72)*f[26]+(205379/72)*f[25]-(205379/216)*f[24] = 0

 

(205379/216)*f[28]-(205379/72)*f[27]+(205379/72)*f[26]-(205379/216)*f[25] = 0

 

(205379/216)*f[29]-(205379/72)*f[28]+(205379/72)*f[27]-(205379/216)*f[26] = 0

 

(205379/216)*f[30]-(205379/72)*f[29]+(205379/72)*f[28]-(205379/216)*f[27] = 0

 

(205379/216)*f[31]-(205379/72)*f[30]+(205379/72)*f[29]-(205379/216)*f[28] = 0

 

(205379/216)*f[32]-(205379/72)*f[31]+(205379/72)*f[30]-(205379/216)*f[29] = 0

 

(205379/216)*f[33]-(205379/72)*f[32]+(205379/72)*f[31]-(205379/216)*f[30] = 0

 

(205379/216)*f[34]-(205379/72)*f[33]+(205379/72)*f[32]-(205379/216)*f[31] = 0

 

(205379/216)*f[35]-(205379/72)*f[34]+(205379/72)*f[33]-(205379/216)*f[32] = 0

 

(205379/216)*f[36]-(205379/72)*f[35]+(205379/72)*f[34]-(205379/216)*f[33] = 0

 

(205379/216)*f[37]-(205379/72)*f[36]+(205379/72)*f[35]-(205379/216)*f[34] = 0

 

(205379/216)*f[38]-(205379/72)*f[37]+(205379/72)*f[36]-(205379/216)*f[35] = 0

 

(205379/216)*f[39]-(205379/72)*f[38]+(205379/72)*f[37]-(205379/216)*f[36] = 0

 

(205379/216)*f[40]-(205379/72)*f[39]+(205379/72)*f[38]-(205379/216)*f[37] = 0

 

(205379/216)*f[41]-(205379/72)*f[40]+(205379/72)*f[39]-(205379/216)*f[38] = 0

 

(205379/216)*f[42]-(205379/72)*f[41]+(205379/72)*f[40]-(205379/216)*f[39] = 0

 

(205379/216)*f[43]-(205379/72)*f[42]+(205379/72)*f[41]-(205379/216)*f[40] = 0

 

(205379/216)*f[44]-(205379/72)*f[43]+(205379/72)*f[42]-(205379/216)*f[41] = 0

 

(205379/216)*f[45]-(205379/72)*f[44]+(205379/72)*f[43]-(205379/216)*f[42] = 0

 

(205379/216)*f[46]-(205379/72)*f[45]+(205379/72)*f[44]-(205379/216)*f[43] = 0

 

(205379/216)*f[47]-(205379/72)*f[46]+(205379/72)*f[45]-(205379/216)*f[44] = 0

 

(205379/216)*f[48]-(205379/72)*f[47]+(205379/72)*f[46]-(205379/216)*f[45] = 0

 

(205379/216)*f[49]-(205379/72)*f[48]+(205379/72)*f[47]-(205379/216)*f[46] = 0

 

(205379/216)*f[50]-(205379/72)*f[49]+(205379/72)*f[48]-(205379/216)*f[47] = 0

 

(205379/216)*f[51]-(205379/72)*f[50]+(205379/72)*f[49]-(205379/216)*f[48] = 0

 

(205379/216)*f[52]-(205379/72)*f[51]+(205379/72)*f[50]-(205379/216)*f[49] = 0

 

(205379/216)*f[53]-(205379/72)*f[52]+(205379/72)*f[51]-(205379/216)*f[50] = 0

 

(205379/216)*f[54]-(205379/72)*f[53]+(205379/72)*f[52]-(205379/216)*f[51] = 0

 

(205379/216)*f[55]-(205379/72)*f[54]+(205379/72)*f[53]-(205379/216)*f[52] = 0

 

(205379/216)*f[56]-(205379/72)*f[55]+(205379/72)*f[54]-(205379/216)*f[53] = 0

 

(205379/216)*f[57]-(205379/72)*f[56]+(205379/72)*f[55]-(205379/216)*f[54] = 0

 

(205379/216)*f[58]-(205379/72)*f[57]+(205379/72)*f[56]-(205379/216)*f[55] = 0

 

(205379/216)*f[59]-(205379/72)*f[58]+(205379/72)*f[57]-(205379/216)*f[56] = 0

 

(59/6)*f[1]-(59/6)*f[0] = 1.0

 

(3481/36)*f[2]-(3481/18)*f[1]+(3481/36)*f[0] = 0

 

(3481/36)*f[59]-(3481/18)*f[58]+(3481/36)*f[57] = 2

(14)

sol := fsolve([op(eqs)])

{f[-1] = 74076407.16, f[0] = 74076407.19, f[1] = 74076407.29, f[2] = 74076407.42, f[3] = 74076407.63, f[4] = 74076407.95, f[5] = 74076408.39, f[6] = 74076408.95, f[7] = 74076409.58, f[8] = 74076410.32, f[9] = 74076411.18, f[10] = 74076412.19, f[11] = 74076413.34, f[12] = 74076414.66, f[13] = 74076416.09, f[14] = 74076417.69, f[15] = 74076419.41, f[16] = 74076421.28, f[17] = 74076423.28, f[18] = 74076425.45, f[19] = 74076427.75, f[20] = 74076430.17, f[21] = 74076432.77, f[22] = 74076435.56, f[23] = 74076438.51, f[24] = 74076441.69, f[25] = 74076445.02, f[26] = 74076448.54, f[27] = 74076452.24, f[28] = 74076456.15, f[29] = 74076460.29, f[30] = 74076464.65, f[31] = 74076469.16, f[32] = 74076473.82, f[33] = 74076478.70, f[34] = 74076483.79, f[35] = 74076489.05, f[36] = 74076494.52, f[37] = 74076500.21, f[38] = 74076506.15, f[39] = 74076512.33, f[40] = 74076518.79, f[41] = 74076525.57, f[42] = 74076532.68, f[43] = 74076540.10, f[44] = 74076547.80, f[45] = 74076555.85, f[46] = 74076564.23, f[47] = 74076572.94, f[48] = 74076581.93, f[49] = 74076591.18, f[50] = 74076600.60, f[51] = 74076610.20, f[52] = 74076620.03, f[53] = 74076630.05, f[54] = 74076640.28, f[55] = 74076650.64, f[56] = 74076661.19, f[57] = 74076671.90, f[58] = 74076682.68, f[59] = 74076693.50}

(15)

``


 

Download FDM1.mw

 

Goodday everyone,

Please, anyone with useful informations on the above stated error code should help.

Below is the attached file.

Error_invalid_subscript_selector.mw

Thanks in anticipation for your response

Hello everyone, 

         Anyone with the solutions to the error code "Error, unable to compute coeff" should please help. 

         Attached below is the code.

         Thanking you in anticipations for your prompt response. 

Hpm_1.mw

Goodday sirs, 

            How can I get over these error message123.mw
 

restart

 

 

(int((1/6)*(eta-s)^3*(S*(s*f[i](s)+3*(diff(diff(f[i](s), s), s))+(diff(f[i](s), s))*(diff(diff(f[i](s), s), s))-f[i]*(diff(diff(diff(f[i](s), s), s), s)))+M^2*(diff(diff(f[i](s), s), s))), s = 0 .. eta))/(1+1/y)

(1)

G := (int((eta-s)^3*(S*(s*f[i](s)+3*(diff(f[i](s), `$`(s, 2)))+(diff(f[i](s), s))*(diff(f[i](s), `$`(s, 2)))-f[i]*(diff(f[i](s), `$`(s, 3))))+M^2*(diff(f[i](s), `$`(s, 2))))/factorial(3), s = 0 .. eta))/(1+1/y)

 

f[0] := (1/6)*s+(1/6)*s^3:

for i from 0 to n do f[i+1] := (1/6*(-eta^3+eta))*subs(eta = 1, diff(G, `$`(eta, 2)))-eta*subs(eta = G)+G; f[i+1] := subs(eta = s, f[i+1]) end do

Error, final value in for loop must be numeric or character

 

``


Anyone with useful informations please.

Thanking you in anticipation for a favurabke response

Download 123.mw

 

3 4 5 6 7 8 9 Page 5 of 10