1. Basic Statistics with OpenEuphoria

How can I do common statistical tests in Euphoria?

Some of these common tests are given on this page: https://cyfar.org/types-statistical-tests

I have seen this page: https://openeuphoria.org/docs/std_stats.html#_3952_statistics but it gives functions for very basic data analysis: mean, standard deviation etc only.

Thanks for your help.

new topic     » topic index » view message » categorize

2. Re: Basic Statistics with OpenEuphoria

Hi,

not very helpful, but

  1. write your own
  2. create a library
  3. share it for everyone else to use / criticise / pick apart
  4. improve it.
  5. goto 3.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: Basic Statistics with OpenEuphoria

Good option! I would really like to do this if I can get time.

Can I use C libraries here?

For example Apophenia: http://apophenia.info/

or: IMSL C stat library: https://docs.roguewave.com/en/imsl/c/8.6/pdf/C_Stat_library.pdf

Also, is this more easily possible with Phix? (I would have asked on Phix forum but I just can't find it now)

new topic     » goto parent     » topic index » view message » categorize

4. Re: Basic Statistics with OpenEuphoria

Hi

Yes you can use c liraries, you may even be able to build a dll. Phix will offer no real advantage here.

You will still have to wrap the libraries, and it may just be easier to write what you need yourself, using those other libraries as guides.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

5. Re: Basic Statistics with OpenEuphoria

Thanks for guidance.

Just out of curosity, can SWIG ( http://www.swig.org/ ) be used here?

new topic     » goto parent     » topic index » view message » categorize

6. Re: Basic Statistics with OpenEuphoria

rneu said...

Can I use C libraries here?

Yes! You'll want to see Dynamic Linking to external code in the docs.

Here are several projects that demonstrate how to wrap C libraries in Euphoria:

rneu said...

Personally, I would go with Apophenia since it seems simpler and it's open source.

rneu said...

Also, is this more easily possible with Phix?

It's more or less the same, but Pete has added some easier support for structures into Phix.

rneu said...

(I would have asked on Phix forum but I just can't find it now)

I think this is effectively the Phix forum.

rneu said...

Just out of curosity, can SWIG ( http://www.swig.org/ ) be used here?

You're welcome to try that, although in my experience the work required to get SWIG working is more involved than just wrapping a library by hand.

You'll find some old SWIG related code on The Archive: https://archive.usingeuphoria.com/

-Greg

new topic     » goto parent     » topic index » view message » categorize

7. Re: Basic Statistics with OpenEuphoria

Thanks for very useful suggestions.

This link is not working: https://openeuphoria.org/wiki/view/std_dll.html#_5377_dynamiclinkingtoexternalcode.wc

new topic     » goto parent     » topic index » view message » categorize

8. Re: Basic Statistics with OpenEuphoria

rneu said...

Thanks for very useful suggestions.

This link is not working: https://openeuphoria.org/wiki/view/std_dll.html#_5377_dynamiclinkingtoexternalcode.wc

The easiest way to wrap a C library in Euphoria is to use a DLL.

--load sigil.dll 
atom sl 
 
--do platform check and load library for the correct platform 
ifdef WIN32 then 
	sl = open_dll("sigil.dll") 
	if sl = -1 then 
		puts(1,"Failed to open sigil.dll!\n") 
		abort(0) 
	end if 
	elsifdef LINUX or FREEBSD then 
	 sl = open_dll("sigil.so") 
	 if sl = -1 then 
	 	puts(1,"Failed to load sigil.so!\n") 
	 	abort(0) 
	 end if 
end ifdef 
 
public constant xslWindow = define_c_proc(sl,"+slWindow",{C_INT,C_INT,C_POINTER,C_INT}) 
 
public procedure slWindow(atom width,atom height,sequence title,integer fullScr) 
 
 atom str = allocate_string(title,1) 
 c_proc(xslWindow,{width,height,str,fullScr}) 
	 
end procedure 

The above is a snippet from a wrapper I wrote for the Sigil library. The process is virtually the same for most C libraries you would want to wrap.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Basic Statistics with OpenEuphoria

Great. This is exactly what I wanted.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Basic Statistics with OpenEuphoria

This is very helpful.

Can you also give an example where memory allocation is also involved.

Thanks.

new topic     » goto parent     » topic index » view message » categorize

11. Re: Basic Statistics with OpenEuphoria

rneu said...

This is very helpful.

Can you also give an example where memory allocation is also involved.

Thanks.

Here I have an example of memory allocation from my EuSDL2 SDL2 Wrapper.

Stores one or more double words, starting at a memory location. -From the Manual on poke4 function. https://openeuphoria.org/docs/std_machine.html#_5697_poke4

procedure calc_rect(atom rect,integer sx,integer sy,integer tx,integer ty) 
 
 poke4(rect,sx)  
 poke4(rect+4,sy) 
 poke4(rect+8,tx) 
 poke4(rect+12,ty) 
	 
end procedure 
 
atom drect = allocate(10) --allocates bytes in memory 
 
calc_rect(drect,10,10,100,100) --A SDL_RECT is x,y,w,h  
new topic     » goto parent     » topic index » view message » categorize

12. Re: Basic Statistics with OpenEuphoria

Great. Thanks for the code and the link.

Euphoria seems to be a language which is easy and powerful at the same time. Why then it is not more popular? I think it should also be on https://stackoverflow.com/ where many programmers go for solutions and discussions.

new topic     » goto parent     » topic index » view message » categorize

13. Re: Basic Statistics with OpenEuphoria

rneu said...

Euphoria seems to be a language which is easy and powerful at the same time.

It is! What other languages do you use? We're always looking for help on the language itself and our other related projects.

rneu said...

Why then it is not more popular?

I would say Euphoria peaked in popularity around 2000-2005. Here's breakdown of messages by year. There were more than nearly ten times as many messages in 2004 as there were in 2019.

mysql> SELECT YEAR(created_at), COUNT(created_at) FROM messages GROUP BY YEAR(created_at) ORDER BY COUNT(created_at) DESC; 
+------------------+-------------------+ 
| YEAR(created_at) | COUNT(created_at) | 
+------------------+-------------------+ 
|             2004 |             11034 | 
|             2002 |             10186 | 
|             2001 |             10136 | 
|             2000 |              9508 | 
|             2003 |              8719 | 
|             2005 |              8414 | 
|             2008 |              8027 | 
|             1999 |              6857 | 
|             2007 |              6836 | 
|             2009 |              6797 | 
|             2006 |              6523 | 
|             1998 |              6288 | 
|             2010 |              3828 | 
|             2015 |              3352 | 
|             1997 |              3334 | 
|             2013 |              3151 | 
|             2012 |              2987 | 
|             2011 |              2850 | 
|             2014 |              2461 | 
|             2018 |              1615 | 
|             2016 |              1409 | 
|             2019 |              1374 | 
|             2017 |              1042 | 
|             1996 |               466 | 
|             2020 |               212 | 
|             1995 |                12 | 
+------------------+-------------------+ 

(The messages table for this forum also includes a complete import of the original mailing list hosted by RDS.)

rneu said...

I think it should also be on https://stackoverflow.com/ where many programmers go for solutions and discussions.

Eh. We're a pretty small community so breaking out to other forums would probably be counter-productive at this point. We do have an active-ish #euphoria channel on Freenode.

I've considered using Discord and Reddit as well (both very popular for developer communities) but right now I think this forum is the best place for us.

-Greg

new topic     » goto parent     » topic index » view message » categorize

14. Re: Basic Statistics with OpenEuphoria

Thanks for a detailed reply.

Your data regarding popularity of Euphoria can be shown in a graph for clarity: https://imgur.com/a/pHzoN7h (Had to create in Python)

new topic     » goto parent     » topic index » view message » categorize

15. Re: Basic Statistics with OpenEuphoria

rneu said...

Your data regarding popularity of Euphoria can be shown in a graph for clarity: https://imgur.com/a/pHzoN7h (Had to create in Python)

Wow, that's really neat! I mean, it's kind of sad to see it visualized like that, but it's still neat!

-Greg

new topic     » goto parent     » topic index » view message » categorize

16. Re: Basic Statistics with OpenEuphoria

.

new topic     » goto parent     » topic index » view message » categorize

17. Re: Basic Statistics with OpenEuphoria

ghaberek said...

Wow, that's really neat! I mean, it's kind of sad to see it visualized like that, but it's still neat!

-Greg

This is the main advantage of languages with many external libraries available - and that may happen if Euphoria is used in mainstream forums like stackoverflow. Just a thought.

new topic     » goto parent     » topic index » view message » categorize

18. Re: Basic Statistics with OpenEuphoria

rneu said...

https://imgur.com/a/pHzoN7h (Had to create in Python)

http://phix.x10.mx/messages_on_euforum.png
https://imgur.com/a/sqeb3b1

sequence data = {{2004,11034}, 
                 {2002,10186}, 
                 {2001,10136}, 
                 {2000, 9508}, 
                 {2003, 8719}, 
                 {2005, 8414}, 
                 {2008, 8027}, 
                 {1999, 6857}, 
                 {2007, 6836}, 
                 {2009, 6797}, 
                 {2006, 6523}, 
                 {1998, 6288}, 
                 {2010, 3828}, 
                 {2015, 3352}, 
                 {1997, 3334}, 
                 {2013, 3151}, 
                 {2012, 2987}, 
                 {2011, 2850}, 
                 {2014, 2461}, 
                 {2018, 1615}, 
                 {2016, 1409}, 
                 {2019, 1374}, 
                 {2017, 1042}, 
                 {1996,  466}, 
                 {2020,  212}, 
                 {1995,   12}} 
 
include pGUI.e 
 
Ihandle dlg, plot 
 
IupOpen() 
IupControlsOpen() 
plot = IupPlot("MENUITEMPROPERTIES=Yes, SIZE=640x320") 
IupSetAttribute(plot, "TITLE", "Messages"); 
IupSetAttribute(plot, "TITLEFONTSIZE", "10"); 
IupSetAttribute(plot, "TITLEFONTSTYLE", "ITALIC"); 
IupSetAttribute(plot, "GRIDLINESTYLE", "DOTTED"); 
IupSetAttribute(plot, "GRID", "YES"); 
IupSetAttribute(plot, "AXS_XLABEL", "Year"); 
IupSetAttribute(plot, "AXS_YLABEL", "Messages"); 
IupSetAttribute(plot, "AXS_XFONTSTYLE", "ITALIC"); 
IupSetAttribute(plot, "AXS_YFONTSTYLE", "ITALIC"); 
IupSetAttribute(plot, "AXS_YTICKSIZEAUTO", "NO"); 
IupSetAttribute(plot, "AXS_YTICKMAJORSIZE", "8"); 
IupSetAttribute(plot, "AXS_YTICKMINORSIZE", "0"); 
IupPlotBegin(plot) 
data = sort(data) 
for i=1 to length(data) do 
    IupPlotAdd(plot, data[i][1], data[i][2]) 
end for 
{} = IupPlotEnd(plot) 
dlg = IupDialog(plot) 
IupCloseOnEscape(dlg) 
IupSetAttribute(dlg, "TITLE", "Messages") 
IupMap(dlg) 
IupShowXY(dlg,IUP_CENTER,IUP_CENTER) 
IupMainLoop() 
IupClose() 
new topic     » goto parent     » topic index » view message » categorize

19. Re: Basic Statistics with OpenEuphoria

Very nice.

GUI capabilities of Euphoria should also be mentioned on home page https://openeuphoria.org/index.wc since most visitors look for this aspect when evaluating a new language.

GUI code like this should also be included on "Sample Code" page: https://openeuphoria.org/wiki/view.wc?page=SampleCode

Code similar to this should also be added to http://rosettacode.org/wiki/Plot_coordinate_pairs (where there is no Euphoria entry currently).

- Rneu

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu