m_magooda

20 Reputation

One Badge

6 years, 311 days

MaplePrimes Activity


These are questions asked by m_magooda

 

Hello,

I'm writing an equation that has a term including divergence .. i'd like to print that as the sum of the derivatives

for example instead of nabla(u) display it as ux+uy+uz

 

restart

VectorCalculus[SetCoordinates]('cartesian'[x, y, z]); F := x, y, z, t

vel := VectorCalculus[VectorField](`<,>`(u(F), v(F), w(F)))

vel := u(x, y, z, t)*`#mover(mi("e"),mo("&lowbar;"))`[x]+v(x, y, z, t)*`#mover(mi("e"),mo("&lowbar;"))`[y]+w(x, y, z, t)*`#mover(mi("e"),mo("&lowbar;"))`[z]

(1)

Mass_eqn := diff(rho(F), t)+Divergence(rho(F)*vel)

Mass_eqn := diff(rho(x, y, z, t), t)+VectorCalculus[Nabla].(Vector(3, {(1) = rho(x, y, z, t)*u(x, y, z, t), (2) = rho(x, y, z, t)*v(x, y, z, t), (3) = rho(x, y, z, t)*w(x, y, z, t)}))

(2)

print(Mass_eqn)

diff(rho(x, y, z, t), t)+VectorCalculus[Nabla].(Vector(3, {(1) = rho(x, y, z, t)*u(x, y, z, t), (2) = rho(x, y, z, t)*v(x, y, z, t), (3) = rho(x, y, z, t)*w(x, y, z, t)}))

(3)

NULL


 

Download aero.mw

I've 2 equatoions that i wish to solve to get 2 values, which should be used as an input for the next step and so on,

I've managed to produce the equations, but i can't force the code to use the output of the first loop T1[1] and T2[1] into the 2nd loop and so on

It produces only equations, I'd appreciate it if anyone could tell me how to do that into an array or something similar

restart

k := 28:

Tinf := 200; -1; h := 45; -1; `&Delta;t` := 15; -1; t_total := 150; -1; T1[0] := Tinf; -1; T2[0] := Tinf; -1; L := 0.4e-1; -1; M := 3; -1; `&Delta;x` := L/(M-1); -1; tau := alpha*`&Delta;t`/`&Delta;x`^2; -1; for i from 0 to t_total/`&Delta;t` do T1[i+1] = tau*(T0+T2[i])+(1-2*tau)*T1[i]+tau*g*`&Delta;x`^2/k; 2*h*`&Delta;x`*(Tinf-T2[i])/k+2*(T1[i]-T2[i])+g*`&Delta;x`^2/k = (T2[i+1]-T2[i])/tau end do

T1[1] = 139.7321429

 

71.42857143 = 2.133333333*T2[1]-426.6666666

 

T1[2] = .4687500000*T2[1]+0.625000000e-1*T1[1]+33.48214286

 

84.28571429-2.064285714*T2[1]+2*T1[1] = 2.133333333*T2[2]-2.133333333*T2[1]

 

T1[3] = .4687500000*T2[2]+0.625000000e-1*T1[2]+33.48214286

 

84.28571429-2.064285714*T2[2]+2*T1[2] = 2.133333333*T2[3]-2.133333333*T2[2]

 

T1[4] = .4687500000*T2[3]+0.625000000e-1*T1[3]+33.48214286

 

84.28571429-2.064285714*T2[3]+2*T1[3] = 2.133333333*T2[4]-2.133333333*T2[3]

 

T1[5] = .4687500000*T2[4]+0.625000000e-1*T1[4]+33.48214286

 

84.28571429-2.064285714*T2[4]+2*T1[4] = 2.133333333*T2[5]-2.133333333*T2[4]

 

T1[6] = .4687500000*T2[5]+0.625000000e-1*T1[5]+33.48214286

 

84.28571429-2.064285714*T2[5]+2*T1[5] = 2.133333333*T2[6]-2.133333333*T2[5]

 

