Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am practicing with some diff equations. I am having problem solving for one of the constants. I am having a pproblem assigning a value to derivatives or 2nd derivatives. What is a good general technique is this type of situation?
 

restart

NULL

``

omega^2 = g/l

omega^2 = g/l

(1)

Eq1 := diff(Theta(t), t, t) = -omega^2*Theta(t)

diff(diff(Theta(t), t), t) = -omega^2*Theta(t)

(2)

ics := Theta(0) = 0, (diff(Theta(t), t))(0) = Vmax, (diff(Theta(t), t, t))(0) = 0

Theta(0) = 0, (diff(Theta(t), t))(0) = Vmax, (diff(diff(Theta(t), t), t))(0) = 0

(3)

SHM := dsolve({Eq1, ics})

(4)

SHM := dsolve({Eq1})

{Theta(t) = _C1*sin(omega*t)+_C2*cos(omega*t)}

(5)

SHM := dsolve({Eq1, Theta(0) = 0})

Theta(t) = _C1*sin(omega*t)

(6)

``

diffSHM := diff(SHM, t)

diff(Theta(t), t) = _C1*omega*cos(omega*t)

(7)

``

(Theta(t))(0) = 0, (diff(Theta(t), t))(0) = V

(Theta(t))(0) = 0, (diff(Theta(t), t))(0) = V

(8)

``

``

``

``

``

NULL

NULL


 

Download SHM.mw

I was trying to write a procedure that would compute a simple linear equation using the Extended Euclidean Algorithm. I was thinking of a procedure like the following:

solveEeaMatrix := proc (a::list, b::list) 
 local c::list;  
 c := a -iquo(a[1],b[1])*b;  
 print(c);  
 while (c[1] <> gcd(a[1],b[1]) do 
 ...

I am basically stuck at this part as

1) I don't know how to setup a multi-dimensional array that could dynamically grow(as a possible solution).

2) I can't come up with a recursive function that could possibly take care of this.

In short, if I am given for example an equation like: 84*x+203*y = 14

I will transform it into 2 linear equation as follow:
row0 := [203, 0, 1] row1 := [84, 1, 0] Subsequently, I will perform the following:

c := a -iquo(a[1],b[1])*b;  

Where aand b are both lists and arguments of the procedure and cbeing another list and a local variable.

But I don't know how to do the following programmatically:

row3 := row1-iquo(row1[1], row2[1])*row2;
row4 := row2-iquo(row2[1], row3[1])*row3;
row5 := row3-iquo(row3[1], row4[1])*row4;
and so on ...                  

Any hint would be appreciated.

I want to calculate the intersection between three circles.
I know that in this case i can calculate intersection of only the first and second equation, but I need this for a interactive component.

The command "intersection"[GEOMETRY] work only with 2 circles.

I did this but it doesn't work.

Thanks.

I used the command line betwen two poin, and i saw the graphic.

The line passes for my two point, but i I would like it started in the first point and finished in the second.

Thanks.

guys, need your help. i've been trying to find 9 pamater which are psi1,psi2,psi3,m1,m2,m3,sigma1,sigma2,sigma3. I need to minimize one function. i have datas and several contraints. i will share this with you guys. Really need your help and i'll appreciate any suggestion. Thanks

data:

a(x):=qtopi[x];

this is my objective function:

fungsikerugian := sum((1-(1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3))))/a(x))^2, x = 0 .. 111);

these are my contraints

a := psi1+psi2+psi3 = 1;
         
b := 0 <= exp(-((x+1)/m1)^(m1/sigma1));
                          
c := 1 >= exp(-((x+1)/m1)^(m1/sigma1));
                       
d := 0 <= 1-exp(-((x+1)/m2)^(-m2/sigma2));
                        
e := 1 >= 1-exp(-((x+1)/m2)^(-m2/sigma2));
                 
f := 0 <= exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3));
                  
g := 1 >= exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3));
            
h := 0 <= exp(-(x/m1)^(m1/sigma1));
                        
