Title: how to make a differentiation of a string? Post by: lookang on January 29, 2009, 04:24:36 pm I have an interface function field called fstring.
it read the string value in it and is pass to the graphics view as an analyticCurve with X() = x Y() = %fstring% i am able to draw a nice graph say sin(xt). perfect! but how do i make a d(sin(xt)/dt ? i tried putting an evolution page d(fstring)/dt = velocity and make another analyticCurve X() = x Y() = velocity doesn't seem to work, any idea how to make graph of d(fstring)/dt. thanks! if you want to see my xml, just delete the evolution page and it will run ;D Title: Re: how to make a differentiation of a string? Post by: FuKwun Hwang on January 29, 2009, 06:09:28 pm You can use AnalyticCurve to draw curve directly.
Since you used Code: double u = _view.waveFunction.evaluate(x,t); to evaluate it's value in your code.You can calculate u2=_view.waveFunction.evaluate(x,tddt); And you can get du/dt with u2u/ddt if ddt is small enough! Just calculated it by definition! Title: Re: how to make a differentiation of a string? Post by: lookang on January 29, 2009, 09:23:05 pm You can use AnalyticCurve to draw curve directly. Since you used Code: double u = _view.waveFunction.evaluate(x,t); to evaluate it's value in your code.You can calculate u2=_view.waveFunction.evaluate(x,tddt); And you can get du/dt with (u2u)/ddt if ddt is small enough! Just calculated it by definition! it was a brilliant idea/method but it didn't solve the problem :( It is because the code above is for the n = 50 points that is spread out in the xaxis, the little points. original code from paco and wolfgang seems to use the %string% method to draw the nice function. guess it is difficult to get du/dx = k*cos ( k*x  w*t) from a string u = sin ( k*x  w*t). i go try your idea but on a separate loop. Title: Re: how to make a differentiation of a string? Post by: FuKwun Hwang on January 29, 2009, 09:29:18 pm You are differential it in time, so it should not matter if your points are spread out in space.
I do not understand why you said it is not working. May be you have another problem. And becareful: It is not correct to write something like sin(xt) x and t is not the same dimension. You can not substract time from space You can write sin(k*xw*t). But sin(xt) is meanless. Title: Re: how to make a differentiation of a string? Post by: lookang on January 29, 2009, 09:54:58 pm You are differential it in time, so it should not matter if your points are spread out in space. I do not understand why you said it is not working. May be you have another problem. And becareful: It is not correct to write something like sin(xt) x and t is not the same dimension. You can not substract time from space You can write sin(k*xw*t). But sin(xt) is meanless. LOL agreed, sin(k*xw*t), i was assuming k =1 and w =1 for quick typing :) i now get strange simulation, think i debug tomorrow found one bug!! dudt = (u2u)/ddt; // () is so important :) let me give it some time to crack it before i ask u again :) think i need du/dx = k*cos ( k*x  w*t) from a string u = sin ( k*x  w*t) instead of du/dt Title: Re: how to make a differentiation of a string? Post by: lookang on January 30, 2009, 02:29:12 am it works now, need to refine it. thanks!
