Wikipedia:Reference desk/Archives/Computing/2015 April 24
Computing desk | ||
---|---|---|
< April 23 | << Mar | April | May >> | April 25 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
April 24
[edit]sound card
[edit]hi all, which card could be better for a sennheisers hd518... an asus xonar dgx or a Sound Blaster Audigy Fx, most part for music
thank you in advance
Does Jenkins run all tests on each commit like Travis CI? WinterWall (talk) 06:12, 24 April 2015 (UTC)
Where can I host one or two documents?
[edit]I would like to put my CV on-line and link to it from Facebook etc. I don't really want to pay for hosting and I don't have a website anymore. What are my options? Hayttom 11:00, 24 April 2015 (UTC)
- LinkedIn -- Mr. Prophet (talk) 11:39, 24 April 2015 (UTC)
- Dropbox. WegianWarrior (talk) 13:02, 24 April 2015 (UTC)
- Wow, I already use Dropbox; it hadn't occurred to me that I could point links to a document there. Thanks. Hayttom 13:22, 24 April 2015 (UTC)
Resolved
- I used Google Sites to create a web page for my career portfolio. -- Gadget850 talk 14:04, 24 April 2015 (UTC)
- Wow, I already use Dropbox; it hadn't occurred to me that I could point links to a document there. Thanks. Hayttom 13:22, 24 April 2015 (UTC)
In a sequence diagram, how do you show a subset of non-adjacent participants engage in an abstracted use case?
[edit]In a sequence diagram involving a number of participants (e.g. A, ..., E), how do you show a non-adjacent subset of them (e.g. A, C, & E) engaging in a sub-usecase, which is shown as an abstract block? The goal is to show that A, C, & E are participants, but B & D are not. In this simple example, we can reorder the participants to make A, C, & E to make them adjacent, but that is generally not possible when you have several such abstract blocks involving different subsets of participants. Is there a standard way of identifying the participants of an abstract sub-usecase? What are the common practices? --134.242.92.2 (talk) 18:10, 24 April 2015 (UTC)
- I can't find an example at present, but I've seen this handled by making e.g. A,C,E one color, while B,D are a different color. Another option is to make the nodes different shapes, e.g. squares vs. circles. Just make sure you include a key/legend, and you should be able to clearly point out sub-groupings without using adjacency. SemanticMantis (talk) 18:24, 24 April 2015 (UTC)
Statistics : Gaussian bell curve/Normal distribution/Probability density function in pure ANSI C or C++
[edit]While studying density function of normal distribution I got the need to create a program for my embedded device which can solve integrates of : for solving probabilities in this form :
and it’s reverts like finding in or in with
The problem is solving integrates without using primitives is currently beyond of my knowledge and I won’t be able to use standard normal distribution tables the day I will have to solve those simple situations. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 19:32, 24 April 2015 (UTC)
- The Cumulative distribution function of the Normal distribution does not exist as an elementary function. For convenience, we define the normal CDF in terms of "erf" - There will be many options available, but I would start by considering Error_function#Taylor_series. SemanticMantis (talk) 21:07, 24 April 2015 (UTC)
- erf and erfc = 1 − erf are available in math.h (or cmath). See C mathematical functions. -- BenRG (talk) 23:34, 24 April 2015 (UTC)
- BenRG erfc is complementary function of erf not it’s reverse. And erf/erfl is not present in ANSI C. It is an addition which come with C99. I don’t have a C99 compatible compiler for embedded device. Also I am unable to find a long double version of an erfinv implementation and I don’t have the knowledge to create them. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 12:24, 25 April 2015 (UTC)
- Sorry, I thought they were at least in C++98, but I didn't check. And I missed that you need the inverse.
- Boost.Math has erf(c) and erf(c)_inv, with an arbitrary-precision implementation and optimized versions for 80-bit and (for erf only) 128-bit floats, and it's probably sufficiently portable. It's a large dependency, of course. You might be able to extract the relevant bits from boost/math/special_functions/erf.hpp and boost/math/special_functions/detail/erf_inv.hpp.
- You could of course solve the inverse problem by successive approximation, using at worst one call of erf per mantissa bit plus a few to find the exponent. -- BenRG (talk) 19:25, 25 April 2015 (UTC)
- BenRG Also my device doesn’t feature a return key on it’s keyboard, that's why I would prefer to use C if possible. Boost seems to rely partially on the UNIX/POSIX API which I can’t use.
- I am unable to see how I can use an hypothetical erfinvl function for finding the minimal value in this kind of inequality 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 21:29, 25 April 2015 (UTC)
- That equation is solved by the quantile function, which is given in normal distribution in terms of . (What is the relevance of a return key? It certainly doesn't favor C over C++. If you need newlines, and you have a compiler on the device (since otherwise its keyboard wouldn't matter), you could always write a version of tr first to translate your code…) --Tardis (talk) 13:51, 28 April 2015 (UTC)
- BenRG erfc is complementary function of erf not it’s reverse. And erf/erfl is not present in ANSI C. It is an addition which come with C99. I don’t have a C99 compatible compiler for embedded device. Also I am unable to find a long double version of an erfinv implementation and I don’t have the knowledge to create them. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 12:24, 25 April 2015 (UTC)
- erf and erfc = 1 − erf are available in math.h (or cmath). See C mathematical functions. -- BenRG (talk) 23:34, 24 April 2015 (UTC)
- Are you looking for a highly precise solution, or just a rough one? Does it matter if the solution is computationally efficient (e.g. will you be iterating this thousands of times), or do you just need it to run occasionally? It is fairly easy to implement crude solutions to this problem that will be accurate to several decimal places but not necessarily exact, but whether that is good enough probably depends on your application. Dragons flight (talk) 19:45, 25 April 2015 (UTC)
- Dragons flight Answering your question I don’t need something fast. The device itself is already using FPU emulation, and the code generation is optimized for size over speed. Crude/Slow solutions are perfectly acceptable.
- The final precision accuracy does matter for the first six digits. As there are several intermediate steps, I guess higher internal precision is necessary. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 21:29, 25 April 2015 (UTC)
- For example Error function#Approximation with elementary functions gives approximation for erf and erfinv in basic functions that are everywhere accurate to three decimal places. As suggested above a Taylor series can give you even better accuracy but will generally require more terms. Dragons flight (talk) 19:58, 25 April 2015 (UTC)
- I guess I'm still a little confused. It looks like OP wants to implement something to evaluate certain expressions and inequalities, but can't use many established packages due to system constraints? Error_function#B.C3.BCrmann_series looks better than the Taylor series approach, and could in principle be implemented from first principles using only arithmetic. If OP can't see how that link will help solve the example problems, someone can probably explain that too- but it's more a question of math than computers at that point. SemanticMantis (talk) 14:47, 26 April 2015 (UTC)
- SemanticMantis building for my system is like building for an MS-DOS 5.0 PC with an intel 80286 with a broken return key. (I’m using a NEC V30MX with an old ROM-DOS version and special built-in keyboard) 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 17:57, 26 April 2015 (UTC)
- I've used that kind of system, but never had to compile code on it. Do you not have access to operations that can accomplish this?
- If you can code that, you can get a reasonably accurate and fast approximation to erf, which will then let you compute the kinds of things that you describe above. In other words, if you can manage to define/implement the right hand side above, then you won't need to depend on a built-in function to integrate Gaussian PDFs/normal distributions. Does that help? If you cannot implement that, can you tell us why not, or what operations you can't perform? (ok, and since I'm trying to help, mind telling us what the bigger goal is here? :) SemanticMantis (talk) 19:08, 26 April 2015 (UTC)
- SemanticMantis What is sgn()? Again, the thing I can acess the ANSI C standard library with. I don’t know what is sgn, the remaining looks OK. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 21:09, 26 April 2015 (UTC)
- sgn is the sign function, which is simply -1, 0, or 1 depending on whether x is negative, zero, or positive respectively. It's probably not part of a standard library but it is trivial to implement with a few conditional statements. Dragons flight (talk) 21:49, 26 April 2015 (UTC)
- In fact, the compiler I’m using is Borland C++ 4.5.2 which can be downloaded here. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 00:09, 27 April 2015 (UTC)
- sgn is the sign function, which is simply -1, 0, or 1 depending on whether x is negative, zero, or positive respectively. It's probably not part of a standard library but it is trivial to implement with a few conditional statements. Dragons flight (talk) 21:49, 26 April 2015 (UTC)
- Be careful:
30/200==0
(as do 341/8000 and 0.000000000000000000000e+0L; why not just write "0" in the last case?). --Tardis (talk) 13:51, 28 April 2015 (UTC)- To clarify, I didn't write that code - someone else must have decided it was better to place their suggestion in with my comment. My understanding is that the OP has some math problems/questions along with the "computer" problems - the example I gave is just one way of getting an elementary expression to approximate erf, other expressions could be derived that use more summands and have coefficients that aren't so close to zero. SemanticMantis (talk) 14:03, 28 April 2015 (UTC)
- This is the reverse, I have some computer problems along maths problems. The aim of the program is to replace the standard normal tables which I might no be allowed to use. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 00:03, 29 April 2015 (UTC)
- To clarify, I didn't write that code - someone else must have decided it was better to place their suggestion in with my comment. My understanding is that the OP has some math problems/questions along with the "computer" problems - the example I gave is just one way of getting an elementary expression to approximate erf, other expressions could be derived that use more summands and have coefficients that aren't so close to zero. SemanticMantis (talk) 14:03, 28 April 2015 (UTC)
- SemanticMantis What is sgn()? Again, the thing I can acess the ANSI C standard library with. I don’t know what is sgn, the remaining looks OK. 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 21:09, 26 April 2015 (UTC)
- SemanticMantis building for my system is like building for an MS-DOS 5.0 PC with an intel 80286 with a broken return key. (I’m using a NEC V30MX with an old ROM-DOS version and special built-in keyboard) 2A02:8420:508D:CC00:56E6:FCFF:FEDB:2BBA (talk) 17:57, 26 April 2015 (UTC)
- I guess I'm still a little confused. It looks like OP wants to implement something to evaluate certain expressions and inequalities, but can't use many established packages due to system constraints? Error_function#B.C3.BCrmann_series looks better than the Taylor series approach, and could in principle be implemented from first principles using only arithmetic. If OP can't see how that link will help solve the example problems, someone can probably explain that too- but it's more a question of math than computers at that point. SemanticMantis (talk) 14:47, 26 April 2015 (UTC)
- For example Error function#Approximation with elementary functions gives approximation for erf and erfinv in basic functions that are everywhere accurate to three decimal places. As suggested above a Taylor series can give you even better accuracy but will generally require more terms. Dragons flight (talk) 19:58, 25 April 2015 (UTC)
#include <MATH.H>
#include <FLOAT.H>
#define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
#define M_PIl 3.141592653589793238462643383279502884L /* pi */
inline long double sgn(long double x) {
if(x>0)
return 1.000000000000000000000e+0L;
if(x==0)
return 0.000000000000000000000e+0L;
return -1.000000000000000000000e+0L;
}
inline long double erfl(long double x) {
return M_2_SQRTPIl*sgn(x)*sqrtl(1-expl(-powl(x,2)))*((sqrtl(M_PIl)/2)+((1.500000000000000000000e-1L)*expl(-powl(x,2)))-((4.262500000000000000000e-2L)*expl(-2*powl(x,2))));
}
void n_dist_eq_to_inf() {
const long double m=read_ldouble("N(µ; )");
const long double sigma=read_ldouble("N( ;σ)");
const long double n=read_ldouble("[n->∞]\n P(X>n)\=?");
cls(); // clear screen
printf("%.7Lg",1-(0.5*(1-erfl(M_SQRT2l*(n-m)/sigma))));
}
- Dragons flight Ok now it lacks the reverse error function which can be approximated as : . The problem is I don't understand what does correspond to. Also, the code I posted outputs completely wrong results. 46.218.124.194 (talk) 09:51, 27 April 2015 (UTC)