i := 1 >= exp(-(x/m1)^(m1/sigma1));
                     
j := 0 <= 1-exp(-(x/m2)^(-m2/sigma2));
                           
k := 1 >= 1-exp(-(x/m2)^(-m2/sigma2));
                      
l := 0 <= exp(exp(-m3/sigma3)-exp((x-m3)/sigma3));
                   
m := 1 >= exp(exp(-m3/sigma3)-exp((x-m3)/sigma3));
               
n := 0 <= 1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3)));

o := 1 >= 1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3)));
 
i use this to solve that but seems to not going anywhere
NLPSolve(fungsikerugian, {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o}, assume = nonnegative);
 
Thanks

Hello people in mapleprimes,

I am using maple 2016's standard UI.
And, I write save command in the ending place there.

And, while I write a code, whenever I think I had better put a name of an expression on a list in another .mpl file, to refer it later, I scroll down the cursor to the ending of the worksheet, and write the name of the expression, and again I bring the cursor back to the place where I wrote an expression whose name I wrote among the arguments of save.
  But, this is a little inconvenient. I have to find the original place where I had been before I moved to the end of the worksheet. But, on the other hand, using a bookmark seems complicated. Isn't there any better way to go to the place of the save command, which is the end of the worksheet, and to go back to the original place soon.

I hope you will give any hint to me. Thanks in advance.

 

When I do

seq(a||i,i=1..3); Maple returns   a1, a2, a3

But  seq(a__i,i=1..3);  returns a__i, a__i, a__i

Is there a way to make the second example also return  a__1,a__2,a__3 ?

http://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet/documenting/2DMathShortcutKeys

thank you,
Maple 2016.2

 

I am not a math major, so may be I am missing something here. But for this ode:

(diff(y(x),x))^2=4 * y(x)

There ought to be (I think) 2 solutions (other than the singular one y(x)=0), due to the square root. i.e the ode becomes

   diff(y(x),x)= +-  2* sqrt(y(x))

So for the + case, there is one solution, and for the - case, there is another solution. But Maple dsolve only gives one solution (again, ignoring the singular solution for now):

eq:=(diff(y(x),x))^2=4 * y(x);
sol:=dsolve(eq,y(x));

     y(x) = _C1^2-2*_C1*x+x^2

In Mathematica, it gives both solutions

