## 599 Reputation

13 years, 209 days

## LinearUnivariateSystem - very long winde...

Thank you on both points Indeed it should be Ai.x+Bi.y=Ci and indeed 28 intersections. I have been trying to find a way forward using the LinearUnivariateSystem command. My thinking is that there are 256 solutions. So if ei (i=1..8) are the LHS of my linear equations (Ai.x+Bi.y-Ci) eq11111111:={e1>0,e2>0,e3>0,e4>0,e5>0,e6>0,e7>0,e8>0}; then the other 254 equations all the way to eq00000000:={e1<0,e2<0,e3<0,e4<0,e5<0,e6<0,e7<0,e8<0}; then LinearUnivariateSystem(eqj,x) (j=11111111..00000000) ought to give as many solutions as there are But it feels very long winded!

## LinearUnivariateSystem - very long winde...

Thank you on both points Indeed it should be Ai.x+Bi.y=Ci and indeed 28 intersections. I have been trying to find a way forward using the LinearUnivariateSystem command. My thinking is that there are 256 solutions. So if ei (i=1..8) are the LHS of my linear equations (Ai.x+Bi.y-Ci) eq11111111:={e1>0,e2>0,e3>0,e4>0,e5>0,e6>0,e7>0,e8>0}; then the other 254 equations all the way to eq00000000:={e1<0,e2<0,e3<0,e4<0,e5<0,e6<0,e7<0,e8<0}; then LinearUnivariateSystem(eqj,x) (j=11111111..00000000) ought to give as many solutions as there are But it feels very long winded!

## Use of seq()function...

If I had a procedure proc_image(n)which I call n times how would each proc_image(n) appear in the display function using the seq() function. I have never used the seq(function). Thanks for your interest

Many thanks BA

Many thanks BA

## Calling procedures from a differential s...

To answer my own question use the 'procedure=' option as detailed in the help files. The code I have used is as follows > restart: > with (plots): Warning, the name changecoords has been redefined > ic:=array([0,0.1]): > dvars:=[s(t),v(t)]: > > > > RLLS:=proc(vel,t) > local v,N,k,feq,mu,lambda,tim,friction; > tim:=t; > v:=vel: > N:=9.807: > k:=.00005: > feq:=-tim^2: > mu:=2: > #The following algorithim is an implementation from the following work > #Quinn Dane D, A New Regularization of Coulomb Friction, > #Journal of Vibration and Acoustics > #July 2004, Vol 126 p 391-397 > if abs(feq/mu*N)<=1 > then lambda:=k*feq/mu*N > else lambda:=k*signum(feq/mu*N) > > end if; > > if abs(v-lambda)<=k > then friction:= (-mu*N/k)*(v-lambda) > else friction:=-mu*N*signum((v-lambda)/k) > end if; > end proc: > > solproc:=proc(N,t,Y,YP) local vel, friction,tim,action_force; > action_force:=-10.0; > tim:=t; > vel:=Y; > friction:=RLLS(vel,tim); > YP:=Y; > YP:=action_force+friction; > > end proc: > dsol:=dsolve(numeric,number=2,procedure=solproc,start=0,initial=ic,procvars=dvars): > > > odeplot(dsol,[[t,s(t)*100],[t,v(t)]],0..(.01));

## Calling procedures from a differential s...

