MaplePrimes - Questions and Posts tagged with function
http://www.mapleprimes.com/tags/function
en-us2014 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemSun, 21 Dec 2014 06:53:01 GMTSun, 21 Dec 2014 06:53:01 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
the meaning of _type and conditional
http://www.mapleprimes.com/questions/203056-The-Meaning-Of-type-And-Conditional?ref=Feed:MaplePrimes:Tagged With function
<p>Dear people in mapleprimes,</p>
<p> </p>
<p>>define(INT, linear, conditional(INT(a::algebraic, X::name) = a*X, _type(a, freeof(X))), INT(X::name, X::name) = (1/2)*X^2);</p>
<p>>INT(2*x+4, x);<br><br> x^2 + 4*x</p>
<p>>INT(z+x, z);</p>
<p>(1/2)* z ^2+ x*z<br><br></p>
<p>is written in the <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=define">help page</a> of maple.</p>
<p>This code is to make a function INT.</p>
<p>What it means is that if INT(a::algebraic, x::name) then this is transformed into a*X, where a is independent from x.</p>
<p>And, INT(X::name,X::name) is transformed into (1/2)*X^2.</p>
<p> </p>
<p>The first of what I want to ask you is the way of use of "_type", which is not in the help page, and as for names with "_" ahead, </p>
<p>it is written that "_" means internal command for Maple, so not to use it. Is it right to use a name with "_" ahead of it here?</p>
<p>The second of what I want to know is the way to use "conditional."</p>
<p>Please teach me the meaning of this.</p>
<p>Thanks in advance.</p>
<p> </p>
<p>I hope you will teach me the above questions.</p>
<p> </p>
<p>Best wishes.</p>
<p> </p>
<p>taro</p>
<p> </p>
<p> </p><p>Dear people in mapleprimes,</p>
<p> </p>
<p>>define(INT, linear, conditional(INT(a::algebraic, X::name) = a*X, _type(a, freeof(X))), INT(X::name, X::name) = (1/2)*X^2);</p>
<p>>INT(2*x+4, x);<br><br> x^2 + 4*x</p>
<p>>INT(z+x, z);</p>
<p>(1/2)* z ^2+ x*z<br><br></p>
<p>is written in the <a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=define">help page</a> of maple.</p>
<p>This code is to make a function INT.</p>
<p>What it means is that if INT(a::algebraic, x::name) then this is transformed into a*X, where a is independent from x.</p>
<p>And, INT(X::name,X::name) is transformed into (1/2)*X^2.</p>
<p> </p>
<p>The first of what I want to ask you is the way of use of "_type", which is not in the help page, and as for names with "_" ahead, </p>
<p>it is written that "_" means internal command for Maple, so not to use it. Is it right to use a name with "_" ahead of it here?</p>
<p>The second of what I want to know is the way to use "conditional."</p>
<p>Please teach me the meaning of this.</p>
<p>Thanks in advance.</p>
<p> </p>
<p>I hope you will teach me the above questions.</p>
<p> </p>
<p>Best wishes.</p>
<p> </p>
<p>taro</p>
<p> </p>
<p> </p>203056Thu, 11 Dec 2014 15:11:14 ZtarotaroBodePlot function doesn't like inputs with units
http://www.mapleprimes.com/questions/203028-BodePlot-Function-Doesnt-Like-Inputs-With-Units?ref=Feed:MaplePrimes:Tagged With function
<p>I have been having problems with using the BodePlot function with units:</p>
<p> </p>
<p>R1 := 18.2*10^3*Unit('Omega');</p>
<p>R2 := 10^3*Unit('Omega');</p>
<p>C1 := 470*10^(-12)*Unit('F');</p>
<p>C2 := 4.7*10^(-9)*Unit('F');</p>
<p># wo is in hertz</p>
<p>wo := 1/sqrt(R1*R2*C1*C2);</p>
<p># Q is unitless</p>
<p>Q := wo*R1*R2*C2/(R1+R2)</p>
<p> </p>
<p>with(DynamicSystems);</p>
<p>sys := TransferFunction(wo^2/(s^2+wo*s/Q+wo^2));</p>
<p> </p>
<p>This is the error message I got:</p>
<p>Error, (in Units:-Standard:-+) the units `1` and `Hz` have incompatible dimensions</p>
<p> </p>
<p>I think the problem is that the BodePlot function doesn't expect 'wo' to have units. </p>
<p>So I tried to work around the issue by using the loglogplot but it doesn't seem to like </p>
<p>complex function even when I used abs to find the magnitude (with or without units).</p>
<p> </p>
<p> Any workaround is appreciated.</p><p>I have been having problems with using the BodePlot function with units:</p>
<p> </p>
<p>R1 := 18.2*10^3*Unit('Omega');</p>
<p>R2 := 10^3*Unit('Omega');</p>
<p>C1 := 470*10^(-12)*Unit('F');</p>
<p>C2 := 4.7*10^(-9)*Unit('F');</p>
<p># wo is in hertz</p>
<p>wo := 1/sqrt(R1*R2*C1*C2);</p>
<p># Q is unitless</p>
<p>Q := wo*R1*R2*C2/(R1+R2)</p>
<p> </p>
<p>with(DynamicSystems);</p>
<p>sys := TransferFunction(wo^2/(s^2+wo*s/Q+wo^2));</p>
<p> </p>
<p>This is the error message I got:</p>
<p>Error, (in Units:-Standard:-+) the units `1` and `Hz` have incompatible dimensions</p>
<p> </p>
<p>I think the problem is that the BodePlot function doesn't expect 'wo' to have units. </p>
<p>So I tried to work around the issue by using the loglogplot but it doesn't seem to like </p>
<p>complex function even when I used abs to find the magnitude (with or without units).</p>
<p> </p>
<p> Any workaround is appreciated.</p>203028Mon, 08 Dec 2014 07:11:41 Zkle8309kle8309Why can I not define the square of a function/variable instead of a function/variable?
http://www.mapleprimes.com/questions/202949-Why-Can-I-Not-Define-The-Square-Of-A?ref=Feed:MaplePrimes:Tagged With function
<p>Greetings,</p>
<p>Maple 15 allows the following syntax</p>
<p>omega := sqrt(w0^2*(1+((z-zf)/z0)^2))</p>
<p>But it does not allow this one </p>
<p>omega^2 := sqrt(w0^2*(1+((z-zf)/z0)^2))</p>
<p>Why is this so for functions and variables? Is there any way around this, I am really bugged by this issue. The Maple Math told me that the syntax was invalid so I had type the commands directly.</p>
<p> </p><p>Greetings,</p>
<p>Maple 15 allows the following syntax</p>
<p>omega := sqrt(w0^2*(1+((z-zf)/z0)^2))</p>
<p>But it does not allow this one </p>
<p>omega^2 := sqrt(w0^2*(1+((z-zf)/z0)^2))</p>
<p>Why is this so for functions and variables? Is there any way around this, I am really bugged by this issue. The Maple Math told me that the syntax was invalid so I had type the commands directly.</p>
<p> </p>202949Wed, 26 Nov 2014 18:56:21 ZVesnogVesnogDifferenting an expression with two time dependent variables outputs a table function?
http://www.mapleprimes.com/questions/202928-Differenting-An-Expression-With-Two?ref=Feed:MaplePrimes:Tagged With function
<p>Hi</p>
<p>I'm trying make Maple write the actual result, when i differenting an expression: x[s] := x(t)+sin(theta(t))*a.<br>when i differentiate with respect to t, i get:<br><br></p>
<p>> diff(x[s], t);<br> = <br>print(`output redirected...`); # input placeholder<br> / d \ / d \ <br> |--- ()(t)| + cos(theta(t)) |--- theta(t)| a<br> \ dt / \ dt /</p>
<p>Maple, writes the expression as a table, but i need to see the normal function? Why does it do that? And how can i make it show the expression as a normal function?</p>
<p><br>When i derive the two parts serperately i get the normal result, but as soon as i add them together, i get the table rasult again?<br><br>Is there an easy trick for this one?</p>
<p>-Nicolai</p>
<p> </p>
<p> </p><p>Hi</p>
<p>I'm trying make Maple write the actual result, when i differenting an expression: x[s] := x(t)+sin(theta(t))*a.<br />when i differentiate with respect to t, i get:<br /><br /></p>
<p>> diff(x[s], t);<br /> = <br />print(`output redirected...`); # input placeholder<br /> / d \ / d \ <br /> |--- ()(t)| + cos(theta(t)) |--- theta(t)| a<br /> \ dt / \ dt /</p>
<p>Maple, writes the expression as a table, but i need to see the normal function? Why does it do that? And how can i make it show the expression as a normal function?</p>
<p><br />When i derive the two parts serperately i get the normal result, but as soon as i add them together, i get the table rasult again?<br /><br />Is there an easy trick for this one?</p>
<p>-Nicolai</p>
<p> </p>
<p> </p>202928Sun, 23 Nov 2014 16:32:21 Z9colai9colaiMaximas and minimas of piecewise defined functions
http://www.mapleprimes.com/questions/202924-Maximas-And-Minimas-Of-Piecewise-Defined?ref=Feed:MaplePrimes:Tagged With function
<p>Consider the function</p>
<p> </p>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZoAAAAxCAIAAABsyPitAAAFwElEQVR4nO2drVIzMRSG9wKQXEglmfkkAlmBQCA7GURFBbIzCASCmVQiEIjKatYgegGIigpmFoFAVCAQFQhEPtFt6U82OQnd3ZPlfRTDbM+mfTdvNr8n0QAA0AiSugsAAAD7AXYGAGgIHO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Z3Nm5sb30+B/eHR2YRSgBXmqYCi/SStVms8Hq//p2gHXNFUgBMMMNcNpgJArOzamW0/bbfbvb+/X11n2QGHhRrRAjsDsbJjZxtTlEuXSmUilNZ6Mpmcnp5S4l5fX2MZbbOBUoAbSzvLh/83X82yLMuUkFIKsTqDotPpPD8/24PO5/OzszNscmo2UApwY/V2ttF3XJEpIYRan+Wcz+edTsc+pdXv932XaKyIpJI8St8TmPdPiYf/UIhEKR0oFrJnRoj9gKDAk8F+QzSVxPcEZioscmhSiEYpHXRcdsgRa6BmXAcEVV5dYqokWocmy7AHrD+HJoXYlNKeYuGM2fiw2ZnvGdR7waOS+ORM9MYvuKv1J2f2ZJJDkwIXpbzjE1/VYGfxEftptPTEmgF4B7e2/vbMnusx6s+hSYGTUiHxXa9qsLP4iN3OyIk1g6AHz1t8a/5te2ZP6pbJSnJoUmCllFd8t1haw85iJHo7IybWDMQdnDrI7MrsuYJFDk0KvJQixfeaEYCdxUf0dkbMmRiGNXhJ48ossjRRYKWUK37AjA3sLD7itjPvnIk+WIN7LmXyG9JpoJ2VqpQrftgiQdhZfMRqZ7/KmVh5cJ8VL02zs1KVKis+smfGSax2VjchRx42jEiU0hDr7wA7A4FAKcAN2BkIBEoBbsDOQCBQCnCDnZ0Nh0NUkiiAUoAb7OxsOp222+2ws9JAlUApwA12dqa1HgwGvV5vNpvVXRDgAEoBVvwHwR5kwuk3YgIAAAAASUVORK5CYII=" alt=""></p>
<p> </p>
<p>The above definition may result in four cases depening on r and x.</p>
<p>Can Maple calculate automatically all possible cases and the corresponding Maxima, Minima and Values at intervals limits?</p>
<p> </p><p>Consider the function</p>
<p> </p>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZoAAAAxCAIAAABsyPitAAAFwElEQVR4nO2drVIzMRSG9wKQXEglmfkkAlmBQCA7GURFBbIzCASCmVQiEIjKatYgegGIigpmFoFAVCAQFQhEPtFt6U82OQnd3ZPlfRTDbM+mfTdvNr8n0QAA0AiS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MHOLDttTJ3Nwh1wwZ3Nm5sb30+B/eHR2YRSgBXmqYCi/SStVms8Hq//p2gHXNFUgBMMMNcNpgJArOzamW0/bbfbvb+/X11n2QGHhRrRAjsDsbJjZxtTlEuXSmUilNZ6Mpmcnp5S4l5fX2MZbbOBUoAbSzvLh/83X82yLMuUkFIKsTqDotPpPD8/24PO5/OzszNscmo2UApwY/V2ttF3XJEpIYRan+Wcz+edTsc+pdXv932XaKyIpJI8St8TmPdPiYf/UIhEKR0oFrJnRoj9gKDAk8F+QzSVxPcEZioscmhSiEYpHXRcdsgRa6BmXAcEVV5dYqokWocmy7AHrD+HJoXYlNKeYuGM2fiw2ZnvGdR7waOS+ORM9MYvuKv1J2f2ZJJDkwIXpbzjE1/VYGfxEftptPTEmgF4B7e2/vbMnusx6s+hSYGTUiHxXa9qsLP4iN3OyIk1g6AHz1t8a/5te2ZP6pbJSnJoUmCllFd8t1haw85iJHo7IybWDMQdnDrI7MrsuYJFDk0KvJQixfeaEYCdxUf0dkbMmRiGNXhJ48ossjRRYKWUK37AjA3sLD7itjPvnIk+WIN7LmXyG9JpoJ2VqpQrftgiQdhZfMRqZ7/KmVh5cJ8VL02zs1KVKis+smfGSax2VjchRx42jEiU0hDr7wA7A4FAKcAN2BkIBEoBbsDOQCBQCnCDnZ0Nh0NUkiiAUoAb7OxsOp222+2ws9JAlUApwA12dqa1HgwGvV5vNpvVXRDgAEoBVvwHwR5kwuk3YgIAAAAASUVORK5CYII=" alt="" /></p>
<p> </p>
<p>The above definition may result in four cases depening on r and x.</p>
<p>Can Maple calculate automatically all possible cases and the corresponding Maxima, Minima and Values at intervals limits?</p>
<p> </p>202924Sun, 23 Nov 2014 09:23:09 ZFarouqFarouqsubstitution a sequnce of numbers in a function
http://www.mapleprimes.com/questions/202875-Substitution-A-Sequnce-Of-Numbers-In-A-Function?ref=Feed:MaplePrimes:Tagged With function
<p>Hi all</p>
<p>Assume that we have a function, say f(t) and we want to substitute t in it where t is:</p>
<p>t=[0,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]</p>
<p>by subs or other better command, how can we do it?</p>
<p>best wishes</p>
<!--break-->
<p>Mahmood Dadkhah</p>
<p>Ph.D Candidate</p>
<p>Applied Mathematics Department</p><p>Hi all</p>
<p>Assume that we have a function, say f(t) and we want to substitute t in it where t is:</p>
<p>t=[0,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]</p>
<p>by subs or other better command, how can we do it?</p>
<p>best wishes</p>
<!--break-->
<p>Mahmood Dadkhah</p>
<p>Ph.D Candidate</p>
<p>Applied Mathematics Department</p>202875Tue, 18 Nov 2014 08:32:48 Zmahmood180mahmood180Question about Inequal
http://www.mapleprimes.com/questions/202812-Question-About-Inequal?ref=Feed:MaplePrimes:Tagged With function
<p>with(plots)</p>
<p>inequal((2*c-1)/(3*c-1),c=0..1.5,Alpha=0..1)</p>
<p> </p>
<p>with(plots)</p>
<p>inequal((2*c-1)/(3*c-1),c=0..1,Alpha=0..1)</p>
<p> </p>
<p>Why are the results of the two orders above so different???</p>
<p>A bug in the function of inequal???</p><p>with(plots)</p>
<p>inequal((2*c-1)/(3*c-1),c=0..1.5,Alpha=0..1)</p>
<p> </p>
<p>with(plots)</p>
<p>inequal((2*c-1)/(3*c-1),c=0..1,Alpha=0..1)</p>
<p> </p>
<p>Why are the results of the two orders above so different???</p>
<p>A bug in the function of inequal???</p>202812Mon, 10 Nov 2014 08:01:58 ZShaohuahanShaohuahanpowerset P(A), injection and subset
http://www.mapleprimes.com/questions/202798-Powerset-PA-Injection-And-Subset?ref=Feed:MaplePrimes:Tagged With function
<div><strong>Let A = {a1, . . . , a10} be a set of 10 distinct positive two-digit integers (i.e., each ai</strong></div>
<div><strong>is at</strong></div>
<div><strong>least 10 and at most 99).</strong></div>
<div><strong>For each subset B ⊆ A let f(B) denote the sum of all elements in B. (If B = ∅, set</strong></div>
<div><strong>f(B) = 0.) Thus, f is a function from the power set P(A) of A to N. Prove that this</strong></div>
<div><strong>function is not injective.</strong></div>
<div><strong> </strong></div>202798Sat, 08 Nov 2014 08:46:55 Zlaporte bernardlaporte bernardpiecewise 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 Zjonlgjonlg