Hi all,
I have the following code:
M = zeros(N)
for i = 1:N
for j = 1:N
M(i,j)= log(norm(rs(:,i)-rc(:,j)))+log(norm(ri(:,i)-rc(:,j)));
end
end
Where rs, rc and ri are 2xN arrays.
Is there a way to construct the matrix without the use of the two for loops?
I'm...
So, I'm doing a loop through 612 rows of data, each row having 2592 numbers. If the number I'm looking at is NOT equal to NaN, I want to do a calculation using a different array. This way, if the element in sfc_data is not a number, the number in lat_matrix in that same column is ignored, and...
Grr! This is flummoxing me!
I want to add every combination of cells in n rows that will be input be textfields.
The number of rows is flexible. It is defined when the appropriate number of textfields have strings of numbers in them.
Each row will have its own number of cells in it...
I am writing a program in C (vanilla, non-C++/C#) and I am having trouble figuring out why my initialization of my array of structures isn't working. I have tried a number of things without any luck. I still get a compiler error: "conflicting types for 'cardInfo' "
I am writing a simple...
Hi,
i want to ask a question, if you help me i'll apraciate.
I have a jacobian matris with 4 initial parameters. J [1,1] like:
J =
-1/25-7610043006264749541981/760193818229211136000000*20265^(3/4)*1663^(1/4)*(1/T)^(7/4)/Yf^(9/10)*233^(13/20)*1000^(7/20)*Yox^(33/20)-Ypr
in here. I...
Hello all,
I have some data stored in character*1 array(value,value) apparently the code is in f77, i got the original reading code for the data as a text...
I am working in f90, and to the extend of my knowledge (not much in fortran) I can not declare such 2D array as character...
Homework Statement
I don't know how to limit the array. I know that the program crashed because it exceeds the array end points at zero and maximum position and time. But how can I tell MathCAD not to do so? I'm stuck without any idea! Can anyone who can show me the code lines I should...
Homework Statement
say a[5] = { 5.6, -3.2, 11, -7.7, -1 );
and b = 5
void fum ( double a[], int b ){
for ( int i = b -1; i >= 0; i-- ){
if ( a[i] < 0 )
cout << -a[i];
else cout << a[i];
cout << ", ";
}
}
Why is the output
1, 7.7, 11, 3.2, 5.6
and not
7.7...
Simple Array assignment, directions as follows:
(Must be implemented using a one-dimensional array.)
Write an application that inputs ten numbers from the user, each number can be between 10 and 100, inclusive. As each number is read in determine if it is a number already entered. If it is...
Homework Statement
I don't know if this has ties to linear algebra, so sorry in advance if I'm posting in a wrong section.
We have an n*n matrix A, n is an odd number, and "the matrix's sides are 0" meaning:
we'll call non-zero elements as 1's for now.1st line 1111...1111
2nd line 0111...1110...
Rank of a tensor--- 2x2x2 Array
Can anybody give me an example of 2x2x2 Array whose tensor rank is 2
or
Can somebody show me why the tensor rank is two for the following 2x2x2 array. That is can you express as a sum of 2 outer products?
I am giving the entries of the first face and then...
hello,
our team has a solar car project, and i am in charge of the solar array system. Now we have an average silicon solar cell of Voc 0.6 V and Isc 6 A, thus 3.5 W of power. We are given 6 sq. meter of area to cover with solar cells. This corresponds to around 2300 standard sized solar...
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 +...
Homework Statement
Given a permutation of the set {1,...,n} for a natural n, and two possible operations on this set:
Type-1(k): Shift the first element in the array to the back of it, do it k times.
[3,2,1,4] -> T1(1) -> [2,1,4,3]
Type-2(k): Shift the third element in the array to the front...
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...
Homework Statement
Given an array with random real elements, find the indices pair (i, j) where j>i s.t
a[j] - a[i] is maximised in O(n ln n) time
I tried sorting the array of (value, index) pair with O(n ln n) sort, and then inspect the index array. However it does not suggest me any...
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
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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"...
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...
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?
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...
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...
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...
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.
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...