Apolgies of these feature already exists and I have not yet found it, but would it be possible to add a capability to get the derivative and cumulative integral of any given data set ds$ within a 'begin graph' environment block? It seems like this should be a trivial thing to implement but I can't seem to achieve it with existing features of the language (that I know of, at least). Many thanks!
And for the typos in the feature request! :-D
Dave:
I think you can probably program these functions in GLE. Here are some subroutines I wrote to do integration and factorial for a starting point. Hope this helps
Vince
sub factorial n
local ret
ret = 1
if n > 1 then
for i = 1 to n step 1
ret = ret*i
next i
end if
return ret
end sub
sub laguerre n alpha x
! Associated or generalized laguarre polynomial
! L(0,alpha,X) = 1,
! L(1,alpha,X) = 1 - alpha - x,
! L(N,alpha,X) = (2*(N-1)+1+alpha-X) * L(N-1,alpha,X) - (N-1+alpha) * L(N-2,alpha,X))n
local ret
if n < 0 then
ret = 0
else if n = 0 then
ret = 1
else if n = 1 then
ret = 1+alpha-x
else
ret = ((2 * n - 1 + alpha - x ) * laguerre(n-1,alpha,x) - (n-1+alpha) * laguerre(n-2,alpha,x))/n
end if
return ret
end sub
sub hermite n x
! Recursion:
!
! H(0,X) = 1,
! H(1,X) = 2X,
! H(N,X) = 2X * H(N-1,X) - 2(N-1) * H(N-2,X)
local ret
ret = 0
if n < 0 then
ret = 0
else if n = 0 then
ret = 1
else if n = 1 then
ret = 2x
else
ret = 2 * x * hermite(n-1,x) - 2 * (n-1) * hermite(n-2,x)
end if
return ret
end sub
sub dmaxy_x ds$
! Function to compute the x-value of the maximum y-value of a dataset
local i
local crmax = datayvalue(ds$,1)
local _xmax = dataxvalue(ds$,1)
for i = 2 to ndata(ds$)
if crmax < datayvalue(ds$,i) then
crmax = datayvalue(ds$,i)
_xmax = dataxvalue(ds$,i)
end if
next i
return _xmax
end sub
sub integrate ds$
local i , dx , sum
sum = 0
dx = dataxvalue(ds$,1)
dy = datayvalue(ds$,1)
for i = 2 to ndata(ds$)
sum = sum + (dataxvalue(ds$,i) - dx ) * ( dy + (datayvalue(ds$,i) - dy)/2)
dx = dataxvalue(ds$,i)
dy = datayvalue(ds$,i)
next i
return sum
end sub
From: Dave Chapman [mailto:dchapmanflf@users.sourceforge.net]
Sent: Thursday, October 24, 2019 10:58 AM
To: Ticket #45: Add derivative and cumulative integral function for data sets in graph block 45@feature-requests.glx.p.re.sourceforge.net
Subject: [glx:feature-requests] #45 Add derivative and cumulative integral function for data sets in graph block
[feature-requests:#45]https://sourceforge.net/p/glx/feature-requests/45/ Add derivative and cumulative integral function for data sets in graph block
Status: open
Group:
Created: Thu Oct 24, 2019 02:58 PM UTC by Dave Chapman
Last Updated: Thu Oct 24, 2019 02:58 PM UTC
Owner: nobody
Apolgies of these feature already exists and I have not yet found it, but would it be possible to add a capability to get the derivative and cumulative integral of any given data set ds$ within a 'begin graph' environment block? It seems like this should be a trivial thing to implement but I can't seem to achieve it with existing features of the language (that I know of, at least). Many thanks!
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/glx/feature-requests/45/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Feature Requests: #45
Dear Vincent,
Another thing I should've mentioned... Many years ago (I think 2012) I posted a feature request using an old sourceforge account about the possibility of a syntax highlighting package for the KDE Advanced Editor (KATE). I checked out the old issue and it looks like this was never investigated by the GLE development team. Would it be possible to have this issue looked at again as I have recently started to use GLE in an Ubuntu machine again.
Ta,
Dave
From: Vincent P. LaBella vlabella@users.sourceforge.net
Sent: Friday, October 25, 2019 3:47 AM
To: [glx:feature-requests] 45@feature-requests.glx.p.re.sourceforge.net
Subject: [glx:feature-requests] Re: #45 Add derivative and cumulative integral function for data sets in graph block
Dave:
I think you can probably program these functions in GLE. Here are some subroutines I wrote to do integration and factorial for a starting point. Hope this helps
Vince
sub factorial n
local ret
ret = 1
if n > 1 then
for i = 1 to n step 1
ret = ret*i
next i
end if
return ret
end sub
sub laguerre n alpha x
! Associated or generalized laguarre polynomial
! L(0,alpha,X) = 1,
! L(1,alpha,X) = 1 - alpha - x,
! L(N,alpha,X) = (2*(N-1)+1+alpha-X) * L(N-1,alpha,X) - (N-1+alpha) * L(N-2,alpha,X))n
local ret
if n < 0 then
ret = 0
else if n = 0 then
ret = 1
else if n = 1 then
ret = 1+alpha-x
else
ret = ((2 * n - 1 + alpha - x ) * laguerre(n-1,alpha,x) - (n-1+alpha) * laguerre(n-2,alpha,x))/n
end if
return ret
end sub
sub hermite n x
! Recursion:
!
! H(0,X) = 1,
! H(1,X) = 2X,
! H(N,X) = 2X * H(N-1,X) - 2(N-1) * H(N-2,X)
local ret
ret = 0
if n < 0 then
ret = 0
else if n = 0 then
ret = 1
else if n = 1 then
ret = 2x
else
ret = 2 * x * hermite(n-1,x) - 2 * (n-1) * hermite(n-2,x)
end if
return ret
end sub
sub dmaxy_x ds$
! Function to compute the x-value of the maximum y-value of a dataset
local i
local crmax = datayvalue(ds$,1)
local _xmax = dataxvalue(ds$,1)
for i = 2 to ndata(ds$)
if crmax < datayvalue(ds$,i) then
crmax = datayvalue(ds$,i)
_xmax = dataxvalue(ds$,i)
end if
next i
return _xmax
end sub
sub integrate ds$
local i , dx , sum
sum = 0
dx = dataxvalue(ds$,1)
dy = datayvalue(ds$,1)
for i = 2 to ndata(ds$)
sum = sum + (dataxvalue(ds$,i) - dx ) * ( dy + (datayvalue(ds$,i) - dy)/2)
dx = dataxvalue(ds$,i)
dy = datayvalue(ds$,i)
next i
return sum
end sub
From: Dave Chapman [mailto:dchapmanflf@users.sourceforge.net]
Sent: Thursday, October 24, 2019 10:58 AM
To: Ticket #45: Add derivative and cumulative integral function for data sets in graph block 45@feature-requests.glx.p.re.sourceforge.net45@feature-requests.glx.p.re.sourceforge.net
Subject: [glx:feature-requests] #45 Add derivative and cumulative integral function for data sets in graph block
[feature-requests:#45]https://sourceforge.net/p/glx/feature-requests/45/https://sourceforge.net/p/glx/feature-requests/45/ Add derivative and cumulative integral function for data sets in graph block
Status: open
Group:
Created: Thu Oct 24, 2019 02:58 PM UTC by Dave Chapman
Last Updated: Thu Oct 24, 2019 02:58 PM UTC
Owner: nobody
Apolgies of these feature already exists and I have not yet found it, but would it be possible to add a capability to get the derivative and cumulative integral of any given data set ds$ within a 'begin graph' environment block? It seems like this should be a trivial thing to implement but I can't seem to achieve it with existing features of the language (that I know of, at least). Many thanks!
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/glx/feature-requests/45/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
[feature-requests:#45]https://sourceforge.net/p/glx/feature-requests/45/ Add derivative and cumulative integral function for data sets in graph block
Status: open
Group:
Created: Thu Oct 24, 2019 02:58 PM UTC by Dave Chapman
Last Updated: Thu Oct 24, 2019 02:59 PM UTC
Owner: nobody
Apolgies of these feature already exists and I have not yet found it, but would it be possible to add a capability to get the derivative and cumulative integral of any given data set ds$ within a 'begin graph' environment block? It seems like this should be a trivial thing to implement but I can't seem to achieve it with existing features of the language (that I know of, at least). Many thanks!
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/glx/feature-requests/45/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
[https://firstlightfusion.com/assets/first-light-fusion-square-logo-footer.png]
First Light Fusion Ltd.
p: 01865 807 670
a: Unit 10, Oxford Industrial Park, Mead Road, Yarnton, Kidlington, Oxford, OX5 1QU
This email and any attachments are confidential. Find more legal information herehttp://firstlightfusion.com/confidentiality/.
[https://firstlightfusion.com/wp-content/uploads/2018/03/cyber-essentials-plus.png]
Related
Feature Requests: #45
Hi Vincent,
Thank you very much for you quick response. I have had some success in writing my own code to evaluate function is the 'native' GLE language; I have done the \Gamma function, the \expm1 function and some Fermi-Dirac integrals as well. However, my chief complaint has been that I don't see how to use, define or operate on vectors, i.e. not datasets themselves, but defining a container for coefficients over which loops can be done to build summations or products, etc. that lie at the heart of most special function implementations. If you have some literature or examples of how to define and use vectors in GLE I would be most grateful and of course willing to contribute all my code to the repository (I have a huge amount of it designed to support physics applications in my field of high-energy-density plasma physics).
With respect to the derivative and cumulative integral. I see from your example that you have implemented a simple trapezoidal integration method to give the estimate of the area under a given data set... this is not the same as the cumulative integral, which would itself be a dataset and represent the area contained by the original curve up to a given point along the x axis. Likewise, the derivative function would also have to return a dataset, being the gradient of the original curve at each point along x. It's the operations on a dataset that modify it and/or create new datasets that I don't understand and can find no examples for.
Any help you would be able to give me to address the issues I've described would be very much welcomed!
Thanks again,
Dave
From: Vincent P. LaBella vlabella@users.sourceforge.net
Sent: Friday, October 25, 2019 3:47 AM
To: [glx:feature-requests] 45@feature-requests.glx.p.re.sourceforge.net
Subject: [glx:feature-requests] Re: #45 Add derivative and cumulative integral function for data sets in graph block
Dave:
I think you can probably program these functions in GLE. Here are some subroutines I wrote to do integration and factorial for a starting point. Hope this helps
Vince
sub factorial n
local ret
ret = 1
if n > 1 then
for i = 1 to n step 1
ret = ret*i
next i
end if
return ret
end sub
sub laguerre n alpha x
! Associated or generalized laguarre polynomial
! L(0,alpha,X) = 1,
! L(1,alpha,X) = 1 - alpha - x,
! L(N,alpha,X) = (2*(N-1)+1+alpha-X) * L(N-1,alpha,X) - (N-1+alpha) * L(N-2,alpha,X))n
local ret
if n < 0 then
ret = 0
else if n = 0 then
ret = 1
else if n = 1 then
ret = 1+alpha-x
else
ret = ((2 * n - 1 + alpha - x ) * laguerre(n-1,alpha,x) - (n-1+alpha) * laguerre(n-2,alpha,x))/n
end if
return ret
end sub
sub hermite n x
! Recursion:
!
! H(0,X) = 1,
! H(1,X) = 2X,
! H(N,X) = 2X * H(N-1,X) - 2(N-1) * H(N-2,X)
local ret
ret = 0
if n < 0 then
ret = 0
else if n = 0 then
ret = 1
else if n = 1 then
ret = 2x
else
ret = 2 * x * hermite(n-1,x) - 2 * (n-1) * hermite(n-2,x)
end if
return ret
end sub
sub dmaxy_x ds$
! Function to compute the x-value of the maximum y-value of a dataset
local i
local crmax = datayvalue(ds$,1)
local _xmax = dataxvalue(ds$,1)
for i = 2 to ndata(ds$)
if crmax < datayvalue(ds$,i) then
crmax = datayvalue(ds$,i)
_xmax = dataxvalue(ds$,i)
end if
next i
return _xmax
end sub
sub integrate ds$
local i , dx , sum
sum = 0
dx = dataxvalue(ds$,1)
dy = datayvalue(ds$,1)
for i = 2 to ndata(ds$)
sum = sum + (dataxvalue(ds$,i) - dx ) * ( dy + (datayvalue(ds$,i) - dy)/2)
dx = dataxvalue(ds$,i)
dy = datayvalue(ds$,i)
next i
return sum
end sub
From: Dave Chapman [mailto:dchapmanflf@users.sourceforge.net]
Sent: Thursday, October 24, 2019 10:58 AM
To: Ticket #45: Add derivative and cumulative integral function for data sets in graph block 45@feature-requests.glx.p.re.sourceforge.net45@feature-requests.glx.p.re.sourceforge.net
Subject: [glx:feature-requests] #45 Add derivative and cumulative integral function for data sets in graph block
[feature-requests:#45]https://sourceforge.net/p/glx/feature-requests/45/https://sourceforge.net/p/glx/feature-requests/45/ Add derivative and cumulative integral function for data sets in graph block
Status: open
Group:
Created: Thu Oct 24, 2019 02:58 PM UTC by Dave Chapman
Last Updated: Thu Oct 24, 2019 02:58 PM UTC
Owner: nobody
Apolgies of these feature already exists and I have not yet found it, but would it be possible to add a capability to get the derivative and cumulative integral of any given data set ds$ within a 'begin graph' environment block? It seems like this should be a trivial thing to implement but I can't seem to achieve it with existing features of the language (that I know of, at least). Many thanks!
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/glx/feature-requests/45/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
[feature-requests:#45]https://sourceforge.net/p/glx/feature-requests/45/ Add derivative and cumulative integral function for data sets in graph block
Status: open
Group:
Created: Thu Oct 24, 2019 02:58 PM UTC by Dave Chapman
Last Updated: Thu Oct 24, 2019 02:59 PM UTC
Owner: nobody
Apolgies of these feature already exists and I have not yet found it, but would it be possible to add a capability to get the derivative and cumulative integral of any given data set ds$ within a 'begin graph' environment block? It seems like this should be a trivial thing to implement but I can't seem to achieve it with existing features of the language (that I know of, at least). Many thanks!
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/glx/feature-requests/45/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
[https://firstlightfusion.com/assets/first-light-fusion-square-logo-footer.png]
First Light Fusion Ltd.
p: 01865 807 670
a: Unit 10, Oxford Industrial Park, Mead Road, Yarnton, Kidlington, Oxford, OX5 1QU
This email and any attachments are confidential. Find more legal information herehttp://firstlightfusion.com/confidentiality/.
[https://firstlightfusion.com/wp-content/uploads/2018/03/cyber-essentials-plus.png]
Related
Feature Requests: #45