T1[7] = .4687500000*T2[6]+0.625000000e-1*T1[6]+33.48214286

 

84.28571429-2.064285714*T2[6]+2*T1[6] = 2.133333333*T2[7]-2.133333333*T2[6]

 

T1[8] = .4687500000*T2[7]+0.625000000e-1*T1[7]+33.48214286

 

84.28571429-2.064285714*T2[7]+2*T1[7] = 2.133333333*T2[8]-2.133333333*T2[7]

 

T1[9] = .4687500000*T2[8]+0.625000000e-1*T1[8]+33.48214286

 

84.28571429-2.064285714*T2[8]+2*T1[8] = 2.133333333*T2[9]-2.133333333*T2[8]

 

T1[10] = .4687500000*T2[9]+0.625000000e-1*T1[9]+33.48214286

 

84.28571429-2.064285714*T2[9]+2*T1[9] = 2.133333333*T2[10]-2.133333333*T2[9]

 

T1[11] = .4687500000*T2[10]+0.625000000e-1*T1[10]+33.48214286

 

84.28571429-2.064285714*T2[10]+2*T1[10] = 2.133333333*T2[11]-2.133333333*T2[10]

(1)

``


 

Download Advheat-ex55.mwAdvheat-ex55.mw

Hello,

I need a little help...

what I want to do, if i have 3 equations  with multiple variables and i want to get derivative of some of these variables wrt other variables while setting others as constants

here in the example

1st i thought the last equation should have partial m / partial f ... how can i get that

2nd if ,another problem, i wanted to set z as a constant so it won't consider getting its derivative, how do i get that

diff_test.mw

f1 := x = y+z

x = y+z

(1)

f2 := y = 2*f^2+3

y = 2*f^2+3

(2)

f3 := z = 22*f^3+33*f+m

z = 22*f^3+33*f+m

(3)

implicitdiff({f1, f2, f3}, {x, y, z}, x, f)

66*f^2+4*f+33

(4)

NULL


Download diff_test.m

 

hope i was clear in my explanation. thank you

 

Hello

I was trying to introduce vector r_vec that has 3 components in x,y,z

I've attached my file, I've 2 questions here

first, why isn't the vector shown in as r_vec = () ei + () ej + () ek instead appears as a column vector

second, why doesn't it accept differentating

thank you
 

restart````

r := sqrt(VectorCalculus:-`+`(x^2, VectorCalculus:-`+`(y, VectorCalculus:-`-`(VectorCalculus:-`*`(z, 1/VectorCalculus:-`*`(tan, alpha))))^2))

(x^2+(y-z/(tan*alpha))^2)^(1/2)

(1)

 

theta := arctan((y-z)/x)

arctan((y-z)/x)

(2)

Z := VectorCalculus:-`*`(z, 1/VectorCalculus:-`*`(sin, alpha))

z/(sin*alpha)

(3)

with(VectorCalculus): 

r_vec := `<,>`(VectorCalculus:-`*`(r, `cos&theta;`), VectorCalculus:-`+`(VectorCalculus:-`*`(VectorCalculus:-`*`(r, sin), theta), VectorCalculus:-`*`(VectorCalculus:-`*`(Z, cos), alpha)), VectorCalculus:-`*`(VectorCalculus:-`*`(Z, sin), alpha))

Matrix(3, 1, {(1, 1) = sqrt(x^2+(y-z/(tan*alpha))^2)*`cos&theta;`, (2, 1) = sqrt(x^2+(y-z/(tan*alpha))^2)*sin*arctan((y-z)/x)+z*cos/sin, (3, 1) = z})

(4)

diff(r_vec, r)

Error, (in VectorCalculus:-diff) invalid input: diff received (x^2+(y-z/(tan*alpha))^2)^(1/2), which is not valid for its 2nd argument

 

``


 

Download tst1.mwtst1.mw

1 2 Page 1 of 2