MaplePrimes Questions


Dear colleagues, Can anyone explain what (a::list,b::list) will be understood by the programme?

I thought the programme is made for only adding the numbers in the list. But it seems there is something more than that, i could not get.

Equn label (6) onwards, I donot understand, how the answer was obtained.

Thanks for explaining.

Ramakrishnan V

with(MathematicalFunctions:-Evalf); -1; addList1 := proc (a::list, b::integer)::integer; local x, i, s; description "add a list of numbers and multiply by a constant"; x := b; s := 0; for i in a do s := s+a[i] end do; s := s*x end proc

proc (a::list, b::integer)::integer; local x, i, s; description "add a list of numbers and multiply by a constant"; x := b; s := 0; for i in a do s := s+a[i] end do; s := s*x end proc

(1)

s := addList1([1, 2, 3, 4], 2)

20

(2)

s := addList1([2, 2, 3, 4], 2)

22

(3)

x := 2 = 2NULL

s := addList1([x, 2, 3, 4], 2)

22

(4)

s := addList1([2, x, 3, 4], 2)

22

(5)

sumList := addList1([4, 3, 1, 3, 4, 3], 2)

26

(6)

s := addList1([4, 3, 1, 3, x, 3, 4, 3], 2)

34

(7)

s := addList1([2, 2, 3, 4], 2)

22

(8)

s := addList1([4, 3, 1, 8, x, 3, 4, 3], 2)

58

(9)

x

2

(10)

``


 

Download Doubt_on_list.mw

I have successfully created a a function of Y for the Beta-Binomial probability masss function using the built in distributions for the beta probability density function and the binomial probability mass function. However, despite trying many different things, I cannot take that function and turn it into a probability distribution for a random variable.  Of the code given below, all lines work except the last.  If someone could please help me, I would be most appreciative.

fYgivP := proc (Y) options operator, arrow; ProbabilityFunction(Binomial(n, P), Y) end proc

fP := proc (P) options operator, arrow; ProbabilityDensityFunction(('Beta')(a, b), P) end proc

fYandP := proc (Y, P) options operator, arrow; fYgivP(Y)*fP(P) end proc

fY := proc (Y) options operator, arrow; int(fYandP(Y, P), P = 0 .. 1) end proc

BB:=Distribution(ProbabilityFunction= X->piecewise(X<0,0,X>=0,  unapply(fX(X),X)))

I executed finding the roots of the derivative of a series expansion containing 500 terms.  I did it 2 ways.  The 1st using fsolve & the 2nd using RootFinding.  The fsolve took over 20 minutes to find a single root within a specified range while the RootFinding took less than 60 seconds to find all roots within a larger range.  I do not know of the inner mechanisms of either command, but why is this the case?  Why would the algorithms differ?  My results are in the link below.

fsolve_vs_RootFinding.mw

I am trying to use fracdiff with a variable order argument, e.g. plot3d( fracdiff(x^2, x, t), x=0..1, t=0..2);

I get the error message "Error, (in fracdiff) Unable to determine ceiling of t"

but I am unable to find any information on this error.

 

i want to plot these four functions in the same graphe f(x)=1/1+x^2 on the intervalle [0,1] also the second function the line curve that connects the two points(0,f(0)) and (1/3,f(1/3)), the third function the line curve that connects the two points (1/3,f(1/3)) and (2/3,f(2/3)), the fourth function the line curve that connects the two points (2/3,f(2/3)) and (1,f(1))

can anyone help me ?

Hello there !

I'm currently working on a project and I have a simple problem that I can't solve.

I've solved an equation system and I get an answer which looks like G := {A=exp1,B=exp2}  (exp stands for expression)

I would like to assign exp1 and exp2 to my variables : A:=exp1 & B:=exp2

How can I manage to get that ? 

Thank everyone :)

plot([(exp((1/2)*x))((1/2)*x+2*t*(1/3)), (exp((1/2)*x))(1+t((-256)+240-108+27)/2^7+t(168-24+27)^2/2^7+(1/3)*t^3*((-16)+9)/2^6+(1/4)*t^4/2^7), (exp((1/2)*x))(1+t(256*(-1.01)+240*(-1.01)^2+108*(-1.01)^3+27*(-1.01)^4)/2^7+t(168*(-1.01)^2+24*(-1.01)^3+27*(-1.01)^4)^2/2^7+(1/3)*t^3*(16*(-1.01)^3+9*1.01^4)/2^6+(1/4)*t^4*(-1.01)^4/2^7)], x = -4 .. 4, t = 5)

Hello!

I im interesting  how to stop executing algorithm if user chose "cancel" in maplet filedialog?

restart;
maplet:=Maplet(FileDialog['FD1']('filefilter' = "*.txt,*.m",
'filterdescription' = "TXT-files and Maple m-files",
'directory'= "D:\\NIR\\Experimental result\\Data\\",
'onapprove' = Shutdown(['FD1']), 'oncancel' = Shutdown())):
Maplets[Display](maplet):
f1:=%[1];
#Point to stop executing
a := 1;
b := 2;

 

I have this expression:

-sin(alpha)*(sin(theta1)*cos(theta)-cos(theta1)*sin(theta))

which can be combined using a trigonmetric formula...

However when using combine() it also tried to sneak alpha into the result...

Is it possible to freeze the variable alpha when combining?

Can anyone tell me why maple wont accept my constraint?

Code:

