mehdibgh

240 Reputation

6 Badges

7 years, 243 days

MaplePrimes Activity


These are questions asked by mehdibgh

I want to produce a user defined function in Maple and use it in my program like Matlab. My function in Matlab is as below:

function R=ff(i,m)
K=1;
Q= zeros( i );
for j=1:2:i
 Q(j)=2*i-K;
 K=4+K;
end
R=Q(m);

How to produce this function in Maple and use it in my program?

Hi

How Maple knows free and dummy index?

 

I am tryng to change variables in multiple integral as below, but receive error. Help me to do so.
 

``

restart

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

 

with(IntegrationTools):

V := Int(Physics:-`*`(f(Physics:-`^`(x, 2)), g(y)), [x = a .. b, y = c .. d])

Int(f(x^2)*g(y), [x = a .. b, y = c .. d])

(1)

``

Change(V, {x = u-W, y = v-Q})

Error, (in IntegrationTools:-Change) missing a list with the new variables

 

``


 

Download inttt.mw

Where I made a mistake I got this error in for loop and how to fix it?


 

restart

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

 

N := 5:

c__1 := Matrix([[c1__11, c1__12, 0], [c1__12, c1__22, 0], [0, 0, c1__66]]):

c__2 := Matrix([[c2__11, c2__12, 0], [c2__12, c2__22, 0], [0, 0, c2__66]]):

c__3 := Matrix([[c3__11, c3__12, 0], [c3__12, c3__22, 0], [0, 0, c3__66]]):

c__4 := Matrix([[c4__11, c4__12, 0], [c4__12, c4__22, 0], [0, 0, c4__66]]):

c__5 := Matrix([[c5__11, c5__12, 0], [c5__12, c5__22, 0], [0, 0, c5__66]]):

NULL

Q := Array(1 .. 3, 1 .. 3, 1 .. N):

A := Matrix([[0, 0, 0], [0, 0, 0], [0, 0, 0]]):

Z := Matrix([[h__1], [h__2], [h__3], [h__4], [h__5], [h__6]]):

for ii to 3 do for jj to 3 do Q(ii, jj, 1) := c__1(ii, jj); Q(ii, jj, 2) := c__2(ii, jj); Q(ii, jj, 3) := c__3(ii, jj); Q(ii, jj, 4) := c__4(ii, jj); Q(ii, jj, 5) := c__5(ii, jj) end do end do

"for i from 1  to 3 do for j from 1 to 3 do Ar:=0:for k from 1 to N do  Ar:=(Q (i,j,k)*(Z(k+1)-Z(k)))+Ar: end do A(i,j):=Ar: end do end do"

Error, invalid loop statement termination

"for i from 1  to 3 do for j from 1 to 3 do Ar:=0:for k from 1 to N do Ar:=(Q (i,j,k)*(Z(k+1)-Z(k)))+Ar: end do A(i,j):=Ar: end do end do"

 

``

``


 

Download quest.mw

I have expression h1 as below:

 

 

 

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

 

restart

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

 

"`u__1`(`xi__1`,`xi__2`,Zeta,t):=`u__0`(`xi__1`,`xi__2`,Zeta,t)+Zeta*`phi__1`(`xi__1`,`xi__2`,t):"

"`u__2`(`xi__1`,`xi__2`,Zeta,t):=`v__0`(`xi__1`,`xi__2`,Zeta,t)+Zeta*`phi__2`(`xi__1`,`xi__2`,t):"

"`u__3`(`xi__1`,`xi__2`,Zeta,t):=`w__0`(`xi__1`,`xi__2`,Zeta,t):"

`φ__n` := (diff(v__0(`ξ__1`, `ξ__2`, Zeta, t)*a__2(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`)-(diff(u__0(`ξ__1`, `ξ__2`, Zeta, t)*a__1(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`)))/(2*a__1(`ξ__1`, `ξ__2`, Zeta, t)*a__2(`ξ__1`, `ξ__2`, Zeta, t))

`ϵ0__1` := (diff(u__0(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`)+v__0(`ξ__1`, `ξ__2`, Zeta, t)*(diff(a__1(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`))/a__2(`ξ__1`, `ξ__2`, Zeta, t)+a__1(`ξ__1`, `ξ__2`, Zeta, t)*w__0(`ξ__1`, `ξ__2`, Zeta, t)/R__1)/a__1(`ξ__1`, `ξ__2`, Zeta, t)

`ϵ0__2` := (diff(v__0(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`)+u__0(`ξ__1`, `ξ__2`, Zeta, t)*(diff(a__2(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`))/a__1(`ξ__1`, `ξ__2`, Zeta, t)+a__2(`ξ__1`, `ξ__2`, Zeta, t)*w__0(`ξ__1`, `ξ__2`, Zeta, t)/R__2)/a__2(`ξ__1`, `ξ__2`, Zeta, t)

`ϵ0__4` := (diff(w__0(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`)+a__2(`ξ__1`, `ξ__2`, Zeta, t)*`φ__2`(`ξ__1`, `ξ__2`, t)-a__2(`ξ__1`, `ξ__2`, Zeta, t)*v__0(`ξ__1`, `ξ__2`, Zeta, t)/R__2)/a__2(`ξ__1`, `ξ__2`, Zeta, t)

`ϵ0__5` := (diff(w__0(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`)+a__1(`ξ__1`, `ξ__2`, Zeta, t)*`φ__1`(`ξ__1`, `ξ__2`, t)-a__1(`ξ__1`, `ξ__2`, Zeta, t)*u__0(`ξ__1`, `ξ__2`, Zeta, t)/R__1)/a__1(`ξ__1`, `ξ__2`, Zeta, t)

`ω0__1` := (diff(v__0(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`)-u__0(`ξ__1`, `ξ__2`, Zeta, t)*(diff(a__1(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`))/a__2(`ξ__1`, `ξ__2`, Zeta, t))/a__1(`ξ__1`, `ξ__2`, Zeta, t)-`φ__n`

`ω0__2` := (diff(u__0(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`)-v__0(`ξ__1`, `ξ__2`, Zeta, t)*(diff(a__2(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`))/a__1(`ξ__1`, `ξ__2`, Zeta, t))/a__2(`ξ__1`, `ξ__2`, Zeta, t)+`φ__n`

`ϵ1__1` := (diff(`φ__1`(`ξ__1`, `ξ__2`, t), `ξ__1`)+`φ__2`(`ξ__1`, `ξ__2`, t)*(diff(a__1(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`))/a__2(`ξ__1`, `ξ__2`, Zeta, t))/a__1(`ξ__1`, `ξ__2`, Zeta, t)

`ϵ1__2` := (diff(`φ__2`(`ξ__1`, `ξ__2`, t), `ξ__2`)+`φ__1`(`ξ__1`, `ξ__2`, t)*(diff(a__2(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`))/a__1(`ξ__1`, `ξ__2`, Zeta, t))/a__2(`ξ__1`, `ξ__2`, Zeta, t)

`ω1__1` := (diff(`φ__2`(`ξ__1`, `ξ__2`, t), `ξ__1`)+`φ__1`(`ξ__1`, `ξ__2`, t)*(diff(a__1(`ξ__1`, `ξ__2`, Zeta, t), `ξ__2`))/a__2(`ξ__1`, `ξ__2`, Zeta, t))/a__1(`ξ__1`, `ξ__2`, Zeta, t)-`φ__n`/R

`ω1__2` := (diff(`φ__1`(`ξ__1`, `ξ__2`, t), `ξ__2`)+`φ__2`(`ξ__1`, `ξ__2`, t)*(diff(a__2(`ξ__1`, `ξ__2`, Zeta, t), `ξ__1`))/a__1(`ξ__1`, `ξ__2`, Zeta, t))/a__2(`ξ__1`, `ξ__2`, Zeta, t)+`φ__n`/R

`ϵ__1` := (Zeta*`ϵ1__1`+`ϵ0__1`)/(1+Zeta/R__1)

`ϵ__2` := (Zeta*`ϵ1__2`+`ϵ0__2`)/(1+Zeta/R__2)

`ϵ__4` := `ϵ0__4`/(1+Zeta/R__2)

`ϵ__5` := `ϵ0__5`/(1+Zeta/R__1)

`ϵ__6` := (Zeta*`ω1__1`+`ω0__1`)/(1+Zeta/R__1)+(Zeta*`ω1__2`+`ω0__2`)/(1+Zeta/R__2)

epsilon := Matrix([[`ϵ__1`], [`ϵ__2`], [`ϵ__4`], [`ϵ__5`], [`ϵ__6`]])

with(LinearAlgebra)

e__1 := Matrix([[0, 0, 0, e1__15, 0], [0, 0, e1__24, 0, 0], [e1__31, e1__31, 0, 0, 0]])

e__5 := Matrix([[0, 0, 0, e5__15, 0], [0, 0, e5__24, 0, 0], [e5__31, e5__31, 0, 0, 0]])

E__1 := -Matrix([[diff(`ϕ1`(`ξ__1`, `ξ__2`, Zeta), `ξ__1`)], [diff(`ϕ1`(`ξ__1`, `ξ__2`, Zeta), `ξ__2`)], [diff(`ϕ1`(`ξ__1`, `ξ__2`, Zeta), Zeta)]])

E__5 := -Matrix([[diff(`ϕ5`(`ξ__1`, `ξ__2`, Zeta), `ξ__1`)], [diff(`ϕ5`(`ξ__1`, `ξ__2`, Zeta), `ξ__2`)], [diff(`ϕ5`(`ξ__1`, `ξ__2`, Zeta), Zeta)]])

`ε__1` := Matrix([[`ε1__11`, 0, 0], [0, `ε1__22`, 0], [0, 0, `ε1__33`]])

`ε` := Matrix([[`ε5__11`, 0, 0], [0, `ε5__22`, 0], [0, 0, `ε5__33`]])

f := Matrix([[f1, f2, f3]])

D__1 := Multiply(e__1, epsilon)+Multiply(`ε__1`, E__1)

D__5 := Multiply(e__5, epsilon)+Multiply(`ε__5`, E__5)

h1 := simplify((Multiply(Transpose(E__1), D__1))(1))

(-R__1*(diff(varphi1(xi__1, xi__2, Zeta), Zeta))*e1__31*(R__2+Zeta)*(phi__2(xi__1, xi__2, t)*Zeta+v__0(xi__1, xi__2, Zeta, t))*(diff(a__1(xi__1, xi__2, Zeta, t), xi__2))-(diff(varphi1(xi__1, xi__2, Zeta), Zeta))*R__2*e1__31*(R__1+Zeta)*(phi__1(xi__1, xi__2, t)*Zeta+u__0(xi__1, xi__2, Zeta, t))*(diff(a__2(xi__1, xi__2, Zeta, t), xi__1))-a__2(xi__1, xi__2, Zeta, t)*R__1*(diff(varphi1(xi__1, xi__2, Zeta), Zeta))*e1__31*(R__2+Zeta)*(diff(u__0(xi__1, xi__2, Zeta, t), xi__1))-a__1(xi__1, xi__2, Zeta, t)*(diff(varphi1(xi__1, xi__2, Zeta), Zeta))*R__2*e1__31*(R__1+Zeta)*(diff(v__0(xi__1, xi__2, Zeta, t), xi__2))-a__2(xi__1, xi__2, Zeta, t)*R__1*(diff(varphi1(xi__1, xi__2, Zeta), xi__1))*e1__15*(R__2+Zeta)*(diff(w__0(xi__1, xi__2, Zeta, t), xi__1))-a__1(xi__1, xi__2, Zeta, t)*R__2*(diff(varphi1(xi__1, xi__2, Zeta), xi__2))*e1__24*(R__1+Zeta)*(diff(w__0(xi__1, xi__2, Zeta, t), xi__2))+`ε1__33`*a__1(xi__1, xi__2, Zeta, t)*a__2(xi__1, xi__2, Zeta, t)*(R__2+Zeta)*(R__1+Zeta)*(diff(varphi1(xi__1, xi__2, Zeta), Zeta))^2-e1__31*(a__2(xi__1, xi__2, Zeta, t)*R__1*Zeta*(R__2+Zeta)*(diff(phi__1(xi__1, xi__2, t), xi__1))+a__1(xi__1, xi__2, Zeta, t)*(R__2*Zeta*(R__1+Zeta)*(diff(phi__2(xi__1, xi__2, t), xi__2))+a__2(xi__1, xi__2, Zeta, t)*w__0(xi__1, xi__2, Zeta, t)*(R__1+R__2+2*Zeta)))*(diff(varphi1(xi__1, xi__2, Zeta), Zeta))+a__2(xi__1, xi__2, Zeta, t)*(`ε1__11`*(R__2+Zeta)*(R__1+Zeta)*(diff(varphi1(xi__1, xi__2, Zeta), xi__1))^2-e1__15*(R__2+Zeta)*(phi__1(xi__1, xi__2, t)*R__1-u__0(xi__1, xi__2, Zeta, t))*(diff(varphi1(xi__1, xi__2, Zeta), xi__1))+(R__1+Zeta)*(`ε1__22`*(R__2+Zeta)*(diff(varphi1(xi__1, xi__2, Zeta), xi__2))-e1__24*(phi__2(xi__1, xi__2, t)*R__2-v__0(xi__1, xi__2, Zeta, t)))*(diff(varphi1(xi__1, xi__2, Zeta), xi__2)))*a__1(xi__1, xi__2, Zeta, t))/(a__1(xi__1, xi__2, Zeta, t)*a__2(xi__1, xi__2, Zeta, t)*(R__1+Zeta)*(R__2+Zeta))

(1)

NULL

``

 

 

Download simplifymore.mw

 

 

How can i simplify h1 more in Maple?

First 15 16 17 18 Page 17 of 18