math

matrix multiplication result value range

▼魔方 西西 提交于 2020-01-17 04:41:12
问题 Here is the initial question: About the output value range of LeGall 5/3 wavelet Today I found actually the transform can be seen as a matrix multiplication. It is easy to calculate the wavelet coefficients as a matrix (in order to estimate the value, all the Rounded down action is ignored which will not affect the estimation of the max value). The 1st level of DWT2 has two steps which is to perform the LeGall 5/3 filter on two directions. If we see the I as the input 8*8 matrix and A as the

Evaluating mathematical expression from a string and inserting it on stack

你离开我真会死。 提交于 2020-01-17 04:03:17
问题 I'm trying to build an arbitrary precision calculator. I represent numbers in linked lists (one node is a single digit), and I want to store them in a stack. However, I can't seem to figure out how to break the mathematical expression received as a string apart while keeping the right mathematical operations order. For example, if the inserted expression is 6*8-2+8-8*9/4 , I'll represent numbers as linked lists and insert them into a stack, and insert the operators into a different stack, and

How do I add a column to a date in Postgres?

谁都会走 提交于 2020-01-17 02:51:09
问题 I’m using Postgres 9. I’m trying to do date math with a column in my table that is an integer. I’m trying this: select current_timestamp + interval age || ' years' from my_table where age is not null limit 5; ERROR: syntax error at or near "||" LINE 1: select current_timestamp + interval age || ' years' from rac... What is the proper way to write this? I’m trying to add the age column, which is in years, to the current timestamp (now)? 回答1: Multiply your integer with 1-year intervals and add

Merging multiple transformation matrices

只谈情不闲聊 提交于 2020-01-17 01:21:09
问题 I am trying to develop a gesture based transform function. I am just confused about merging many transformation matrices by their own pivot point. Actually I am trying to use some functions like this: matrix4x4 transform(matrix4x4 prevMatrix, vector3 pivot, vector3 deltaTranslation, float deltaRotation, float deltaScale){ 'magic is here.. } 'First call var temp = transform(identity, (.5,.5,0), (0.1,0.2), 0.1, 105deg); renderCanvas(temp); 'Second call temp = transform(temp, (0, 0), (-1, 2), -

How to find reflection vector when the object doesn't sit on an axis?

泄露秘密 提交于 2020-01-16 19:31:30
问题 How do I calculate the reflection vector to this problem? Using the formula r = v - 2 (v.n)n I can get the reflection when the object is sat on the x or y axis however when using this formula when it isnt seems to give strange results. Any help would be greatly appreciated. Example of the problem 回答1: The normal vector n needs to be normalized. In your example, n should be (1/sqrt(2), 1/sqrt(2)) . 来源: https://stackoverflow.com/questions/58699100/how-to-find-reflection-vector-when-the-object

How to create nxm HTML5 canvas Grid of objects (colored squares)?

99封情书 提交于 2020-01-16 17:35:31
问题 I'm trying to create a grid (matrix) of squares in a given area <canvas> with n columns and m rows, and an option to set a spacing between the squares if desired. The grid should fill squares with random coloring. I'd also like to add a zoom function, so the colored squares will appear much bigger in a region that is double-clicked. Can anyone suggest a good method to generate the grid and assign random colors to the squares? If you can suggest how to create the zoom effect too that would be

After subtracting a number from a sequence, how many of remaining numbers are positive? [closed]

牧云@^-^@ 提交于 2020-01-16 14:06:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I have a number sequence of length N . I will have to do Q operations on this number sequence. In each operation I will be given three integers P, Q, V with P ≤ Q ≤ N and will subtract V from every iᵗʰ integer, where P ≤ i ≤ Q . After each operation, I will be given another two integers X, Y with X ≤ Y ≤ N . I

Calculating SVG donut slice label position server side

跟風遠走 提交于 2020-01-16 09:05:12
问题 How can I calculate a slice text label to be positioned directly in the center of a slice in an svg donut chart? I have an svg donut chart that is generated server side. I have the slices of the chart correctly implemented but I'm having some trouble figuring out the math to place each individual slice label inside the center of it's respective slice. The label will be the percentage of the slice it occupies. This is a slimmed down version of the svg. <svg width="100%" height="100%" viewBox=

3d graphics, unit vectors and orthogonal matrices

坚强是说给别人听的谎言 提交于 2020-01-16 07:05:08
问题 I'm trying to get my head wrapped around tangent space and I'm starting to come up with questions that I can't ask my colleagues because they're starting to have no idea what I'm talking about. I'm trying to do normal mapping on opengl. My current plan is to calculate the tangent-bitangent-normal matrix in a geometry shader. When I have an orthogonal matrix (such as the TBN matrix) and I let opengl interpolate it between vertices, are the three resulting vectors (T, B and N) then still unit

how to solve this problem in R: In while (t <= cc[i]) { … : the condition has length > 1 and only the first element will be used

允我心安 提交于 2020-01-16 05:36:11
问题 big thank you and warm regards for the answer Mr. Tom, for the detail problem may you can help me the following step : I have a problem with R Program, first, I make a trendlinier (At+B) from this data set timedelay<-c(76.77,65.88,60.96,51.61,48.72,39.86,35.43,33.36,30.32,23.96,16.95,3.564) timedelayts<-ts(timedelay,start=c(2011,1),freq=12) plot(timedelayts,ylab="Time Delay",col="blue") time=ts(1:length(timedelayts),start=c(2011,1),freq=12) trendlinier<-lm(timedelayts~time) trendlinier Call: