Array Definition and 481 Threads

  1. P

    Need help initialising a 2D array

    Hello everyone, I have a newbie Matlab question. I need to set up a 2D array 'phi' whose gradient is an identity mapping in terms of the spatial coordinate. So, basically I have a 2D image and what I want to do is set up phi at each pixel (x, y) as follows: phi(x, y) = 0.5 * (x^2 +...
  2. M

    Help w/BWR Array: Guide Rods/Tubes in 8x8 Assembly

    On a typical 8 x 8 BWR assembly which slots would contain guide rods, or instrumentation tubes?
  3. A

    LaTeX [latex] enumerate list colliding with equation array

    So I have a list like \begin{enumerate} \item asdfasdfasdf \item asdfasdfasdf \item \begin{align} equation here \end{align} \end{enumerate} I want to put an equation array to center and give some space around the equation, otherwise it looks all cluttered. I keep getting...
  4. C

    Fortran Increase of array memory in gfortran compiler

    Dear colleagues My code in Fortran passes all data in one large vector. I increased the size of this vector for the maximum that the compiler accepts but still need more positions allocable to it. Is there any way I can increase the memory allocation of the compiler? Thank's
  5. F

    How to pass array element form a subroutine to main function

    Hi guys. I want to transfer each elements of an array (which is declared in one subroutine)to main function using common block technique. When i am doing so i go always a constant value in the array in the main function. Suppose i have one array bparz(i) which has different values in one...
  6. J

    Powering LEDs: Array of 168 LEDs, 120V AC, 25mA, 2.8V Forward Bias

    Hey, so I have a large array of LEDs. I think I have 168 of them. I want to power them from my wall in the US (120V AC). The forward bias for each LED is 2.8V. The current rating is 25mA. I plan to arrange them in chains of about 42 to get 117.6V drop over all the LEDs. That leaves me with...
  7. James889

    Shifting Array in C: Solving Last Element Problem

    Hi, i would like some help with this task. My task is to write a function that shifts an array arbitrary number of steps. So for example the array { 0,1,2,3,4,5,6,7,8,9 } would look like { 9,0,1,2,3,4,5,6,7,8 } after the function was called with the steps arguments set to 1. The...
  8. matqkks

    How Can We Make Matrices More Tangible for Struggling Engineering Students?

    At present I introduce matrices as an array of numbers and then carry out various matrix operations. Is there a more tangible way of introducing this topic? I have thought of transformations but my experience with students has been that they get lost in the transformations and so give up on...
  9. A

    Fortran Fortran: creating array containing characters

    Hello. I'd like to create an array containing characters (basically a word stored as a 1xn array). I have no idea how to do this, however. I thought that the most obvious way to do it (yes, it would've been highly impractical for long words) was to write character, dimension(3) :: A...
  10. F

    Fresnel Lens Array - Focal Point Question

    Hello, all, I am using 9 fresnel lenses (~1x1' per lens) and 9 water blocks for a solar water heater. Each fresnel lens is positioned so that a water block below is heated. A pump is used to pump the water through the system. However, I have one question... I have all of my fresnel...
  11. L

    How to Sort Word Frequencies in a C Program?

    Homework Statement Develop a C program that to count how many times each word appears in a large text file. Your program must read words from a file and output the number of times each word of the file appears. 1. Implement an algorithm to count how many times each word appears in a large...
  12. M

    Swapping numbers in a multidimensional array

    i'm trying to swap the 43 and the 435, but instead 435 is printed where 43 should be. #include <iostream> using namespace std; void print(const int matrix[][2]); void swap(int matrix[][2]); int main(){ int matrix[2][2] = {{14, 435}, {43, 65}}; print(matrix); cout << endl...
  13. B

    Solar declination / solar panel array design

    I need some help, I am planning on installing a 10 kilowatt solar panel array in the next couple of months. I will not be using a solar tracking device. The plan thus far is to determine the solar south bearing and face the panels in that direction and work out an appropriate angle for the...
  14. N

    Mathematica Mathematica: Function output to array

    Hello everybody! I've got a Mathematica problem that I've been working on for a while but can't seem to solve. My code is pretty involved, so I'll simplify the dilemma for you. F1 := Function[{x,m,b}, y = m*x+b; Print[y] ] I have a function called F1. If I call it like...
  15. M

    Difference Between Array & Tuple for Large App

    I am wondering if anyone can describe to me the correct use of a couple words. I am programming a very large application, and I like to name my variables so that they are very descriptive. Before I begin, I would like to know what is the difference between an array and a tuple? Are they the...
  16. M

    Fix Dynamic Array Bug: Find the First Item Less than Preceding

    this function is supposed to find the first item in an array that is less than the element preceding it, and set the p parameter to point to that item, so the caller can know the location of that item. when i run it.. it fails. there are probably multiple bugs.. any suggestions on how to fix...
  17. E

    MATLAB Matlab: how to use an array in a matrix

    hi all.. I have a 2x2 matrix and an array , for example: a=linspace(0,12) %this is my frequency range. B=[2*a 3*a-1 a./2 a] this one does not results a 2x2 matrix, that I need it to have ...B2xB1xB how could i get a 2x2 matrix? should i use a loop instead of an array...
  18. F

    Infinite array of charged wires

    In the Feynman Lectures, Volume II, Chapter 7, the final two pages (7-10 and 7-11), Feynman describes an infinite array of parallel charged wires and uses a Fourier series to solve for the field above them. He shows that the series can be expressed entirely in terms of cosine terms and that the...
  19. V

    Comp Sci Comparing array of data is fortran

    Hi FORTRAN experts, I have two arrays of data, called data1.dat and data2.dat. each contains 60 data. What I want to do is to compare the data in each file and write the counting into bins. It goes like this. First, take the first data in data1.dat file and compare with the 60 data in...
  20. M

    How to read this file line by line and store contents in an array

    Hello, In my computational science class I have the task of taking the following input file and manipulating it. I have the following input file: C1 0 0.00 0 000.0 0 000.0 O2 1 1.22 0 000.0 0 000.0 H3 1 1.09 2 120.0 0 000.0 C4 1 1.54 2 120.0 3 180.0 H5 4 1.09 1 110.0 2...
  21. V

    C/C++ Troubleshooting a Private Member Double Array in C++

    I have been pulling my hair out on this one. I have a double** that is a private member of a class. The constructor declares and initializes it as a 2 dimensional dynamic array of doubles (an array of arrays). Then it sets every element of the array equal to 0 with a set of two nested for...
  22. G

    MATLAB Matlab Problem structured array

    Not sure if anyone here is familiar with MATLAB programming. I am supposed to create a structured array (resembling a game board) that acts as a predator/prey simulator. The user needs to specify the size of the game board. Within the gameboard I am supposed to represent a couple of different...
  23. 9

    Help with Array: Evaluating Integral of sin(x)

    What I need help with is the output. What should be our output? For example, [0, 1) ?
  24. V

    C/C++ Why Aren't My C++ Array Functions Working?

    Have read a million different sites and threads, but still not getting anywhere (damn 1st year java makes addresses incomprehensible!). What changes do I need to make to get these c++ functions to work? //---------Functions //-- A function to increment the (n,m) element void...
  25. D

    Scipy/numpy 2D array: how to define with a function?

    I want to make a matrix of values as so: F(0,0) . . . F(1,n) . . . F(n,1) . . . F(n,n) I could of course do it like this list=[] for i in range(0,n): for j in range(0,n): list.append(F(i,j)) a=array(list) a.reshape(n,n) But I am curious if there is a more...
  26. O

    MATLAB Apply if/else if to each element in array in MATLAB

    Hi! I have an array that is 1 column by many rows, of which each element represents a time. I want to find variable f at each time, where f is defined as follows: if t < tp f=(sin((pi*t)/(2*tp)))^2; if tp < t < ts f=(cos((pi*(t-tp))/(2*(ts-tp))))^2; otherwise f=0 I've tried...
  27. J

    Why is this highly distributed array a bad idea?

    I once ran into a nobel-winning astronomer at a conference and suggested to him putting small internet-controlled telescopes for free (and fully supported) on a the roof of any household that wanted one. The telescopes would be controlled by "The Project" from a central server, and the "owner"...
  28. A

    Comp Sci C++ Probability of Birthday Paradox for Room of 50 People

    Homework Statement Write a program that approximates the probability that at least two people in a room of 50 people have the same birthday. Run 5,000 trials, count up the number at least two people have the same birthday, and divide by the number of trials to get a probability. Homework...
  29. J

    What is a hexagonal array and how is it transferred into different substrates?

    I was reading a paper, and this term came up a lot. I have been searching for couple hours, and still cannot find a good source to explain this term. Anyone has any idea?
  30. P

    Locate maximum occuring element array in perl

    guys..i need help... how to extract a maximum occurring element in array using perl... example... a[1]=11; a[2]=12; a[3]=13; a[4]=14; a[5]=15; a[6]=13; a[7]=14; a[8]=14; we will see that, 14 is the most occurring at element 8... how to know the no of frequently it...
  31. D

    How to Add a Vector to a 2D Array in Fortran 90?

    hi. i have a quick question regarding fortran 90. i often need to add a vector to a 2d dimensional array, and i find it a bit to 'bulky' to always use do loops. let's say i have this: do i=1, 20 a(:, i)=a(:, i)+b(:) end do is there a simple(r) way to tell fortran that i want to...
  32. S

    Is there a positive integer solution to 1234x-4321y=1?

    Homework Statement Find a positive integer solution to 1234x-4321y=1, both x and y will be positive. Homework Equations The Attempt at a Solution I created this array 4321 1234 619 615 4 3 1 3 1 1 153 1 1082 309 155 154 1 1...
  33. B

    Fortran Printing 1D array in Fortran as 2D array

    Delete.. Delete..
  34. S

    Fortran90 How to take the power of elements of an array to, say, 5?

    Hi all, as title, how to take the power of elements of an array to, say, 5? I know how to do it using loops, but would it be very troublesome if I have to do it a thousand times? Any ready made function in fortran90? I hope there is... I have googled it quite a bit, but seems nothing useful.
  35. O

    How do i make a function return an array?

    in the c++ programming language, how do i make a function return an array?
  36. C

    Help with C Homework: Array from 1D to 2D for 9 Cell Average

    Homework Statement Need to write a 1 dimensional array in 2D so I can do operations on a 9 cell average. Here's what I've got so far #include <stdio.h> #include <stdlib.h> int main() { int dataArray[2]; int imax, jmax; FILE *fp; char buffer[4]; int...
  37. T

    Can a Portable Biochemical Testing Device Revolutionize Disease Management?

    Hi all, I was thinking recently about insulin testing, and whether the convenience could be extended to other hormones and biochemicals in the body. For instance the thyroid molecules T3 and T4. It seems like a device capable of testing for the level of these molecules on the fly would be...
  38. A

    Fortran Fortran 90 & elements array comparaison

    Dear all, I'm trying to figure about an efficient way to to get the redundant element in my array. For instance, let's take the array [0,2,3,0]. I'd like to get out [2,0,3] (or 3,0,2 it doesn't matter). So it find out which element is duplicated, an puts its value in between the 2 other...
  39. A

    Fortran Fortran, complex array with rank one

    I'm using the MATMUL command to multiplicate two arrays: array A is of rank one and has three complex elements, while array B is a 3x3 matrix with complex elements. However, the compilation is aborted because "the shapes of the array expressions do not conform". I'm pretty sure that the...
  40. A

    MATLAB Extracting a Column from a 4D Double Array in MATLAB using Squeeze

    Hello, I'd like to access a column of values from the 4th dimension of a 4D Double array in MATLAB and then save them to a new matrix. For example: A = rand(3,3,3,3); A(1,1,1,:) gives me: ans(:,:,1,1) = 0.7077 ans(:,:,1,2) = 0.0669 ans(:,:,1,3) = 0.7794 I...
  41. A

    MATLAB Creating an Array of X Values for Plotting a Function

    I want to create a plot of a given function for all x values between negative infinite to negative R (for some given R value). How do I create an array for x so that my plot will include all the x values?
  42. Saladsamurai

    Excel VBAWriting a .txt file to an Array or Wrksht

    [SIZE="5"]Go To Post #7 for new Question :smile: So let's that I have a .txt file called input.txt that simply contains the following: abc+123 I want to load input.txt using VBA into a 1-dim array called MyArray. I want each character to be an element of the array. That is a is...
  43. W

    Learn How to Dim an LED Array with a Simple Circuit - No Switch Required!

    Hi. I've got a LED dimmer circuit. When the dc power turns on, the LED will slowly lights up. There is a switch in the circuit that if I "open" the switch, the LED will slowly turns off. The million dollar question is how do I remove the switch and the LED will slowly turns off when the...
  44. F

    Keplerian scattering through an array of mass lumps

    Hey guys, Hit a bit of a snag in something I'm working on and need some help. I've attached an image so hopefully that will help a bit. Basically I'm trying to model a mass m moving through a potential that is, currently, a grid of point masses and seeing how the overall distance traveled in a...
  45. S

    Counting on a Rectangular Array

    Homework Statement Suppose you have an a x b rectangular array of distinct integers (think of it as a matrix if you would like). Now suppose we first move across the columns and take a permutation of the entries in each column. Informally, we can imagine the integers in the array as cards, and...
  46. H

    MATLAB How can I use the find function to replace missing values in a 4D array?

    Hi all- I have a question regarding using the find function as opposed to if statements in finding values in a 4D array. These are climate variables, such as temperature (in Kelvin). Missing values are represented as 10^15, and I want to change them to NaN which plots much nicer. I have...
  47. H

    MATLAB MATLAB char array with variable names

    Hello all. I am having troubles reading in data(from a .hdf file) and giving it my own variable names. I have created a character array var_names with the names I wish to use. The .hdf variables are 3D and 4D (they are climate parameters). What I am trying to do is loop through the...
  48. R

    Debugging C Program for Outputting Array Elements

    C programme ? Homework Statement /* Program-8.4 */ #include <stdio.h> int main() { int marks[5]= {89, 45, 73, 98, 39}; printf("%d\n", marks); //memory addres pointed by pointer printf("%d\n", &marks[0]); //memory address of 1st element printf("%d\n", *marks)...
  49. M

    Fortran Loading 2D array files to Fortran variables

    Hi, I have created data files by compiling and running a c++ code. Now I need to open and store the contents of these files in Fortran 77 variables. But I am not able to do this. The read command does not return the values stored in the file. The files are having some 2003 lines and 53...
  50. N

    How Do Photon Journeys Affect Light Clock Synchronization in Relativity?

    I asked this question in an earlier thread, but I have thought a bit more about it and would like to add to it, hopefully focussing more successfully on the bit the bothers me. First some preparation: At first, I was thinking of two light clocks set in motion relative to an observer A but at...
Back
Top