405 questions
0
votes
0
answers
67
views
I can't get the coverage graph for the Wald interval. It only shows the outlines of 99% CI but not the coverage that wald has
wald = function(x, n, conf.level = 0.99){
p = x/n
sd <- sqrt(p*((1-p)/n))
z = 2.576
ci <- p + z*sd
return(ci)
}
numSamples <- 10000
numTrials <- 10
probs <- seq(0.2, 0.4, 0....
-1
votes
4
answers
74
views
Formula needed to solve the following pattern/list in excel
What formula could i put starting with cell A2 that would create the following computational list of numbers all the way down. I want to start with a number then in cell A1 and then in the cell below ...
0
votes
1
answer
351
views
Using Python to solve the "resistor cube"
This is a computational problem.
My code:
import numpy as np
# Number of nodes in the cube
num_nodes = 8
# Create the conductance matrix G and the current vector I
G = np.zeros((num_nodes, num_nodes)...
0
votes
1
answer
162
views
Correct finite automata diagrams for these simple problems?
Hello I am learnign about finite automata and I want to see if these diagrams and my explanation make sense.
{w ∈ Σ∗ | w contains the substring 1010} using five states
There is the substring of 1010 ...
0
votes
0
answers
38
views
Why am I getting this computation error of unkown type name 'driver_proc'
Full screen of code and libraries
computation errors
I am encountering a compilation error related to driver_proc struct definition in my project for phase4. The error appears when I try to run make ...
-1
votes
1
answer
62
views
What is this problem with computation of large integers? [closed]
The following equation is same as doing nothing to the integer
((as.bigz(27080235094679553)+1028)*2)/2 - 1028
However, the answer to this in console is 27080235094679552. To get the correct answer I ...
0
votes
1
answer
60
views
How to write a solver for the vibration ODE using the current version of Devito?
I'm reading the devito_book/fdm-jupyter-book/notebooks/01_vib/vib_undamped.ipynb and the code in it seems not compatible with devito 4.8.3.
So I tried to rewrite it as:
import numpy as np
from devito ...
1
vote
1
answer
200
views
What is the best approach to compute Brun's constant with Python (which includes a primality test and a long-running sum)? [closed]
Re Brun's constant, the sum of the reciprocals of the twin primes:
https://en.wikipedia.org/wiki/Brun%27s_theorem
http://numbers.computation.free.fr/Constants/Primes/twin.html
How do I compute the sum ...
0
votes
0
answers
62
views
Is cartopy projections are computaionally heavy?
I have been struggling with Cartopy ever since I started using it few months ago. Many times, the Jupyter notebooks have crashed, and even running scripts from the command line didn't work.I am ...
-1
votes
1
answer
62
views
Inconsistent Runtime Performance in CPLEX OPL Optimization Problem Solving
I am solving am optimization problem in Cplex opl of version 12.10. The problem is formulated as a Mixed Integer Cone Programming model. I execute the code separately for each of the 24 hours of the ...
0
votes
1
answer
64
views
Script in windows when turning on the PC a security message appears
At the company where I work, I'm trying to carry out a process that is to show an image to the user when they turn on the computer, it's a PowerShell script.
Our employees are in Active Directory and ...
2
votes
1
answer
5k
views
DFA for all binary strings having even number of 0's or contains exactly two 1's
I'm trying to solve this challenge:
Design a DFA for all binary strings having an even number of 0's or containing exactly two 1's
I'm a bit confused with this question. I had tried to come up with ...
0
votes
1
answer
622
views
Need a DFA for the alphabets {a,b} such that the language must contain equal and even numbers of a and b
The DFA for even numbers of and b is this DFA for even numbers of a and b but the DFA of even and equal number of a and b is not available
L={\epsilon,aabb,abab,baba,bbaa,aaaabbbb,aabbaabb,bbaabbaa,...
1
vote
0
answers
45
views
Optimizing the computation of rows using Pyspark
I'm encountering a problem that is working with loops in pandas is not efficient, and I'm new to Pyspark, so I would like to ask for ideas, solutions to complete 2 tasks illustrated below.
I have a ...
2
votes
1
answer
144
views
How to search list of numbers for a particular property
I have a long list of numbers. There are no duplicates in the list and all numbers are representable with 2N bits.
For every pair of numbers, I can calculate whether a particular condition is true (...
1
vote
1
answer
99
views
Computing Triple Summation in MATLAB
I have a general solution to my heat equation as:
I have tried implementing this in MATLAB but I get inconsistent results. Do you think the issue is about my code or just the triple summation does ...
0
votes
1
answer
129
views
Convert Nondeterministic Finite Automata to Regular Expression
I am having a really tough time on this conversion problem. I have read, re-read and watched videos but I am pretty sure the answer I am coming up with is not correct.here is the diagram of the NFA
I ...
1
vote
1
answer
404
views
How to tell how small `h` is the in the finite difference?
I'm doing a project required to compute the precise(up to a certain precession N) numerical derivatives of a function.
The usual approach was to use the finite difference types of algorithms, i.e.
(f(...
-1
votes
1
answer
74
views
Computation of Physics
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Parameter simulasi
Lx = 10.0 # Panjang domain pada sumbu x
Ly = 5.0 # Panjang domain pada sumbu y
nx = ...
1
vote
1
answer
65
views
Reduce the computation and storage burden for row-wise comparison in Python
Consider we have the following data frame:
message
0 ABC
1 abc
2 cba
3 abcd
4 dcsa
5 adcd
6 abcd
7 cba
I want to perform row-wise ...
0
votes
1
answer
113
views
Why is the definition of convergence different for root finding algorithms as compared to sequences?
The definition of convergence for root finding algorithms is given in a few sources as:
A sequence ${x^k}$ generated by a numerical method is said to converge to the root $\alpha$ with order $p\geq 1$ ...
1
vote
1
answer
251
views
Exhaustive enumeration technique in Python to find the square root of a number [closed]
Is there a better technique than the following to exhaustively enumerate the square root of numbers between 0 and 1? I have tried to implement Newton's method, but as it converges quadratically, using ...
0
votes
1
answer
118
views
Why does taking modulus (%) make code faster?
I was solving leetcode 2466 (https://leetcode.com/problems/count-ways-to-build-good-strings/) and I had an issue when I tried to solve the problem recursively. This was the code which was giving me a ...
0
votes
1
answer
72
views
Maximum modulus of deviation of the value of the interpolation polynomial from the value of the original function
I am learning computations on GNU octave and am struggling with the following task.
Let the interpolation nodes X be given and the functions lagrange(X,Y,x0) and original_function(x0) defined, which ...
0
votes
0
answers
428
views
Can OneAPI or ROCm run natively on Windows with AMD GPU?
I am trying to identify any potential options to accelerate linear algebra calculations by using the GPU. To be more precise I need to accelerate an explicit dynamics solver. Since in each increment ...
1
vote
2
answers
165
views
Finding sum of a function u=n*x*y for n =[ 0 to N] ; x and y are some array
I want to write a code using python for solving a function such as follows :
u = sum(n*x*y) for n=[0 to N]
Let's say x = [1,2,3,4,5] and y =[6,7,8,9,10] and n= [1,2,..100]
I expect an output like ...
-2
votes
1
answer
35
views
Interval Computation for Python
need some help on this :)
I have a table like this
Time
Participant
2023-01-17 15:13:23
Customer
2023-01-17 15:14:00
Customer
2023-01-17 15:16:16
Customer
2023-01-17 15:16:18
Agent
2023-01-17 15:16:28
...
-1
votes
3
answers
60
views
Summing list to specific treshold with zeros trace
Is there a reasonable way to get the following done in fast compilation way?
I try to sum the list of numbers to specific treshold and replace previous values to 0.
I'm looking for the fastest ...
0
votes
1
answer
670
views
What is better from an energy-saving perspective to run task minimum energy consumption
The CPU frequency and CPU usage are the main factors that impact energy consumption (as far as I know). however what is better from an energy-saving perspective to run task minimum energy consumption:
...
0
votes
1
answer
564
views
Difference between machine precision and underflow
I don't get the difference between machine precision and underflow. Take for example the single precision system: there the machine precision is 10^-7 while the underflow is 1.18 *10^-38.
That means ...
-1
votes
1
answer
883
views
How to write Bessel function using power series method in Python without Sympy?
I am studying Computational Physics with a lecturer who always ask me to write Python and Matlab code without using instant code (a library that gives me final answer without showing mathematical ...
1
vote
1
answer
162
views
Can we assure a strictly decreasing function is computable?
I've been assigned to solve an exercise that questions the following:
Suppose a function f: N->N that is strictly decreasing. Can we assure f is computable?
So far I've found that all non-...
-1
votes
1
answer
89
views
How to use sum in MYSQL
This my code and I want a output like in the picture:
SELECT `test`.custinfo.CustID, OtherDeductionName AS DeductionName, sum(OtherDeductionAmount) as DeductionAmount FROM `db_payroll`.`...
0
votes
1
answer
286
views
torch.sub cause cuda memory out
I have two tensors, a and b, with sizes a.shape=(10000,10000,120) and b.shape=(10000,10000,120).
I'm trying to get a cost matrix between a and b,
cost = torch.sub((a-b)**2,-1), where cost.shape=(10000,...
1
vote
0
answers
113
views
Is there a way to see how much R computation is left from mac terminal?
I have been running an R script that takes around 4 days to complete. The script involves a for loop that contains a text progress bar indicator, like so:
pb = txtProgressBar(min = 1, max = 60000, ...
-1
votes
1
answer
105
views
proof of SAT np completeness
I know if we want to prove the np completeness of some problem we must show these :
there is a nondeterministic polynomial solution for the problem
all other np problems are reducible to the problem
...
0
votes
1
answer
2k
views
Question about macOS's caffeinate utility [closed]
When one needs to run long-running computations on macOS, caffeinate utility is very handy.
However, it is not very clear from the documentation, which flags I suppose to use?
man caffeinate says:
-i ...
0
votes
1
answer
446
views
computing the math formula on the mask (google earth engine)
I am about to calculate Chorophyll-a in the water bodies in one region, as I outlined above. I have created a mask, with water=1, land=0(transparent). And I want to calculate quality formula (NDCI, ...
14
votes
1
answer
2k
views
For loop in c# vs For loop in python
I was writing a method that would calculate the value of e^x. The way I implemented this in python was as follows.
import math
def exp(x):
return sum([
x**n/math.factorial(n)
for ...
-2
votes
1
answer
421
views
Calculate XP percentage completed for multiple levels (similar to call of duty/etc)
I am developing an XP/Leveling system for a website. Think of it like Call of Duty levels.
For example
Level 1 = 0 - 100XP
Level 2 = 100 - 200XP
Level 3 = 200 - 300XP
Now obviously for level 1, ...
2
votes
1
answer
76
views
Is there a name for not needing to run an algorithm entirely because you have already started it in advance?
I have a graph algorithm I don't need to run from scratch when invoking a function because I've been tracking the necessary information in advance. The opposite of lazy evaluation, or "reversed ...
1
vote
2
answers
131
views
eigenvectors created by numpy.linalg.eig have dots instead of data
I want to calculate complex eigenvectors (Psi functions for shrodinger equation) for 20k*20k matrices, but always gets smth like this:
[ 2.99009782e-09 -1.12381299e-08 -2.82346868e-08 ..., 6....
0
votes
0
answers
87
views
Generating a series of functions
I am working on a computational project where I have to determine a series of functions f_0, f_1, f_2,...f_n, that will be used in a calculation.
The evaluation of the nth function requires knowledge ...
0
votes
0
answers
40
views
Nodejs efficient calculation through multidimensional array
suppose that we have a multidimensional array like this:
[ [{ a: 0} , {a: 1} , {a: 2}], [{ b: 0} , {b: 1}], [{ c: 0} , {c: 1} , {c: 2}, {c: 3}]]
what i want to obtain are all combinations from
a0,b0,...
0
votes
1
answer
138
views
How to find a sequence of input to drive a system to a certain state?
I encountered a problem and would like to ask what type/class of problem it should fall into in terms of algorithm/computing theory. I’d also like to ask if there’s a smart algorithm to solve it ...
0
votes
0
answers
34
views
How can i add these to get their total grade?
I already got their percentage for attendance to exam, i cant add all these to compute their total grade, it says in error unknown column 'attpercent' in 'fieldlist'
1
vote
3
answers
195
views
Code performance optimization : speeding up population of an array in Matlab
Part of a longer algorithm, populating the column array b takes 80% of the total run time. The line (see code below) where S1 is calculated in the for loop is the bottleneck because it's called an ...
0
votes
2
answers
127
views
Java, computing the following formula
I am trying the write the formula in the image using Java. However, I get the wrong output. This is what I am so far for the computation.
Assume Input is: Loan Amount = 50000 and Length = 3 year.
My ...
0
votes
0
answers
523
views
How do I invert a convolution operator?
The title may be a little obscure, sorry. I'm not quite sure how to phrase it otherwise.
The problem is as such: I have a 2D kernel (as is used for convolution) and a vector of weights (e.g., floats ...
1
vote
0
answers
102
views
Missing corners on a square lattice
As can be seen in Figure1. I am trying to plot a square lattice in python.
Somehow I am missing the corner points.
The code is working fine for 3x3 square lattice but it's not for 5x5 and the ...