LPSolve(3*x__1+14*x__2+18*x__3+6*x__4+2*x__5, {3*x__1+5*x__2+6*x__3+2*x__4+x__5 <= 10}, x__1 = 0 .. 1, x__2 = 0 .. 1, x__3 = 0 .. 1, x__4 = 0 .. 1, x__5 = 0 .. 1, maximize = true)

It returns the error "Warning, problem appears to be unbounded", when i can clearly see that it is bounded!

Im trying to solve the LP-relaxation of a binary problem which is why i have a 0..1 bound on every variable. Running Maple 2016.1 on windows if thats a help.

Please help me

My Question

how may i know which is the theta prime or f double prime or theta only or f prime and theta double prime?

 i have attach double prime

tq maple
 

restart

with(student)

with(plots)

inf := 3

equ1 := (diff(f(eta), `$`(eta, 3)))/((1-`&varphi;`)^2.5*(1-`&varphi;`+`&varphi;`*rho[s]/rho[f]))+(diff(f(eta), eta, eta))*f(eta)-(diff(f(eta), eta))^2+1+M*(1-(diff(f(eta), eta))) = 0

equ2 := (1+4/(3*N*k))*(diff(theta(eta), eta, eta))+Pr*(1-`&varphi;`+`&varphi;`*rho[s]*Cp[s]/(rho[f]*Cp[f]))*(diff(theta(eta), eta))*f(eta)/k+Br*(diff(f(eta), eta, eta))^2/(k*(1-`&varphi;`)^2.5) = 0

Bcs := f(0) = 0, (D(f))(0) = `&epsilon;`, (D(f))(inf) = 1, theta(inf) = 0, theta(0) = 1

Pr := 6.2; Cp[s] := 385; Cp[f] := 4179; `&varphi;` := .1; rho[f] := 997.1; rho[s] := 8933; k[s] := 400; k[f] := .613; k := (k[s]+2*k[f]-2*`&varphi;`*(k[f]-k[s]))/(k[s]+2*k[f]+`&varphi;`*(k[f]-k[s])); Br := .1; M := 1; N := 1

func := proc (v) options operator, arrow; rhs((dsolve({equ1, equ2, subs(`&epsilon;` = v, [Bcs])[]}, numeric))(0)[3])/(1-`&varphi;`)^2.5 end proc; plot(func, -1 .. 1, title = typeset((diff(f(eta), eta, eta))*versus*`&epsilon;`/(1-'`&varphi;`')^2.5), titlefont = [times, italic, 18])

 

func2 := proc (v) options operator, arrow; rhs((dsolve({equ1, equ2, subs(`&epsilon;` = v, [Bcs])[]}, numeric))(0)[5]) end proc; plot(func2, -1 .. 1, title = typeset((diff(theta(eta), eta))*versus*`&epsilon;`), titlefont = [times, italic, 18])

 

``


 

Download plot.mw
 

restart

with(student)

with(plots)

inf := 3

equ1 := (diff(f(eta), `$`(eta, 3)))/((1-`&varphi;`)^2.5*(1-`&varphi;`+`&varphi;`*rho[s]/rho[f]))+(diff(f(eta), eta, eta))*f(eta)-(diff(f(eta), eta))^2+1+M*(1-(diff(f(eta), eta))) = 0

equ2 := (1+4/(3*N*k))*(diff(theta(eta), eta, eta))+Pr*(1-`&varphi;`+`&varphi;`*rho[s]*Cp[s]/(rho[f]*Cp[f]))*(diff(theta(eta), eta))*f(eta)/k+Br*(diff(f(eta), eta, eta))^2/(k*(1-`&varphi;`)^2.5) = 0

Bcs := f(0) = 0, (D(f))(0) = `&epsilon;`, (D(f))(inf) = 1, theta(inf) = 0, theta(0) = 1

Pr := 6.2; Cp[s] := 385; Cp[f] := 4179; `&varphi;` := .1; rho[f] := 997.1; rho[s] := 8933; k[s] := 400; k[f] := .613; k := (k[s]+2*k[f]-2*`&varphi;`*(k[f]-k[s]))/(k[s]+2*k[f]+`&varphi;`*(k[f]-k[s])); Br := .1; M := 1; N := 1

func := proc (v) options operator, arrow; rhs((dsolve({equ1, equ2, subs(`&epsilon;` = v, [Bcs])[]}, numeric))(0)[3])/(1-`&varphi;`)^2.5 end proc; plot(func, -1 .. 1, title = typeset((diff(f(eta), eta, eta))*versus*`&epsilon;`/(1-'`&varphi;`')^2.5), titlefont = [times, italic, 18])

 

func2 := proc (v) options operator, arrow; rhs((dsolve({equ1, equ2, subs(`&epsilon;` = v, [Bcs])[]}, numeric))(0)[5]) end proc; plot(func2, -1 .. 1, title = typeset((diff(theta(eta), eta))*versus*`&epsilon;`), titlefont = [times, italic, 18])

 

``


 

Download plot.mw

 

Maple gives me poor accuracy for simple arithmetic problems.

My calculator gives me 0.7 and 0.9 respectively.

I guess I could do evalf(convert(2.59/3.7,fraction)) = 0.7000000000

but this seems excessive.

Sup Brainiacs

I found this "solved" problem for backing rectangular items efficiently. The first example (without rotation of items).

https://www.researchgate.net/file.PostFileLoader.html?id=59938b635b49527571134c33&assetKey=AS%3A527790252490752%401502846410852

I think I have the constraints the same as the text, but I get different solutions. my questions are at the end of the worksheet. Thanks

I 2D_BP.mw

First 890 891 892 893 894 895 896 Last Page 892 of 2428