,4471 >> Precisie bTemp[3,0,0] = 389.685 >> Precisie Q[3,1] = 390.729 >> Precisie bTemp[3,0,1] =53.8232 >Now the \[CapitalThorn]rst one makes sense, but the last one, how is it possible that >if I add two numbers of precision ca. 390 I get something of precision >53 back? Cancellation of signi\[CapitalThorn]cant digits? *If* the two numbers have different signs, this could happen. For example: a=+2.1234567895 b=-2.1234567891 a+b=0.4*10^-10 The \[CapitalThorn]rst two numbers have a precision of 11 digits. Their sum has a precision of 1. To see this in Mathematica, you should experiment with numbers with more then 16 digits, lest not to fall in the machine precision Maelstrom. a = +2.3333333333333333335; b = -2.333333333333331245; Precision[a] Precision[b] Precision[a + b] > are there any public powerful computers which I can use for intense > calculations? I donÕt know > and if not, is there a way to run a kernel on a different computer > and to use it remotely? if so, how? search for Òremote kernelÓ in the help or on \ the Wolfram site. (Mathematica must be installed on the remote host!) Marcus -- Unfortunately our politicians are either incompetent or corrupt. Sometimes both on the same day. -- W. Allen newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!news-FFM2. ecrc.net!newsfeed00.sul.t-online.de!newsfeed01. sul.t-online.de!t-online.de!nntp.infostrada.it! news.mailgate.org!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: function de\[CapitalThorn]nition dif\[CapitalThorn]culty MathTensor, Inc. Moderator DXC=L7NZ6@\\P]7O\\o7M8kQj6M;[h;PUXBgbD; jPa7nMWN0EEFiONJ7[GoFo4Jn2lNoRSJ comp.soft-sys.math.mathematica:56220 Hi Marc, I think you fooled yourself, your example is correct and working: cdtable = {{1.941,1.149, 0.911, 0.725, 0.678, 0.74}, {2.094, 1.098, 0.911, 0.516, 0.305,0.18}}; cd[x_] := cdtable[[If[x < 1000., 1, 2], i]]; i = 3; cd[999] returns 0.911 P.O. It would help if you put a bit more effort into your writing. sincerely, Daniel > I have a function say :sz[x_]:= cc (x/1000)^cd + cfcc, cd and cf are coef\[CapitalThorn]cients to be chosen in a list say forcd:cdtable = {{1.941,1.149, 0.911, 0.725, 0.678, 0.74}, {2.094, 1.098, 0.911, 0.516, 0.305, 0.18}}Here is where it gest tricky :I want to chose the nth part of either the \[CapitalThorn]rst or the second sublistof cdtable depending on the value of x (the constant ÒiÓ being \ de\[CapitalThorn]ned beforehand).I triedand cd[x_] := =cdtable[[If[x < 1000., 1, 2],i]]orchoice[x_]:=If[x < 1000., 1, 2]cd[x_]:= cdtable[[choice[x],i]]then if I typei=3;cd[999]I ought to get the result asOut[]= 0.911ihowever, I get Part::pspec:ÓPart \ speci\[CapitalThorn]cation If[x <1000., 1, 2] is neither an > integer nor a list of integers. Plus...can anyone provide a simple way out of this?I have a function say :sz[x_]:= cc (x/1000)^cd + cfcc, cd and cf are coef\[CapitalThorn]cients to be chosen in a list sayforcd:cdtable = {{1.941, 1.149, 0.911, 0.725, 0.678, 0.74}, {2.094, 1.098, 0.911, 0.516, 0.305,0.18}}Here is where it gest tricky :I want to chose the nth part of either the \[CapitalThorn]rst or the second sublistofcdtable depending on the value of x (the constant ÒiÓ being \ de\[CapitalThorn]ned beforehand).I triedand cd[x_] := cdtable[[If[x <1000., 1, 2],i]]orchoice[x_]:=If[x < 1000., 1,2]cd[x_]:= cdtable[[choice[x],i]]then if I typei=3;cd[999]Iought to get the result as Out[]= 0.911ihowever, I get Part::pspec:ÓPart \ speci\[CapitalThorn]cation If[x <1000., 1, 2] isneither an > integer nor a list of integers. Plus...can anyone provide a simple way out of this? newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!ngpeer.news.aol.com! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: Representation and Simulation of Dynamic Systems MathTensor, Inc. Moderator DXC=UK::YXRN;4knJ]SQJ40F_gC_A=>8kQj6m;[h;PUXBgbd; jPa7nMWN0eEFiONJ7[Gof0cg71=:Pmib comp.soft-sys.math.mathematica:56221 Dr. Caffa Vittorio, Do you have a good link (http://....) that describes covariance simulation and/or the method of adjoints? > Chris, > I have used as a toy example a dynamic system which happens to be linear > with constant coef\[CapitalThorn]cients. Actually, I wanted to focus the discussion > on non-linear dynamic systems. > (As a special case, linear systems, possibly with non-constant > coef\[CapitalThorn]cient, could be also analyzed with an extension of the method I am > suggesting. Given the system description, one could for instance compute > symbolically the matrices A(t), B(t), C(t), D(t). Then using the method > of adjoints or a covariance simulation one could compute the system for > example the system response to a stochastic input.) > Actually the method I am suggesting is a surrogate of an interface into > which one could place a block diagram. If such an interface were > available I would probably do all my simulation work with Mathematica > instead of using that-simulation-link-addition-which-must-not-be-named > on that-mathematics-laboratory-program-which-must-not-be-named. > >-----Original Message----- > >Cc: mathgroup@smc.vnet.net === > >Subject: Representation and Simulation of Dynamic Systems > >It seems like you are solving systems with constant coef\[CapitalThorn]cients. > >The trickiest parts would be (a) designing an interface into which one > >could place a block diagram and (b) having Mathematica interpret that > >diagram. > >If you could do that, control system professional can probably do > >whatever else you might need ... > >http://library.wolfram.com/examples/CSPExtending/ > >Does anyone know if there is a good bond graph or block diagram > >ÓpackageÓ available for Mathematica? > >I would really like to see the equivalent of > >that-simulation-link-addition-which-must-not-be-named on >that-mathematics-laboratory-program-which-must-not-be-named for > >Mathematica. > >> The behavior of (time-continuous, non-linear) dynamic systems can be > >> numerically investigated with NDSolve. One can \[CapitalThorn]rst sketch a block > >> diagram of the system and then convert it into equations. Here is a > toy > >> example after the conversion: > >> > >> posÕ[t] = vel[t] > >> velÕ[t] = -k pos[t] + force[t] / m > >> > >> This works \[CapitalThorn]ne if the variables are all states, as in the example > >> above. But often, in order to describe a given dynamic system you > want > >> or you have to introduce some auxiliary variables (i.e. variables > which > >> are not states). This is in fact the case if you want to describe a > >> generic dynamic system. Here are the standard equations: > >> > >> xÕ[t] = f[x[t], u[t], t] (state equations) > >> y[t] = g[x[t], u[t], t] (output equations) > >> > >> where: x = state vector, u = input vector, y = output vector, t = > time. > >> In this case the components of the output vector are the ÒauxiliaryÓ > >> variables. > >> > >> IÕm considering here a scheme for representing dynamic systems > (possibly > >> using a block diagram as a starting point) which allows the usage of > >> auxiliary variables. This representation can be transformed into > >> equations for NDSolve automatically. After having solved the > equations > >> it is possible to inspect not only the state variables but also the > >> auxiliary variables. > >> > >> Comments or alternative solutions to the problem IÕm considering are > >> welcome! > >> > >> Procedure > >> > >> o) Sketch the system on a piece of paper. Here is a toy example: > >> > >> ---------- [ -k ] --------- > >> | | > >> V | > >> force[t] --> [ 1/m ] --> + --> [ 1/s ] ---> [ 1/s ] ---> pos[t] > >> | | > >> | --------------> vel[t] > >> | > >> ---------------------------> acc[t] > >> > >> Note: [ 1/s ] is an integrator block > >> [ k ] is a gain block > >> > >> o) Convert the sketch into a system description: > >> > >> In[1]:= sys = {posÕ[t] -> vel[t], > >> velÕ[t] -> acc[t], > >> acc[t] -> -k pos[t] + force[t] / m}; > >> > >> Note: the arrow points to the source of the signal. > >> > >> o) Make a list of the state variables: > >> > >> In[2]:= states = {pos[t], vel[t]}; > >> > >> o) Form the differential equations (the following steps could be > >> performed by a function): > >> > >> In[3]:= lhs = D[states, t] > >> > >> Out[3]= {posÕ[t], velÕ[t]} > >> > >> In[4]:= rhs = D[states, t] //. sys > >> > >> force[t] > >> Out[4]= {vel[t], -------- - k pos[t]} > >> m > >> > >> In[5]:= eqns = Join[Thread[lhs == rhs], {pos[0] == pos0, vel[0] == > >> vel0}] > >> > >> force[t] > >> Out[5]= {posÕ[t] == vel[t], velÕ[t] == \ -------- - k pos[t], pos[0] == > >> pos0, > >> m > >> vel[0] == vel0} > >> > >> o) Specify the parameters: > >> > >> In[6]:= params = {m -> 10, k -> 2, pos0 -> 0, vel0 -> 0, force[t] -> > >> Sin[t]}; > >> > >> o) Solve the differential equations: > >> > >> In[7]:= sol = First[NDSolve[eqns /. params, states, {t, 0, 10}]] > >> > >> Out[7]= {pos[t] -> InterpolatingFunction[{{0., 10.}}, <>][t], > >> > >> vel[t] -> InterpolatingFunction[{{0., 10.}}, <>][t]} > >> > >> o) Inspect the results (including auxiliary variables) > >> > >> In[8]:= Plot[pos[t] /. sol, {t, 0, 10}] > >> > >> Out[8]= -Graphics- > >> > >> In[9]:= Plot[acc[t] //. sys /. params /. sol, {t, 0, 10}] > >> > >> Out[9]= -Graphics- > >> > >> > >> -------------------------------------------- > >> Dr.-Ing. Vittorio G. Caffa > >> IABG mbH > >> Abt. VG 32 > >> Einsteinstr. 20 > >> 85521 Ottobrunn / Germany > >> > >> Tel. (089) 6088 2054 > >> Fax: (089) 6088 3990 > >> E-mail: caffa@iabg.de > >> Website : www.iabg.de > >> -------------------------------------------- > >> > >> > >-- > >Chris Chiasson > >http://chrischiasson.com/ > >1 (810) 265-3161 -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news.maxwell.syr.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Representation and Simulation of Dynamic Systems Moderator DXC=bKZ\\dFCd1Ob2hjn;A6STQiC_A=>8kQj6m;[h;PUXBgbdW[m>13cG[: gEFiONJ7[Gof31aocGBEIBj comp.soft-sys.math.mathematica:56216 and you can not select your depend output variables (like y[t]) in your example and just insert the solution that NDSolve[] gives for your independent variables ? Strange ... Jens ÒCaffa Vittorio Dr.Ó schrieb \ im > The behavior of (time-continuous, non-linear) > dynamic systems can be > numerically investigated with NDSolve. One can > \[CapitalThorn]rst sketch a block > diagram of the system and then convert it into > equations. Here is a toy > example after the conversion: > posÕ[t] = vel[t] > velÕ[t] = -k pos[t] + force[t] / m > This works \[CapitalThorn]ne if the variables are all states, > as in the example > above. But often, in order to describe a given > dynamic system you want > or you have to introduce some auxiliary > variables (i.e. variables which > are not states). This is in fact the case if you > want to describe a > generic dynamic system. Here are the standard > equations: > xÕ[t] = f[x[t], u[t], t] (state equations) > y[t] = g[x[t], u[t], t] (output equations) > where: x = state vector, u = input vector, y = > output vector, t = time. > In this case the components of the output vector > are the ÒauxiliaryÓ > variables. > IÕm considering here a scheme for representing > dynamic systems (possibly > using a block diagram as a starting point) which > allows the usage of > auxiliary variables. This representation can be > transformed into > equations for NDSolve automatically. After > having solved the equations > it is possible to inspect not only the state > variables but also the > auxiliary variables. > Comments or alternative solutions to the problem > IÕm considering are > welcome! > Procedure > o) Sketch the system on a piece of paper. Here > is a toy example: > ---------- > [ -k ] --------- > force[t] --> [ 1/m ] --> + --> [ 1/s ] ---> [ > 1/s ] ---> pos[t] > | | > | --------------> > vel[t] > ---------------------------> > acc[t] > Note: [ 1/s ] is an integrator block > [ k ] is a gain block > o) Convert the sketch into a system description: > In[1]:= sys = {posÕ[t] -> vel[t], > velÕ[t] -> acc[t], > acc[t] -> -k pos[t] + force[t] / m}; > Note: the arrow points to the source of the > signal. > o) Make a list of the state variables: > In[2]:= states = {pos[t], vel[t]}; > o) Form the differential equations (the > following steps could be > performed by a function): > In[3]:= lhs = D[states, t] > Out[3]= {posÕ[t], velÕ[t]} > In[4]:= rhs = D[states, t] //. sys > force[t] > Out[4]= {vel[t], -------- - k pos[t]} > In[5]:= eqns = Join[Thread[lhs == rhs], {pos[0] > == pos0, vel[0] == > vel0}] > force[t] > Out[5]= {posÕ[t] == vel[t], velÕ[t] > == -------- - k pos[t], pos[0] == > pos0, > vel[0] == vel0} > o) Specify the parameters: > In[6]:= params = {m -> 10, k -> 2, pos0 -> 0, > vel0 -> 0, force[t] -> > Sin[t]}; > o) Solve the differential equations: > In[7]:= sol = First[NDSolve[eqns /. params, > states, {t, 0, 10}]] > Out[7]= {pos[t] -> InterpolatingFunction[{{0., > 10.}}, <>][t], > vel[t] -> InterpolatingFunction[{{0., > 10.}}, <>][t]} > o) Inspect the results (including auxiliary > variables) > In[8]:= Plot[pos[t] /. sol, {t, 0, 10}] > Out[8]= -Graphics- > In[9]:= Plot[acc[t] //. sys /. params /. sol, > {t, 0, 10}] > Out[9]= -Graphics- > -------------------------------------------- > Dr.-Ing. Vittorio G. Caffa > IABG mbH > Abt. VG 32 > Einsteinstr. 20 > 85521 Ottobrunn / Germany > Tel. (089) 6088 2054 > Fax: (089) 6088 3990 > E-mail: caffa@iabg.de > Website : www.iabg.de > -------------------------------------------- newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!ngpeer.news.aol.com! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: and/or $MinPrecision,... MathTensor, Inc. Moderator DXC=5n`6kELj8kQj6=;[h;PUXBgb4NC\\aW59k8;: EFiONJ7[Go65QDZXm[U?K: comp.soft-sys.math.mathematica:56224 ... and with that $MinPrecision statement I forgot to include, both outputs are zero. > Lately I seem to be \[CapitalThorn]nding a lot of SetPrecision[]/$MinPrecision bugs. > This appears to be another one: > In[1]:= $MinPrecision = 20; > savedData1 = 669151541.9328941107875; > savedData2 = 0.99960472897267246018765; > savedData3 = Log[savedData1^savedData2/savedData1^savedData2]; > Print[Apply[Plus, savedData3 - > Log[savedData1^savedData2/savedData1^savedData2]] ]; > x = 0.99960472897267245645; > y = 669151541.932894110712; > Do[ > z = SetPrecision[y,24]^x; > ,{50000}]; > Print[Apply[Plus, savedData3 - > Log[savedData1^savedData2/savedData1^savedData2]] ]; > The output looks like this on my Mathematica 3.0 system: > 1.9586707534418188626 x 10^-30 > Obviously the question is why is the second Print statement not > also returning a 0, after all the code that runs between the two > Print statements neither changes any of the variables referenced > by the two Print statements, nor even references any of the same > variables. > The problem maybe reproducible without the $MinPrecision but with > this speci\[CapitalThorn]c test case it is needed (there might however be other > constants that can reproduce the problem without $MinPrecision). > Can someone also run this on a more recent version of Mathematica > to see if it reproduces? All help is very much appreciated! > Terry -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: and/or $MinPrecision,... MathTensor, Inc. Moderator DXC=UK::YXRN;4[NEg=@eQK2QZC_A=>8kQj6];[h;PUXBgbT; jPa7nMWN0UEFiONJ7[GoVhmg9fmiFJHZ comp.soft-sys.math.mathematica:56223 On my Mathematica 5.0 for Windows XP sp2, the output of your code is: 0``20.85065878472074 0``20.85065878472074 > Lately I seem to be \[CapitalThorn]nding a lot of SetPrecision[]/$MinPrecision bugs. > This appears to be another one: > In[1]:= $MinPrecision = 20; > savedData1 = 669151541.9328941107875; > savedData2 = 0.99960472897267246018765; > savedData3 = Log[savedData1^savedData2/savedData1^savedData2]; > Print[Apply[Plus, savedData3 - > Log[savedData1^savedData2/savedData1^savedData2]] ]; > x = 0.99960472897267245645; > y = 669151541.932894110712; > Do[ > z = SetPrecision[y,24]^x; > ,{50000}]; > Print[Apply[Plus, savedData3 - > Log[savedData1^savedData2/savedData1^savedData2]] ]; > The output looks like this on my Mathematica 3.0 system: > 1.9586707534418188626 x 10^-30 > Obviously the question is why is the second Print statement not > also returning a 0, after all the code that runs between the two > Print statements neither changes any of the variables referenced > by the two Print statements, nor even references any of the same > variables. > The problem maybe reproducible without the $MinPrecision but with > this speci\[CapitalThorn]c test case it is needed (there might however be other > constants that can reproduce the problem without $MinPrecision). > Can someone also run this on a more recent version of Mathematica > to see if it reproduces? All help is very much appreciated! > Terry -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: ChineseRemainder MathTensor, Inc. Moderator DXC=2EU0m2TgJ@=G9T[HIVmA74C_A=>8kQj6=;[h;PUXBgb4O=lNJco\\ XA1EFiONJ7[Go6>2a_b96[Wd3 comp.soft-sys.math.mathematica:56227 HiDana, see below > Hello. I have a question on the function ÒChineseRemainder.Ó Could anyone > HereÕs the package... > \ Needs[ÒNumberTheory`NumberTheoryFunctions`Ó] > The following small example has no solution, and returns the null set, which > is ok... > list1={2,3,4};list2={9,4,8}; > r=ChineseRemainder[list1,list2] > {} > The following returns a solution of 94. > list1={2,3,4};list2={4,7,9}; > r=ChineseRemainder[list1,list2] > 94 > According to Help on this function, we can test the solution with the > following, and it correctly returns list1. > Mod[r,list2] > {2,3,4} > These similar numbers return a different solution. > list1={2,3,4};list2={9,7,4}; > r=ChineseRemainder[list1,list2] > 164 > However, it does not correctly return list1. (According to help) > Mod[r,list2] > {2,3,0} This is correct. By de\[CapitalThorn]nition of ChineseRemainder: r == list2 mod list1. Therefore Mathematica says 164 == 0 mod 4 and because 0 == 4 mod 4 this also means that 164 == 4 mod 4 > This happens often in my program, and IÕm having a tough time trusting the > solution. Does anyone familiar with this have any insight? > I note that MathematicaÕs built-in ChineseRemainder function returns the > same answer, so IÕm sure Mathematica is doing it \ correctly. I guess I donÕt > understand why Mod[r,list2] will often not return list1 (According to help). > Reduce`RChineseRemainder[list1, list2] > 164 > Dana > $Version > Ò5.1 for Microsoft Windows (January 27, \ 2005)Ó newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! logbridge.uoregon.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: ChineseRemainder MathTensor, Inc. Moderator DXC=5n`6kELjD9?]MBC_A=>8kQj6M;[h;PUXBgbD; jPa7nMWN0EEFiONJ7[GoF[CmOV<_o?SA comp.soft-sys.math.mathematica:56225 Mod[4,4] is zero. I think the routine should return a null set. > Hello. I have a question on the function ÒChineseRemainder.Ó Could anyone > HereÕs the package... > \ Needs[ÒNumberTheory`NumberTheoryFunctions`Ó] > The following small example has no solution, and returns the null set, which > is ok... > list1={2,3,4};list2={9,4,8}; > r=ChineseRemainder[list1,list2] > {} > The following returns a solution of 94. > list1={2,3,4};list2={4,7,9}; > r=ChineseRemainder[list1,list2] > 94 > According to Help on this function, we can test the solution with the > following, and it correctly returns list1. > Mod[r,list2] > {2,3,4} > These similar numbers return a different solution. > list1={2,3,4};list2={9,7,4}; > r=ChineseRemainder[list1,list2] > 164 > However, it does not correctly return list1. (According to help) > Mod[r,list2] > {2,3,0} > This happens often in my program, and IÕm having a tough time trusting the > solution. Does anyone familiar with this have any insight? > I note that MathematicaÕs built-in ChineseRemainder function returns the > same answer, so IÕm sure Mathematica is doing it \ correctly. I guess I donÕt > understand why Mod[r,list2] will often not return list1 (According to help). > Reduce`RChineseRemainder[list1, list2] > 164 > Dana > $Version > Ò5.1 for Microsoft Windows (January 27, \ 2005)Ó -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! logbridge.uoregon.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: calculate de Jong function MathTensor, Inc. Moderator DXC=ZUQbcbO8i7``JJ7h?6@8kQj6m;[h;PUXBgbdNC\\aW59k8; jEFiONJ7[GofLOQN7?TSWmj comp.soft-sys.math.mathematica:56229 x=some vector f[x_]=x.x On 5/11/05, Stefan Schuster > I donÕt know how I should implement the \[CapitalThorn]rst \ de jong function: > f(x)=Sum((x_i)^2) > where x is a Vector with n dimensions and x_i is the value of the i-th > Dimension. > i.e. all Values of the Vector are squared and added. > My problem is that I donÕt know how many Dimensions there are, so I > canÕt de\[CapitalThorn]ne the borders of the SUM function. > Stefan -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: calculate de Jong function MathTensor, Inc. Moderator DXC=UK::YXRN;4Kk^S9D8kQj6M;[h;PUXBgbDNC\\aW59k8; JEFiONJ7[GoFUH_dm5CSU3D comp.soft-sys.math.mathematica:56222 Hi Stefan, there is the Length function that gives you the length of e.g. a vector, that is the dimension of your x. In version 5.1 there is the function Norm that can make your life still easier. > I donÕt know how I should implement the \[CapitalThorn]rst \ de jong function: > f(x)=Sum((x_i)^2) > where x is a Vector with n dimensions and x_i is the value of the i-th > Dimension. > i.e. all Values of the Vector are squared and added. > My problem is that I donÕt know how many Dimensions there are, so I > canÕt de\[CapitalThorn]ne the borders of the SUM function. > Stefan newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!news-FFM2. ecrc.net!newsfeed.vmunix.org!newsfeed.stueberl.de!peer01. cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: calculate de Jong function Moderator DXC=W\\n8b7X0JRKN>O;:SV[lhFC_A=>8kQj6M;[h;PUXBgbDW[m>13cG[: GEFiONJ7[GoFkGe0cT1MlU@ comp.soft-sys.math.mathematica:56217 your vector is a list and the dimension of the vector is the length of the list f[x_]:=x.x does what you want. Jens ÒStefan SchusterÓ schrieb im Newsbeitrag > I donÕt know how I should implement the \[CapitalThorn]rst \ de > jong function: > f(x)=Sum((x_i)^2) > where x is a Vector with n dimensions and x_i is > the value of the i-th > Dimension. > i.e. all Values of the Vector are squared and > added. > My problem is that I donÕt know how many > Dimensions there are, so I > canÕt de\[CapitalThorn]ne the borders of the SUM function. > Stefan newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net!wn13feed! worldnet.att.net!216.196.98.141!border2.nntp.dca.giganews.com !nntp.giganews.com!cyclone1.gnilink.net!gnilink.net! cyclone.rdc-nyc.rr.com!news.maxwell.syr.edu!newsfeeds.sol.net !posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: calculate de Jong function MathTensor, Inc. Moderator DXC=VE__b3RU\\j;XPjNm[V63b>C_A=>8kQj6=;[h;PUXBgb4O=lNJco\\ XA1EFiONJ7[Go6ZS18KkcA=o1 comp.soft-sys.math.mathematica:56214 x={x1,x2,x3,x4}; Use Dot f1[x_?VectorQ] := x.x; f1[x] x1^2 + x2^2 + x3^2 + x4^2 or f2[x_?VectorQ] := Tr[x^2]; f2[x] x1^2 + x2^2 + x3^2 + x4^2 or f3[x_?VectorQ] := Plus@@(x^2); f3[x] x1^2 + x2^2 + x3^2 + x4^2 or f4[x_?VectorQ] := Inner[Times,x,x]; f4[x] x1^2 + x2^2 + x3^2 + x4^2 Bob Hanlon === > Subject: calculate de Jong function > I donÕt know how I should implement the \[CapitalThorn]rst \ de jong function: > f(x)=Sum((x_i)^2) > where x is a Vector with n dimensions and x_i is the value of the i-th > Dimension. > i.e. all Values of the Vector are squared and added. > My problem is that I donÕt know how many Dimensions there are, so I > canÕt de\[CapitalThorn]ne the borders of the SUM function. > Stefan newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx02.iad01.newshosting.com!news-spur1. maxwell.syr.edu!news.maxwell.syr.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: MapThread MathTensor, Inc. Moderator DXC=8DBan`0aGd8WV@`bFQ>LQ9C_A=>8kQj6=;[h;PUXBgb4[`caKjchWR: EFiONJ7[Go6`nZKTGEkX=5 comp.soft-sys.math.mathematica:56230 Hi Everyone, I have been working on the following problem: states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} stim = {33, 44, 55, 66, 77} The locations of state 3,5,7,9,11 to be equal 33,44,55,66,77 MapThread[{#1 = #2} &, {Take [states, {3, 12, 2}], stim}] I tried to the above but it gives me errors: Set::setraw: Cannot assign to raw object 3 However these work individually: MapThread[#1 &, {Take [states, {3, 12, 2}], stim}] MapThread[ #2 &, {Take [states, {3, 12, 2}], stim}] Any ideas? newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp2.twtelecom.net!not-for-mail === Subject: Re: MapThread comp.soft-sys.math.mathematica:56262 > Hi Everyone, > I have been working on the following problem: > states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} > stim = {33, 44, 55, 66, 77} > The locations of state 3,5,7,9,11 to be equal 33,44,55,66,77 > MapThread[{#1 = #2} &, {Take [states, {3, 12, 2}], stim}] > I tried to the above but it gives me errors: > Set::setraw: Cannot assign to raw object 3 > However these work individually: > MapThread[#1 &, {Take [states, {3, 12, 2}], stim}] > MapThread[ #2 &, {Take [states, {3, 12, 2}], stim}] > Any ideas? The simplest way to do what (I think) you are trying to do is states[[Range[3,12,2]]]=stim; states {1,2,33,4,44,6,55,8,66,10,77,12,13,14} Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/andrzej/index.html http://www.mimuw.edu.pl/~akoz/ newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newsfeed.telusplanet.net!newsfeed2.telusplanet.net! newsfeed.telus.net!cycny01.gnilink.net!cyclone1.gnilink.net! gnilink.net!cyclone.rdc-nyc.rr.com!news.maxwell.syr.edu! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2. twtelecom.net!not-for-mail === Subject: Re: MapThread Moderator DXC=?]0h3fF7bJ?E@ZX[:2Fm`8C_A=>8kQj6=2f3;U>_oji9]j7bZ=BU6I: EFiONJ7[Go6eVl3o4BcSn< comp.soft-sys.math.mathematica:56259 you canÕt say that 3=33 this is nonsense and Mathematica donÕt like it, you can MapThread[Hold[{#1 == #2}] &, {Take [states, {3, 12, 2}], stim}] Jens ÒSwati ShahÓ schrieb im > Hi Everyone, > I have been working on the following problem: > states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, > 13, 14} > stim = {33, 44, 55, 66, 77} > The locations of state 3,5,7,9,11 to be equal > 33,44,55,66,77 > MapThread[{#1 = #2} &, {Take [states, {3, 12, > 2}], stim}] > I tried to the above but it gives me errors: > Set::setraw: Cannot assign to raw object 3 > However these work individually: > MapThread[#1 &, {Take [states, {3, 12, 2}], > stim}] > MapThread[ #2 &, {Take [states, {3, 12, 2}], > stim}] > Any ideas? newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!novia!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Partitioning a list from an index MathTensor, Inc. Moderator DXC=8DBan`0aGdX4JR]SmgOleWC_A=>8kQj6];[h;PUXBgbTW[m>13cG[: WEFiONJ7[GoV0_CB37=K\\;[ comp.soft-sys.math.mathematica:56231 > list1={1,2,3,4,5,6,7,8,9,10} >and i might want to split it to pairs or threes from index 6 for example, >sofor threes it will be > {1,2,{3,4,5},{6,7,8},9,10} >for pairs it will be > {1,{2,3},{4,5},{6,7},{8,9},10} If you want to ÔspreadÕ the partitioning from a \ point pos inside your list, IÕd suggest to work on two separate lists: the \ \[CapitalThorn]rst one, from the beginning to position pos-1 will have to be reversed. You can then apply Partition, with or without padding to each one of this lists. To obtain the above two results, you only need this procedure: PartitionAt[mylist_List, pos_Integer, dim_Integer] := Module[ {lista, listb, rem1, rem2, p1, p2, l = Length[mylist]}, lista = Take[mylist, pos - 1]; listb = Drop[mylist, pos - 1]; rem1 = Take[lista, Mod[pos - 1, dim]]; rem2 = Take[listb, -Mod[l - pos + 1, dim]]; p1 = Reverse[Reverse /@ Partition[Reverse[lista], dim]]; p2 = Partition[listb, dim]; Join[rem1, p1, p2, rem2] ] PartitionAt[{1,2,3,4,5,6,7,8,9,10},6,2] {1,{2,3},{4,5},{6,7},{8,9},10} PartitionAt[{1,2,3,4,5,6,7,8,9,10},6,3] {1,2,{3,4,5},{6,7,8},9,10} PartitionAt[{1,2,3,4,5,6,7,8,9,10},7,4] {1,2,{3,4,5,6},{7,8,9,10}} PartitionAt[{1,2,3,4,5,6,7,8,9,10},8,4] {1,2,3,{4,5,6,7},8,9,10} If you want to take advantage of the more advanced signatures of Partition youÕd have to modify the code to accept more parameters so that they can be passed to Partition acting on the two lists (this is easily done by adding an others___ argument in the call to PartitionAt, or by writing different procedured for the different signatures), and removing the lines that select and add the remnants of the list. In fact, if you use padding, you would not need to add the hangovers to your result. The code gets more complicated in this case, since Partition can have a lot of tweaks. This is an *untested* (and probably wrong) attempt PartitionAt[mylist_List, pos_Integer, dim_Integer, others___] := Module[ {lista, listb, p1, p2, l = Length[mylist]}, lista = Take[mylist, pos - 1]; listb = Drop[mylist, pos - 1]; p1 = Reverse[Reverse /@ Partition[Reverse[lista], dim, others]]; p2 = Partition[listb, dim, others]; Join[p1, p2] ] An evident problem with this approach is that overhanging would take place on each of the two lists, separatedly. But padding should work... cheers, Peltio Invalid address in reply-to. Crafty demunging required to mail me. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02. iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: bode diagram MathTensor, Inc. Moderator DXC=NZG^iE@OS6hnJ]SQJ40F_gC_A=>8kQj6m;[h;PUXBgbd; jPa7nMWN0eEFiONJ7[Gof0mBh1gbg6Nd comp.soft-sys.math.mathematica:56232 > hi, like plotting simple bode diagrams of systems. could you give > me some > information about it? i can do it with another program, but iÕd > like to see > how mathematica works > thank you HereÕs some simple code for making a Bode plot: gain[p_, q_, \\[Omega]_] := q/Sqrt[p^2*\\[Omega]^2 + (q - \\[Omega]^2)^2]; \\[Phi][p_, q_, \\[Omega]_] := ArcCos[(q - \\[Omega]^2)/Sqrt[p^2*\\[Omega]^2 + (q - \\[Omega]^2)^2]]; gainplot[p_, q_]:= Plot[20 Log[10, gain[p,q,10^x]], {x,-1,1}, PlotRange->All, AxesLabel -> {Ò\\!\\(log\\_10\\)\\[Omega]Ó, \ ÒGain (dB)Ó}]; angleplot[p_, q_] := Plot[\\[Phi][p, q, 10^x]/Degree, {x,-1,1}, PlotRange->All, AxesLabel -> {Ò\\!\\(log\\_10\\)\\[Omega]Ó, \ ÒPhase Angle (deg)Ó}, Ticks -> {Automatic, 30 Range[1, 6]}]; << ÒGraphics`Graphics`Ó BodePlot[p_, q_] := DisplayTogetherArray[{gainplot[p, q], angleplot [p, q]}, PlotLabel->ÓBode Plot ( \ p=Ó<>ToString[p]<>Ó, \ q=Ó<>ToString[q] <>Ó )Ó, Frame-> True, ImageSize -> 500]; BodePlot[.5, 5] (See http://library.wolfram.com/infocenter/Books/4855/) Selwyn Hollis www.appliedsymbols.com www.math.armstrong.edu/faculty/hollis newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: dsolve? MathTensor, Inc. Moderator DXC=NZG^iE@OS6Hk^S9D8kQj6M;[h;PUXBgbDW[m>13cG[: GEFiONJ7[GoFWSCT5=V2>0},Integrate[(P1*V1^k)/V^k,{V,V1,V2}]] Workaround 2: First[DSolve[{Derivative[1][W][V]==(P1*V1^k)/V^k},W,V]] First[Solve[W[V1]==0/.%,C[1]]] FullSimplify[W[V]/.%%/.%] -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: Representation and Simulation of Dynamic Systems MathTensor, Inc. Moderator DXC=NZG^iE@OS6XNEg=@eQK2QZC_A=>8kQj6];[h;PUXBgbT[` caKjchWRZEFiONJ7[GoVAd[TcebJQ^P comp.soft-sys.math.mathematica:56234 Hi Chris, First of all the topic here is Òlinear systems with time-varying coef\[CapitalThorn]cientsÓ. The response of such systems to \ deterministic signals can be computed with standard methods (e.g. NDSolve). If the input is stochastic (normally white noise) in the general case (non-linear systems) Monte Carlo techniques are generally used. But, in the special case of linear systems with time-varying coef\[CapitalThorn]cients, one can also perform a covariance analysis or use the method adjoints. In chapter 25 of the book: William S. Levine, Ed. The Control Handbook CRC Press coef\[CapitalThorn]cients with literature. Any book about the Kalman \[CapitalThorn]lter explains what covariances are and how they propagate. >-----Original Message----- >Cc: mathgroup@smc.vnet.net === >Subject: Re: Representation and Simulation of >Dynamic Systems >Dr. Caffa Vittorio, >Do you have a good link (http://....) that describes covariance >simulation and/or the method of adjoints? >> Chris, >> I have used as a toy example a dynamic system which happens to be linear >> with constant coef\[CapitalThorn]cients. Actually, I wanted to focus the discussion >> on non-linear dynamic systems. >> (As a special case, linear systems, possibly with non-constant >> coef\[CapitalThorn]cient, could be also analyzed with an extension of the method I am >> suggesting. Given the system description, one could for instance compute >> symbolically the matrices A(t), B(t), C(t), D(t). Then using the method >> of adjoints or a covariance simulation one could compute the system for >> example the system response to a stochastic input.) >> Actually the method I am suggesting is a surrogate of an interface into >> which one could place a block diagram. If such an interface were >> available I would probably do all my simulation work with Mathematica >> instead of using that-simulation-link-addition-which-must-not-be-named >> on that-mathematics-laboratory-program-which-must-not-be-named. >> >-----Original Message----- >> >Cc: mathgroup@smc.vnet.net === >> >Subject: Representation and Simulation of >Dynamic Systems >> > >> >It seems like you are solving systems with constant coef\[CapitalThorn]cients. >> > >> >The trickiest parts would be (a) designing an interface into which one >> >could place a block diagram and (b) having Mathematica interpret that >> >diagram. >> > >> >If you could do that, control system professional can probably do >> >whatever else you might need ... >> > >> >http://library.wolfram.com/examples/CSPExtending/ >> > >> >Does anyone know if there is a good bond graph or block diagram >> >ÓpackageÓ available for Mathematica? >> > >> >I would really like to see the equivalent of >> >that-simulation-link-addition-which-must-not-be-named on >that-mathematics-laboratory-program-which-must-not-be-named for >> >Mathematica. >> > >> > >> >> The behavior of (time-continuous, non-linear) dynamic systems can be >> >> numerically investigated with NDSolve. One can \[CapitalThorn]rst sketch a block >> >> diagram of the system and then convert it into equations. Here is a >> toy >> >> example after the conversion: >> >> >> >> posÕ[t] = vel[t] >> >> velÕ[t] = -k pos[t] + force[t] / m >> >> >> >> This works \[CapitalThorn]ne if the variables are all states, as in the example >> >> above. But often, in order to describe a given dynamic system you >> want >> >> or you have to introduce some auxiliary variables (i.e. variables >> which >> >> are not states). This is in fact the case if you want to describe a >> >> generic dynamic system. Here are the standard equations: >> >> >> >> xÕ[t] = f[x[t], u[t], t] (state equations) >> >> y[t] = g[x[t], u[t], t] (output equations) >> >> >> >> where: x = state vector, u = input vector, y = output vector, t = >> time. >> >> In this case the components of the output vector are the ÒauxiliaryÓ >> >> variables. >> >> >> >> IÕm considering here a scheme for representing dynamic systems >> (possibly >> >> using a block diagram as a starting point) which allows the usage of >> >> auxiliary variables. This representation can be transformed into >> >> equations for NDSolve automatically. After having solved the >> equations >> >> it is possible to inspect not only the state variables but also the >> >> auxiliary variables. >> >> >> >> Comments or alternative solutions to the problem IÕm considering are >> >> welcome! >> >> >> >> Procedure >> >> >> >> o) Sketch the system on a piece of paper. Here is a toy example: >> >> >> >> ---------- [ -k ] --------- >> >> | | >> >> V | >> >> force[t] --> [ 1/m ] --> + --> [ 1/s ] ---> [ 1/s ] ---> pos[t] >> >> | | >> >> | --------------> vel[t] >> >> | >> >> ---------------------------> acc[t] >> >> >> >> Note: [ 1/s ] is an integrator block >> >> [ k ] is a gain block >> >> >> >> o) Convert the sketch into a system description: >> >> >> >> In[1]:= sys = {posÕ[t] -> vel[t], >> >> velÕ[t] -> acc[t], >> >> acc[t] -> -k pos[t] + force[t] / m}; >> >> >> >> Note: the arrow points to the source of the signal. >> >> >> >> o) Make a list of the state variables: >> >> >> >> In[2]:= states = {pos[t], vel[t]}; >> >> >> >> o) Form the differential equations (the following steps could be >> >> performed by a function): >> >> >> >> In[3]:= lhs = D[states, t] >> >> >> >> Out[3]= {posÕ[t], velÕ[t]} >> >> >> >> In[4]:= rhs = D[states, t] //. sys >> >> >> >> force[t] >> >> Out[4]= {vel[t], -------- - k pos[t]} >> >> m >> >> >> >> In[5]:= eqns = Join[Thread[lhs == rhs], {pos[0] == pos0, vel[0] == >> >> vel0}] >> >> >> >> force[t] >> >> Out[5]= {posÕ[t] == vel[t], velÕ[t] == \ -------- - k pos[t], pos[0] == >> >> pos0, >> >> m >> >> vel[0] == vel0} >> >> >> >> o) Specify the parameters: >> >> >> >> In[6]:= params = {m -> 10, k -> 2, pos0 -> 0, vel0 -> 0, force[t] >> >> Sin[t]}; >> >> >> >> o) Solve the differential equations: >> >> >> >> In[7]:= sol = First[NDSolve[eqns /. params, states, {t, 0, 10}]] >> >> >> >> Out[7]= {pos[t] -> InterpolatingFunction[{{0., 10.}}, <>][t], >> >> >> >> vel[t] -> InterpolatingFunction[{{0., 10.}}, <>][t]} >> >> >> >> o) Inspect the results (including auxiliary variables) >> >> >> >> In[8]:= Plot[pos[t] /. sol, {t, 0, 10}] >> >> >> >> Out[8]= -Graphics- >> >> >> >> In[9]:= Plot[acc[t] //. sys /. params /. sol, {t, 0, 10}] >> >> >> >> Out[9]= -Graphics- >> >> >> >> >> >> -------------------------------------------- >> >> Dr.-Ing. Vittorio G. Caffa >> >> IABG mbH >> >> Abt. VG 32 >> >> Einsteinstr. 20 >> >> 85521 Ottobrunn / Germany >> >> >> >> Tel. (089) 6088 2054 >> >> Fax: (089) 6088 3990 >> >> E-mail: caffa@iabg.de >> >> Website : www.iabg.de >> >> -------------------------------------------- >> >> >> >> >> > >> > >> >-- >> >Chris Chiasson >> >http://chrischiasson.com/ >> >1 (810) 265-3161 >Chris Chiasson >http://chrischiasson.com/ >1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net! news-xfer.cox.net!peer01.cox.net!cox.net!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Crossing of 3D functions Moderator DXC=1O[[V=\\cMVgfMDbMQQNgfbC_A=>8kQj6m;[h;PUXBgbdW[m>13cG[: gEFiONJ7[GofI;W3R?kT2Fd comp.soft-sys.math.mathematica:56237 Hi Pawel, see below. > Hello > I have two functions of surfaces > F1=\\!\\(\\(-7.516\\)*\\ > Exp[\\(-3.076\\)*\\((r - 1.184)\\)]*\\((1 - > 8.28*10\\^\\(-5\\)*\\((180\\ - \\ f)\\)\\^2)\\)*0.7\\^0.5 + > 3.758*Exp[\\(-6.152\\)*\\((r - 1.184)\\)] + 3.92\\) > and > F2=\\!\\(\\(-0.958\\)*\\ Exp[\\(-4.993\\)*\\((r - 1.375)\\)]*\\((1 - \\ > 1.07*10\\^\\(-3\\)*\\((133\\ - \\ f)\\)\\^2)\\)*1\\^0.5 + 0.479* > Exp[\\(-9.986\\)*\\((r - 1.375)\\)] + 0.479\\) > variables are r and f > I want to \[CapitalThorn]nd a plot which describes crossing of these functions. First load the package: Graphics`ImplicitPlot` Then the following will plot the crossing: ImplicitPlot[F1[r, f] == F2[r, f], {r, -1, 2}, AspectRatio -> 1/GoldenRatio] > I tried Solve command but without any success > I also tried a simpler example > Fa=Exp[-(x^2 + y^2)] > and > Fb=0.5 > and when I used > Solve[Fa == Fb, {y}] > I received y1 and y2 - two parts of wanted function > How to obtain one function (circle) from the above Fa nad Fb? The circle has two branches,one above the x-axis, the other below. Therefore it is not possible to specify y[x] as a single valued function of x, you have to live with two functions. > Please Help > Pawel newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01. iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Crossing of 3D functions Moderator DXC=5lb>8kQj6=;[h;PUXBgb4W[m>13cG[: 7EFiONJ7[Go6H]=KhlET9V? comp.soft-sys.math.mathematica:56235 > Hello > I have two functions of surfaces > F1=\\!\\(\\(-7.516\\)*\\ > Exp[\\(-3.076\\)*\\((r - 1.184)\\)]*\\((1 - > 8.28*10\\^\\(-5\\)*\\((180\\ - \\ f)\\)\\^2)\\)*0.7\\^0.5 + > 3.758*Exp[\\(-6.152\\)*\\((r - 1.184)\\)] + 3.92\\) > and > F2=\\!\\(\\(-0.958\\)*\\ Exp[\\(-4.993\\)*\\((r - 1.375)\\)]*\\((1 - \\ > 1.07*10\\^\\(-3\\)*\\((133\\ - \\ f)\\)\\^2)\\)*1\\^0.5 + 0.479* > Exp[\\(-9.986\\)*\\((r - 1.375)\\)] + 0.479\\) > variables are r and f > I want to \[CapitalThorn]nd a plot which describes crossing of these functions. > I tried Solve command but without any success > I also tried a simpler example > Fa=Exp[-(x^2 + y^2)] > and > Fb=0.5 > and when I used > Solve[Fa == Fb, {y}] > I received y1 and y2 - two parts of wanted function > How to obtain one function (circle) from the above Fa nad Fb? > Please Help > Pawel One idea is to use NDSolve to generate interpolating function solutions to your problem. Simply differentiate your problem, and then integrate using NDSolve with the appropriate initial conditions. You mention that you want one function encompassing the entire curve, and one way to achieve this is to parametrize your curve in terms of the arc length of the curve. That is, the answer will be {x[s],y[s]} where x[s] and y[s] are functions of the arc length. I will work with your simpler example. Let g[x_,y_]:= Exp[ -(x^2+y^2)] - 0.5 so that you are interested in solving g[x,y]==0. One of the equations needed by NDSolve is found by expressing x and y as x[s] and y[s], where s is the arc length, and differentiating g[x[s],y[s]]. The second equation is simply the arc length equation dx^2+dy^2=ds^2, or xÕ[s]^2+yÕ[s]^2==1. We use NDSolve as follows: curve=NDSolve[ {D[g[x[s],y[s]],s]==0, xÕ[s]^2+yÕ[s]^2==1, x[0]==(-Log[0.5])^(1/2), y[0]==0}, {x,y},{s,0,5} ]; NDSolve will return 2 solutions, one moving along the curve clockwise and one moving counterclockwise. For the initial conditions, I plugged in the point where y is zero (and so x is a somewhat ugly function of Log[0.5]). You may need to play with the endpoint of NDSolve, which is 5 in the above example, to get the full curve you are interested in. We can see how the answer looks by using ParametricPlot: ParametricPlot[Evaluate[{x[s],y[s]}/.curve[[1]]], {s,0,5}] If you plug the above into Mathematica you will see a circle missing a small arc at the end, since the perimeter of the circle is a bit larger than 5. For your problem, you will just need to de\[CapitalThorn]ne g[r_,f_]:=F1-F2, and \[CapitalThorn]nd one of the points on the curve to use as an initial condition. Carl Woll newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!wn13feed! worldnet.att.net!64.12.151.226!ngpeer.news.aol.com! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: Crossing of 3D functions MathTensor, Inc. Moderator DXC=2EU0m2TgJ@mfMDbMQQNgfbC_A=>8kQj6m;[h;PUXBgbdW[m>13cG[: gEFiONJ7[Go\[CapitalThorn]G0Fo@Mcj4i comp.soft-sys.math.mathematica:56226 Can you post your code in Òinput formÓ? > Hello > I have two functions of surfaces > F1=\\!\\(\\(-7.516\\)*\\ > Exp[\\(-3.076\\)*\\((r - 1.184)\\)]*\\((1 - > 8.28*10\\^\\(-5\\)*\\((180\\ - \\ f)\\)\\^2)\\)*0.7\\^0.5 + > 3.758*Exp[\\(-6.152\\)*\\((r - 1.184)\\)] + 3.92\\) > and > F2=\\!\\(\\(-0.958\\)*\\ Exp[\\(-4.993\\)*\\((r - 1.375)\\)]*\\((1 - \\ > 1.07*10\\^\\(-3\\)*\\((133\\ - \\ f)\\)\\^2)\\)*1\\^0.5 + 0.479* > Exp[\\(-9.986\\)*\\((r - 1.375)\\)] + 0.479\\) > variables are r and f > I want to \[CapitalThorn]nd a plot which describes crossing of these functions. > I tried Solve command but without any success > I also tried a simpler example > Fa=Exp[-(x^2 + y^2)] > and > Fb=0.5 > and when I used > Solve[Fa == Fb, {y}] > I received y1 and y2 - two parts of wanted function > How to obtain one function (circle) from the above Fa nad Fb? > Please Help > Pawel -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: Crossing of 3D functions Moderator DXC=L7NZ6@\\P]7?WV@`bFQ>LQ9C_A=>8kQj6=;[h;PUXBgb4[`caKjchWR: EFiONJ7[Go6Yg schrieb im > Hello > I have two functions of surfaces > F1=\\!\\(\\(-7.516\\)*\\ > Exp[\\(-3.076\\)*\\((r - 1.184)\\)]*\\((1 - > 8.28*10\\^\\(-5\\)*\\((180\\ - \\ > f)\\)\\^2)\\)*0.7\\^0.5 + > 3.758*Exp[\\(-6.152\\)*\\((r - 1.184)\\)] + > 3.92\\) > and > F2=\\!\\(\\(-0.958\\)*\\ Exp[\\(-4.993\\)*\\((r - > 1.375)\\)]*\\((1 - \\ > 1.07*10\\^\\(-3\\)*\\((133\\ - \\ f)\\)\\^2)\\)*1\\^0.5 + > 0.479* > Exp[\\(-9.986\\)*\\((r - 1.375)\\)] + > 0.479\\) > variables are r and f > I want to \[CapitalThorn]nd a plot which describes crossing > of these functions. > I tried Solve command but without any success > I also tried a simpler example > Fa=Exp[-(x^2 + y^2)] > and > Fb=0.5 > and when I used > Solve[Fa == Fb, {y}] > I received y1 and y2 - two parts of wanted > function > How to obtain one function (circle) from the > above Fa nad Fb? > Please Help > Pawel newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01. iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Folding Deltas, and evaluation scheme of Mathematica MathTensor, Inc. Moderator DXC=IOk9:nQC_A=>8kQj6];[h;PUXBgbTW[m>13cG[: WEFiONJ7[GoVcdYga8Z12Z\\ comp.soft-sys.math.mathematica:56239 > I can not agree with you. > Integrate[1/x, {x, 1, In\[CapitalThorn]nity}] is In\[CapitalThorn]nity, > and Integrate[1/x, {x, In\[CapitalThorn]nity, 1}] = - Integrate[1/x, {x, 1, In\[CapitalThorn]nity}] = > - In\[CapitalThorn]nity. > These are true. > But before evaluate Integrate[1/x, {x, 1, In\[CapitalThorn]nity}] - Integrate[1/x, {x, > In\[CapitalThorn]nity, 1}] > = In\[CapitalThorn]nity - In\[CapitalThorn]nity, the following rules can \ be applied: > (* this comes from the de\[CapitalThorn]nition of de\[CapitalThorn]nite \ integral*) > Integrate[exp_, {x_, a_, b_}] := - Integrate[exp, {x, b, a}] /; a > b; > Subtract[exp_, exp_] = 0; These rules apply when values in question are \[CapitalThorn]nite. In other cases you have what are generally referred to as Òindeterminate \ formsÓ. Often one can obtain a desired value as a principal value integral, wherein the singular part is cancelled by introducing a dependency into a pair of limits. > Sadly, Mathematica will not apply the second rule at \[CapitalThorn]rst and it will do > the de\[CapitalThorn]nite integral at \[CapitalThorn]rst. > In my opinion, if Mathematica apply the rule ÒSubtract[exp_, exp_] = 0Ó > before evaluate > exp will free you from applying limit wrappers to improper integrals. > More generally, for some functions, such as Subtract, Plus, Times, Power, > before evaluate their parameters > some rule should be applied if possible. for example: > Plus[exp_, exp_] := 2 a; Times[0, exp_] := 0; > This is just what Òhuman beingsÓ do when \ simplify expression. :) Much of this is already done in Mathematica evaluation of Plus and Times. An attempt is made to not do such things when an indeterminate form is present, because in such cases these \ Òsimpli\[CapitalThorn]cationsÓ are plain wrong. There is a good deal of folklore and some published literature in the computer algebra community on how these can be incorrect, along with (often conßicting) opinions on how and when to avoid such simpli\[CapitalThorn]cations. > gauerkk@uregina.c > cc: === > 05, 11, 2005 Subject: Re: Folding Deltas > Recently reading the mathgroup postings, I saw you post below a > generalization which seems to be false. > Quoting Zhengji Li : >>.............. >>But, Integrate[Anything, {t, a, b}] + Integrate[Anything, {t, b, a}] >>0, so you will get the result. > set Anything -> 1/x, a -> 1, b -> In\[CapitalThorn]nity. My understanding is that > In\[CapitalThorn]nity-In\[CapitalThorn]nity does not evaluate without a \ warning message, and > instead does not vanish, as you indicate (compare to the other > standard improper integral used for calculating the volume of the Horn > of Gabriel, Anything -> 1/x^2, where this time, the differences are > equal and \[CapitalThorn]nite (and also zero), although the intgrals are improper, > as below - in the original question). > Of course, instead choosing b -> k (a \[CapitalThorn]xed \ \[CapitalThorn]nite real), others as > above, and running Limit[Integrate[Anything, {t, a, b}] + Integrate > [Anything, {t, b, a}], k -> In\[CapitalThorn]nity] instead should return zero (for > most evaluatable functions, excluding Cantor and DiracDelta functions > which leap around on a semi-in\[CapitalThorn]nite box). As posed (if I follow correctly) this may well be an indeterminate form. There are lurking issues of language semantics that cannot and should not be ignored. For a linear operator Op, we have on the one hand Op[a+b] and on the other hand Op[a]+Op[b]. The standard Mathematica semantics for the \[CapitalThorn]rst says to add a and b before applying Op, and for the second we allpy to each separately and then add the results. I would guess this is the interpretation used by most programs. It is, to me, the one that makes the most sense. I will also mention that there is a certain amount of voodoo behind the scenes. Some integrals are evaluated by splitting sums, but in cases when singularities cancel this can be dif\[CapitalThorn]cult to do correctly. > I personally always try to apply a limit wrapper to any improper > integral which I may have to evaluate in version 3, and \[CapitalThorn]rst operate > symbolically on my limit in question, followed by, only if necessary, > the numerical evaluation. I wonder if theyÕd \ \[CapitalThorn]xed in v 5 yet the > capability of calculating limits from multiple directions. My guess is > probably not, based on a reply to one of the archives messages, circa > last decade. > [...] IÕm not sure exactly what is the issue here. At points where a function is not analytic, limits are dependent on path of approach. If one wants limit values along rays from different directions one can certainly do that in Mathematica. Daniel Lichtblau Wolfram Research newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!cyclone1.gnilink.net!gnilink.net!newsfeed3. dallas1.level3.net!news.level3.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: calculate de Jong function MathTensor, Inc. Moderator DXC=IOk8kQj6m;[h;PUXBgbd1T[9j> ECT1nEFiONJ7[Gof:YZ^P3dADZo comp.soft-sys.math.mathematica:56240 Hi! f[x_List] := Sum[x[[i]]^2, {i, 1, Length[x]}] or f[x_List] := Plus@@x^2 since Powers are Listable On Wed, 11 May 2005 05:24:54 -0400 (EDT) Stefan Schuster > I donÕt know how I should implement the \[CapitalThorn]rst \ de jong function: > f(x)=Sum((x_i)^2) > where x is a Vector with n dimensions and x_i is the value of the i-th > Dimension. > i.e. all Values of the Vector are squared and added. > My problem is that I donÕt know how many Dimensions there are, so I > canÕt de\[CapitalThorn]ne the borders of the SUM function. > Stefan -- Christoph Lhotka -- University of Vienna Institute for Astronomy newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!novia!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: ok. How to resolve? MathTensor, Inc. Moderator DXC=LK5B5Ui>2aIVS1USibAf`FC_A=>8kQj6M;[h;PUXBgbD1T[9j> ECT1NEFiONJ7[GoFTfnJk9Vf99D comp.soft-sys.math.mathematica:56241 > I donÕt know about other version, but the following makes me worried: > In[1]:= Limit[ArcTan[1/x],x->0]==Limit[ArcTan[1/x],x->0,Direction->-1] > Out[1]= > True > In[2]:= Limit[ArcTan[1/x],x->0]==Limit[ArcTan[1/x],x->0,Direction->1] > Out[2]= > False > In[3]:= > $Version > Out[3]= > IsnÕt there a requirement that the right and left limits match before > a limit exists? In mathematics, for the bilateral limit to exist, yes. But Mathematica has no bilateral (or omnidirectional) limit. The documentation is deceptive (although, of course, not purposefully so). This regrettable matter has been brought up repeatedly in this newsgroup. HereÕs a link to a response by Daniel Lichtblau in one such thread: comp.soft-sys.math.mathematica/msg/25c0f5767d75ef2f?hl=en> Of course, it will continue to be brought up until adequately noticeable documentation is provided. In any event, note that In[100]:= Options[Limit] Out[100]= {Analytic -> False, Assumptions -> $Assumptions, Direction -> Automatic} In[101]:= ?Direction Direction is an option for Limit. Limit[expr, x -> x0, Direction -> 1] computes the limit as x approaches x0 from smaller values. Limit[expr, x -> x0, Direction -> -1] computes the limit as x approaches x0 from larger values. Direction -> Automatic uses Direction -> -1 except for limits at In\[CapitalThorn]nity, where it is equivalent to Direction -> 1. But even that documentation is still incomplete: What is the default direction if x0 happens not to lie on the extended real line? David Cantrell newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!novia! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: another image problem MathTensor, Inc. Moderator DXC=LK5B5Ui>2aY4JR]SmgOleWC_A=>8kQj6];[h;PUXBgbT]NlFZ= GKZBWEFiONJ7[GoVl\\A1LjF1DfP comp.soft-sys.math.mathematica:56242 >LetÕs say you have a picture of two overlapping graphs. >You donÕt have the equations that generated them. but you know the >graphs is relatively accurate. for example, >http://pg.photos.yahoo.com/ph/sean_incali/detail?.dir=/9264& .dnm=191b.jpg&.src=ph >Now... letÕs say you wanted to \[CapitalThorn]nd the area \ under curve for both >curves (blue and green) between certain x values... >for example, 425nm <= x <= 475nm , and then 500nm <= x <= 550nm, and >then 525nm <= x <= 575nm. >is this doable in Mathematica? >sean Hi Sean, IÕm a relative novice with Mathematica, so this may be complete rubbish! Apologies if it is. What I have done is to crop the graph in Adobe Photoshop at the origin {400,0}. Then I have thresholded each channel (RGB) to give pure green and cyan on a white background and save as a TIFF \[CapitalThorn]le (graph.tif). Then I run the following code: graph = Import[ÒC:\\\\Documents and Settings\\\\Mark\\\\Desktop\\\\graph.tifÓ]; Show[graph, Frame -> True] data = Position[graph[[1, 1]], {0, 255, 0}]; (*{0, 255, 0} for green; {0, 255, 255} for cyan*) maxy = Max[data /. {x_, y_} -> y]; maxx = Max[data /. {x_, y_} -> x]; \[CapitalThorn]t = Cases[Mean /@ Table[Cases[data, {x_, i}], {i, maxy}], {x_, y_}]; int = ListInterpolation[\[CapitalThorn]t, {{1, maxy}, {1, maxx}}]; data\[CapitalThorn]t = Table[int[i, 1], {i, maxy}] // N; ListPlot[data\[CapitalThorn]t] origin = 400; Plus @@ Take[data\[CapitalThorn]t, {500 - origin, 550 - origin}] I hope this is what you are after. Best wishes, Mark newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news.maxwell.syr.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: another image problem MathTensor, Inc. Moderator DXC=ZUQbcbO8i7@N>O;:SV[lhFC_A=>8kQj6M;[h;PUXBgbD[` caKjchWRJEFiONJ7[GoF=eh8;`4E comp.soft-sys.math.mathematica:56228 Yea... One of the easiest ways is: Knowing the (x,y) size of the graph in pixels, convert pixel lengths to x and y scales. Paste the picture into Mathematica. Make sure the picture is selected, the border will have dotted lines if that is true. If it \ isnÕt selected, click on it once. Now press down the CTRL key. Follow one of the lines with the mouse, clicking at regular intervals. Release the CTRL key. Choose Edit - Copy. Click in an empty notebook area. Choose Edit - Paste. You will see a list of points. It is up to you to convert these pixel locations into the functionÕs domain and range. After that you might interpolate the list of points so that you can plot or integrate them. The other curve may be treated in the same manner. > LetÕs say you have a picture of two overlapping graphs. > You donÕt have the equations that generated them. but you know the > graphs is relatively accurate. for example, http://pg.photos.yahoo.com/ph/sean_incali/detail?.dir=/9264&. dnm=191b.jpg&.src=ph > Now... letÕs say you wanted to \[CapitalThorn]nd the area \ under curve for both > curves (blue and green) between certain x values... > for example, 425nm <= x <= 475nm , and then 500nm <= x <= 550nm, and > then 525nm <= x <= 575nm. > is this doable in Mathematica? > sean -- Chris Chiasson http://chrischiasson.com/ 1 (810) 265-3161 newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!novia!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: another image problem Moderator DXC=W\\n8b7X0JR[SG_F;W?K`2YC_A=>8kQj6];[h;PUXBgbTW[m>13cG[: WEFiONJ7[GoV1VakoM9>PWV comp.soft-sys.math.mathematica:56218 mak a interpolation function form the data, NIntegrate/Integrate it and search the intersections of the interpolation functions. Jens Òsean_incaliÓ schrieb \ im > LetÕs say you have a picture of two overlapping > graphs. > You donÕt have the equations that generated > them. but you know the > graphs is relatively accurate. for example, http://pg.photos.yahoo.com/ph/sean_incali/detail?.dir=/9264&. dnm=191b.jpg&.src=ph > Now... letÕs say you wanted to \[CapitalThorn]nd the area > under curve for both > curves (blue and green) between certain x > values... > for example, 425nm <= x <= 475nm , and then > 500nm <= x <= 550nm, and > then 525nm <= x <= 575nm. > is this doable in Mathematica? > sean newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!novia! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: ArcTan[1/0] no result, but ArcTan[In\[CapitalThorn]nity] ok. How to resolve? MathTensor, Inc. Moderator DXC=P3NFVPBm8kQj6=;[h;PUXBgb4[`caKjchWR: EFiONJ7[Go6:?mnScD=`U= comp.soft-sys.math.mathematica:56243 1 / 0 gets rightly : ÔIn\[CapitalThorn]nite \ expressionÕ. In fact that rapresentation is symbolically entered in Math as ÔIn\[CapitalThorn]nityÕ. So, if you want to write 1/0 you have just to enter In\[CapitalThorn]nity symbol. Otherwise, if you have an expression like 1/x and calculate Limit[ArcTan[1/x],x->0] you get Pi/2, as you expected. ~Scout~ ÒsteveÓ ha scritto nel \ messaggio > hi; > Mathematica 5.1, on windows. > ArcTan[1/0] gives an error but > ArcTan[In\[CapitalThorn]nity] gives the correct answer. > One way to make ArcTan[1/0] give Pi/2 is to > write it as ArcTan[0,1]. > I do know that 1/0 is DirectedIn\[CapitalThorn]nity[] with > unknown direction while In\[CapitalThorn]nity is > DirectedIn\[CapitalThorn]nity[1], and that is probably the > reason that ArcTan[1/0] gives an error > but ArcTan[In\[CapitalThorn]nity] does not. > I am asking is how to make 1/0 result in DirectedIn\[CapitalThorn]nity[1] > to avoid the error? is this possible? > What function do I need to wrap 1/0 with to > cause it to become In\[CapitalThorn]nity[1] instead of > In\[CapitalThorn]nity[] ? or may be I need to \[CapitalThorn]gure how > to detect if a division results in In\[CapitalThorn]nity[] > and convert that to In\[CapitalThorn]nity[1]? do I need > to red\[CapitalThorn]ne 1/0 somehow? may be make a new > rule to say if Mathematica see 1/0 expression then > make it In\[CapitalThorn]nity[1]? but may be this will screw > other things? > Or may I should not mess with this stuff and > just change the code to ArcTan[x,y] instead of > ArcTan[y/x] and be happy? > Steve newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news.maxwell.syr.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: NIntegrate-FindRoot acting up in version 5.1 MathTensor, Inc. Moderator DXC=P3NFVPBm8kQj6M;[h;PUXBgbDW[m>13cG[: GEFiONJ7[GoF[;ooeX1BG_K comp.soft-sys.math.mathematica:56244 Deliberately leaving out ÒfnaxÓ makes it \ dif\[CapitalThorn]cult for us to debug your code. Beyond that, it appears that z, v, c, and r are also unde\[CapitalThorn]ned. All of them have to be numeric, as FindRoot and NIntegrate are purely numeric functions. We canÕt tell whether you left their assignments out of the post, or you left one or more of them out of your NOTEBOOK. Since you say the code ran in 4.1.1 (not with those omissions, though), itÕs quite possible you need Evaluate wrapped around the \[CapitalThorn]rst argument of FindRoot, NIntegrate, or both. And you may need to de\[CapitalThorn]ne things in a couple of steps, something like: Clear[len, f] len[z_?NumericQ, ang_?NumericQ, b_?NumericQ] = Sqrt[z^2 + (x Cos[ang] + r Sin[ b])^2 + (-r Cos[b] - x Sin[ang])^2]; f[z_?NumericQ, ang_?NumericQ] := (beta = b /. FindRoot[len[z, ang, b] == c b r/v, {b, 0}, WorkingPrecision -> 100, AccuracyGoal 80]; fnax) speed = NIntegrate[f[z, ang], {ang, 0, 3Pi/2, 2Pi}, WorkingPrecision -> \\ 80, AccuracyGoal -> 9] In version 5, itÕs sometimes more important to prevent non-numeric evaluation, and thatÕs what the patterns above accomplish. Bobby On Wed, 11 May 2005 05:23:58 -0400 (EDT), John Roberts > I originally made the input shown below in Mathematica 4.1.1. Version > 4.1.1 ran it ßawlessly and always produced the correct result from > NIntegrate with no warnings or error messages. Now, when I run the same > notebook with version 5.1.0 it crashes and gives the ÒFindRoot: :nlnumÓ > message shown below: > In1: len = Sqrt[ (z^2 + (x Cos[ang] + r Sin[b] )^2 + (-r Cos[b] - x > Sin[ang])^2 ] ; > In2: speed = NIntegrate[ (eqn = FindRoot[ len == c b r / v, {b, > 0}, WorkingPrecision->100, > AccuracyGoal->80 ] ; beta = b /. eqn; fnax) , {ang, 0, > 3Pi/2, 2Pi}, WorkingPrecision->80, AccuracyGoal->9 ] > Out2: FindRoot: :nlnum : The function value {0. + Sqrt[0.0172266 + (0. + > 0.05 <<1>>)^2 + (-0.125 - 0.05 Sin[<<1>>])^2] > is not a list of numbers with dimensions {1} at {b} = {0.}. > As can be seen from the input shown above, NIntegrate integrates the > expression fnax with respect to the angle ang. But fnax is also a > function of the initial angle beta or b (beta = b), so each time > NIntegrate calculates the value of fnax it must \[CapitalThorn]rst use FindRoot to > \[CapitalThorn]nd the value of beta that corresponds to the value of ang that it is > using. I did not include the expression for fnax here because it is > rather large, but there is nothing exotic about fnax, it is just a lot > of terms with Sin and Cos functions. > All of the values z, x, r, c v are input with 120 decimal places of > precision or with in\[CapitalThorn]nite precision (no decimal point). > It should also be noted that I checked the FindRoot part alone (without > NIntegrate) at various points along the range of integration from ang > = 0 to ang = 2 Pi, and FindRoot got the correct value of beta at > every point with no warnings or error messages; so the problem appears > to be associated with how NIntegrate uses FindRoot in Mathematica 5.1 > rather than with FindRoot itself. > John R. -- DrBob@bigfoot.com newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: NIntegrate-FindRoot acting up in version 5.1 MathTensor, Inc. Moderator DXC=1O[[V=\\cMV7G9T[HIVmA74C_A=>8kQj6=;[h;PUXBgb4W[m>13cG[: 7EFiONJ7[Go6aL_]99?_>Q? comp.soft-sys.math.mathematica:56238 Your problem might be solved if you de\[CapitalThorn]ne a function, like fang[ang_?NumberQ]:= (eqn = FindRoot[ len == c b r / v, {b, 0}, WorkingPrecision->100, AccuracyGoal->80 ] ; beta = b /. eqn; fnax) and use the command NIntegrate[fang[ang], {ang, 0, 3Pi/2, 2Pi}, WorkingPrecision->80, AccuracyGoal->9 ] I hope this will work (canÕt say without the actual inputs). Anton Antonov, Wolfram Research, Inc. > I originally made the input shown below in Mathematica 4.1.1. Version > 4.1.1 ran it ßawlessly and always produced the correct result from > NIntegrate with no warnings or error messages. Now, when I run the same > notebook with version 5.1.0 it crashes and gives the ÒFindRoot: :nlnumÓ > message shown below: > In1: len = Sqrt[ (z^2 + (x Cos[ang] + r Sin[b] )^2 + (-r Cos[b] - x > Sin[ang])^2 ] ; > In2: speed = NIntegrate[ (eqn = FindRoot[ len == c b r / v, {b, > 0}, WorkingPrecision->100, > AccuracyGoal->80 ] ; beta = b /. eqn; fnax) , {ang, 0, > 3Pi/2, 2Pi}, WorkingPrecision->80, AccuracyGoal->9 ] > Out2: FindRoot: :nlnum : The function value {0. + Sqrt[0.0172266 + (0. + > 0.05 <<1>>)^2 + (-0.125 - 0.05 Sin[<<1>>])^2] > is not a list of numbers with dimensions {1} at {b} = {0.}. > As can be seen from the input shown above, NIntegrate integrates the > expression fnax with respect to the angle ang. But fnax is also a > function of the initial angle beta or b (beta = b), so each time > NIntegrate calculates the value of fnax it must \[CapitalThorn]rst use FindRoot to > \[CapitalThorn]nd the value of beta that corresponds to the value of ang that it is > using. I did not include the expression for fnax here because it is > rather large, but there is nothing exotic about fnax, it is just a lot > of terms with Sin and Cos functions. > All of the values z, x, r, c v are input with 120 decimal places of > precision or with in\[CapitalThorn]nite precision (no decimal point). > It should also be noted that I checked the FindRoot part alone (without > NIntegrate) at various points along the range of integration from ang > = 0 to ang = 2 Pi, and FindRoot got the correct value of beta at > every point with no warnings or error messages; so the problem appears > to be associated with how NIntegrate uses FindRoot in Mathematica 5.1 > rather than with FindRoot itself. > John R. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: NIntegrate-FindRoot acting up in version 5.1 MathTensor, Inc. Moderator DXC=5lb>D9?]MBC_A=>8kQj6M;[h;PUXBgbDW[m>13cG[: comp.soft-sys.math.mathematica:56236 > I originally made the input shown below in Mathematica 4.1.1. Version > 4.1.1 ran it ßawlessly and always produced the correct result from > NIntegrate with no warnings or error messages. Now, when I run the same > notebook with version 5.1.0 it crashes and gives the ÒFindRoot: :nlnumÓ > message shown below: > In1: len = Sqrt[ (z^2 + (x Cos[ang] + r Sin[b] )^2 + (-r Cos[b] - x > Sin[ang])^2 ] ; > In2: speed = NIntegrate[ (eqn = FindRoot[ len == c b r / v, {b, > 0}, WorkingPrecision->100, > AccuracyGoal->80 ] ; beta = b /. eqn; fnax) , {ang, 0, > 3Pi/2, 2Pi}, WorkingPrecision->80, AccuracyGoal->9 ] > Out2: FindRoot: :nlnum : The function value {0. + Sqrt[0.0172266 + (0. + > 0.05 <<1>>)^2 + (-0.125 - 0.05 Sin[<<1>>])^2] > is not a list of numbers with dimensions {1} at {b} = {0.}. > As can be seen from the input shown above, NIntegrate integrates the > expression fnax with respect to the angle ang. But fnax is also a > function of the initial angle beta or b (beta = b), so each time > NIntegrate calculates the value of fnax it must \[CapitalThorn]rst use FindRoot to > \[CapitalThorn]nd the value of beta that corresponds to the value of ang that it is > using. I did not include the expression for fnax here because it is > rather large, but there is nothing exotic about fnax, it is just a lot > of terms with Sin and Cos functions. > All of the values z, x, r, c v are input with 120 decimal places of > precision or with in\[CapitalThorn]nite precision (no decimal point). > It should also be noted that I checked the FindRoot part alone (without > NIntegrate) at various points along the range of integration from ang > = 0 to ang = 2 Pi, and FindRoot got the correct value of beta at > every point with no warnings or error messages; so the problem appears > to be associated with how NIntegrate uses FindRoot in Mathematica 5.1 > rather than with FindRoot itself. > John R. I got identical garbage in 4.1 and 5.1. Which is as I would expect, because the code is attempting numerical algorithms on nonumerical data. Even with values for the parameters noted, it is not clear what fnax should be. (Moral: Post the code you actually used.) Here is a way to do this that might be what you have in mind. It gives the same numerical result in both versions. SeedRandom[1111]; {c,x,r,v,z} = Table[Random[Integer,{1,100}], {5}]; len = Sqrt[z^2 + (x*Cos[ang] + r*Sin[b])^2 + (-r*Cos[b] - x*Sin[ang])^2]; integrand[ang_?NumberQ] := b /. FindRoot[len == c*b*r/v, {b,0}, WorkingPrecision->100, AccuracyGoal->80] NIntegrate[integrand[ang], {ang,0,3*Pi/2,2*Pi}, WorkingPrecision->80, AccuracyGoal->9] Depending on parameter values and other considerations you may be able to dispense with or at least weaken the precision and accuracy requirements. Daniel Lichtblau Wolfram Research newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp3.twtelecom.net!not-for-mail === Subject: Re: named pattern variable scoped as global, should be local MathTensor, Inc. Moderator <200505051001.GAA21799@smc.vnet.net> <000a01c552ff$474046a0$84d19b83@pc5> <2ae120b5ba51383d5749e6263ef3d143@mimuw.edu.pl> <200505100743.DAA08426@smc.vnet.net> <200505110924.FAA23984@smc.vnet.net> DXC=P3NFVPBm@JieC_A=>8kQj6m;[h;PUXBgbd1T[9j> ECT1nEFiONJ7[GofOhD2U5Q8@:j comp.soft-sys.math.mathematica:56245 Trial and error is often the rule, I must agree. MOST of the time, though, I avoid the tricky cases without noticing. Bobby On Wed, 11 May 2005 05:24:05 -0400 (EDT), Chris Chiasson > One day, I will understand why people donÕt understand or disagree > with what happens when using Block vs. Module. Until then, IÕll just > have to be satis\[CapitalThorn]ed with bumbling around until my code works. >> Andrzej, >> I never thought of de\[CapitalThorn]ning what a bug is. But whatever it is, it is at the >> and of the scale of undesirable behaviour. I agree that sometimes some >> undesirable behaviour is unavoidable and therefore cannot always be >> considered as a bug. Nevertheless the task of the programmer is to avoid >> undesirable behaviour as much as possible. >> Unfortunately, my analysis of of the curious behaviour of substitution rules >> in modules was not quite correct. I will present a simpler (and I hope >> better) one here. That also changed my opinion: now I am inclined to >> consider this behaviour as a bug. >> I added one extra command to the examples discussed so far: >> In[96]:= >> Clear[x, y, z]; >> x = 7; >> (* 1 *) z /. x_ -> 2*x >> (* 2 *) Block[{x}, z /. x_ -> 2*x] >> (* 3 *) Module[{x}, z /. x_ -> 2*x] >> y = 1; >> (* 4 *) Module[{x}, z /. x_ -> 2*x*y] >> (* 5 *) Module[{x, y = 1}, z /. x_ -> 2*x*y] >> Out[98]=14 >> Out[99]=2 z >> Out[100]=14 >> Out[102]=14 >> Out[103]=2 z >> It is strange that the results 2 and 3 are different, as are the results 4 >> and 5. >> Let us start with reading the manual, which is always a good start. It >> states: >> When nested scoping constructs are evaluated, new symbols are automatically >> generated in the inner scoping constructs so as to avoid name conßicts with >> symbols in outer scoping constructs. In general, symbols with names of the >> form xxx are renamed xxx$. >> The following command shows this renaming. Observe that Block is not a >> scoping construct, so the local variables in Block are not renamed. >> Module[{t}, Hold[{x, t, Module[{x}, x + t + v] , Block[{x}, x + t + v], >> Rule[x_, x + t + v], f[x_] := x + t + v, Function[{x}, x + t + v]}]] >> The manual does not exclude the situation that a local name in the inner >> scoping construct equals a local name in the outer scoping construct. We do >> an experiment: >> In[105]:= >> Module[{s, t}, Hold[{Module[{t}, x + t] , Module[{t}, s + t], Rule[t_, x + >> t], Rule[t_, s + t], f[t_] := x + t, f[t_] := s + t}]] >> Out[105]= >> Hold[{Module[{t}, x + t], Module[{t$}, s$19 + t$], t_ -> x + t, t$_ -> s$19 >> + t$, f[t_] := x + t, f[t$_] := s$19 + t$}] >> A local name in an inner scoping construct that equals a local name of an >> outer scoping construct seems to be renamed only when in the in the inner >> scoping construct another local name from the outer scoping construct >> occurs. >> I am wondering whether this indeed is intentionally. The manual suggests >> that renaming always takes place. Anyway, the undesirable results in the >> situations 3 and 4 are both due to the fact that the local variable x in the >> rule is not renamed to x$, as in situation 5. So now I am inclined to >> consider >> this behaviour as a bug. >> Fred Simons >> Eindhoven University of Technology >> ----- Original Message ----- === >> Subject: named pattern variable scoped as >> global, should be local >> > *This message was transferred with a trial version of CommuniGate(tm) Pro* >> > Fred, >> > >> > As usual very good and convincing analysis. As for whether this behaviour >> > constitutes a ÒbugÓ or not: I think this \ is probably one of those cases true answer. It seems >> > to me reasonable to de\[CapitalThorn]ne a bug as something in the code that causes >> > behaviour that is undesirable in a way that either not realised by the >> > programmer or could not have been avoided without causing even more >> > undesirable behaviour (this latter situation is quite common in programs >> > like Mathematica). I am now also inclined to think that under the above >> > de\[CapitalThorn]nition this probably does not qualify as a bug. It seems to me that >> > this behaviour is mildly undesirable and causes some dif\[CapitalThorn]culty to users, >> > but probably it is a side effect of something intentional. Still, I do not >> > see any obvious bene\[CapitalThorn]ts form $ not being appended when the RHS contains >> > unscoped variables; maybe this improves performance but the gain seems to >> > be very slight. Perhaps the reason lies in trying to be consistent with >> > some more general principles of scoping. >> > Unfortunately these ÒprinciplesÓ do not \ appear to be clearly stated >> > anywhere, which of course is one reason why Òdetective workÓ like yours is >> > so valuable (as well as entertaining). >> > >> > Andrzej >> > >> > -- DrBob@bigfoot.com newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!logbridge.uoregon.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: solve() problem since new ROM update MathTensor, Inc. Moderator <200505100742.DAA08361@smc.vnet.net> DXC=2giNE1CW^H9C=aIl6945`?C_A=>8kQj6=;[h;PUXBgb4; jPa7nMWN05EFiONJ7[Go6\\iLY:IPg?G; comp.soft-sys.math.mathematica:56246 > Solve[x^4 - 1 == 3, x] > {{x -> -Sqrt[2]}, > {x -> (-I)*Sqrt[2]}, > {x -> I*Sqrt[2]}, > {x -> Sqrt[2]}} > In the Mathematica context, I have no idea what ALG, SOLVE, and RPN might be. I expect Mike meant to post to comp.sys.hp48. Bhuvanesh, Wolfram Research. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx02.iad01.newshosting.com!novia! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: calculate de Jong function MathTensor, Inc. Moderator DXC=2giNE1CW^HYG[n\\L2_@9VQC_A=>8kQj6];[h;PUXBgbT; jPa7nMWN0UEFiONJ7[GoVS=0EGElG[oP comp.soft-sys.math.mathematica:56247 Stefen, Is this what you want? deJong[vector_] := Plus @@ (vector^2) Mapping it onto a list of vectors of varying length... deJong /@ {{1, 1, 1}, {1, 2, 3, 4}, {a, b}} {3, 30, a^2 + b^2} The marvels of Mathematica functional programming! David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ [mailto:bi1169*delete_from_star_to_star*@fh-weihenstephan.de] === Subject: calculate de Jong function I donÕt know how I should implement the \[CapitalThorn]rst de \ jong function: f(x)=Sum((x_i)^2) where x is a Vector with n dimensions and x_i is the value of the i-th Dimension. i.e. all Values of the Vector are squared and added. My problem is that I donÕt know how many Dimensions there are, so I canÕt de\[CapitalThorn]ne the borders of the SUM function. Stefan newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: bode diagram MathTensor, Inc. Moderator DXC=A@oRLd>WU@gfMDbMQQNgfbC_A=>8kQj6m;[h;PUXBgbd; jPa7nMWN0eEFiONJ7[Gof;1L\\jbbE@Zj comp.soft-sys.math.mathematica:56248 IÕm fairly certain it could be done with Mathematica if you would only tell us what a bode diagram is and give us some sample data of function that you want to plot in the diagram. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ hi, like plotting simple bode diagrams of systems. could you give me some information about it? i can do it with another program, but iÕd like to see how mathematica works thank you newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news.maxwell.syr.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: NDSolve. SolveDelayed->True MathTensor, Inc. Moderator DXC=A@oRLd>WU@GEFLBoYkbQfNC_A=>8kQj6M;[h;PUXBgbD; jPa7nMWN0EEFiONJ7[GoFHkTrue Moderator DXC=?]0h3fF7bJ_SW6MMT7Gj0ZC_A=>8kQj6]2f3;U>_ojiYn9miUM; H5WZEFiONJ7[GoV>3Z17^Q=OG\\ comp.soft-sys.math.mathematica:56260 insert the scaline explicit in your equations and solve the system for the mass of the chemicals and not for the concentrations. Jens ÒChris FernandoÓ schrieb \ im >I am simulating a simple cell containing >chemicals. I have a set of kinetic equations for >each chemical in the cell. However, the cell >grows at a certain rate, and this changes the >concentration of the chemicals in it. This means >I have to scale the concentrations of chemicals >at each timestep of the numerical simulation, >according to the factor [(S(t)/S(t+1)]^(3/2). >When I was using Eular integration in a C program >this was easy. I just did it every timestep. But >with NDSolve, how can I scale all the equations >for substrate concentration appropriately. > In general terms, how do I deal with having to > scale the r.h.s. of a set of differential > equations on the basis of the function above, > where SÕ[t] is also a differential equation that > is being solved in that system!!?? > Yours > Chrisantha newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! logbridge.uoregon.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Remote Kernel MathTensor, Inc. Moderator DXC=[R]P9:nQC_A=>8kQj6];[h;PUXBgbT; jPa7nMWN0UEFiONJ7[GoVbJ3g7IjJ]8_ comp.soft-sys.math.mathematica:56250 Hi Guy > are there any public powerful computers which I can use for > intense calculations? > and if not, is there a way to run a kernel on a different > computer and to use it remotely? if so, how? A. Probably, but I donÕt know of any. B. Mathematica works by passing most commands to & from the Front End and the Kernel, even on the same computer. Look at the documentation in section 2.13.10 Special Topic: Running Programs on Remote Computers for more details. Dave. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!newsfeed.icl.net! newsfeed.fjserv.net!feed.news.tiscali.de!uio.no! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Re: solve() problem since new ROM update MathTensor, Inc. Moderator DXC=[R]P8kQj6=;[h;PUXBgb4; jPa7nMWN05EFiONJ7[Go6Q=7;;RdfYC; comp.soft-sys.math.mathematica:56251 Hi Mike, This looks like a question for a HP-4? Newsgroup .... > I have tried multiple problems (simple ones albiet) to solve > while in ALG mode. > SOLVE(x^4 - 1 = 3, x) > but this provides no result. Just returns the question with no answer. > The answer should be x = -Sqrt(2) or x = sqrt(2). Mathematica and my HP-48GX agree here to 11 decimal places -- there are 4 roots +/-Sqrt[2] and +/-I * Sqrt[2]. > The example works in RPN, but I use both environments > depending what I am doing. It worked before the upgrade. Maybe you need to try upgrading your ROM again? > Am I missing something here! Mathematica by the looks of things ... Dave. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: bode diagram MathTensor, Inc. Moderator DXC=ENcUjddBOWHVS1USibAf`FC_A=>8kQj6M;[h;PUXBgbD; jPa7nMWN0EEFiONJ7[GoF2C9;Da2kKMB comp.soft-sys.math.mathematica:56252 > hi, like plotting simple bode diagrams of systems. could you > give me some information about it? i can do it with another > program, but iÕd like to see how mathematica works thank \ you There is HaagerÕs package on MathSource called \ ÒControlÓ (http://library.wolfram.com/infocenter/MathSource/4607/) that plots Bode diagrams as well as at least two commerical packages. For the free package, BodePlot[transferFunction[s], {s, s_lo, s_hi}]; plots the transfer function. Dave. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net! news.maxwell.syr.edu!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: NSum: badly missed Option MathTensor, Inc. Moderator <200505070816.EAA20223@smc.vnet.net> DXC=ENcUjddBOWh8kQj6m;[h;PUXBgbd; jPa7nMWN0eEFiONJ7[GofJVnBO841a=c comp.soft-sys.math.mathematica:56253 > Nested Method option can be used in NSum. > In[2]:= NSum[1/(x20*Sin[x]^2), {x, 1, In\[CapitalThorn]nity}, Method -> {NIntegrate, > MaxRecursion -> 100}] > Anton Antonov > Wolfram Research, Inc. Is there a general syntax rule here? In other words, here is a function (NSum) with a ÒMethodÓ \ which refers to a second function (NIntegrate), the latter callable on its own with Options. Then, can you always invoke any legal option of that second function in this nested way in the call of *any* function that has a ÒMethodÓ? (All Methods are Nested Methods?) alan newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx02.iad01.newshosting.com!novia! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: Output to a \[CapitalThorn]le MathTensor, Inc. Moderator DXC=dnf<8kQj6=;[h;PUXBgb4; jPa7nMWN05EFiONJ7[Go616HnBK]>1m6 comp.soft-sys.math.mathematica:56254 I want to write the following list in a \[CapitalThorn]le, (and below is what I did) testList = {{1, 8}, {2, 9}, {3, 10}, {4, 11}, {5, 12}, {6, 13}, {7, 14}}; str = OpenWrite[Òtest.datÓ]; Write [str, testList]; Close[str]; test.dat looks like {{1, 8}, {2, 9}, {3, 10}, {4, 11}, {5, 12}, {6, 13}, {7, 14}} But, I want the test.dat to look like: 1 8 2 9 3 10 4 11 and so on... Can anyone give me any suggestions as to how I can accomplish this? Namrata newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net! nnrp2.twtelecom.net!not-for-mail === Subject: Re: Output to a \[CapitalThorn]le Moderator DXC=?]0h3fF7bJo30gWdKkK8kQj6m2f3;U>_ojii]j7bZ= BU6IjEFiONJ7[Gofmdl?Qcb6 schrieb im Newsbeitrag > I want to write the following list in a \[CapitalThorn]le, > (and below is what I did) > testList = {{1, 8}, {2, 9}, {3, 10}, {4, 11}, > {5, 12}, {6, 13}, {7, 14}}; > str = OpenWrite[Òtest.datÓ]; > Write [str, testList]; Close[str]; > test.dat looks like > {{1, 8}, {2, 9}, {3, 10}, {4, 11}, {5, 12}, {6, > 13}, {7, 14}} > But, I want the test.dat to look like: > 1 8 > 2 9 > 3 10 > 4 11 > and so on... > Can anyone give me any suggestions as to how I > can accomplish this? > Namrata newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!novia! newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3. twtelecom.net!not-for-mail === Subject: GramSchmidt problem Calgary Moderator DXC=dnf<8kQj6];[h;PUXBgbT; jPa7nMWN0UEFiONJ7[GoVZZ0Oh3hm9O[ comp.soft-sys.math.mathematica:56255 Does anyone know if there are any know problems with GramSchmidt crashing Mathematica? When I run it on these 4 25-dimensional vectors it crashes on my system: \\!\\({1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), 0, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 0, 1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1, 0, \\(-1\\), 0, 0, 0, 0, 0, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), \\(-1\\), 0, \ 1}\\) \\!\\({1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 0, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), 0, 1, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), \\(-1\\), 0, 0, 0, 0, 0, 0, \\(-1\\), 1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1, 0}\\) \\!\\({1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1, 0, \\(-1\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 0, 1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), 0, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), \\(-1\\), 0, 1, 0, 0, 0, 0, 0}\\) \\!\\({1, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), \\(-1\\), 0, 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((1 + \\@5)\\), 0, 1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((\\(-3\\) - \\@5)\\), 1\\/2\\ \\((3 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 0, \\(-1\\), 1\\/2\\ \\((1 + \\@5)\\), 1\\/2\\ \\((\\(-1\\) - \\@5)\\), 1, 0, 0, 0, 0, 0, 0}\\) Heath newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!novia!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Reading in a \[CapitalThorn]le MathTensor, Inc. Moderator DXC=dnf<@JieC_A=>8kQj6m;[h;PUXBgbd; jPa7nMWN0eEFiONJ7[GofRHYf5Ud[T5k comp.soft-sys.math.mathematica:56256 Hi everyone, I have the following \[CapitalThorn]le named \ Òtemp.txtÓ with the following format: ; Restart \[CapitalThorn]le created by make.m ; NYTOT 140 STTOT 30 ; TIME 0.00000000000000 3.1 4.1 2.3 4.5 3.3 2.5 1.1 4.1 I want to read this \[CapitalThorn]le in, but store the value of NYTOT which is 140 in a variable nytot, sttot in another variable named sttot At the end, I would like the get nytot = 140 sttot = 30 time = 0.0 and the rest of the values in another list: tmpLst = {3.1,4.1,2.3,4.5,3.3,2.5,1.1,4.1} I have done the following so far: tmpLst=Flatten[Select[Import[Òtemp.txtÓ, \ ÒTableÓ], NumericQ[First[#]] &]]; Which gives the tmpLst values but am not sure how I can get the sttot, nytot and time values? Any ideas? newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon02.news.prodigy.com!prodigy.net! newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: More problems with SetPrecision[] and/or $MinPrecision,... MathTensor, Inc. Moderator DXC=:m9dHc:C9^F;6T0N`8kQj6M;[h;PUXBgbD; jPa7nMWN0EEFiONJ7[GoFM7QLGde784F comp.soft-sys.math.mathematica:56257 Hi Terry, MMA version: 5.1, Windows in my case everything work as it should. I get: 0.x10^-21 this is the correct answer for a value of zero that has an accuracy of 21 and (by de\[CapitalThorn]nition) zero precision > Lately I seem to be \[CapitalThorn]nding a lot of SetPrecision[]/$MinPrecision bugs. > This appears to be another one: > In[1]:= $MinPrecision = 20; > savedData1 = 669151541.9328941107875; > savedData2 = 0.99960472897267246018765; > savedData3 = Log[savedData1^savedData2/savedData1^savedData2]; > Print[Apply[Plus, savedData3 - > Log[savedData1^savedData2/savedData1^savedData2]] ]; > x = 0.99960472897267245645; > y = 669151541.932894110712; > Do[ > z = SetPrecision[y,24]^x; > ,{50000}]; > Print[Apply[Plus, savedData3 - > Log[savedData1^savedData2/savedData1^savedData2]] ]; > The output looks like this on my Mathematica 3.0 system: > 1.9586707534418188626 x 10^-30 > Obviously the question is why is the second Print statement not > also returning a 0, after all the code that runs between the two > Print statements neither changes any of the variables referenced > by the two Print statements, nor even references any of the same > variables. > The problem maybe reproducible without the $MinPrecision but with > this speci\[CapitalThorn]c test case it is needed (there might however be other > constants that can reproduce the problem without $MinPrecision). > Can someone also run this on a more recent version of Mathematica > to see if it reproduces? All help is very much appreciated! > Terry newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!novia!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail === Subject: Re: Converting result to ASCII-art MathTensor, Inc. Moderator DXC=]jaKO2V7>@oO8kQj6m2f3;U>_ojii]j7bZ= BU6IjEFiONJ7[GofeG3m0HCOo3d comp.soft-sys.math.mathematica:56258 Duid you tryTeXForm[]? also printing into a postscript \[CapitalThorn]le can later be converted to a pdf \[CapitalThorn]le, quite easily. The following is a TexForm output of the required result. you may send it and the other side copy it into a latex \[CapitalThorn]le. There is no line wrapping of any kind here __________________________________________________________ \\left\\{-\\frac{b}{4 a}-\\frac{1}{2} \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}-\\frac{1}{2} \\sqrt{\\frac{b^2}{2 a^2}-\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}-\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}-\\frac{-\\frac{b^3}{a^3}-\\frac{8 c}{a}}{4 \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}}},-\\frac{b}{4 a}-\\frac{1}{2} \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}+\\frac{1}{2} \\sqrt{\\frac{b^2}{2 a^2}-\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}-\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}-\\frac{-\\frac{b^3}{a^3}-\\frac{8 c}{a}}{4 \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}}},-\\frac{b}{4 a}+\\frac{1}{2} \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}-\\frac{1}{2} \\sqrt{\\frac{b^2}{2 a^2}-\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}-\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}+\\frac{-\\frac{b^3}{a^3}-\\frac{8 c}{a}}{4 \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}}},-\\frac{b}{4 a}+\\frac{1}{2} \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}+\\frac{1}{2} \\sqrt{\\frac{b^2}{2 a^2}-\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}-\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}+\\frac{-\\frac{b^3}{a^3}-\\frac{8 c}{a}}{4 \\sqrt{\\frac{b^2}{4 a^2}+\\frac{\\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}{3 \\sqrt[3]{2} a}+\\frac{\\sqrt[3]{2} (4 a d-b c)}{a \\sqrt[3]{27 d b^2+27 a c^2+\\sqrt{\\left(27 d b^2+27 a c^2\\right)^2-4 (12 a d-3 b c)^3}}}}}}\\right\\} _____________________________________________________________ ______ yehuda yehuda > When running MathKernel from command line in OS X, it shows expressions > kind of like ASCII-art. I have a very long equation that I need to > convert to ASCII, but when doing this the way I normally do, using > Terminal and copying and pasting, it comes out looking like a mess, > because it does too much line wrapping. What I am trying to display is > the result of: > Solve[a x^4+b x^3+c x+d==0,x] > IÕve tried displaying this in command line with and \ without MatrixForm. > Is there some other form that I should try? > What I really need is some way that I can send this result to someone > (who doesnÕt have Mathematica, MathReader, or any type of MathML > reader), so that they can copy and paste out of it. A PDF would be > \[CapitalThorn]ne, but when I use Print to create a PDF, the PDF that it creates > canÕt be read by either Preview or Acrobat. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01. iad01.newshosting.com!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail === Subject: Re: Converting result to ASCII-art MathTensor, Inc. Moderator DXC=l;f?E8@aegKbgBE0H8kQj6M;[h;PUXBgbDW[m>13cG[: GEFiONJ7[GoF;Q;CNaTl63A comp.soft-sys.math.mathematica:56212 it all depends what the receiver wants to do with the formula. A simple solution would be: Solve[a x^4 + b x^3 + c x + d == 0, x] // InputForm This can be copied and pasted without problems. If he wants C code you may also try: Solve[a x^4 + b x^3 + c x + d == 0, x] // CForm There is also FortranForm. Homever, if the graphic, 2D form is needed, copy and paste it into a word document. SIncerely, Daniel > When running MathKernel from command line in OS X, it shows expressions > kind of like ASCII-art. I have a very long equation that I need to > convert to ASCII, but when doing this the way I normally do, using > Terminal and copying and pasting, it comes out looking like a mess, > because it does too much line wrapping. What I am trying to display is > the result of: > Solve[a x^4+b x^3+c x+d==0,x] > IÕve tried displaying this in command line with and \ without MatrixForm. > Is there some other form that I should try? > What I really need is some way that I can send this result to someone > (who doesnÕt have Mathematica, MathReader, or any type of MathML > reader), so that they can copy and paste out of it. A PDF would be > \[CapitalThorn]ne, but when I use Print to create a PDF, the PDF that it creates > canÕt be read by either Preview or Acrobat. newssvr33.news.prodigy.com!newsdbm06.news.prodigy.com! newsdst02.news.prodigy.com!newsmst01a.news.prodigy.com! prodigy.com!newscon06.news.prodigy.com!prodigy.net!border1. nntp.dca.giganews.com!border2.nntp.dca.giganews.com! nntp.giganews.com!novia!newsfeeds.sol.net! posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail === Subject: Re: MapThread MathTensor, Inc. Moderator DXC=f@`JRJU^?U]e3:W?T:5ElSC_A=>8kQj6]2f3;U>_ojiYn9miUM; H5WZEFiONJ7[GoV1e\\GbC\\GV>\\ comp.soft-sys.math.mathematica:56263 Try this: In[1]:= states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; In[2]:= stim = {33, 44, 55, 66, 77}; In[3]:= ilist = Range[3, 12, 2] Out[3]= {3, 5, 7, 9, 11} In[4]:= states[[ilist]] = {33, 44, 55, 66, 77}; In[5]:= states Out[5]= {1, 2, 33, 4, 44, 6, 55, 8, 66, 10, 77, 12, 13, 14} >-----Original Message----- === >Subject: MapThread >Hi Everyone, >I have been working on the following problem: >states = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} >stim = {33, 44, 55, 66, 77} >The locations of state 3,5,7,9,11 to be equal 33,44,55,66,77 >MapThread[{#1 = #2} &, {Take [states, {3, 12, 2}], stim}] >I tried to the above but it gives me errors: >Set::setraw: Cannot assign to raw object 3 >However these work individually: >MapThread[#1 &, {Take [states, {3, 12, 2}], stim}] >MapThread[ #2 &, {Take [states, {3, 12, 2}], stim}] >Any ideas?