MaplePrimes Questions

Wondering if anyone has created a Maple "front end" for handling SLAB calls.

 

 

I want calcule the product of this function for x = x1, x2, ... xn:
       
    fx:= theta*exp(-theta*x)

I tried this:

    prod:= product(fx, x=1..n)

However this consider the integer values of x's, i.e, x = 1,2,3...,n.

I don't know how to make x values undefined. Is there anyway?

Hi
I want to solve this integration simbolic:


I use this cammand :

But Maple return this:

Would you Please Help me , thanks

How can I change the color of a graphic tittle?

Hello guys, i would like to do parallel computation in my code written in the Maple18. The question that can help me is:

Given a procedure that compute an function g, where g = f1+f2+f3+f4+f5+f6+f7+f8, i would like to compute all fi at same time.
Now, i´m using " grid:-seq('f[i]',[i=1,2,3,4,5,6,7,8])" and it works very well. However, i think that for my case an better solution should be;
Calculate the f1 in core 1, f2 in core 2, f3 in core 3 ... f8 in core 8 at same time, and after this, to sum all results(f1+f2+f3+..+f8). How i can do this?

Att,

Griffith.

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class test

{

    public static void main( String args[] )

    {

        String a[];

        Engine t;

        int i;

        a = new String[1];

        a[0] = "java";

        try

        {

            t = new Engine( a, new EngineCallBacksDefault(), null, null );

            t.evaluate( "int( x,x );" );

        }

        catch ( MapleException e )

        {

            System.out.println( "An exception occurred\n" );

            return;

        }

        System.out.println( "Done\n" );

    }

}

This code error import com.maplesoft.externalcall.MapleException in java?

Please help me.

http://www.maplesoft.com/support/help/Maple/view.aspx?path=OpenMaple/Java/Examples

I have the following multi-variable polynomial:

F:=(d^4-2)*C+(7*d^3-3*d)*C^2-(10*d^4-4*d)*L^2+(d-d^2)*L^3+(R+z^2)*x1+(10*d^3-4*d)*L;

Here my question is how to (i) generate "F" in the following form-> F:=k1*C+k2*L+k3*x1; (ii) How to find the coeficient terms of  "C", "L", "x1".

 

Thanking you in advance.

 

MVC

I am using mathematical simplification. In between the simplifcations I have the function after unsing "factor(f)"

f:=X^2*R*(1-y^3)(5+4*x-10*p+34*x^2)*y*x^2*(R+d^3+4*R-10*a*b^2)

 

Here my question is "How can separate or take out the term(s) within the brackets()" from the multivariate polynomial.

 

Thanking you in advance for your help.

 

MVC

I am trying to solve an optimization problem with several constraints and it is not working. The decision variables are the matrix entries.

 

Below is the code:

restart;
interface(displayprecision = 4): with( plots ):
with(linalg):with( Optimization );
[ImportMPS, Interactive, LPSolve, LSSolve, Maximize, Minimize,

NLPSolve, QPSolve]
f:=proc(x1,x2,x3,x4,x5,x6)
global lambda,mu,rho,Ls;
local eq,Lsq,g,P,n,IM,ImP,ImPi,c0,cb,Sol,i,j,t1,t2,fact,t3,t4,t5,Wq,W,Lq,L,Ws;
n:=7;
g:=array(1..n,[5,0,0,0,0,0,0]);
mu:=array(1..n,[10,5,5,5,5,5,5]);
P:=matrix([[0,x1,x2,0,0,0,0],[0,0,0,x3,x4,0,0],[0,0,0,0,0,x5,x6],
[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]]);
IM := array(identity, 1..n,1..n):
ImP:=evalm(IM-P):
ImPi:=inverse(ImP):
lambda:=evalm(g&*ImPi):
for i from 1 to n do
rho[i] := lambda[i]/mu[i]
od:
c0:=array(1..n,[1/2,0,0,0,0,0,0]);
cb:=array(1..n,[1/5,1/5,1/5,1/5,1/5,1/5,1/5]);
for i from 1 to n do
eq[i]:=(g[i]/lambda[i])*c0[i] + sum((lambda[j]/lambda[i])*P[j,i]*((P[j,i]*(rho[j]^2*cb[j] +(1-rho[j]^2)*cx[j] ))+ (1 -P[j,i])),j=1..n)
od:
Sol:=fsolve({eq[1]-cx[1]=0,eq[2]-cx[2]=0,eq[3]-cx[3]=0,eq[4]-cx[4]=0,eq[5]-cx[5]=0,eq[6]-cx[6]=0,eq[7]-cx[7]=0},{cx[1],cx[2],cx[3],cx[4],cx[5],cx[6],cx[7]}):
assign(Sol):cx:
for i from 1 to n do
t1:= -2*(1-rho[i])/(3*rho[i]):
t2:= ((1-cx[i])^2)/(cx[i]+cb[i]):
fact := exp(t1*t2):
if cx[i] >= 1 then
fact:=1:
else
fact:
fi:
t3:=rho[i]/(1-rho[i]):
t4:= (cx[i]+ cb[i])/2:
t5:=1/mu[i]:
Wq[i] := (t3*t4*t5*fact):
W[i] := Wq[i] + t5:
Lq[i] := lambda[i]*Wq[i]:
L[i] := lambda[i]*W[i]:
od:
Ls:=add(L[i],i=1..n);Lsq:=add(Lq[i],i=1..n):Ws:=Ls/add(g[i],i=1..n):
RETURN(Ls):
end proc:

# here are the constraint procedures to ensure the probability pairs sum to one

p1 := proc (x1, x2) x1+x2-1 end proc;
proc(x1, x2) ... end;
p2 := proc (x3, x4) x3+x4-1 end proc;
proc(x3, x4) ... end;
p3 := proc (x5, x6) x5+x6-1 end proc;
proc(x5, x6) ... end;

sol := Optimization:-NLPSolve(f, {p1}, {p2}, {p3}, 0 .. 1, 0 .. 1, 0 .. 1, 0 .. 1, 0 .. 1, 0 .. 1, initialpoint = [.5, .5, .5, .5, .5, .5]);


Error, (in Optimization:-NLPSolve) unexpected parameters: {p3}

It seems to say that the problem are the constraints but this seems odd.

 

 

My PhD involves generating equations that are very long, in some cases, more than 10 pages long.

For the reader its much more useful to have some of these equations described than presented. One of the descriptions I'd like to use is number of characters and intuitively the command Length feels like it should tell you the number of characters in an expr

However what is written on the help page for this function I don't understand:
https://www.maplesoft.com/support/help/maple/view.aspx?path=length

 

For other objects, the length of each operand of expr is computed recursively and added to the number of words used to represent expr. In this way, the measure of the size of expr is returned.

then the example that is given is

>length(x+2y)

length(x+2y)

99

(5)

See Also

numelems

S


Could anyone explain to me what is meant when it is said length(x+2y)=9? if I try an apply things recursively the expression with the most chatracters i can generate is "x+y+y"which is only 5 characters.


Is there another command that would be better suited to my purposes?

Hi,

i would like to plot a graph in R^3 of a function f(n,t), where n is integer and t is real. For every t i would like to have a sequence of points. Is it possible?

thanks, anna rita 

hello everyone, 

To illustrate my question I will get Bob and Alice 

Suppose Bob and Alice work separately on the same subject and must share some information.
They decide to exchange information among themselves by using .m files (Maple internal format files).

-------------------

1) Bob performs the first serie of calculus which ends by some "result". 
This result is the information Bob must send to Alice for her doing her part of the job.
Bob assigns this result to a variable named MyVar and saves it in a .m file :

.....
MyVar := ... :
save  MyVar   "/.../MyFile.m"

Then Bob indicates to Alice the complete path to MyFile.m ... but forgets to say her the name of the variable he has saved.

-------------------

2) Alice reads the file MyFile.m (read "/.../MyFile.m") .... 
Of course, if Alice knew the name of the variable Bob used in his "save" command, it would be the simplest thing in the World for her to browse the content of the .m file (eval(MyVar) generally works well).

But I assumed it is not the case, so my question :

Can Alice recover the name of the variable and visualize it ? 


Any answer will be greatly appreciated


postscript : it is not the first time I find myself in the situation Alice faces here. Often I have to recover the content of .m files written years ago by people who have changed their core business without having properly documented (like Bob) what these files contain

How do we specify the length of the string in external calling if we don't know the length beforehand?

In a local directory I have a number of worksheets that uses the same procedures, so I want to collect these procedures in a package, where the file with the package should be stored locally, since it is only relevant locally.

Is that possible, and how can it be done ?

Hi,

I have to find the root of an equation corresponding to the maximum absolute value. I am using root finding package to get all the roots. But after getting all the roots i am not able to apply abs function. Maple sheet is attached.

restart

with(plots):

with(LinearAlgebra):

with(DEtools):

with(ColorTools):

Digits := 30

30

(1)

x := proc (t) options operator, arrow; x0*exp(lambda*t) end proc:

phi := proc (t) options operator, arrow; phi0*exp(lambda*t) end proc:

eqm1 := collect(simplify(coeff(expand(diff(x(t), `$`(t, 2))+(2*0)*beta*(diff(x(t), t))+0*x(t)+n*psi*(-v*(phi(t)-phi(t-2*Pi/(n*omega0)))+x(t)-x(t-2*Pi/(n*omega0)))), exp(lambda*t))), {phi0, x0})

(-n*psi*v+n*psi*v*exp(-2*lambda*Pi/(n*omega0)))*phi0+(lambda^2+n*psi-n*psi*exp(-2*lambda*Pi/(n*omega0)))*x0

(2)

