Items tagged with program program Tagged Items Feed

 

 

but if restart the program,the menu of Plot Builder is appear,in same function(x^2+y^2+(1/1000000000)*z-25 = 0),why thing like this happen?

when run the order like this, the menu of Plot builder disapper

Thank you in advance for your help

Hi:

I will a write program in maple for plot the function f(x),while asked value n from user at first,then plot function f(x) for each value of n and finally all plots show in one figure only for different value of n,how to do it?

f(x)=1+2*(1+x)^n,x=0..5

Hi all

I have a mathematical problem and I asked it in various sites but the answers till yet are not correct.

Assume that we have:

T[m]:=t->t^m:
b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, T[m](N*t-(n-1)*tj), 0), t):

where n,N,tj are known constants. furthermore assume that we want to comute the following integral:

for following approximations:

I have written the following code but it seems to be incorrect:

V1:=Vector([seq(seq(b[n,m](t),m=0..1),n=1..3)]);
V:=evalf(V1.Transpose(V1));

the original program is :

taaylor.mws

I will be so grateful if any one can help me to solve it by maple

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

hi all.

I have wrore the following program for optimization with bernstein and block pulse hybrid functions.

the program have some errors which i can't understand.

Bernestien1.mws

restart:

alias(C=binomial):
with(LinearAlgebra):
macro(LA= LinearAlgebra):


HybrFunc:=proc(N, M,  tj)               # N=Number of subintervals,  M=Number of functions in subintervals
 
local B, n, m;

global b;

for n from 1 to N do
for m from 0 to M-1 do

B := (i,m,t) -> C(m,i)*(1-t)^(m-i)*t^i:

b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, B(m,2,N*t-(n-1)*tj), 0), t):
 od:od:


Array(1..N, 0..M-1, (n,m)->b[n,m](t)):

#convert(%,vector);
end proc:

HybrFunc(3, 3, 1);




                                       # End Of Definition
 
g2(t):=t;            #*exp(t-1):                      # Any other function can be replaced here
    

g1(t):=add(add(c[n,m]*b[n,m](t), m=0..2), n=1..3);
Optimization[Minimize](sqrt(int((g2(t)-g1(t))^2, t=0.. 1)));
assign(op(%[2]));
plot([g2(t),g1(t)], t=0..1, 0..5, color=[blue,red],thickness=[1,3],discont, scaling=constrained);

Array(1 .. 3, 0 .. 2, {(1, 0) = piecewise(0 <= t and t < 1/3, (1-3*t)^2, 0), (1, 1) = piecewise(0 <= t and t < 1/3, (6*(1-3*t))*t, 0), (1, 2) = piecewise(0 <= t and t < 1/3, 9*t^2, 0), (2, 0) = piecewise(1/3 <= t and t < 2/3, (2-3*t)^2, 0), (2, 1) = piecewise(1/3 <= t and t < 2/3, (2*(2-3*t))*(3*t-1), 0), (2, 2) = piecewise(1/3 <= t and t < 2/3, (3*t-1)^2, 0), (3, 0) = piecewise(2/3 <= t and t < 1, (3-3*t)^2, 0), (3, 1) = piecewise(2/3 <= t and t < 1, (2*(3-3*t))*(3*t-2), 0), (3, 2) = piecewise(2/3 <= t and t < 1, (3*t-2)^2, 0)}, datatype = anything, storage = rectangular, order = Fortran_order)

g2(t) := t

"g1(t):=c[1,0] ({[[(1-3 t)^2,0<=t and t<1/3],[0,otherwise]])+c[1,1] ({[[6 (1-3 t) t,0<=t and t<1/3],[0,otherwise]])+c[1,2] ({[[9 t^2,0<=t and t<1/3],[0,otherwise]])+c[2,0] ({[[(2-3 t)^2,1/3<=t and t<2/3],[0,otherwise]])+c[2,1] ({[[2 (2-3 t) (3 t-1),1/3<=t and t<2/3],[0,otherwise]])+c[2,2] ({[[(3 t-1)^2,1/3<=t and t<2/3],[0,otherwise]])+c[3,0] ({[[(3-3 t)^2,2/3<=t and t<1],[0,otherwise]])+c[3,1] ({[[2 (3-3 t) (3 t-2),2/3<=t and t<1],[0,otherwise]])+c[3,2] ({[[(3 t-2)^2,2/3<=t and t<1],[0,otherwise]])"

