MaplePrimes - Maple 16 Posts and Questions
http://www.mapleprimes.com/products/Maple/Maple 16
en-us2014 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemMon, 28 Jul 2014 04:15:54 GMTMon, 28 Jul 2014 04:15:54 GMTMaple 16 Questions and Posts on MaplePrimeshttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Maple 16 Posts and Questions
http://www.mapleprimes.com/products/Maple/Maple 16
Nonlinear system of 14 equations/unknowns, 9 parameters: eliminate
http://www.mapleprimes.com/questions/201996-Nonlinear-System-Of-14-Equationsunknowns?ref=Feed:MaplePrimes:Version Maple 16
<p>Hello,</p>
<p>this is the second time I'm writing.</p>
<p>I posted this question in June http://www.mapleprimes.com/questions/201781-System-Of-Parametric-Equations.</p>
<p>This time I have a similar problem because I'm trying to find a solution for a parametric system of equations but the number of equations and parameters is much bigger and using the tips you gave me last time I couldn't reach any result.</p>
<p>Here is the system:</p>
<p>1) alpha[1]=v*a*u*b ;<br>2) alpha[2]=v*a*u*(1-b);<br>3) alpha[3]= v*z*c*(1-a) ;<br>4) alpha[4]=v*z*(1-a)*(1-c) ;<br>5) alpha[11]=1/2*v*a* u* b* (-p*u*b+p*u*b*a+b*g-g);<br>6) alpha[22]=1/2*v*a*u*(1-b)* (p u b-p u b a-b g-p u+p u a);<br>7) alpha[33] =1/2*v*c*z*(1-a)* (c* (-z*p*a+q)-q);<br>8) alpha[44]=1/2*v*z*((1-a)*(1-c)* (c*z*p*a-z*p*a-q*c);<br>9) alpha[12]=v*a*u*b*(1- b)*(-p*u+p*u*a+g) ;<br>10) alpha[13]=v*a*u*b*z*c*p*(1-a) ;<br>11) alpha[14]=a*u*b*z*(1-a)*(1-c) ;<br>12) alpha[23]=a*u*z*c*(1-a)*(1-b);<br>13) alpha[24]=v*a*u*z*p*(1-a)*(1-b)*(1-c);<br>14) alpha[34]= v*c*z*(1-a)*(1-c)*(-z*p*a+q);</p>
<p> </p>
<p>I have 14 equations/unknowns and 8 parameters (a, b, c, u, v, z, p, q).</p>
<p>I would like to write this system only in terms of alphas. In order to do so, I usually try to find the value for the parameters and the substitute them into the equations (and I have already found b,c,g,q using this technique) but I couldn't manage to find all of them. </p>
<p>Howveer, as you suggested me, with Maple there is the command "eliminate" that implement exactly what I'm looking for but I can't make it work.</p>
<p>This is my code:</p>
<p>> sys := {alpha[1] = v*a*u*(1-b), alpha[2] = v*a*u*b, alpha[3] = v*z*c*(1-a), alpha[4] = v*z*(1-a)*(1-c), alpha[11] = (1/2)*v*a*u*(1-b)*(p*u*b-p*u*b*a-b*g-p*u+p*u*a), alpha[12] = v*a*u*b*(1-b)*(-p*u+p*u*a+g), alpha[13] = z*c*a*u*(1-a)*(1-b), alpha[14] = v*z*a*u*p*(1-a)*(1-b)*(1-c), alpha[22] = (1/2)*v*a*u*b*(-p*u*b+p*u*b*a+b*g-g), alpha[23] = v*z*c*a*u*b*p*(1-a), alpha[24] = z*a*u*b*(1-a)*(1-c), alpha[33] = (1/2)*v*c*z*(1-a)*(c*(-z*p*a+q)-q), alpha[34] = v*c*z*(1-a)*(1-c)*(-z*p*a+q), alpha[44] = (1/2)*v*z*(1-a)*(1-c)*(c*z*p*a-z*p*a-q*c)};</p>
<p>> eliminate(sys, {a,b,c, p, q, u, v, z});</p>
<p>> simplify(%, size);</p>
<p> </p>
<p>I also tries to substitute in the system the four parameters I already found but still I can't find a solution.</p>
<p>What am I doing wrong? Or the problem is that it is too complicated?</p>
<p> </p>
<p>Thank you for your attention,</p>
<p>Elena</p><p>Hello,</p>
<p>this is the second time I'm writing.</p>
<p>I posted this question in June http://www.mapleprimes.com/questions/201781-System-Of-Parametric-Equations.</p>
<p>This time I have a similar problem because I'm trying to find a solution for a parametric system of equations but the number of equations and parameters is much bigger and using the tips you gave me last time I couldn't reach any result.</p>
<p>Here is the system:</p>
<p>1) alpha[1]=v*a*u*b ;<br />2) alpha[2]=v*a*u*(1-b);<br />3) alpha[3]= v*z*c*(1-a) ;<br />4) alpha[4]=v*z*(1-a)*(1-c) ;<br />5) alpha[11]=1/2*v*a* u* b* (-p*u*b+p*u*b*a+b*g-g);<br />6) alpha[22]=1/2*v*a*u*(1-b)* (p u b-p u b a-b g-p u+p u a);<br />7) alpha[33] =1/2*v*c*z*(1-a)* (c* (-z*p*a+q)-q);<br />8) alpha[44]=1/2*v*z*((1-a)*(1-c)* (c*z*p*a-z*p*a-q*c);<br />9) alpha[12]=v*a*u*b*(1- b)*(-p*u+p*u*a+g) ;<br />10) alpha[13]=v*a*u*b*z*c*p*(1-a) ;<br />11) alpha[14]=a*u*b*z*(1-a)*(1-c) ;<br />12) alpha[23]=a*u*z*c*(1-a)*(1-b);<br />13) alpha[24]=v*a*u*z*p*(1-a)*(1-b)*(1-c);<br />14) alpha[34]= v*c*z*(1-a)*(1-c)*(-z*p*a+q);</p>
<p> </p>
<p>I have 14 equations/unknowns and 8 parameters (a, b, c, u, v, z, p, q).</p>
<p>I would like to write this system only in terms of alphas. In order to do so, I usually try to find the value for the parameters and the substitute them into the equations (and I have already found b,c,g,q using this technique) but I couldn't manage to find all of them. </p>
<p>Howveer, as you suggested me, with Maple there is the command "eliminate" that implement exactly what I'm looking for but I can't make it work.</p>
<p>This is my code:</p>
<p>> sys := {alpha[1] = v*a*u*(1-b), alpha[2] = v*a*u*b, alpha[3] = v*z*c*(1-a), alpha[4] = v*z*(1-a)*(1-c), alpha[11] = (1/2)*v*a*u*(1-b)*(p*u*b-p*u*b*a-b*g-p*u+p*u*a), alpha[12] = v*a*u*b*(1-b)*(-p*u+p*u*a+g), alpha[13] = z*c*a*u*(1-a)*(1-b), alpha[14] = v*z*a*u*p*(1-a)*(1-b)*(1-c), alpha[22] = (1/2)*v*a*u*b*(-p*u*b+p*u*b*a+b*g-g), alpha[23] = v*z*c*a*u*b*p*(1-a), alpha[24] = z*a*u*b*(1-a)*(1-c), alpha[33] = (1/2)*v*c*z*(1-a)*(c*(-z*p*a+q)-q), alpha[34] = v*c*z*(1-a)*(1-c)*(-z*p*a+q), alpha[44] = (1/2)*v*z*(1-a)*(1-c)*(c*z*p*a-z*p*a-q*c)};</p>
<p>> eliminate(sys, {a,b,c, p, q, u, v, z});</p>
<p>> simplify(%, size);</p>
<p> </p>
<p>I also tries to substitute in the system the four parameters I already found but still I can't find a solution.</p>
<p>What am I doing wrong? Or the problem is that it is too complicated?</p>
<p> </p>
<p>Thank you for your attention,</p>
<p>Elena</p>201996Thu, 17 Jul 2014 10:59:06 Zele88ele88Error, (in convert/matrix) expecting array, rtable or list
http://www.mapleprimes.com/questions/201976-Error-in-Convertmatrix-Expecting?ref=Feed:MaplePrimes:Version Maple 16
<p>hello, I put in the code:</p>
<p>> with(plots), with(ColorTools), with(LinearAlgebra), with(RandomTools), with(ExcelTools);<br>> A := `<|>`(`<,>`(1, 2, 0, 2, 3, 4, 3, 4, 7, 9, 5, 3, 4, 6, 7, 8, 3), `<,>`(0, 4, 7, 2, 2, 2, 4, 5, 6.5, 7, 5, 3, 2, 5, 9, 0, 1), `<,>`(1, 5, 2, 0, 4, 1, 2, 3, 4.3, 7, 8, 5, 3, 2, 9, 6, 4)); J := convert(Import("testB1.xlsx", "Cartesian", "E2:G18"), matrix);<br>Error, (in convert/matrix) expecting array, rtable or list<br>> B := matrix([[1], [.2], [.1], [.8], [.5], [.6], [.8], [.764], [.234], [0.4e-1], [.89], [.36], [.687], [.627], [.689], [.328], [.139]]); H := convert(Import("test.xlsx", "Cartesian", "D2:D18"), matrix);<br>Error, (in convert/matrix) expecting array, rtable or list<br>> C := [seq(Color([H[i, 1], 0, 0]), i = 1 .. RowDimension(A))];</p>
<p> </p>
<p>And i get the error message everytime I try import m data list and I dont understand why. Any help would be appreciated. Thank you</p>
<p> </p>
<p>Jennifer</p><p>hello, I put in the code:</p>
<p>> with(plots), with(ColorTools), with(LinearAlgebra), with(RandomTools), with(ExcelTools);<br />> A := `<|>`(`<,>`(1, 2, 0, 2, 3, 4, 3, 4, 7, 9, 5, 3, 4, 6, 7, 8, 3), `<,>`(0, 4, 7, 2, 2, 2, 4, 5, 6.5, 7, 5, 3, 2, 5, 9, 0, 1), `<,>`(1, 5, 2, 0, 4, 1, 2, 3, 4.3, 7, 8, 5, 3, 2, 9, 6, 4)); J := convert(Import("testB1.xlsx", "Cartesian", "E2:G18"), matrix);<br />Error, (in convert/matrix) expecting array, rtable or list<br />> B := matrix([[1], [.2], [.1], [.8], [.5], [.6], [.8], [.764], [.234], [0.4e-1], [.89], [.36], [.687], [.627], [.689], [.328], [.139]]); H := convert(Import("test.xlsx", "Cartesian", "D2:D18"), matrix);<br />Error, (in convert/matrix) expecting array, rtable or list<br />> C := [seq(Color([H[i, 1], 0, 0]), i = 1 .. RowDimension(A))];</p>
<p> </p>
<p>And i get the error message everytime I try import m data list and I dont understand why. Any help would be appreciated. Thank you</p>
<p> </p>
<p>Jennifer</p>201976Mon, 14 Jul 2014 14:56:10 ZjentoxjentoxModule/Package - Why are some functions (proc) not loading correctly?
http://www.mapleprimes.com/questions/201974-ModulePackage--Why-Are-Some-Functions-proc?ref=Feed:MaplePrimes:Version Maple 16
<p>I've been using a maple package (written by another author) on earlier versions of Maple. Recently I have been trying to rewrite it so it's a bit more Maple 16+ friendly (since I've read that Maple is not forward-compatible). However, I have been experiencing similar <em>strange</em> behavior in both the original and my current version: </p>
<p>After saving the module to my personal library, I load with(MyPackage). Most functions work fine (all but a handful out of dozens). However, some functions won't be recognized (e.g., Coproduct(...) will return itself Coproduct(...)). </p>
<p>HOWEVER, when I execute the code in the module in its own Maple worksheet, <em>all</em> functions are recognized and work perfectly. I look at the difference in the code between the functions that work upon loading the package (using with(MyPackage) command in a separate sheet) and those that don't, and there is no difference.</p>
<p>I'm assuming I'll just have to cut and paste the hundreds of lines of code for my package into each sheet I'd like to use it in, since I haven't been able to find others experience this problem in the knowledge base. I'm hoping someone will be able to help out, however.</p><p>I've been using a maple package (written by another author) on earlier versions of Maple. Recently I have been trying to rewrite it so it's a bit more Maple 16+ friendly (since I've read that Maple is not forward-compatible). However, I have been experiencing similar <em>strange</em> behavior in both the original and my current version: </p>
<p>After saving the module to my personal library, I load with(MyPackage). Most functions work fine (all but a handful out of dozens). However, some functions won't be recognized (e.g., Coproduct(...) will return itself Coproduct(...)). </p>
<p>HOWEVER, when I execute the code in the module in its own Maple worksheet, <em>all</em> functions are recognized and work perfectly. I look at the difference in the code between the functions that work upon loading the package (using with(MyPackage) command in a separate sheet) and those that don't, and there is no difference.</p>
<p>I'm assuming I'll just have to cut and paste the hundreds of lines of code for my package into each sheet I'd like to use it in, since I haven't been able to find others experience this problem in the knowledge base. I'm hoping someone will be able to help out, however.</p>201974Sun, 13 Jul 2014 18:30:04 ZoughteroughterMaple having trouble simplifying
http://www.mapleprimes.com/questions/201840-Maple-Having-Trouble-Simplifying?ref=Feed:MaplePrimes:Version Maple 16
<p>Well, I'm having issues getting this expression to simplify. I have a bunch of polynomial results I store in an array, and the simplify command isn't cancelling obvious terms which should cancel out.<br><br><a href="/view.aspx?sf=201840_question/June_18.mw">June_18.mw</a><br><br>Curiously, it will simplify if I use the command by selecting it from the drop down menu when I select the expression (see lines (7) vs. (8))</p><p>Well, I'm having issues getting this expression to simplify. I have a bunch of polynomial results I store in an array, and the simplify command isn't cancelling obvious terms which should cancel out.<br><br><a href="/view.aspx?sf=201840_question/June_18.mw">June_18.mw</a><br><br>Curiously, it will simplify if I use the command by selecting it from the drop down menu when I select the expression (see lines (7) vs. (8))</p>201840Tue, 24 Jun 2014 01:17:55 Zber9erudber9erudwriting data during iteration
http://www.mapleprimes.com/questions/201807-Writing-Data-During-Iteration?ref=Feed:MaplePrimes:Version Maple 16
<p>I am writing a big numerical code in maple. I need to write the results in each step in a file. I mean in the first step of loop it writes the results in the first line of a text file, in the second step writes in the second line and to the end. when I use writedata command, it needs to write a complete array or matrix and it is not what i need. In other words I want to save data for each steps of iteration during the calculation and when it goes to ther next step it writes the result in the next line.</p>
<p>Can you help me to perform it?</p>
<p>Thanks</p><p>I am writing a big numerical code in maple. I need to write the results in each step in a file. I mean in the first step of loop it writes the results in the first line of a text file, in the second step writes in the second line and to the end. when I use writedata command, it needs to write a complete array or matrix and it is not what i need. In other words I want to save data for each steps of iteration during the calculation and when it goes to ther next step it writes the result in the next line.</p>
<p>Can you help me to perform it?</p>
<p>Thanks</p>201807Tue, 17 Jun 2014 15:46:16 ZpuyapuyaHow to create all possible lists containing m elements from an n element list?
http://www.mapleprimes.com/questions/201773-How-To-Create-All-Possible-Lists-Containing?ref=Feed:MaplePrimes:Version Maple 16
<p>Hey everyone,<br><br>New here but I'm a bit stuck. Ive looked around in list tools as well as tried but I havent had any luck.<br><br>Suppose I have a list defined as FirstList:=[A,B,C,D,E,F]. Now I want to create (and label) all possible<br>lists from FirstList which contain 4 elements which dont have an element repeated within the same list<br>In this example, there are 15 lists in total i.e.<br><br>Sublist[1]:=[A,B,C,D]:<br>Sublist[2]:=[A,B,C,E]:<br>Sublist[3]:=[A,B,C,F]:<br>Sublist[4]:=[A,C,D,E]:<br><br>..etc<br><br>Is there a simple way to do this???<br><br>Any help is appreciated!<br><br></p><p>Hey everyone,<br><br>New here but I'm a bit stuck. Ive looked around in list tools as well as tried but I havent had any luck.<br><br>Suppose I have a list defined as FirstList:=[A,B,C,D,E,F]. Now I want to create (and label) all possible<br>lists from FirstList which contain 4 elements which dont have an element repeated within the same list<br>In this example, there are 15 lists in total i.e.<br><br>Sublist[1]:=[A,B,C,D]:<br>Sublist[2]:=[A,B,C,E]:<br>Sublist[3]:=[A,B,C,F]:<br>Sublist[4]:=[A,C,D,E]:<br><br>..etc<br><br>Is there a simple way to do this???<br><br>Any help is appreciated!<br><br></p>201773Wed, 11 Jun 2014 22:30:13 ZNeedMapleListHelpNeedMapleListHelpExecuting Sections in Maple
http://www.mapleprimes.com/questions/201763-Executing-Sections-In-Maple?ref=Feed:MaplePrimes:Version Maple 16
<p>Is there away to quickly execute a specific section within Maple? I know that I can execute a selection, but that sometimes requires me to select several lines of Maple code and can be tedious and tiresome.</p><p>Is there away to quickly execute a specific section within Maple? I know that I can execute a selection, but that sometimes requires me to select several lines of Maple code and can be tedious and tiresome.</p>201763Mon, 09 Jun 2014 20:09:28 ZBoundary condition - Partial differential equation
http://www.mapleprimes.com/questions/201754-Boundary-Condition--Partial-Differential?ref=Feed:MaplePrimes:Version Maple 16
<p>Hello everybody,</p>
<p>I am trying to solve a partial differential equation (wave equation) with initial conditions that contain derivative and x-varying values</p>
<p>My equation <br>Uxx – Utt = 0 (hiperbólica) where xx and tt denote second partial derivatives with respect to x and t<br>0 <= x <= 10; t > 0; <br>u(0,t) = u(10,t) = 0; <br>Ut(x,0) = 0;<br>u(x,0)= <br>x for 0 <= x < 5<br>10-x for 5 <= x <= 10</p>
<p>I ve defined my equation as follow<br>> PDE := diff(u(x,t),x,x)=diff(u(x,t),t,t);<br><img src="webkit-fake-url://8BDFBF0A-1CD1-4845-BE40-0906E4CA77C8/image.tiff" alt=""></p>
<p>I m first trying without the x-varying initial condition.</p>
<p>> IBC := {u(0,t)=0,u(10,t)=0,u(x,0)=10-x,diff(u(x,0), t) = 0};<br>Returns the ugly<br><img src="webkit-fake-url://FE9626D1-563F-48FD-9C3C-5A53F517B3FB/image.tiff" alt=""><br>And that gives error when trying to solve<br>> pds := pdsolve(PDE,IBC,numeric);<br>Error, (in pdsolve/numeric/process_IBCs) initial/boundary condition does not contain the dependent variables of the PDE: 0 = 0</p>
<p>Another try with <br>> IBC := {u(0,t)=0,u(10,t)=0,u(x,0)=10-x,diff(u(x,t=0), t) = 0};<br><img src="webkit-fake-url://262C213B-B19A-42E4-8769-8CD2C30BFF3C/image.tiff" alt=""><br>Looks like more promissing but returns (in a solving attempt)<br>> pds := pdsolve(PDE,IBC,numeric);<br>Error, (in pdsolve/numeric/process_IBCs) initial/boundary condition does not contain the dependent variables of the PDE: 0 = 0</p>
<p><br>Regarding the x varying initial condition, I ve tried the `assuming` keyword in various attempts but without success.</p>
<p>Anybody could help on the matter?</p>
<p><br>Thanks in advance for anytip. <br>Have a good day<br>Nicolas</p><p>Hello everybody,</p>
<p>I am trying to solve a partial differential equation (wave equation) with initial conditions that contain derivative and x-varying values</p>
<p>My equation <br />Uxx – Utt = 0 (hiperbólica) where xx and tt denote second partial derivatives with respect to x and t<br />0 <= x <= 10; t > 0; <br />u(0,t) = u(10,t) = 0; <br />Ut(x,0) = 0;<br />u(x,0)= <br />x for 0 <= x < 5<br />10-x for 5 <= x <= 10</p>
<p>I ve defined my equation as follow<br />> PDE := diff(u(x,t),x,x)=diff(u(x,t),t,t);<br /><img src="webkit-fake-url://8BDFBF0A-1CD1-4845-BE40-0906E4CA77C8/image.tiff" alt="" /></p>
<p>I m first trying without the x-varying initial condition.</p>
<p>> IBC := {u(0,t)=0,u(10,t)=0,u(x,0)=10-x,diff(u(x,0), t) = 0};<br />Returns the ugly<br /><img src="webkit-fake-url://FE9626D1-563F-48FD-9C3C-5A53F517B3FB/image.tiff" alt="" /><br />And that gives error when trying to solve<br />> pds := pdsolve(PDE,IBC,numeric);<br />Error, (in pdsolve/numeric/process_IBCs) initial/boundary condition does not contain the dependent variables of the PDE: 0 = 0</p>
<p>Another try with <br />> IBC := {u(0,t)=0,u(10,t)=0,u(x,0)=10-x,diff(u(x,t=0), t) = 0};<br /><img src="webkit-fake-url://262C213B-B19A-42E4-8769-8CD2C30BFF3C/image.tiff" alt="" /><br />Looks like more promissing but returns (in a solving attempt)<br />> pds := pdsolve(PDE,IBC,numeric);<br />Error, (in pdsolve/numeric/process_IBCs) initial/boundary condition does not contain the dependent variables of the PDE: 0 = 0</p>
<p><br />Regarding the x varying initial condition, I ve tried the `assuming` keyword in various attempts but without success.</p>
<p>Anybody could help on the matter?</p>
<p><br />Thanks in advance for anytip. <br />Have a good day<br />Nicolas</p>201754Sun, 08 Jun 2014 14:40:17 ZMikoulasseMikoulasseBuild array of coordinates from implicit equation.
http://www.mapleprimes.com/questions/201747-Build-Array-Of-Coordinates-From-Implicit?ref=Feed:MaplePrimes:Version Maple 16
<p>Hallo,</p>
<p>Is there a fairly straightforward method for obtaining an array of coordinates from an implicit equation? I have an ellipse defined implicitly (by a horrendously involved expression) and can't figure out how to extract a set of coordinates from an implicitplot. I'm reluctant to use seq and fsolve with a fixed stepsize.</p>
<p>Would be grateful for some insight!</p>
<p>Thanks.</p>
<p>Weirp</p><p>Hallo,</p>
<p>Is there a fairly straightforward method for obtaining an array of coordinates from an implicit equation? I have an ellipse defined implicitly (by a horrendously involved expression) and can't figure out how to extract a set of coordinates from an implicitplot. I'm reluctant to use seq and fsolve with a fixed stepsize.</p>
<p>Would be grateful for some insight!</p>
<p>Thanks.</p>
<p>Weirp</p>201747Fri, 06 Jun 2014 22:08:16 ZweirpweirpHow do I plot 2D animate in Maple?
http://www.mapleprimes.com/questions/201673-How-Do-I-Plot-2D-Animate-In-Maple?ref=Feed:MaplePrimes:Version Maple 16
<p>I wish to plot 2D animate for the soltion of this equation here is the code</p>
<p>restart;<br>with(PDEtools):<br>with(ArrayTools):<br>with(plots):</p>
<p>f:=u->sech(u):<br>g:=v->sech(v):<br>h:=1/10:<br>N:=20:<br>M:=20:<br>V:=x->x^2:<br>psi:=Array(0..N/h+1,0..M/h+1):<br> for i from 0 to N/h do <br> psi[i,0]:=evalf(f(i*h)): <br> od:<br> for j from 0 to M/h do<br> psi[0,j]:=evalf(g(j*h)):<br> od:<br> for i from 1 to N/h do<br> for j from 1 to M/h do<br> psi[i,j]:=-psi[i-1, j-1]+(1-(1/8)*h^2*V((1/2)*h*(j-i-1)))*psi[i, j-1]+(1-(1/8)*h^2*V((1/2)*h*(j- i+1)))*psi[i-1,j]:<br> od:<br> od:<br> ls:=[seq([seq([i*h,j*h,psi[i,j]],i=0..N/h)],j=0..M/h)]: <br> <br>surfdata((ls),axes=boxed,labels=[`u`,`v`,`psi(u,v)`],shading=zhue,style=patchcontour);<br><br><img src="/view.aspx?sf=201673_question/1.jpg" alt=""></p><p>I wish to plot 2D animate for the soltion of this equation here is the code</p>
<p>restart;<br>with(PDEtools):<br>with(ArrayTools):<br>with(plots):</p>
<p>f:=u->sech(u):<br>g:=v->sech(v):<br>h:=1/10:<br>N:=20:<br>M:=20:<br>V:=x->x^2:<br>psi:=Array(0..N/h+1,0..M/h+1):<br> for i from 0 to N/h do <br> psi[i,0]:=evalf(f(i*h)): <br> od:<br> for j from 0 to M/h do<br> psi[0,j]:=evalf(g(j*h)):<br> od:<br> for i from 1 to N/h do<br> for j from 1 to M/h do<br> psi[i,j]:=-psi[i-1, j-1]+(1-(1/8)*h^2*V((1/2)*h*(j-i-1)))*psi[i, j-1]+(1-(1/8)*h^2*V((1/2)*h*(j- i+1)))*psi[i-1,j]:<br> od:<br> od:<br> ls:=[seq([seq([i*h,j*h,psi[i,j]],i=0..N/h)],j=0..M/h)]: <br> <br>surfdata((ls),axes=boxed,labels=[`u`,`v`,`psi(u,v)`],shading=zhue,style=patchcontour);<br><br><img src="/view.aspx?sf=201673_question/1.jpg" alt=""></p>201673Sun, 25 May 2014 20:26:25 ZMOSO1401MOSO1401OpenMaple Problem
http://www.mapleprimes.com/questions/201656-OpenMaple-Problem?ref=Feed:MaplePrimes:Version Maple 16
<p>Hello,</p>
<p>I am writing a program in C that uses the open maple library. It is not the first time that I use it but now I am facing a strange problem that involves the simplify command: suppose a,x,y are symbols that are not previously used in maple, the following lines</p>
<p>1) EvalMapleStatement(kv, "simplify((a*x^2-y^2)/(x^2*y^2-1));");</p>
<p>2) EvalMapleStatement(kv, "simplify((2*x^2-y^2)/(x^2*y^2-1));");</p>
<p>only differ by the fact that the parameter a is replaced by 2 in the second line. But they return the following output:</p>
<p>1) (a*x^2-y^2)/(x^2*y^2-1)</p>
<p>that is correct, nothing to simplify..</p>
<p>2) Error, (in gcd/LinZip) input must be polynomials over the integers</p>
<p>I must be doing something wrong but I am getting nowhere...</p>
<p>Thanks...</p>
<p> </p>
<p>P.S. This is the complete listing </p>
<p> </p>
<p>#include <stdio.h></p>
<p>#include <stdlib.h></p>
<p> </p>
<p>#include "maplec.h"</p>
<p> </p>
<p>static void M_DECL textCallBack( void *data, int tag, char *output )</p>
<p>{</p>
<p> printf("%s\n",output);</p>
<p>}</p>
<p> </p>
<p>int main( int argc, char *argv[] )</p>
<p>{</p>
<p> char err[2048]; /* command input and error string buffers */</p>
<p> MKernelVector kv; /* Maple kernel handle */</p>
<p> MCallBackVectorDesc cb = { textCallBack,</p>
<p> 0, /* errorCallBack not used */</p>
<p> 0, /* statusCallBack not used */</p>
<p> 0, /* readLineCallBack not used */</p>
<p> 0, /* redirectCallBack not used */</p>
<p> 0, /* streamCallBack not used */</p>
<p> 0, /* queryInterrupt not used */</p>
<p> 0 /* callBackCallBack not used */</p>
<p> };</p>
<p> ALGEB r, l; /* Maple data-structures */</p>
<p> char *myargv[]={"maple"};</p>
<p> int myargc=1;</p>
<p> </p>
<p> if( (kv=StartMaple(myargc,myargv,&cb,NULL,NULL,err)) == NULL ) {</p>
<p> printf("Fatal error, %s\n",err);</p>
<p> return( 1 );</p>
<p> }</p>
<p> </p>
<p>EvalMapleStatement(kv, "simplify((a*x^2-y^2)/(x^2*y^2-1));");</p>
<p> </p>
<p>EvalMapleStatement(kv, "simplify((2*x^2-y^2)/(x^2*y^2-1));");</p>
<p> </p>
<p> StopMaple(kv);</p>
<p> </p>
<p> return( 0 );</p>
<p>}</p>
<p> </p>
<p>compiled with</p>
<p>gcc prova.c -I /Library/Frameworks/Maple.framework/Versions/Current/extern/include/ -L /Library/Frameworks/Maple.framework/Versions/Current/bin.APPLE_UNIVERSAL_OSX/ -l maplec</p><p>Hello,</p>
<p>I am writing a program in C that uses the open maple library. It is not the first time that I use it but now I am facing a strange problem that involves the simplify command: suppose a,x,y are symbols that are not previously used in maple, the following lines</p>
<p>1) EvalMapleStatement(kv, "simplify((a*x^2-y^2)/(x^2*y^2-1));");</p>
<p>2) EvalMapleStatement(kv, "simplify((2*x^2-y^2)/(x^2*y^2-1));");</p>
<p>only differ by the fact that the parameter a is replaced by 2 in the second line. But they return the following output:</p>
<p>1) (a*x^2-y^2)/(x^2*y^2-1)</p>
<p>that is correct, nothing to simplify..</p>
<p>2) Error, (in gcd/LinZip) input must be polynomials over the integers</p>
<p>I must be doing something wrong but I am getting nowhere...</p>
<p>Thanks...</p>
<p> </p>
<p>P.S. This is the complete listing </p>
<p> </p>
<p>#include <stdio.h></p>
<p>#include <stdlib.h></p>
<p> </p>
<p>#include "maplec.h"</p>
<p> </p>
<p>static void M_DECL textCallBack( void *data, int tag, char *output )</p>
<p>{</p>
<p> printf("%s\n",output);</p>
<p>}</p>
<p> </p>
<p>int main( int argc, char *argv[] )</p>
<p>{</p>
<p> char err[2048]; /* command input and error string buffers */</p>
<p> MKernelVector kv; /* Maple kernel handle */</p>
<p> MCallBackVectorDesc cb = { textCallBack,</p>
<p> 0, /* errorCallBack not used */</p>
<p> 0, /* statusCallBack not used */</p>
<p> 0, /* readLineCallBack not used */</p>
<p> 0, /* redirectCallBack not used */</p>
<p> 0, /* streamCallBack not used */</p>
<p> 0, /* queryInterrupt not used */</p>
<p> 0 /* callBackCallBack not used */</p>
<p> };</p>
<p> ALGEB r, l; /* Maple data-structures */</p>
<p> char *myargv[]={"maple"};</p>
<p> int myargc=1;</p>
<p> </p>
<p> if( (kv=StartMaple(myargc,myargv,&cb,NULL,NULL,err)) == NULL ) {</p>
<p> printf("Fatal error, %s\n",err);</p>
<p> return( 1 );</p>
<p> }</p>
<p> </p>
<p>EvalMapleStatement(kv, "simplify((a*x^2-y^2)/(x^2*y^2-1));");</p>
<p> </p>
<p>EvalMapleStatement(kv, "simplify((2*x^2-y^2)/(x^2*y^2-1));");</p>
<p> </p>
<p> StopMaple(kv);</p>
<p> </p>
<p> return( 0 );</p>
<p>}</p>
<p> </p>
<p>compiled with</p>
<p>gcc prova.c -I /Library/Frameworks/Maple.framework/Versions/Current/extern/include/ -L /Library/Frameworks/Maple.framework/Versions/Current/bin.APPLE_UNIVERSAL_OSX/ -l maplec</p>201656Fri, 23 May 2014 12:53:36 ZPasqualdoPasqualdoSaving the solution from fsolve
http://www.mapleprimes.com/questions/201625-Saving-The-Solution-From-Fsolve?ref=Feed:MaplePrimes:Version Maple 16
<p>Hello,</p>
<p> </p>
<p> I have a question. Consider</p>
<p> </p>
<p>fsolve(x^2+3*x+1=3, x);</p>
<p> </p>
<p> I want to save the two roots into two variables. What kind of commend shall I use? </p>
<p> </p>
<p>P.S. My further aim comes from solving an equation without analytical solution. Therefore I cannot plug in the solution formula. </p>
<p> </p>
<p> </p><p>Hello,</p>
<p> </p>
<p> I have a question. Consider</p>
<p> </p>
<p>fsolve(x^2+3*x+1=3, x);</p>
<p> </p>
<p> I want to save the two roots into two variables. What kind of commend shall I use? </p>
<p> </p>
<p>P.S. My further aim comes from solving an equation without analytical solution. Therefore I cannot plug in the solution formula. </p>
<p> </p>
<p> </p>201625Fri, 16 May 2014 13:44:01 Zsmith_alphasmith_alphamatrix multiplication element by element
http://www.mapleprimes.com/questions/201442-Matrix-Multiplication-Element-By-Element?ref=Feed:MaplePrimes:Version Maple 16
<p>Who knows: is there a maple command for two matrix multiplication element by element without summing?</p>
<p> </p><p>Who knows: is there a maple command for two matrix multiplication element by element without summing?</p>
<p> </p>201442Mon, 21 Apr 2014 16:04:27 ZmeniskmeniskError in 2nd Order Coupled Nonlinear ODE System
http://www.mapleprimes.com/questions/201337-Error-In-2nd-Order-Coupled-Nonlinear-ODE-System?ref=Feed:MaplePrimes:Version Maple 16
<p>I'm calculating the geodesics to a parametrized system in <strong>R</strong><sup>3</sup>. When trying to solve the geodesic equations for a surface of revolution, I'm getting a strange error. The goal is to write the code for any parametrized surface, not just revolution (hence I didn't use the short cut for surfaces of revolution).</p>
<p>For the code, I find the first fundamental for, then the geodesics, then turn the christoffel symbols into a time-variant array. (Gamma for the position of (u,v) in the uv-plane, and C as the array so I can take derivatives with respect to time.)</p>
<p>The code for creating the Christoffel Symbols and the parametrization of the paraboloid:</p>
<p>restart; with(LinearAlgebra):<br>V := (u, v) -> <v*cos(u), v*sin(u), v^2+1>;</p>
<p>Christoff := proc (X) <br>local x1, x2, M, N, i, j, k, s, E, F, G, g, Q, Delta, Prelim, cyclicPrelim; <br>global Gamma, C; #GAMMA<br>x1 := (u, v) -> <diff(X[1], u), diff(X[2], u), diff(X[3], u)>; <br>x2 := (u, v)-> <(diff(X[1], v), diff(X[2], v), diff(X[3], v))>; <br>E := (u, v) -> DotProduct(x1(u, v), x1(u, v), conjugate = false); <br>F := (u, v) -> DotProduct(x1(u, v), x2(u, v), conjugate = false); <br>G := (u, v) -> DotProduct(x2(u, v), x2(u, v), conjugate = false); <br>simplify([E(u, v), F(u, v), G(u, v)]); <br>M := (u, v) -> <E(u, v), F(u, v); F(u, v), G(u, v)>; <br>simplify(M(u,v));<br>printlevel := 3; <br>Delta := simplify(Determinant(M(u, v))); <br>N := (1/Delta)*<G(u, v), -F(u, v); -F(u, v), E(u, v)>;<br>Q[1] := simplify(map(diff, M(u, v), u)); <br>Q[2] := simplify(map(diff, M(u, v), v)); <br>for i to 2 do for j to 2 do for k to 2 do <br>Prelim[i, j, k] := Q[k][i, j];<br>simplify(Prelim[i, j, k] ); end do end do end do; <br>#(OPTIONAL PRINTOUT) print(Prelim);<br>for i to 2 do for j to 2 do for k to 2 do <br>cyclicPrelim[i, j, k] := Prelim[i, j, k]+Prelim[j, k, i]-Prelim[k, i, j] ;<br>end do end do end do; <br>#(OPTIONAL PRINTOUT) print(cyclicPrelim);<br>for i to 2 do for j to 2 do for k to 2 do <br>Gamma[i, j, k] := simplify((1/2)*add(N[i, s]*cyclicPrelim[j, s, k], s = 1 .. 2)); <br>end do end do end do; <br># for k from 1 to 2 do<br>#print(`GAMMA[i,j,k] =` Matrix([[ `%a` , `%a` ],[ `%a` , `%a` ]])` \n`, Gamma[1,1,k], [Gamma[1,2,k], Gamma[2,1,k], Gamma[2,2,k]);<br># end do;<br>#printf('GAMMA[%a,%a,%a] = %a \n', i,j,k, Gamma[i,j,k]);<br><br>print([Gamma[1,1,1], Gamma[1,2,1], Gamma[2,1,1], Gamma[2,2,1], Gamma[1,1,2], Gamma[1,2,2], Gamma[2,1,2], Gamma[2,2,2]]);<br><br>for i from 1 to 2 do <br>for j from 1 to 2 do <br>for k from 1 to 2 do <br>C[i,j,k]:= apply(Gamma[i,j,k],t);<br>end do end do end do; <br>C:=Array(1..2,1..2,1..2,[ [ [ apply(Gamma[1,1,1],t), apply(Gamma[1,2,1],t) ], [ apply(Gamma[1,1,2],t), apply(Gamma[1,2,2],t) ] ], [ [ apply(Gamma[2,1,1],t), apply(Gamma[2,2,1],t) ], [ apply(Gamma[2,1,2],t), apply(Gamma[2,2,2],t) ] ] ]);<br>print(C);<br><br>end proc;<br><br></p>
<p> </p>
<p>The differential equation solver:</p>
<p>inits:=[u(0)=1, D(u(t))(0)=1,v(0) = 1, D(v(t))(0)=1];</p>
<p>sys1:= [D[1$2](u(t))+C[1,1,1]*(D(u(t)))^(2)+2*C[1,1,2]*(D(u(t)))*(D(v(t)))+C[1,2,2]*(D(v(t)))^2=0, D[1$2](v(t))+C[2,1,1]*(D(u(t)))^(2)+2*C[2,1,2]*(D(u(t))*D(v(t)))^(2)+C[2,2,2]*(D(v(t)))^2=0];</p>
<p>L:=dsolve({sys1} union {inits});</p>
<p> </p>
<p>The error message that comes up is:</p>
<p>"Error, (in unknown) invalid input: op expects 1 or 2 arguments, but received 0"</p>
<p> </p>
<p> </p>
<p>Any help would be greatly appreciated.</p><p>I'm calculating the geodesics to a parametrized system in <strong>R</strong><sup>3</sup>. When trying to solve the geodesic equations for a surface of revolution, I'm getting a strange error. The goal is to write the code for any parametrized surface, not just revolution (hence I didn't use the short cut for surfaces of revolution).</p>
<p>For the code, I find the first fundamental for, then the geodesics, then turn the christoffel symbols into a time-variant array. (Gamma for the position of (u,v) in the uv-plane, and C as the array so I can take derivatives with respect to time.)</p>
<p>The code for creating the Christoffel Symbols and the parametrization of the paraboloid:</p>
<p>restart; with(LinearAlgebra):<br />V := (u, v) -> <v*cos(u), v*sin(u), v^2+1>;</p>
<p>Christoff := proc (X) <br />local x1, x2, M, N, i, j, k, s, E, F, G, g, Q, Delta, Prelim, cyclicPrelim; <br />global Gamma, C; #GAMMA<br />x1 := (u, v) -> <diff(X[1], u), diff(X[2], u), diff(X[3], u)>; <br />x2 := (u, v)-> <(diff(X[1], v), diff(X[2], v), diff(X[3], v))>; <br />E := (u, v) -> DotProduct(x1(u, v), x1(u, v), conjugate = false); <br />F := (u, v) -> DotProduct(x1(u, v), x2(u, v), conjugate = false); <br />G := (u, v) -> DotProduct(x2(u, v), x2(u, v), conjugate = false); <br />simplify([E(u, v), F(u, v), G(u, v)]); <br />M := (u, v) -> <E(u, v), F(u, v); F(u, v), G(u, v)>; <br />simplify(M(u,v));<br />printlevel := 3; <br />Delta := simplify(Determinant(M(u, v))); <br />N := (1/Delta)*<G(u, v), -F(u, v); -F(u, v), E(u, v)>;<br />Q[1] := simplify(map(diff, M(u, v), u)); <br />Q[2] := simplify(map(diff, M(u, v), v)); <br />for i to 2 do for j to 2 do for k to 2 do <br />Prelim[i, j, k] := Q[k][i, j];<br />simplify(Prelim[i, j, k] ); end do end do end do; <br />#(OPTIONAL PRINTOUT) print(Prelim);<br />for i to 2 do for j to 2 do for k to 2 do <br />cyclicPrelim[i, j, k] := Prelim[i, j, k]+Prelim[j, k, i]-Prelim[k, i, j] ;<br />end do end do end do; <br />#(OPTIONAL PRINTOUT) print(cyclicPrelim);<br />for i to 2 do for j to 2 do for k to 2 do <br />Gamma[i, j, k] := simplify((1/2)*add(N[i, s]*cyclicPrelim[j, s, k], s = 1 .. 2)); <br />end do end do end do; <br /># for k from 1 to 2 do<br />#print(`GAMMA[i,j,k] =` Matrix([[ `%a` , `%a` ],[ `%a` , `%a` ]])` \n`, Gamma[1,1,k], [Gamma[1,2,k], Gamma[2,1,k], Gamma[2,2,k]);<br /># end do;<br />#printf('GAMMA[%a,%a,%a] = %a \n', i,j,k, Gamma[i,j,k]);<br /><br />print([Gamma[1,1,1], Gamma[1,2,1], Gamma[2,1,1], Gamma[2,2,1], Gamma[1,1,2], Gamma[1,2,2], Gamma[2,1,2], Gamma[2,2,2]]);<br /><br />for i from 1 to 2 do <br />for j from 1 to 2 do <br />for k from 1 to 2 do <br />C[i,j,k]:= apply(Gamma[i,j,k],t);<br />end do end do end do; <br />C:=Array(1..2,1..2,1..2,[ [ [ apply(Gamma[1,1,1],t), apply(Gamma[1,2,1],t) ], [ apply(Gamma[1,1,2],t), apply(Gamma[1,2,2],t) ] ], [ [ apply(Gamma[2,1,1],t), apply(Gamma[2,2,1],t) ], [ apply(Gamma[2,1,2],t), apply(Gamma[2,2,2],t) ] ] ]);<br />print(C);<br /><br />end proc;<br /><br /></p>
<p> </p>
<p>The differential equation solver:</p>
<p>inits:=[u(0)=1, D(u(t))(0)=1,v(0) = 1, D(v(t))(0)=1];</p>
<p>sys1:= [D[1$2](u(t))+C[1,1,1]*(D(u(t)))^(2)+2*C[1,1,2]*(D(u(t)))*(D(v(t)))+C[1,2,2]*(D(v(t)))^2=0, D[1$2](v(t))+C[2,1,1]*(D(u(t)))^(2)+2*C[2,1,2]*(D(u(t))*D(v(t)))^(2)+C[2,2,2]*(D(v(t)))^2=0];</p>
<p>L:=dsolve({sys1} union {inits});</p>
<p> </p>
<p>The error message that comes up is:</p>
<p>"Error, (in unknown) invalid input: op expects 1 or 2 arguments, but received 0"</p>
<p> </p>
<p> </p>
<p>Any help would be greatly appreciated.</p>201337Tue, 08 Apr 2014 18:03:30 ZJEBlandJEBlandMaple 16 doesn't calculate trigonometric functions
http://www.mapleprimes.com/questions/201333-Maple-16-Doesnt-Calculate-Trigonometric?ref=Feed:MaplePrimes:Version Maple 16
<p>Hy guys,</p>
<p>I'm starting in Maple and I have a problem, my Maple 16 does not calculate a simple trigonometric function.</p>
<p>When I do:</p>
<p>>cos(pi);</p>
<p>The maple return:</p>
<p>cos(π)</p>
<p> </p>
<p> </p>
<p>Thanks a lot!</p><p>Hy guys,</p>
<p>I'm starting in Maple and I have a problem, my Maple 16 does not calculate a simple trigonometric function.</p>
<p>When I do:</p>
<p>>cos(pi);</p>
<p>The maple return:</p>
<p>cos(π)</p>
<p> </p>
<p> </p>
<p>Thanks a lot!</p>201333Tue, 08 Apr 2014 01:59:24 ZRafaelCamposRafaelCampos