To answer my own question use the 'procedure=' option as detailed in the help files. The code I have used is as follows > restart: > with (plots): Warning, the name changecoords has been redefined > ic:=array([0,0.1]): > dvars:=[s(t),v(t)]: > > > > RLLS:=proc(vel,t) > local v,N,k,feq,mu,lambda,tim,friction; > tim:=t; > v:=vel: > N:=9.807: > k:=.00005: > feq:=-tim^2: > mu:=2: > #The following algorithim is an implementation from the following work > #Quinn Dane D, A New Regularization of Coulomb Friction, > #Journal of Vibration and Acoustics > #July 2004, Vol 126 p 391-397 > if abs(feq/mu*N)<=1 > then lambda:=k*feq/mu*N > else lambda:=k*signum(feq/mu*N) > > end if; > > if abs(v-lambda)<=k > then friction:= (-mu*N/k)*(v-lambda) > else friction:=-mu*N*signum((v-lambda)/k) > end if; > end proc: > > solproc:=proc(N,t,Y,YP) local vel, friction,tim,action_force; > action_force:=-10.0; > tim:=t; > vel:=Y; > friction:=RLLS(vel,tim); > YP:=Y; > YP:=action_force+friction; > > end proc: > dsol:=dsolve(numeric,number=2,procedure=solproc,start=0,initial=ic,procvars=dvars): > > > odeplot(dsol,[[t,s(t)*100],[t,v(t)]],0..(.01));

## Passing numerical values from diff to a ...

Thank you once again Will. I guess my question comes down to, given an expression of the form >sys:=diff(s(t),t)=v(t), diff(v(t),t) = ( -P+RLLS(v(t)) )/m: How do you get the numerical value of v(t) out of the solver at each step to pass to the procedure RLLS()?

## Passing numerical values from diff to a ...

Thank you once again Will. I guess my question comes down to, given an expression of the form >sys:=diff(s(t),t)=v(t), diff(v(t),t) = ( -P+RLLS(v(t)) )/m: How do you get the numerical value of v(t) out of the solver at each step to pass to the procedure RLLS()?

## Truth and Procedure Calls from diff...

Thank you William Spaetzel. (For reasons I cannot explain putting < and = together without a space between then looks fine in the comment box but gets stripped out of the posting and hence I have used < = with space between. ) As you will see the error is there despite the correct boolean expression. Have you, or anyone, time to comment why this error occurs. Much appreciated if you can. RLLS:=proc(vt) > local max,v,N,k,feq,mu,lambda; > max:=.01: > v:=vt: > N:=9.807: > k:=.0001: > feq:=10: > mu:=2: > if abs(feq/mu*N)< = 1 > then lambda:=k*feq/mu*N > else lambda:=k*signum(feq/mu*N) > end if; > > if abs(v-lambda)< =k > then feq:= (-mu*N/k)*(v-lambda) > else feq:=-mu*N*signum((v-lambda)/k) > end if; > end proc: > sys:=diff(s(t),t)=v(t), > diff(v(t),t)=( -P+RLLS(v(t)) )/m: > Error, (in RLLS) cannot determine if this expression is true or false: abs(v(t)-.1e-3)-.1e-3 <= 0

## Truth and Procedure Calls from diff...

Thank you William Spaetzel. (For reasons I cannot explain putting < and = together without a space between then looks fine in the comment box but gets stripped out of the posting and hence I have used < = with space between. ) As you will see the error is there despite the correct boolean expression. Have you, or anyone, time to comment why this error occurs. Much appreciated if you can. RLLS:=proc(vt) > local max,v,N,k,feq,mu,lambda; > max:=.01: > v:=vt: > N:=9.807: > k:=.0001: > feq:=10: > mu:=2: > if abs(feq/mu*N)< = 1 > then lambda:=k*feq/mu*N > else lambda:=k*signum(feq/mu*N) > end if; > > if abs(v-lambda)< =k > then feq:= (-mu*N/k)*(v-lambda) > else feq:=-mu*N*signum((v-lambda)/k) > end if; > end proc: > sys:=diff(s(t),t)=v(t), > diff(v(t),t)=( -P+RLLS(v(t)) )/m: > Error, (in RLLS) cannot determine if this expression is true or false: abs(v(t)-.1e-3)-.1e-3 <= 0

## Many thanks Thomas Richard ...

Many thanks Thomas Richard

## Many thanks Thomas Richard ...

Many thanks Thomas Richard 1 2 Page 2 of 2
﻿