MAXR

30 Reputation

5 Badges

2 years, 279 days

MaplePrimes Activity


These are questions asked by MAXR

Dear All, I hope this message finds you well. I am currently facing some issues and would appreciate your support or guidance in resolving them. Nusselt_RSM_Model.mw

 

restart;

with(Statistics): with(LinearAlgebra): with(plots):

local A, B, C, D;

Digits := 10:

 

# Step 1: Define the variables

vars := [A, B, C, D];

 

# Step 2: Generate Central Composite Design (CCD) coded matrix

coded := Matrix([

    [ 1,  1,  1,  1],

    [ 1,  1,  1, -1],

    [ 1,  1, -1,  1],

    [ 1,  1, -1, -1],

    [ 1, -1,  1,  1],

    [ 1, -1,  1, -1],

    [ 1, -1, -1,  1],

    [ 1, -1, -1, -1],

    [-1,  1,  1,  1],

    [-1,  1,  1, -1],

    [-1,  1, -1,  1],

    [-1,  1, -1, -1],

    [-1, -1,  1,  1],

    [-1, -1,  1, -1],

    [-1, -1, -1,  1],

    [-1, -1, -1, -1],

    [ 0,  0,  0,  0],

    [ 0,  0,  0,  0],

    [ 0,  0,  0,  0],

    [ 0,  0,  0,  0]

]):

 

# Step 3: Define uncoded variable ranges

rangeA := [0.1, 0.5]:

rangeB := [0.1, 0.5]:

rangeC := [0.1, 0.5]:

rangeD := [0.1, 0.5]:

 

decode := (val, r) -> r[1] + (val + 1)*(r[2] - r[1])/2:

 

# Step 4: Create actual values matrix

actual := Matrix(20, 4):

for i from 1 to 20 do

    for j from 1 to 4 do

        r := eval(cat("range", vars[j])):

        actual[i, j] := evalf(decode(coded[i, j], r));

    end do;

end do:

 

# Step 5: Define model coefficients (for simulation purposes)

beta := [1.5, 0.8, 0.6, 0.5, 0.3,  # Linear terms

         0.1, 0.2, 0.15, 0.18,  # Square terms

         0.05, 0.04, 0.03, 0.02, 0.01, 0.025]; # Interaction terms

 

# Step 6: Simulate Response (Nusselt number)

Nu := Vector(20):

for i from 1 to 20 do

    A := actual[i,1]; B := actual[i,2]; C := actual[i,3]; D := actual[i,4];

    Nu[i] := evalf(

        beta[1] + beta[2]*A + beta[3]*B + beta[4]*C + beta[5]*D +

        beta[6]*A^2 + beta[7]*B^2 + beta[8]*C^2 + beta[9]*D^2 +

        beta[10]*A*B + beta[11]*A*C + beta[12]*A*D +

        beta[13]*B*C + beta[14]*B*D + beta[15]*C*D

    );

end do:

 

# Step 7: Create data frame for ANOVA

X := Matrix(actual):

Y := convert(Nu, list):

 

# Step 8: Fit quadratic model

model := Fit(

    A + B + C + D + A^2 + B^2 + C^2 + D^2 + A*B + A*C + A*D + B*C + B*D + C*D,

    X,

    Y,

    vars

):

 

# Step 9: ANOVA table

anovaTable := ANOVA(model, significancelevel=0.05):

 

# Step 10: Display results with 8 decimal places

printf("RSM Model for Nu (Nusselt number):\n");

print(evalf[8](model));

printf("\nANOVA Table:\n");

print(anovaTable);

 

# Optional: Plotting

pointplot([seq([i, Nu[i]], i = 1..20)], style=point, symbol=circle,

          color=red, title="Nusselt Number vs Run Index",

          labels=["Run", "Nusselt Number"]);

[A, B, C, D]

 

[1.5, .8, .6, .5, .3, .1, .2, .15, .18, 0.5e-1, 0.4e-1, 0.3e-1, 0.2e-1, 0.1e-1, 0.25e-1]

 