eqm2 := collect(simplify(coeff(expand(diff(phi(t), `$`(t, 2))+(2*0)*(diff(phi(t), t))+phi(t)+n*(-v*(phi(t)-phi(t-2*Pi/(n*omega0)))+x(t)-x(t-2*Pi/(n*omega0)))), exp(lambda*t))), {phi0, x0})

(-n*v+n*v*exp(-2*lambda*Pi/(n*omega0))+lambda^2+1)*phi0+(n-n*exp(-2*lambda*Pi/(n*omega0)))*x0

(3)

mode := simplify(evalc(Re(evalc(subs(lambda = I*Omega, solve(subs(x0 = m*phi0, eqm1), m)))))^2+evalc(Im(evalc(subs(lambda = I*Omega, solve(subs(x0 = m*phi0, eqm1), m)))))^2)

-2*n^2*psi^2*v^2*(-1+cos(2*Omega*Pi/(n*omega0)))/(Omega^4-2*Omega^2*n*psi+2*Omega^2*n*psi*cos(2*Omega*Pi/(n*omega0))+2*n^2*psi^2-2*n^2*psi^2*cos(2*Omega*Pi/(n*omega0)))

(4)

A, b := GenerateMatrix([eqm1, eqm2], [x0, phi0])

A, b := Matrix(2, 2, {(1, 1) = lambda^2+n*psi-n*psi*exp(-2*lambda*Pi/(n*omega0)), (1, 2) = -n*psi*v+n*psi*v*exp(-2*lambda*Pi/(n*omega0)), (2, 1) = n-n*exp(-2*lambda*Pi/(n*omega0)), (2, 2) = -n*v+n*v*exp(-2*lambda*Pi/(n*omega0))+lambda^2+1}), Vector(2, {(1) = 0, (2) = 0})

(5)

with(RootFinding):

eq := subs(n = 6, psi = 1000, omega0 = 1.15, v = 0.1e-1, Determinant(A))

6000.94*lambda^2-5999.94*exp(-.289855072463768115942028985507*lambda*Pi)*lambda^2+lambda^4+6000-6000*exp(-.289855072463768115942028985507*lambda*Pi)

(6)

zeros := RootFinding:-Analytic(eq, lambda, re = 0 .. 400, im = -200 .. 200)

0.899769545162895563524511282265e-56, 0.813609592584011756247655681635e-1-20.6993361029378520006643410260*I, .242743338419727199544214811606-34.4961764258358768825593120288*I, .440964962950043888796944083291-100.074138054178692973033664525*I, .107710271188082726666762251538-106.954651646879437684160623413*I, 1.12290283496379505456476079030-62.0290638297730162295171014475*I, .879463466045683309032252293625-93.2168861049771086211729407830*I, 2.54860869821265794971735119535-80.1919866273564551209847942490*I, 1.52678990439144770439544731898-86.4450560720567958301493690195*I, 2.62945288424037545703549470125-75.0161229879790946191171617450*I, 1.68779005203728587549371003511-68.8012471850312399391042105550*I, .776570081405504740452992339900-55.1681878011205261920670466495*I, 0.851171007270465178285429398270e-9+1.00000500045406723708450960132*I, 0.851171007270465178285445699470e-9-1.00000500045406723708450960133*I, 0.874874719902730972066854301075e-2-6.89997772561385443312823760560*I, 0.354201863215292148351069041542e-1-13.7998152076043523748759861636*I, .369195444156713173497807954493-41.3921704506707022569621870947*I, .540047057129385026999638567235-48.2843908783769449582520027744*I, .149078330738225743331408017894-27.5982749361891156626731068484*I, .369195444156713173497807954500+41.3921704506707022569621870948*I, .440964962950043888796944083291+100.074138054178692973033664525*I, .107710271188082726666762251538+106.954651646879437684160623413*I, 1.12290283496379505456476079030+62.0290638297730162295171014475*I, .879463466045683309032252293625+93.2168861049771086211729407830*I, 2.54860869821265794971735119535+80.1919866273564551209847942490*I, 1.52678990439144770439544731898+86.4450560720567958301493690195*I, 2.62945288424037545703549470125+75.0161229879790946191171617450*I, 1.68779005203728587549371003511+68.8012471850312399391042105550*I, .776570081405504740452992339900+55.1681878011205261920670466495*I, 0.813609592584011756247655681660e-1+20.6993361029378520006643410260*I, 0.354201863215292148351069041261e-1+13.7998152076043523748759861634*I, 0.874874719902730972066854301075e-2+6.89997772561385443312823760560*I, .540047057129385026999638567235+48.2843908783769449582520027744*I, .242743338419727199544214811602+34.4961764258358768825593120288*I, .149078330738225743331408017894+27.5982749361891156626731068484*I

(7)

"zeros.select(int 1)"

Error, missing operation

"zeros.select(int 1)"

 

``


Download question.mw

I will be really thankful for the help.

Regards

Sunit

First 1095 1096 1097 1098 1099 1100 1101 Last Page 1097 of 2428