MaplePrimes - Questions and Posts tagged with function
http://www.mapleprimes.com/tags/function
en-us2014 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemSat, 01 Nov 2014 01:10:29 GMTSat, 01 Nov 2014 01:10:29 GMTThe most recent questions and posts on MaplePrimes tagged with functionhttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Questions and Posts tagged with function
http://www.mapleprimes.com/tags/function
piecewise function simplify / cancel out a variable
http://www.mapleprimes.com/questions/202696-Piecewise-Function-Simplify--Cancel?ref=Feed:MaplePrimes:Tagged With function
<p>Hello,<br>Maple does not cancel out a variable.</p>
<p>Why is that?</p>
<p>Is there a way to solve this? </p>
<p>(I pasted my code on the bottom of this message)</p>
<p><img src="/view.aspx?sf=202696_question/test.JPG" alt=""></p>
<p> </p>
<p>Thanks for your help/advice,</p>
<p>Stephan<br><br></p>
<p>restart:<br>M(x):=piecewise(x<=l,1/2*(q*x^2)/(EI)-3/8*(q*l*x)/(EI),l<x,1/2*(q*x^2)/(EI)-13/8*(q*l*x)/(EI)+5/4*(q*l^2)/(EI)):<br>M(x):=M(x)*(-EI);<br># simplify() does not work.....?<br>M(x):=simplify(%) assuming EI>0;<br># Wiht EI cancelled out by hand it schould look like:<br>M(x):=piecewise(x<=l,1/2*(q*x^2)-3/8*(q*l*x),l<x,1/2*(q*x^2)-13/8*(q*l*x)+5/4*(q*l^2));</p>
<p> </p><p>Hello,<br>Maple does not cancel out a variable.</p>
<p>Why is that?</p>
<p>Is there a way to solve this? </p>
<p>(I pasted my code on the bottom of this message)</p>
<p><img src="/view.aspx?sf=202696_question/test.JPG" alt=""></p>
<p> </p>
<p>Thanks for your help/advice,</p>
<p>Stephan<br><br></p>
<p>restart:<br>M(x):=piecewise(x<=l,1/2*(q*x^2)/(EI)-3/8*(q*l*x)/(EI),l<x,1/2*(q*x^2)/(EI)-13/8*(q*l*x)/(EI)+5/4*(q*l^2)/(EI)):<br>M(x):=M(x)*(-EI);<br># simplify() does not work.....?<br>M(x):=simplify(%) assuming EI>0;<br># Wiht EI cancelled out by hand it schould look like:<br>M(x):=piecewise(x<=l,1/2*(q*x^2)-3/8*(q*l*x),l<x,1/2*(q*x^2)-13/8*(q*l*x)+5/4*(q*l^2));</p>
<p> </p>202696Mon, 27 Oct 2014 10:33:38 ZStephanStephanTrigonometric calculation with parameters in MapleSim
http://www.mapleprimes.com/questions/202641-Trigonometric-Calculation-With-Parameters?ref=Feed:MaplePrimes:Tagged With function
<p>Hi,</p>
<p>I need to build a multibody model in MapleSim 6.4 in which with few global parameters I can describe all the other parameters. In other words the final user will enter this few parameters, that are coordinates of specific points, and then the model will calculate all the relative distances on the base of those coordinates.</p>
<p>The problem is that if I apply trigonometric function and square root (like in the screenshot) the model is not calculating any value. Is it possible to make those calculculations?</p>
<p><img src="/view.aspx?sf=202641_question/screen.JPG" alt=""></p>
<p> </p>
<p>this is the model (don't worry about the nonsense plots, it's because it's not ultimated):</p>
<p><a href="/view.aspx?sf=202641_question/DWS.msim">DWS.msim</a></p>
<p><a href="/view.aspx?sf=202641_question/working_model_21-10.msim"> </a></p>
<p> </p>
<p>Thanks.</p>
<p> </p><p>Hi,</p>
<p>I need to build a multibody model in MapleSim 6.4 in which with few global parameters I can describe all the other parameters. In other words the final user will enter this few parameters, that are coordinates of specific points, and then the model will calculate all the relative distances on the base of those coordinates.</p>
<p>The problem is that if I apply trigonometric function and square root (like in the screenshot) the model is not calculating any value. Is it possible to make those calculculations?</p>
<p><img src="/view.aspx?sf=202641_question/screen.JPG" alt=""></p>
<p> </p>
<p>this is the model (don't worry about the nonsense plots, it's because it's not ultimated):</p>
<p><a href="/view.aspx?sf=202641_question/DWS.msim">DWS.msim</a></p>
<p><a href="/view.aspx?sf=202641_question/working_model_21-10.msim"> </a></p>
<p> </p>
<p>Thanks.</p>
<p> </p>202641Tue, 21 Oct 2014 15:13:09 ZfederavefederaveMulti-dimensional matrices/arrays
http://www.mapleprimes.com/questions/202608-Multidimensional-Matricesarrays?ref=Feed:MaplePrimes:Tagged With function
<p>Hi there,</p>
<p>I was trying to simulate the behaviour of a one-variable, discrete-time function having three parameters.</p>
<p>The function reads</p>
<p>M[n+1]=(b·theta^(m)·R[n])/(theta^(m)+R[n]^m)</p>
<p>defined for b, theta, m > 0</p>
<p>Say I want to simulate the function for the following values</p>
<p>b := [seq(1 .. 10, 1)];<br>theta := [seq(1 .. 5, 1)];<br>m := [seq(1 .. 2, 1)];</p>
<p>for n from 1 to 10.</p>
<p> </p>
<p>I guess I need to build a 4-dimension array. But I was not able to find the right way to do this: should I use the Array strucutre? and if yes, how would I do it? As far as I've read, indexing would be an issue: should I create special indexing functions?</p>
<p>If I'm not wrong Maple matrices (Matrix) are just 2D.</p>
<p> </p>
<p>Once the values of M computed, I would like to generate the corresponding plots, varying one parameter while the other two are fixed, and drawing the different M's in the same plot.</p>
<p>How can I achieve this?</p>
<p>Furthermore, if I would like to generate all possible combinations, I guess I would need to insert the solution given to the above question within a for loop. Will Maple display all plots or will it overlap/overwrite the preceding plot if used within a loop?</p>
<p> </p>
<p>Thanks,</p>
<p>jon</p><p>Hi there,</p>
<p>I was trying to simulate the behaviour of a one-variable, discrete-time function having three parameters.</p>
<p>The function reads</p>
<p>M[n+1]=(b·theta^(m)·R[n])/(theta^(m)+R[n]^m)</p>
<p>defined for b, theta, m > 0</p>
<p>Say I want to simulate the function for the following values</p>
<p>b := [seq(1 .. 10, 1)];<br />theta := [seq(1 .. 5, 1)];<br />m := [seq(1 .. 2, 1)];</p>
<p>for n from 1 to 10.</p>
<p> </p>
<p>I guess I need to build a 4-dimension array. But I was not able to find the right way to do this: should I use the Array strucutre? and if yes, how would I do it? As far as I've read, indexing would be an issue: should I create special indexing functions?</p>
<p>If I'm not wrong Maple matrices (Matrix) are just 2D.</p>
<p> </p>
<p>Once the values of M computed, I would like to generate the corresponding plots, varying one parameter while the other two are fixed, and drawing the different M's in the same plot.</p>
<p>How can I achieve this?</p>
<p>Furthermore, if I would like to generate all possible combinations, I guess I would need to insert the solution given to the above question within a for loop. Will Maple display all plots or will it overlap/overwrite the preceding plot if used within a loop?</p>
<p> </p>
<p>Thanks,</p>
<p>jon</p>202608Thu, 16 Oct 2014 21:20:03 ZjonlgjonlgDefine a set of functions by means of for loops in Maple
http://www.mapleprimes.com/questions/202605-Define-A-Set-Of-Functions-By-Means-Of?ref=Feed:MaplePrimes:Tagged With function
<p>In Maple, I want to define a set of functions by means of two for loops:<br><br> printlevel:=2;<br><br> # Node coordinates.<br> N_x:=5;<br> N_y:=4;<br> N_elx:=N_x-1;<br> N_ely:=N_y-1;<br> h_x:=(x_e-x_s)/N_elx;<br> h_y:=(y_e-y_s)/N_ely;<br> x_n:=[seq(x_s+j*h_x,j=0..N_elx)];<br> y_n:=[seq(y_s+j*h_y,j=0..N_ely)];<br><br> # Partition of unity.<br> for j from 2 by 1 to N_x-1 do<br> for k from 2 by 1 to N_y-1 do<br> phi[j,k]:=(x,y)->(x-x_n[j-1])*(x-x_n[j+1])*(y-y_n[k-1])*(y-y_n[k+1])/((x_n[j]-x_n[j-1])*(x_n[j]-x_n[j+1])*(y_n[k]-y_n[k-1])*(y_n[k]-y_n[k+1]));<br> od;<br> od;<br><br>However, this gives output in which the `[j,k]` vary but the `x_n[j-1]`, `x_n[j+1]`, `y_n[j-1]` and `y_n[j+1]` are not evaluated. But if I for instance input `x_n[3]` I correctly get 1/2 as answer.<br><br>How do I solve this?</p><p>In Maple, I want to define a set of functions by means of two for loops:<br><br> printlevel:=2;<br><br> # Node coordinates.<br> N_x:=5;<br> N_y:=4;<br> N_elx:=N_x-1;<br> N_ely:=N_y-1;<br> h_x:=(x_e-x_s)/N_elx;<br> h_y:=(y_e-y_s)/N_ely;<br> x_n:=[seq(x_s+j*h_x,j=0..N_elx)];<br> y_n:=[seq(y_s+j*h_y,j=0..N_ely)];<br><br> # Partition of unity.<br> for j from 2 by 1 to N_x-1 do<br> for k from 2 by 1 to N_y-1 do<br> phi[j,k]:=(x,y)->(x-x_n[j-1])*(x-x_n[j+1])*(y-y_n[k-1])*(y-y_n[k+1])/((x_n[j]-x_n[j-1])*(x_n[j]-x_n[j+1])*(y_n[k]-y_n[k-1])*(y_n[k]-y_n[k+1]));<br> od;<br> od;<br><br>However, this gives output in which the `[j,k]` vary but the `x_n[j-1]`, `x_n[j+1]`, `y_n[j-1]` and `y_n[j+1]` are not evaluated. But if I for instance input `x_n[3]` I correctly get 1/2 as answer.<br><br>How do I solve this?</p>202605Thu, 16 Oct 2014 13:50:12 ZAdriaanAdriaanSubstitute a function in a matrix
http://www.mapleprimes.com/questions/202600-Substitute-A-Function-In-A-Matrix?ref=Feed:MaplePrimes:Tagged With function
<p>Hi</p>
<p>How can I substitute a function in a matrix? This is what I tried but it's not working at all:</p>
<p>lign1:=x-y+2*z=1:<br>lign2:=(-2)*x+y+z=0:<br>lign3:=(-4)*x+y+7*z=2:<br>lign4:=3*x-2*y+z=1:<br>T := GenerateMatrix([lign1, lign2, lign3, lign4],[x, y, z], augmented);</p>
<p>Then I'd like to substitute another function with lign1:</p>
<p>lign5:=x+y+z=6:<br>T2:=subs(lign1=lign5, T);</p>
<p>But T2 = T and that wasn't really the point.</p>
<p> </p>
<p>Sorry if the answer is obvious no amount of searching has helped me so far. I hope this question isn't too ridiculous.</p>
<p>Thanks</p><p>Hi</p>
<p>How can I substitute a function in a matrix? This is what I tried but it's not working at all:</p>
<p>lign1:=x-y+2*z=1:<br />lign2:=(-2)*x+y+z=0:<br />lign3:=(-4)*x+y+7*z=2:<br />lign4:=3*x-2*y+z=1:<br />T := GenerateMatrix([lign1, lign2, lign3, lign4],[x, y, z], augmented);</p>
<p>Then I'd like to substitute another function with lign1:</p>
<p>lign5:=x+y+z=6:<br />T2:=subs(lign1=lign5, T);</p>
<p>But T2 = T and that wasn't really the point.</p>
<p> </p>
<p>Sorry if the answer is obvious no amount of searching has helped me so far. I hope this question isn't too ridiculous.</p>
<p>Thanks</p>202600Wed, 15 Oct 2014 18:31:07 ZCakePieCakePieHow to limit a function to an interval
http://www.mapleprimes.com/questions/202561-How-To-Limit-A-Function-To-An-Interval?ref=Feed:MaplePrimes:Tagged With function
<p>Hello,</p>
<p> </p>
<p>I have a function, lets say g(x,y,...), that depends on many other functions. But I don´t want the results that are inside certain intervals, and I need to receive the results of those functions as something like NULL when asking for a result that is inside any of those intervals. That way, g(x,y,...) would also have to result in something like NULL if any of the lesser functions are NULL fora any given values.</p>
<p> </p>
<p>I tryied using the piecewise command, and for the intervals that I wanted, it worked, but for those I wanted to be NULL, they were understood as 0, and so G(x,y,..) continued to exist but with a very different value.</p>
<p> </p>
<p>To clarify what I need, I will try an exemple:</p>
<p> </p>
<p>Imagine I have the function f(x)=x</p>
<p> </p>
<p>I want to disconsider the results for x<2 and x>6, in a way that if I try the command 'f(1)', I will receive something like NULL and know that it is outside the range.</p>
<p> </p>
<p>In the same way, I need the plot of this function f(X) to show the function only from 2 to 6, but not existing for the delimited intervals.</p>
<p> </p>
<p>Ad if I continue and make g(x)=f(x)+10 , I don´t want g(x) to exist if f(x) doesn´t exist, and same for the g(x) plot, which shouldn´t be shown in the intervals where f(x) don´t exist.</p>
<p> </p>
<p> </p>
<p>Thank you very much for your atention!</p>
<p> </p>
<p> </p><p>Hello,</p>
<p> </p>
<p>I have a function, lets say g(x,y,...), that depends on many other functions. But I don´t want the results that are inside certain intervals, and I need to receive the results of those functions as something like NULL when asking for a result that is inside any of those intervals. That way, g(x,y,...) would also have to result in something like NULL if any of the lesser functions are NULL fora any given values.</p>
<p> </p>
<p>I tryied using the piecewise command, and for the intervals that I wanted, it worked, but for those I wanted to be NULL, they were understood as 0, and so G(x,y,..) continued to exist but with a very different value.</p>
<p> </p>
<p>To clarify what I need, I will try an exemple:</p>
<p> </p>
<p>Imagine I have the function f(x)=x</p>
<p> </p>
<p>I want to disconsider the results for x<2 and x>6, in a way that if I try the command 'f(1)', I will receive something like NULL and know that it is outside the range.</p>
<p> </p>
<p>In the same way, I need the plot of this function f(X) to show the function only from 2 to 6, but not existing for the delimited intervals.</p>
<p> </p>
<p>Ad if I continue and make g(x)=f(x)+10 , I don´t want g(x) to exist if f(x) doesn´t exist, and same for the g(x) plot, which shouldn´t be shown in the intervals where f(x) don´t exist.</p>
<p> </p>
<p> </p>
<p>Thank you very much for your atention!</p>
<p> </p>
<p> </p>202561Fri, 10 Oct 2014 19:47:26 ZGalossauroGalossauroUnderstanding discrete function creation and for loops
http://www.mapleprimes.com/questions/202533-Understanding-Discrete-Function-Creation?ref=Feed:MaplePrimes:Tagged With function
<p>Hi there,</p>
<p>first post. I am a beginner both with Maple and this forum, so please forgive my mistakes. Just here to learn.</p>
<p>I could not successfully use the Maple editor here, so the code goes as plain text, although I also attach the code: <a href="/view.aspx?sf=202533_question/MapleSimulation_test.mw">MapleSimulation_test.mw</a>.</p>
<p>I am trying to simulate the function below for certain values of the parameters, but when executing the loop, Maple prints just R. Can anyone tell me where my error is, please?</p>
<p> </p>
<p>f := .25; g := 1; R[0] = 5; R[1] = 4.8; nDays := 30;</p>
<p>lambda1:=(1 - f + sqrt((1 - f) + 4*g*f)*1/2;</p>
<p>lambda2:=(1 - f - sqrt((1 - f) + 4*g*f)*1/2;</p>
<p><br> -lambda2*R[0] + R[1]<br>k1:=--------------------------;<br> lambda1 - lambda2</p>
<p> lambda2*R[0] - R[1]<br>k2:=-------------------------;<br> lambda1 - lambda2</p>
<p>R:=n-> k1*lambda1^n + k2*lambda2^n</p>
<p><br>for n from 2 to nDays<br>do R:=evalf(subs(n=%,R));<br>od;</p><p>Hi there,</p>
<p>first post. I am a beginner both with Maple and this forum, so please forgive my mistakes. Just here to learn.</p>
<p>I could not successfully use the Maple editor here, so the code goes as plain text, although I also attach the code: <a href="/view.aspx?sf=202533_question/MapleSimulation_test.mw">MapleSimulation_test.mw</a>.</p>
<p>I am trying to simulate the function below for certain values of the parameters, but when executing the loop, Maple prints just R. Can anyone tell me where my error is, please?</p>
<p> </p>
<p>f := .25; g := 1; R[0] = 5; R[1] = 4.8; nDays := 30;</p>
<p>lambda1:=(1 - f + sqrt((1 - f) + 4*g*f)*1/2;</p>
<p>lambda2:=(1 - f - sqrt((1 - f) + 4*g*f)*1/2;</p>
<p><br> -lambda2*R[0] + R[1]<br>k1:=--------------------------;<br> lambda1 - lambda2</p>
<p> lambda2*R[0] - R[1]<br>k2:=-------------------------;<br> lambda1 - lambda2</p>
<p>R:=n-> k1*lambda1^n + k2*lambda2^n</p>
<p><br>for n from 2 to nDays<br>do R:=evalf(subs(n=%,R));<br>od;</p>202533Mon, 06 Oct 2014 23:31:25 ZjonlgjonlgHow can I display the relating value of each curve on a contourplot?
http://www.mapleprimes.com/questions/202422-How-Can-I-Display-The-Relating-Value?ref=Feed:MaplePrimes:Tagged With function
<p>Consider the following two variable funtion:<br><br>f(x,y)=x^2+y^2-5<br><br>then we want to draw a contourplot:<br><br>contourplot(f,x=-10..10,y=-10..100)<br><br>My problem is that I want maple to diplay the value of the function "f" relating to each curve on the contour plot!<br>How can I do this?<br><br>Please see the following code.<br><br><a href="/view.aspx?sf=202422_question/Example.mw">Example.mw</a></p><p>Consider the following two variable funtion:<br><br>f(x,y)=x^2+y^2-5<br><br>then we want to draw a contourplot:<br><br>contourplot(f,x=-10..10,y=-10..100)<br><br>My problem is that I want maple to diplay the value of the function "f" relating to each curve on the contour plot!<br>How can I do this?<br><br>Please see the following code.<br><br><a href="/view.aspx?sf=202422_question/Example.mw">Example.mw</a></p>202422Mon, 22 Sep 2014 13:55:04 ZH-RH-RCurvefitting for Data
http://www.mapleprimes.com/questions/202414-Curvefitting-For-Data?ref=Feed:MaplePrimes:Tagged With function
<p>Hi. It is be good to be with you after 4 years.</p>
<p>I want to ask about Curvefitting for Data. If I have a numerical data and i want to find a function in x and y for these data.</p><p>Hi. It is be good to be with you after 4 years.</p>
<p>I want to ask about Curvefitting for Data. If I have a numerical data and i want to find a function in x and y for these data.</p>202414Sun, 21 Sep 2014 18:40:19 Zamrramadanegamrramadanegwhy sometimes the menu of Plot builder is disappear？
http://www.mapleprimes.com/questions/202386-Why-Sometimes-The-Menu-Of-Plot-Builder?ref=Feed:MaplePrimes:Tagged With function
<p> </p>
<p><span><img src="/view.aspx?sf=202386_question/image.png" alt=""></span></p>
<p> </p>
<p><span>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？</span></p>
<p><span>when run the order like this, the menu of Plot builder disapper</span></p>
<p><span><img src="/view.aspx?sf=202386_question/ad.JPG" alt=""></span></p>
<p><span>Thank you in advance for your help</span></p><p> </p>
<p><span><img src="/view.aspx?sf=202386_question/image.png" alt=""></span></p>
<p> </p>
<p><span>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？</span></p>
<p><span>when run the order like this, the menu of Plot builder disapper</span></p>
<p><span><img src="/view.aspx?sf=202386_question/ad.JPG" alt=""></span></p>
<p><span>Thank you in advance for your help</span></p>202386Wed, 17 Sep 2014 21:20:10 ZcktamcucktamcuHow to draw 3D graph from 4 variables
http://www.mapleprimes.com/questions/202371-How-To-Draw-3D-Graph-From-4-Variables-?ref=Feed:MaplePrimes:Tagged With function
<p>How can I plot a volume (many surfaces) in X,Y, Z axis where X,Y,Z are functions in 4 variables (a,b,c,d), and the domain for the 4 variables are </p>
<p>-90<=a>=90, -10<=b>=10, -12<=c>=12, -90<=d>=0,</p>
<p> </p>
<p>X := proc (a, b, c, d) options operator, arrow; 324.*cos(b)*sin(c)*cos(d)+324.*sin(b)*sin(d)+323.5*cos(b)*sin(c) end proc<img class="math" src="../images/mathml.png" alt="X := proc (a, b, c, d) options operator, arrow; 324.*cos(b)*sin(c)*cos(d)+324.*sin(b)*sin(d)+323.5*cos(b)*sin(c) end proc"></p>
<p>Y := proc (a, b, c, d) options operator, arrow; (324*1.*sin(a)*sin(b)*sin(c)+324*1.*cos(a)*cos(c))*cos(d)+(-1)*324.*sin(a)*cos(b)*sin(d)+323.5*sin(a)*sin(b)*sin(c)+323.5*cos(a)*cos(c)-100 end proc</p>
<p><img class="math" src="../images/mathml.png" alt="Y := proc (a, b, c, d) options operator, arrow; (324*1.*sin(a)*sin(b)*sin(c)+324*1.*cos(a)*cos(c))*cos(d)+(-1)*324.*sin(a)*cos(b)*sin(d)+323.5*sin(a)*sin(b)*sin(c)+323.5*cos(a)*cos(c)-100 end proc"></p>
<p>Z := proc (a, b, c, d) options operator, arrow; (324*cos(a)*sin(b)*sin(c)-324*sin(a)*cos(c))*cos(d)-324*cos(a)*cos(b)*sin(d)+323.5*cos(a)*sin(b)*sin(c)+(-1)*323.5*sin(a)*cos(c)+150 end proc</p>
<p><img class="math" src="../images/mathml.png" alt="Z := proc (a, b, c, d) options operator, arrow; (324*cos(a)*sin(b)*sin(c)-324*sin(a)*cos(c))*cos(d)-324*cos(a)*cos(b)*sin(d)+323.5*cos(a)*sin(b)*sin(c)+(-1)*323.5*sin(a)*cos(c)+150 end proc"></p><p>How can I plot a volume (many surfaces) in X,Y, Z axis where X,Y,Z are functions in 4 variables (a,b,c,d), and the domain for the 4 variables are </p>
<p>-90<=a>=90, -10<=b>=10, -12<=c>=12, -90<=d>=0,</p>
<p> </p>
<p>X := proc (a, b, c, d) options operator, arrow; 324.*cos(b)*sin(c)*cos(d)+324.*sin(b)*sin(d)+323.5*cos(b)*sin(c) end proc<img class="math" src="../images/mathml.png" alt="X := proc (a, b, c, d) options operator, arrow; 324.*cos(b)*sin(c)*cos(d)+324.*sin(b)*sin(d)+323.5*cos(b)*sin(c) end proc" /></p>
<p>Y := proc (a, b, c, d) options operator, arrow; (324*1.*sin(a)*sin(b)*sin(c)+324*1.*cos(a)*cos(c))*cos(d)+(-1)*324.*sin(a)*cos(b)*sin(d)+323.5*sin(a)*sin(b)*sin(c)+323.5*cos(a)*cos(c)-100 end proc</p>
<p><img class="math" src="../images/mathml.png" alt="Y := proc (a, b, c, d) options operator, arrow; (324*1.*sin(a)*sin(b)*sin(c)+324*1.*cos(a)*cos(c))*cos(d)+(-1)*324.*sin(a)*cos(b)*sin(d)+323.5*sin(a)*sin(b)*sin(c)+323.5*cos(a)*cos(c)-100 end proc" /></p>
<p>Z := proc (a, b, c, d) options operator, arrow; (324*cos(a)*sin(b)*sin(c)-324*sin(a)*cos(c))*cos(d)-324*cos(a)*cos(b)*sin(d)+323.5*cos(a)*sin(b)*sin(c)+(-1)*323.5*sin(a)*cos(c)+150 end proc</p>
<p><img class="math" src="../images/mathml.png" alt="Z := proc (a, b, c, d) options operator, arrow; (324*cos(a)*sin(b)*sin(c)-324*sin(a)*cos(c))*cos(d)-324*cos(a)*cos(b)*sin(d)+323.5*cos(a)*sin(b)*sin(c)+(-1)*323.5*sin(a)*cos(c)+150 end proc" /></p>202371Tue, 16 Sep 2014 15:36:40 Zkfodakfodahow to use hash table in maple
http://www.mapleprimes.com/questions/202339-How-To-Use-Hash-Table-In-Maple?ref=Feed:MaplePrimes:Tagged With function
<p>i want to use dictionary or hashtable in maple</p>
<p>the key are a function, value are a list of things</p>
<p> </p>
<p>how to do?</p><p>i want to use dictionary or hashtable in maple</p>
<p>the key are a function, value are a list of things</p>
<p> </p>
<p>how to do?</p>202339Thu, 11 Sep 2014 08:11:40 ZritritError in program
http://www.mapleprimes.com/questions/202327-Error-In-Program?ref=Feed:MaplePrimes:Tagged With function
<p>Hi all</p>
<p>I have written the following code in maple to approximate arbitrary functions by hybrid of block-pulse and bernstein functions but it doesn't work properly especially for f(t)=1.0, so what is the matter?</p>
<p><a href="/view.aspx?sf=202327_question/bb1.mws">bb1.mws</a></p>
<p> </p>
<p><br>best wishes</p>
<!--break-->
<p>Mahmood Dadkhah</p>
<p>Ph.D Candidate</p>
<p>Applied Mathematics Department</p><p>Hi all</p>
<p>I have written the following code in maple to approximate arbitrary functions by hybrid of block-pulse and bernstein functions but it doesn't work properly especially for f(t)=1.0, so what is the matter?</p>
<p><a href="/view.aspx?sf=202327_question/bb1.mws">bb1.mws</a></p>
<p> </p>
<p><br>best wishes</p>
<!--break-->
<p>Mahmood Dadkhah</p>
<p>Ph.D Candidate</p>
<p>Applied Mathematics Department</p>202327Tue, 09 Sep 2014 10:18:02 Zmahmood180mahmood180How to Correctly Define Elements of a Matrix Using a Function?
http://www.mapleprimes.com/questions/202314-How-To-Correctly-Define-Elements-Of?ref=Feed:MaplePrimes:Tagged With function
<p>I'm used to Mathcad, and I am very new to Maple. Something I cannot figure out right now is how to define multiple elments of a matrix using a function.</p>
<p><br><strong>Input Data<br></strong></p>
<p>Define system dimensions as n:=2;</p>
<p>i:=1..n;</p>
<p>j:=1..n;</p>
<p>lambda:=Matrix(n);</p>
<p><span style="text-decoration: underline;">L</span>ambda:=Matrix(n);</p>
<p>upsilon:=vector(n); </p>
<p>Minor side note: I originaly had upsilon defined using the syntax "Vector[row](ncomp)", but this was giving me an 'exponentiation' operation error, so I changed it to what it is now (basically a list/array, which I guess has different type definitions that no longer cause the error?).</p>
<p>lambda[1,2]:=471.0433;</p>
<p>lambda[2,1]:=883.7530;</p>
<p>upsilon[1]:=58.69;</p>
<p>upsilon[2]:=18.07;</p>
<p><strong>The Problem I'm Having<br></strong></p>
<p>Now I just want to define <span style="text-decoration: underline;">L</span>ambda using a function to define all elements (like I would in Mathcad).</p>
<p>Lambda[i,j]:= (upsilon[j]/upsilon[i]) * exp (-lambda[i,j]/2853);</p>
<p>which gives me an extremely long error message:</p>
<p><em>Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Matrix(2, 2, {(1, 1) = -0.3504976272e-3, (1, 2) = -.16509955895845776, (2, 1) = -.30975332953088164, (2, 2) = -0.3504976272e-3}, datatype = float[8]</em></p>
<p>As far as I can tell (keep in mind that this is my very first Maple project) that it doesn't like lambda as a matrix? But shouldn't it just evaluate to the element? and why is (2,2) and (1,1) giving values, because it should intialize to zero, so exp(0) = 1 in these cases??</p>
<p>I tried to simplify further by just trying</p>
<p>Lambda[i,j]:=(upsilon[j]/upsilon[i]);</p>
<p>but then it just gives me 1, and when I look into Lambda all the elements are now 1 when only the diagnol elements should be 1 (the rest some fractional amount)??</p>
<p>I am at a complete loss. I thought about doing something like For i = 1 to n etc. but then it just looks like coding, which defeats the purpose of trying to make a calculation sheet documenting the procedure...</p>
<p>Any help and/or insights into what I am doing wrong here would be most welcomed :)</p>
<p>P.S. I've just noticed that there is an upload option :/ <a href="/view.aspx?sf=202314_question/Wilson_Equation.mw">Wilson_Equation.mw</a>.</p>
<p> </p><p>I'm used to Mathcad, and I am very new to Maple. Something I cannot figure out right now is how to define multiple elments of a matrix using a function.</p>
<p><br><strong>Input Data<br></strong></p>
<p>Define system dimensions as n:=2;</p>
<p>i:=1..n;</p>
<p>j:=1..n;</p>
<p>lambda:=Matrix(n);</p>
<p><span style="text-decoration: underline;">L</span>ambda:=Matrix(n);</p>
<p>upsilon:=vector(n); </p>
<p>Minor side note: I originaly had upsilon defined using the syntax "Vector[row](ncomp)", but this was giving me an 'exponentiation' operation error, so I changed it to what it is now (basically a list/array, which I guess has different type definitions that no longer cause the error?).</p>
<p>lambda[1,2]:=471.0433;</p>
<p>lambda[2,1]:=883.7530;</p>
<p>upsilon[1]:=58.69;</p>
<p>upsilon[2]:=18.07;</p>
<p><strong>The Problem I'm Having<br></strong></p>
<p>Now I just want to define <span style="text-decoration: underline;">L</span>ambda using a function to define all elements (like I would in Mathcad).</p>
<p>Lambda[i,j]:= (upsilon[j]/upsilon[i]) * exp (-lambda[i,j]/2853);</p>
<p>which gives me an extremely long error message:</p>
<p><em>Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Matrix(2, 2, {(1, 1) = -0.3504976272e-3, (1, 2) = -.16509955895845776, (2, 1) = -.30975332953088164, (2, 2) = -0.3504976272e-3}, datatype = float[8]</em></p>
<p>As far as I can tell (keep in mind that this is my very first Maple project) that it doesn't like lambda as a matrix? But shouldn't it just evaluate to the element? and why is (2,2) and (1,1) giving values, because it should intialize to zero, so exp(0) = 1 in these cases??</p>
<p>I tried to simplify further by just trying</p>
<p>Lambda[i,j]:=(upsilon[j]/upsilon[i]);</p>
<p>but then it just gives me 1, and when I look into Lambda all the elements are now 1 when only the diagnol elements should be 1 (the rest some fractional amount)??</p>
<p>I am at a complete loss. I thought about doing something like For i = 1 to n etc. but then it just looks like coding, which defeats the purpose of trying to make a calculation sheet documenting the procedure...</p>
<p>Any help and/or insights into what I am doing wrong here would be most welcomed :)</p>
<p>P.S. I've just noticed that there is an upload option :/ <a href="/view.aspx?sf=202314_question/Wilson_Equation.mw">Wilson_Equation.mw</a>.</p>
<p> </p>202314Sat, 06 Sep 2014 15:15:39 ZshoelessshoelessPrint arguments of a function(procedure)
http://www.mapleprimes.com/questions/202259-Print-Arguments-Of-A-Functionprocedure?ref=Feed:MaplePrimes:Tagged With function
<p>Hi,</p>
<p>This maybe a really simple question, I remember this is doable but couldnt find where the answer is.</p>
<p>Say I write a function to sum up all values in the list,</p>
<p>mysum:=proc(data::list)</p>
<p>return printf("The sum is %3.3f. ", sum(data[i],i=1..numelems(data)));</p>
<p>end proc;</p>
<p> </p>
<p>and I use it like,</p>
<p>mysum(listA);</p>
<p>mysum(listB);</p>
<p> </p>
<p>How would I print out a more informative string, like this:</p>
<p>"The sum of listA is %3.3f. "</p>
<p>"The sum of listB is %3.3f. "</p>
<p> </p>
<p>Use "data", the input, as a string argument.</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>casper</p><p>Hi,</p>
<p>This maybe a really simple question, I remember this is doable but couldnt find where the answer is.</p>
<p>Say I write a function to sum up all values in the list,</p>
<p>mysum:=proc(data::list)</p>
<p>return printf("The sum is %3.3f. ", sum(data[i],i=1..numelems(data)));</p>
<p>end proc;</p>
<p> </p>
<p>and I use it like,</p>
<p>mysum(listA);</p>
<p>mysum(listB);</p>
<p> </p>
<p>How would I print out a more informative string, like this:</p>
<p>"The sum of listA is %3.3f. "</p>
<p>"The sum of listB is %3.3f. "</p>
<p> </p>
<p>Use "data", the input, as a string argument.</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>casper</p>202259Tue, 26 Aug 2014 20:44:37 Zcasperyccasperyc