Error, (in Statistics:-Fit) invalid input: Fit expects its 4th argument, v, to be of type {name, list(name)}, but received [1.5+2.2*"a"+.805*"a"^2, 1.5+1.9*"a"+.3*"r"+.56*"a"^2+.18*"r"^2+0.65e-1*"a"*"r", 1.5+1.7*"a"+.5*"r"+.57*"a"^2+.15*"r"^2+0.85e-1*"a"*"r", 1.5+1.4*"a"+.8*"r"+.35*"a"^2+.355*"r"^2+.10*"a"*"r", 1.5+1.6*"a"+.6*"r"+.525*"a"^2+.2*"r"^2+0.8e-1*"a"*"r", 1.5+1.3*"a"+.9*"r"+.29*"a"^2+.39*"r"^2+.125*"a"*"r", 1.5+1.1*"a"+1.1*"r"+.31*"a"^2+.37*"r"^2+.125*"a"*"r", 1.5+.8*"a"+1.4*"r"+.1*"a"^2+.585*"r"^2+.12*"a"*"r", 1.5+.8*"r"+1.4*"a"+.1*"r"^2+.585*"a"^2+.12*"a"*"r", 1.5+1.1*"r"+1.1*"a"+.31*"r"^2+.37*"a"^2+.125*"a"*"r", 1.5+1.3*"r"+.9*"...

 

RSM Model for Nu (Nusselt number):

 

model

 


ANOVA Table:

 

ANOVA(model, significancelevel = 0.5e-1)

 

Error, (in plots:-pointplot) incorrect specification of points data

 
 

``

Download Nusselt_RSM_Model.mw

Dear All,

I am facing some problems. This kind of error has been shown: "Error, attempting to assign to `D` which is protected.  Try declaring `local D`; see ? protect for details."

RSM_model.mw

Dear All,

I am facing some problems. This kind of error has been shown ""Error, (in plot/iplot2d/expression) bad range arguments 0.3e-1 = .1 .. .5, 0.3e-1 = .1 .. .5"

Error.mw

Dear All,

I am facing some problems. This kind of error has been shown "Error, (in Engine:-Dispatch) badly formed input to solve: not fully algebraic"

eqn1 := {((1+1/beta).(diff(f(eta), eta, eta, eta))-(1+F[s]).((diff(f(eta), eta))^2)+(diff(f(eta), eta, eta)).f(eta)+M.(A-(diff(f(eta), eta)))-1/(R.D[a]).(diff(f(eta), eta)) = 0, diff(theta(eta), eta, eta)+4/3.N.(diff((1+(K-1).theta(eta))^3.(diff(theta(eta), eta)), eta)))+Pr.f(eta).(diff(theta(eta), eta))+(1+1/beta).Pr.Ec.((diff(f(eta), eta, eta))^2)+M.Ec.((diff(f(eta), eta)-A)^2) = 0, f(0) = 0, theta(0) = 1+alpha.(D(theta))(0), theta(10) = 0, (D(f))(0) = 1+(1+1/beta).lambda.(D(D(f)))(0), (D(f))(10) = 0};
;
sys1 := eval(eqn1, {A = 1, Ec = .2, K = 2.5, M = .5, N = .5, Pr = 6.5, R = 1, alpha = .5, beta = 2, lambda = .5, D[a] = .3, F[s] = 1});
sol1 := dsolve(sys1, numeric);
Error, (in Engine:-Dispatch) badly formed input to solve: not fully algebraic
with(plots);
t1 := odeplot(sol1, [eta, diff(f(eta), eta)], eta = 0 .. 10, numpoints = 65, thickness = 0, color = green, linestyle = solid);
plots[plots:-display]({t1})

MAXR.mw

Dear All,

I am facing some problems. I want to draw some plots: I have considered the 4th order momentum equation and the 2nd order energy equation; it requires 6 boundary conditions, which I have provided, but till asking for errors (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6.

eqn1 := {((kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])/(phi[1]+phi[2]+phi[3])+(p-1).kappa[f]+(p-1).(kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])-(p-1).(phi[1]+phi[2]+phi[3]).kappa[f])/((kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])/(phi[1]+phi[2]+phi[3])+(p-1).kappa[f]-(p-1).(kappa[1].phi[1]+kappa[2].phi[2]+kappa[3].phi[3])+(phi[1]+phi[2]+phi[3]).kappa[f]).(diff(theta(eta), eta, eta)+4/3.N.(diff((1+(K-1).theta(eta))^3.(diff(theta(eta), eta)), eta)))+Pr.(((1-phi[3]).((1-phi[2])*(1-phi[1]+phi[1].(`ρc__s1`/`ρc__f`))+phi[2].(`ρc__s2`/`ρc__f`))+phi[3].(`ρc__s3`/`ρc__f`)).(R.f(eta)+alpha.eta).(diff(theta(eta), eta))+Q.theta(eta)+R.Ec.((diff(f(eta), eta, eta))^2)) = 0, diff(f(eta), eta, eta, eta, eta)-(1-phi[1])^2.5.((1-phi[2])^2.5).((1-phi[3])^2.5).((1-phi[3]).((1-phi[2]).(1-phi[1]+phi[1].(`ρ__s1`/`ρ__f`))+phi[2].(`ρ__s2`/`ρ__f`))+phi[3].(`ρ__s3`/`ρ__f`)).(alpha.(eta.(diff(f(eta), eta, eta, eta))+3.*(diff(f(eta), eta, eta)))+(diff(f(eta), eta, eta, eta)).f(eta)-(diff(f(eta), eta)).(diff(f(eta), eta, eta))).R-(1-phi[1])^2.5.((1-phi[2])^2.5).((1-phi[3])^2.5).A.B.e^(-B.eta) = 0, f(-1) = S, f(1) = 1, theta(-1) = 1, theta(1) = 0, (D(f))(-1) = 0, (D(f))(1) = 0}

sys1 := eval(eqn1, {A = 1, B = .5, Ec = .1, K = 1.5, N = .5, Pr = 2, Q = .4, R = 1, S = -.1, p = 3, alpha = .2, `ρ__f` = 997.1, `ρ__s1` = 0, `ρ__s2` = 0, `ρ__s3` = 5180, `ρc__f` = 997.1.4179, `ρc__s1` = 0, `ρc__s2` = 0, `ρc__s3` = 5180.670, phi[1] = 0., phi[2] = 0., phi[3] = 0.3e-1, kappa[1] = 0, kappa[2] = 0, kappa[3] = 9.7, kappa[f] = .613})

sol1 := dsolve(sys1, numeric);
Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 7, got 6
with(plots);
t1 := odeplot(sol1, [eta, diff(f(eta), eta)], eta = -1 .. 1, numpoints = 65, thickness = 0, color = green, linestyle = solid);
plots[plots:-display]({t1})

Download A1.mw

1 2 Page 1 of 2