Mathematics

Associated with Math.SE; for both general discussion & math qu...
Feb 15, 2019 11:56
(not sure why my integral equation does not work)
Feb 15, 2019 11:55
n	f(n)	f'(n)	Estimate
2	0	+2	0
3	2	+2	1.5
4	4	+3	4
5	7	+4	7.5
6	11	+5	12
7	16	+6	17.5
8	22	+7	24
9	29	+8	31.5
10	37	+9	40
f(n) are from observations and I need to find f. After I observed the delta between the values I came to the conclusion that f'(n) = n - 1 after which I then did $\int_{}^{} n -1 dn \rightarrow \frac{(x-2)x}{2}$ as shown in the estimate column. The values are bit off and I can't figure out why. Can someone help? :D
Feb 15, 2019 11:47
$\frac{test}{latex}$
Feb 15, 2019 11:44
Any math geniouses around that can help me out?
 

 Game Development

Game development and other polite discussion. Game development...
Mar 23, 2017 21:38
strlen on vectors?
Mar 23, 2017 21:35
Why does it have that
Mar 23, 2017 21:33
Some of this new C++ stuff is interesting :P The literal MUST be long double(can't be double, nor float)
Mar 23, 2017 21:33
struct float_proxy{
  float v;
  float operator %(float other){
    return fmod(v, other);
  }
};

float_proxy operator ""_f(long double f){
  float_proxy tmp;
  tmp.v = f;
  return tmp;
}

int main(int argc, char ** args){
  cout << 2.0_f%2.0f << endl;
  return 0;
}
Mar 23, 2017 21:04
You can overload %?
Mar 23, 2017 21:02
That works? :D
Mar 23, 2017 21:01
@JoshPetrie google.dk/…
Mar 23, 2017 20:58
I don't think the maintainer of that website knows that google exists
Mar 23, 2017 20:53
I ran into the problem.. Ended up using int TOP, int BOTTOM
float ratio = static_cast<float>(TOP) / BOTTOM
Mar 23, 2017 18:58
Nope, thanks though :)
Mar 23, 2017 18:57
(unless g++ defaults to that?)
Mar 23, 2017 18:56
Oh so that works... Was far easier than I'd hoped for. Don't even need C++11
Mar 23, 2017 18:54
Where most of the values are constant, but I dont want to just copy the function
Mar 23, 2017 18:54
Creating a wrapper around a method call in a library I'm using
Mar 23, 2017 18:53
Trying that atm, but not sure if works for functions
Mar 23, 2017 18:53
27
Q: C++ Template Specialization with Constant Value

tadmanIs there a straightforward way for defining a partial specialization of a C++ template class given a numerical constant for one of the template parameters? I'm trying to create special constructors for only certain kinds of template combinations: template <typename A, size_t B> class Example { ...

Mar 23, 2017 18:52
Read IBM's article on veradic templates, but it didn't seem like what I needed
Mar 23, 2017 18:52
Exactly that
Mar 23, 2017 18:52
Yes
Mar 23, 2017 18:50
If you are do you know how to pass a compile-time value to a function template or similar?
So that the function will work using that constant value
Mar 23, 2017 18:47
@JoshPetrie You around?
Mar 3, 2017 07:41
Do include_directories(${ CMAKE_SOURCE_DIR }) somewhere before add_executable
Mar 3, 2017 07:38
target_link_libraries( DetectCircle ${OpenCV_LIBS} )
Mar 3, 2017 07:37
Are you binding the library after including it=
Mar 3, 2017 07:34
@DenisKa Yes
Feb 28, 2017 21:00
@yahoo5000 Did you just defy the advice of our almighty C++ god?
Feb 28, 2017 20:57
Merge two uint8 into a uint16
Feb 28, 2017 20:56
@JoshPetrie So what approach would you chose in Yahoo's place?
Feb 28, 2017 20:55
So it's guaranteed for all others?
Feb 28, 2017 20:54
Right. The bool template kinda ruins that assumption :P
Feb 28, 2017 20:52
Why would that be more correct than just memcpy?
Feb 28, 2017 20:50
.data() is C++11 I think
Feb 28, 2017 20:47
@yahoo5000 Because it is
Feb 28, 2017 20:42
Beat me to it..
Feb 28, 2017 20:42
std::copy(&p.buffer[0], &p.buffer[2], (uint8_t*)&type);
Feb 28, 2017 20:27
no
Feb 28, 2017 20:26
yes
Feb 28, 2017 20:24
Also Im lazy and using C-style cast, you shouldn't
Feb 28, 2017 20:24
I think
Feb 28, 2017 20:24
std::copy(p.buffer[0], p.buffer[2], &(uint8_t*)type);
Feb 28, 2017 20:21
Because you usually dont want that
Feb 28, 2017 19:12
@Almo I agree'); DROP TABLES;
Feb 28, 2017 19:10
Whaaat
Feb 28, 2017 19:09
Never used it.. Does it break all canvas?
Feb 28, 2017 19:08
@Lasse Tried to split up UI to different canvas?