ode = (y'[x])^2 == 4 y[x];
DSolve[ode, y[x], x] // Simplify
    {  {y[x] -> (1/4)*(-2*x + C[1])^2},   {y[x] -> (1/4)*(2*x + C[1])^2}}

Both Maple and Mathematica solutions are correct ofcourse. But my question is why did not Maple give both (non-singular) solutions? and it only gave one?

Maple 2016.2

 

 

 

Dear All, 

I am trying to use define_external to use a C dll from inside MAPLE. The C dll exports a function that has a argument of type function pointer which has a return type of pointer. The function itself returns pointers.  

Pointers are needed as return types as the C function needs to return arrays. 

When I try to pass the C function, as maple procedure as the argument, it errs saying "Error, (in rk4_vec) number expected for float[8] parameter, got proc () option remember; table( [( 1 ) = HFloat(1.0), ( 2 ) = HFloat(-0.0) ] ) 'procname(args)' end proc"

rk4_vec is as follows: 

rk4_vec := define_external("rk4vec", 't0' :: float[8], 'm' :: integer[4], 'u0' :: ARRAY(1..2,datatype=float[8]), 'dt' :: float[8], 'f' :: PROC('t' :: float[8], 'm' :: integer[4], 'u' :: ARRAY(1..2,datatype=float[8]), 'RETURN' :: REF(float[8])), 'RETURN' ::REF(float[8]), "WRAPPER", LIB="rk4.dll");

rk4vec in C looks like this: 

double *rk4vec ( double t0, int m, double u0[], double dt, 
  double *f ( double t, int m, double u[] ) )

I am passing as :

rk4vec_test_f := proc(t, n, u)
local uprime :: REF(float[8]);
#uprime := Array(n);
uprime(1) := u(2);
uprime(2) := -u(1);
return uprime;
end proc;

I have tried the RETURN type on the define_external call as : float[8], ARRAY(1..2, datatype=float[8]) , but that didnt work either. I got the idea of using REF from times2 example on this link.

Any guidance in this matter is highly appreciated. 

Attached are the C file, the dll, maple worksheet. Tested on Windows, with 64-bit, Maple 2016 standard. rk4.zip

 

Funny, I can't seem to find a list of all available units in the help file.

Is there not a listed table of units somewhere?

**edit add**  conversion of units I mean.  ie.  meters, miles, gallons, litres, Pa, etc...

I wish to solve for k interms of x, e is a constant in the equation k=x+e*sin(k). Using the solve function, i got 

RootOf(_Z-x-e*sin(_Z)) and using the function allvalues(RootOf(_Z-x-e*sin(_Z))) still gave the same expression in _Z. Please is there a way out because I need the value of  as a substitute to another equation. Any help will be highly appreciated.
 

Ì am trying to convert this [APOh.txt] originally coded for mathematica to maple. In mathematica i ran into severa problems in ploting the function etc.. Anyhow so far failed. The code calls inputs from the followin text document [APO-48-10.txt] I am new to maple and its still unfamiliar. Is this possible to convert to maple?

when test most simple case one to one, and many to one these two reasonable cases, it run a very long time without exit the program.

when i test with the example in book Neural Network Design, it can output correctly but only for book example.

restart:
with(ExcelTools):
with(ListTools):
with(plots):
with(LinearAlgebra):
zipplus := proc(mm, pp)
return zip((x,y) -> x+y, mm, pp)
end proc:
zipminus := proc(mm, pp)
return zip((x,y) -> x-y, mm, pp)
end proc:
zipstar := proc(mm, pp)
return zip((x,y) -> x*y, mm, pp)
end proc:

metara := proc(pp,meaght,bb,mapp,deep)
if deep > 0 then
 pp2 := metara([seq(pp[i], i = 1 .. nops(pp))],meaght,bb,mapp,deep-1):
 mp := zip((x,y) -> x*y,pp2,meaght):
 mpsam := sum(mp[m],m=1..nops(pp2)):
 mpb := [seq(0, i = 1 .. nops(pp2))]:
 for ii from 1 to nops(bb) do
  mpb[ii] := evalf(mpsam + bb[ii]);
 od:
 pa := [seq(0, i = 1 .. nops(pp2))]:
 for ii from 1 to nops(bb) do
  pa[ii] := evalf(mapp[deep](mpb[ii])):
 od:
 return pa:
else
 return pp:
end if:
end proc:

perceptronrule1 := proc(p, t1, meaght1, b1, checksum, mapp)
 meaght3 := meaght1:
 b3 := b1:
 checksum2 := checksum;
 print(p[1]):
 while sum(checksum2[jj], jj=1..nops(p)) <> nops(p) do
  #print("sum(checksum2[jj], jj=1..nops(p))");
  #print(sum(checksum2[jj], jj=1..nops(p)));
  for ii from 1 to nops(p) do
   #print("metara(p[ii],meaght3,b3,mapp,1)");
   #print("p[ii]");
   #print(p[ii]);
   #print("b3");
   #print(b3);
   #print("meaght3");
   #print(meaght3);
   #print(metara(p[ii],meaght3,b3,mapp,1));
   #print("t1[ii]");
   #print(t1[ii]);
   e := zipminus(t1[ii], metara(p[ii],meaght3,b3,mapp,1));
   #print("e");
   #print(e);
   meaght2 := meaght3 + zipstar(e,p[ii]);
   #print("meaght2");
   #print(meaght2);
   #print("meaght3");
   #print(meaght3);
   #print("b3");
   #print(b3);
   b2 := b3 + e;
   #print("b2");
   #print(b2);
   #print("b3");
   #print(b3);
   #print("checksum2");
   #print(checksum2);
   diff1 := zipminus(meaght2, meaght3):
   diff2 := zipminus(b2, b3):
   if sum(diff1[m],m=1..nops(diff1)) = 0 and sum(diff2[m],m=1..nops(diff2)) = 0 then
    checksum2[ii] := 1:
   else
    checksum2[ii] := 0:
    b3 := b2:
    meaght3 := meaght2:
   end if:
  od:
 od:
 return [meaght3, b3, checksum];
end proc:

#Example from book
ppp := [[2,2],[1,-2],[-2,2],[-1,1]]:
check1 := [seq(0,ii=1..nops(ppp))];
ttt1 := [[0,0],[1,1],[0,0],[1,1]]:
mmmeaght1 := [seq(0,ii=1..nops(ppp[1]))]:
bbb1 := [seq(0,ii=1..nops(ppp[1]))]:
emap := [(x) -> if x < 0 then 0 else 1 end if, (x) -> evalf(1/(1+exp(x)))]:
#trace(perceptronrule1);
perceptronrule1(ppp,ttt1,mmmeaght1,bbb1,check1,emap);

#my testing for one to one
#after testing, it loop a very long time and not stop
ppp := [[0,0,0,1],[0,0,1,0],[0,1,0,0],[1,0,0,0]]:
check1 := [seq(0,ii=1..nops(ppp))];
ttt1 := [[0,0,0,1],[0,0,1,0],[0,1,0,0],[1,0,0,0]]:
mmmeaght1 := [0,0,0,0]:
bbb1 := [0,0,0,0]:
emap := [(x) -> if x < 0 then 0 else 1 end if, (x) -> evalf(1/(1+exp(x)))]:
#trace(perceptronrule1);
perceptronrule1(ppp,ttt1,mmmeaght1,bbb1,check1,emap);

#my testing for many to one
#after testing, it loop a very long time and not stop
ppp := [[1,1,0,0],[0,1,1,0],[0,1,0,1]]:
check1 := [seq(0,ii=1..nops(ppp))];
ttt1 := [[1,0,0,0],[0,1,0,0],[0,0,0,1]]:
mmmeaght1 := [0,0,0,0]:
bbb1 := [0,0,0,0]:
emap := [(x) -> if x < 0 then 0 else 1 end if, (x) -> evalf(1/(1+exp(x)))]:
#trace(perceptronrule1);
perceptronrule1(ppp,ttt1,mmmeaght1,bbb1,check1,emap);

#my testing for one to many
#after testing, it loop a very long time and not stop
ppp := [[1,0,0,0],[0,1,0,0],[0,0,0,1]]:
check1 := [seq(0,ii=1..nops(ppp))];
ttt1 := [[1,1,0,0],[0,1,1,0],[0,1,0,1]]:
mmmeaght1 := [0,0,0,0]:
bbb1 := [0,0,0,0]:
emap := [(x) -> if x < 0 then 0 else 1 end if, (x) -> evalf(1/(1+exp(x)))]:
#trace(perceptronrule1);
perceptronrule1(ppp,ttt1,mmmeaght1,bbb1,check1,emap);

Can somebody please expand the following double sum to produce a list of sequences?

(Sum(f[i], i = 0 .. 1))*(Sum(g[i, j, k], j = 0 .. 1)) for k = {1,2}

I need to make sure the operation order is correct, so I would like to verify my workings.

Thanks!

The maple I used at school is a much older version and when I do Definite Integrals there and copy it to Word as part of the project, it just copies perfectly.

Now I have Maple 16 at home and when I have a definite integral, I have to copy it using copy special and take it as an image to MS Word. That's not the problem. The problem is the limits sometimes seem to be cut off. The left hand-side image is the older version of Maple. Limits look perfect and even the integral sign is darker and so on. The right hand-side image is the Maple 2016. Can anyone help me change the style on Maple 2016 so it's like the old one so the integrals look better on my project. Thanks alot

 

First 994 995 996 997 998 999 1000 Last Page 996 of 2215