Questions tagged [numerical-computing]

Is an interconnected combination of computer science and mathematics .

Is an interconnected combination of computer science and mathematics in which we develop and analyze algorithms for solving important problems in science, engineering, medicine, and business, for example, designing a bridge, choosing a stock portfolio, or detecting tumors in medical images

146 questions
0
votes
0 answers

Quark in producing fitted values using LM model in R

A colleague and I noticed this interesting quark in the lm function in R. Say, I am regressing y variable on an x variable and x variable is a factor level variable with two categories (0/1). When I run the regression and examine the fitted values,…
Sharif Amlani
  • 1,138
  • 1
  • 11
  • 25
0
votes
1 answer

store values of function to prevent from running again

Say I have some complicated function f(fvar1, ..., fvarN) such as: def f(fvar1,..., fvarN): return (complicated function of fvar1, ..., fvarN). Now function g(gvar1, ..., gvarM) has an expression in terms of f(fvar1, ..., fvarN), let's say: def…
0
votes
1 answer

How to evaluate double integral with variable upper limit of inner integral

I am trying to evaluate a double integral in which the limit of the inner integral is variable and depends on the outer integral. Coming from Matlab background, it is easy by using symbolic integration, but I have no idea how to calculate the same…
0
votes
1 answer

Is MPI_Reduce also does the work of MPI_Barrier?

As MPI_Reduce and MPI_Barrier are costly commands, so I have to reduce some communication among threads. I know the main work of MPI_Reduce and MPI_Barrier. Sometime I observed that MPI_Reduce is reducing all values in one threads as well as it is…
0
votes
0 answers

L2 error norm of FFT solution not converging

Given a function u(x,y) I want to calculate the Laplacian of a function I am doing this via cuFFT's forward and inverse transforms. Below is the code #include #include #include #define BSZ 8 #define gpuErrChk(ans) {…
0
votes
1 answer

How to show truncation error of second-order numerical differentiation is square of the first-order numerical differentiation

I am trying to show the truncation error of the second-order numerical differentiation is indeed giving us double precision than first-order numerical differentiation (with considering the machine error/round-off error eps()) Here is my code in…
Tack_Tau
  • 628
  • 1
  • 6
  • 12
0
votes
0 answers

Two phase simplex method with matlab

I have a problem with my MATLAB code that solves linear equations with two phase simplex method. In some examples it's not working and I can't find what the problem is. Working Example and not Working Examples are in the picture below : Code is…
0
votes
1 answer

Vectorizing consequential/iterative simulation (in python)

This is a very general question -- is there any way to vectorize consequential simulation (where next step depends on previous), or any such iterative algorithm in general? Obviously, if one need to run M simulations (each N steps) you can use for i…
Physmatik
  • 256
  • 1
  • 6
0
votes
1 answer

Modified Secant method Javascript algorithm?

I need your help to code this New Secant Method into Javascript. The secant method uses two starting parameters, while this new method require only one starting parameter. Thank you in advance. Thank you for your answer [ed: comment], here is what…
0
votes
0 answers

C++ Linker command failes

I am trying to execute the following command. However, I ran into the following error. Undefined symbols for architecture x86_64: "thrust_wrt_world()", referenced from: numerical_dynamics() in lander-8358f0.o "atmospheric_density(vector3d)",…
robotlover
  • 331
  • 1
  • 2
  • 12
0
votes
0 answers

numerical errors in R

I need to compare numbers. But there are many numerical errors in some comparisons. I know they are errors because analytical results are known. Of course when analytical results are known numerical evaluations are not needed, but I want to know how…
quibble
  • 303
  • 2
  • 13
0
votes
0 answers

How to plot 3D electric field strengths in MATLAB

So basically I`m trying to plot the electric field strength at a given point [x,y,z] in MATLAB. I want to plot the field strength at a given point in terms of color; a high field strength at point [x_1, y_1, z_1] would, for example, be shown as a…
torola
  • 113
  • 1
  • 2
  • 8
0
votes
1 answer

Declaring variables in Python 2.7x to avoid issues later

I am new to Python, coming from MATLAB, and long ago from C. I have written a script in MATLAB which simulates sediment transport in rivers as a Markov Process. The code randomly places circles of a random diameter within a rectangular area of a…
SurfProc
  • 105
  • 9
0
votes
1 answer

Program not entering an if-loop in Fortran even when condition is satisfied

This is the section of the code that is not running as expected. I had to include some old-style "pause" statements to pin-point the error location. iteration_index = 1 y_refined = y_current + (0.5d0*dx*(dydx_predictor +…
0
votes
1 answer

Is using matrices with many 0's and 1's considered vectorizing?

Suppose that for some needed transformation I have a mxn matrix A that consists of a few 1's and many 0's. If I were to transform a nx1 vector by A, is this considered a vectorized implementation? While the matrix A mainly consists of 0's, does…