Error, (in Optimization:-NLPSolve) complex value encountered

Error, invalid left hand side in assignment

(1)



Download Bernestien1.mws

 I'll be so grateful if any one can help me.

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Take a look at this link.

Hi all I am truing to write a maple program for Newton's Method for finding a zero of a function.  I got pretty far but I am trying to get it to list all the values not just one.  Any help would be great:

Here is  what I got:

0.2000000000

0.2016393443

0.2016396757

What I want is if I type in 2 (like the last line I showed) I want the output to show for n=0, n=1, =2.  Instead it is only showing the output just for 2.  Any help would be great thanks, Matt.  

For solving problem sets, I have a pdf template I created for myself that has a header with a blank for the class name, TA, professor, date, etc. In addition to this header, I had a margin on the left to scribble questions I had and to holepunch. 

 

I used to print out the template and write on the template and turn in that as my pset.

 

I am nowthinking of doing everything on the computer. Writing out all of the problem set on the computer. Combining stuff from maple, combining handwritten stuff from the computer using a digitizer. However I want to write it all on top of the my template that I created, which is a pdf file. I can turn the pdf into an image file if need be. 

 

What would be the easiest way to do what I want? To open a program that automatically sets that pdf as the template and easily lets me handwrite stuff I want and paste in maple code? 

 

Right now if I tried my idea, I would basically be constantly copying and pasting stuff from maple and my digitizer drawn pictures/equations into one file and it would be very clumsy.

 

Basically there are problems that I do partially on maple and I just want to unify all my work into one easy, printable file. 

Hi all 

I have the following segment of maple program which belongs to time delay systems dynamic. here C=X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P, is a matrix(vector) which comes from reordering the system terms and my goal is to minimizing J:=X.E.Transpose(X)+U.E.Transpose(U), subject to constraint C=0, but i don't know how to do so.

I will be so grateful if anyone can guide me

best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department


restart:
with(Optimization):
with(LinearAlgebra):
macro(LA= LinearAlgebra):
L:=1:  r:=2:  tau:= 1:
interface(rtablesize= 2*r+1):

Z:= Matrix(
     2*r+1, 2*r+1,
     [tau,
      seq(evalf((L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L)), iz= 2..r+1),
      seq(evalf((L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L))), iz= r+2..2*r+1)
      ],
     scan= columns,
     datatype= float[8]
);
                        
Dtau00:= < 1 >:
Dtau01:= Vector[row](r):
Dtau02:= Vector[row](r):
Dtau10:= Vector(r):
Dtau20:= Vector(r):

Dtau1:= LA:-DiagonalMatrix([seq(evalf(cos(2*i*Pi*tau/L)), i= 1..r)]):
Dtau2:= LA:-DiagonalMatrix([seq(evalf(sin(2*i*Pi*tau/L)), i= 1..r)]):
Dtau3:= -Dtau2:
Dtau4:= copy(Dtau1):

Dtau:= < < Dtau00 | Dtau01 | Dtau02 >,
         < Dtau10 | Dtau1  | Dtau2  >,
         < Dtau20 | Dtau3  | Dtau4  > >;
 
P00:= < L/2 >:
P01:= Vector[row](r):
P02:= Vector[row](r, j-> evalf(-L/j/Pi), datatype= float[8]):
P10:= Vector(r):
P20:= Vector(r, i-> evalf(L/2/i/Pi)):
P1:= Matrix(r,r):
P2:= LA:-DiagonalMatrix(P20):
P3:= LA:-DiagonalMatrix(-P20):
P4:= Matrix(r,r):

P:= < < P00 | P01 | P02 >,
      < P10 | P1  | P2  >,
      < P20 | P3  | P4  > >;

interface(rtablesize=2*r+1):    # optionally
J:=Vector([L, L/2 $ 2*r]):      # Matrix([[...]]) would also work here

E:=DiagonalMatrix(J);

X:=  Vector[row](2*r+1,symbol=a);
U:=Vector[row](2*r+1,symbol=b);

X0:= Vector[row](2*r+1,[1]);
G:=Vector[row](2*r+1,[1]);
C:=simplify(X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P);

Z := Matrix(5, 5, {(1, 1) = 1., (1, 2) = 0., (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 0., (2, 4) = 0., (2, 5) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0., (3, 4) = 0., (3, 5) = 0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 0., (4, 5) = 0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = 0., (5, 5) = 0.})

Dtau := Matrix(5, 5, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 0, (2, 2) = 1., (2, 3) = 0, (2, 4) = 0., (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1., (3, 4) = 0, (3, 5) = 0., (4, 1) = 0, (4, 2) = -0., (4, 3) = -0., (4, 4) = 1., (4, 5) = 0, (5, 1) = 0, (5, 2) = -0., (5, 3) = -0., (5, 4) = 0, (5, 5) = 1.})

P := Matrix(5, 5, {(1, 1) = 1/2, (1, 2) = 0, (1, 3) = 0, (1, 4) = -.318309886100000, (1, 5) = -.159154943000000, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = .1591549430, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0.7957747152e-1, (4, 1) = .1591549430, (4, 2) = -.159154943000000, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (5, 1) = 0.7957747152e-1, (5, 2) = 0, (5, 3) = -0.795774715200000e-1, (5, 4) = 0, (5, 5) = 0})

E := Matrix(5, 5, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 0, (2, 2) = 1/2, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1/2, (3, 4) = 0, (3, 5) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1/2, (4, 5) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 1/2})

X := Vector[row](5, {(1) = a[1], (2) = a[2], (3) = a[3], (4) = a[4], (5) = a[5]})

U := Vector[row](5, {(1) = b[1], (2) = b[2], (3) = b[3], (4) = b[4], (5) = b[5]})

X0 := Vector[row](5, {(1) = 1, (2) = 0, (3) = 0, (4) = 0, (5) = 0})

G := Vector[row](5, {(1) = 1, (2) = 0, (3) = 0, (4) = 0, (5) = 0})

C := Vector[row](5, {(1) = 1.500000000*a[1]-2.-.1591549430*a[4]-0.7957747152e-1*a[5]-.5000000000*b[1]-.1591549430*b[4]-0.7957747152e-1*b[5], (2) = a[2]+.1591549430*a[4]+.1591549430*b[4], (3) = a[3]+0.7957747152e-1*a[5]+0.7957747152e-1*b[5], (4) = a[4]+.3183098861*a[1]-.1591549430*a[2]+.3183098861*b[1]-.1591549430*b[2], (5) = a[5]+.1591549430*a[1]-0.7957747152e-1*a[3]+.1591549430*b[1]-0.7957747152e-1*b[3]})

(1)

J:=X.E.Transpose(X)+U.E.Transpose(U);

J := a[1]^2+(1/2)*(a[2]^2)+(1/2)*(a[3]^2)+(1/2)*(a[4]^2)+(1/2)*(a[5]^2)+b[1]^2+(1/2)*(b[2]^2)+(1/2)*(b[3]^2)+(1/2)*(b[4]^2)+(1/2)*(b[5]^2)

(2)

Minimize(J,{C=0});






Error, (in Optimization:-NLPSolve) invalid arguments

 

#XP:=-.015+X[1]+add(X[l+1]*f1(l)+X[r+l+1]*f2(l), l= 1..r):
#plot([XP,T1], t= 0..1);#,legend= "Solution Of x(t) with r=50"):

 

 

 

 

 

 

Download work1.mwswork1.mws

Whassup homies?

http://www.mathsisfun.com/puzzles/who-lives-in-the-city--solution.html

tried to solve this using C.Loves program, but didn't quite get their solution...

Who_Lives_in_the_Cit.mw

Vars:= [PN,Name, TV, Dest,Ages,Hair,Lives]:
PN:=[$1..5]:
Name:= [Bob, Keeley, Rachael, Eilish, Amy]:
TV:=[Simpsons, Coronation, Eastenders, Desperate, Neighbours]:
Dest:= [Fra, Aus, Eng, Afr,Ita]:
Ages:= [14, 21, 46, 52, 81]:
Hair:=[afro, long, straight, curly , bald]:
Lives:= [town, city, village, farm, youth]:
Con1:= Desperate=3: Con2:= Bob=1: Con3:= NextTo(Simpsons,youth,PN): Con4:= Succ(Afr,Rachael,PN): Con5:= village=52: Con6:= Aus=straight: Con7:= Afr=Desperate: Con8:= 14=5: Con9:= Amy=Eastenders: Con10:= Ita=long: Con11:= Keeley=village: Con12:= bald=46: Con13:= Eng=4: Con14:= NextTo(Desperate,Neighbours,PN): Con15:= NextTo(Coronation,afro,PN): Con16:= NextTo(Rachael,afro,PN): Con17:= 21=youth: Con18:= Coronation=long: Con19:= 81=farm: Con20:= Fra=town: Con21:= Eilish<>straight:

read "LogicProblem.mpl"; City:= LogicProblem(Vars): with(City);

 

Hi all

I have following program to solve time delay system...

the solution is good by choosing r:=11... but for r greater than 11(e.g r=20) the system take about4-5 minute to do and then it says:"" K2:=simplify(inverse(K1)):Error, (in minor) object too large""
and for plotting says:""     Warning, unable to evaluate 1 of the 2 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct""

i don't know what is the problem?

any one can help me???

best wishes

 

> restart:
> with(plots):
> with(linalg):
> with(LinearAlgebra):
> L:=1:
> r:=20:
> tau:=0.3:
> #definition of exact solution
>
> T1 := piecewise(t<0,0,t>=0 and t<0.3,1+t^2,t>=0.3 and t<0.6,(691/1000)+(109/100)*t+(7/10)*t^2+(1/3)*t^3,0.6<=t and t<0.9,(4409/5000)+(209/500)*t+(69/50)*t^2+(2/15)*t^3+(1/12)*t^4,0.9<=t and t<1,(1500917/2000000)+(35107/40000)*t+(1617/2000)*t^2+(87/200)*t^3+(1/120)*t^4+(1/60)*t^5):
> plot(T1,t=0..1,numpoints=10000,discont = true):
> g:=t^2:
> a[0]:=evalf((1/L)*Int(g,t=0..L)):
> for i1 from 1 to r do
> a[i1]:=evalf((2/L)*Int(g*cos(2*i1*Pi*t/L),t=0..L)):
> od:
> for j1 from 1 to r do
> b[j1]:=evalf((2/L)*Int(g*sin(2*j1*Pi*t/L),t=0..L)):
> od:
> X00:=matrix([[a[0]]]);
> X10:=matrix(1,r,0):
> for j from 1 to r do
> X10[1,j]:=a[j]:
> od:
>
> X20:=matrix(1,r,0):
> for j from 1 to r do
> X20[1,j]:=b[j]:
> od:

X00 := [0.3333333333]

> X00:=blockmatrix(1,3,[X00,X10,X20]):
>
>
>
> Z:=linalg[matrix](2*r+1,2*r+1):
> Z[1,1]:=tau:
> for iz from 2 to r+1 do
> Z[iz,1]:=(L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L):
> od:
> for iz from r+2 to 2*r+1 do
> Z[iz,1]:=(L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L)):
> od:
> for jz from 2 to 2*r+1 do
> for iz from 1 to 2*r+1 do
> Z[iz,jz]:=0;
> od:
> od: 
> Dtau00:=matrix([[1]]):
> Dtau01:=matrix(1,r,0):
> Dtau02:=matrix(1,r,0):
> Dtau10:=matrix(r,1,0):
> Dtau20:=matrix(r,1,0):
>
> Dtau1:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau1[i,i]:=cos(2*(i)*Pi*tau/L):
> if i<>j then Dtau1[i,j]:=0 fi:
> od:
> od:
>
> Dtau2:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau2[i,i]:=sin(2*(i)*Pi*tau/L):
> if i<>j then Dtau2[i,j]:=0 fi:
> od:
> od:
>
> Dtau3:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau3[i,i]:=-sin(2*(i)*Pi*tau/L):
> if i<>j then Dtau3[i,j]:=0 fi:
> od:
> od:
>
> Dtau4:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau4[i,i]:=cos(2*(i)*Pi*tau/L):
> if i<>j then Dtau4[i,j]:=0 fi:
> od:
> od:
>
> Dtau:=blockmatrix(3,3,[Dtau00,Dtau01,Dtau02,Dtau10,Dtau1,Dtau2,Dtau20,Dtau3,Dtau4]):
>
> P00:=matrix([[L/2]]):
> P01:=matrix(1,r,0):
>
> P02:=matrix(1,r,0):
> for j from 1 to r do
> P02[1,j]:=-L/(j*Pi):
> od:
>
> P10:=matrix(r,1,0):
>
> P20:=matrix(r,1,0):
> for i from 1 to r do
> P20[i,1]:=L/(2*i*Pi):
> od:
>
>
> P1:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P1[i,j]:=0
> od;
> od;
> P2:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P2[i,i]:=L/(2*i*Pi):
> if i<>j then P2[i,j]:=0 fi:
> od:
> od:
>
> P3:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P3[i,i]:=-L/(2*i*Pi):
> if i<>j then P3[i,j]:=0 fi:
> od:
> od:
>
> P4:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P4[i,j]:=0:
> od:
> od:
>
> P:=blockmatrix(3,3,[P00,P01,P02,P10,P1,P2,P20,P3,P4]):
> I1:=Matrix(2*r+1,shape=identity):
> K1:=simplify(evalm(I1-Dtau&*P+Dtau&*Z)):
> K2:=simplify(inverse(K1)):
Error, (in minor) object too large

>
> X0:=matrix(1,2*r+1,0):
> X0[1,1]:=1:
> for j from 2 to 2*r+1 do
> X0[1,j]:=0:
> od:
>
> X:=simplify(evalm(evalm((X0+X00))&*K2)):
>
> for h from 1 to r do
> f1(h):=cos(2*h*Pi*t/L):
> od:

> for k from 1 to r do
> f2(k):=sin(2*k*Pi*t/L):
> od:
> XP:=X[1,1]+evalf(sum(X[1,l+1]*f1(l)+X[1,r+l+1]*f2(l),l=1..r )):
> plot({XP,T1},t=0..1);
Warning, unable to evaluate 1 of the 2 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

¿Que tipos de programas ayudan en  el desarrollo de problemas geometricos?

I am getting an error dialog when I try to Browse an array I created programmatically.  The title of the dialog is RTable Browse Error with and error that says Empty RTable Structure. 

 

Now the data is 0..20 x 0..1 Array Datatype :anything Storage: rectangular

Order: Fortran_Order. 

 

If I do a showall, I can see the data, I just cannot browse it.  Any help would be appreciated.

Code is:


for i from 1 to N do
 t:=h*i:
 X[i,0]:=x1+h*(-x1)*x2+x1:
 X[i,1]:=x2+h*x1*x2-x2:
 x1:=X[i,0]:
 x2:=X[i,1]:
 print('Iteration',i,'AtTime',t,x1,x2)
end do;
print(X);

Thanks

Melvin

 

 

Hi everyone,

I need to write a program to save some files in both Windows or Unix System.

The structure of the path files is different from windows to Unix, so i want to something like this

if (WindowsOS) then

        pathFILE := "\\MyDirectory\\blabla.txt";

elif (UnixOS) then

       pathFILE := "\/MyDirectory\/blabla.txt";

end if;

 

Thanks for help.

hi

is there any way that i run my maplet output in  systems that havnt any maple install on them?

(i wanna run maple program without maple)

 

Reza2961

analytical solution...

September 26 2013 dalindaz 10

hello,i have a problem i have to program analytic solution of heat equation of a rod with two heat sources if you can help me by anything please d'ont hesitate, thank you.

1 2 3 4 5 Page 1 of 5