Separation of variables in vector components

I have a function f in two variables y and theta, where y = z ^ 2 + x ^ 2. There are numerical values ​​for x, z and theta (x and z are the dimensions). I have to do calculations to get the speed. Therefore the speed vector has to be expressed separately in two components x and z. The following is a simple example of my task:

f(y_,θ_) = a y Cos θ + b y^2 (1 - 3 Cos θ)

gradf(y_, θ_) = Grad(f(y, θ), {y, θ})

v(y_, θ_) = f(y, θ)/gradf(y, θ)

I have taken the following path, but it is not correct.

v((z^2 + x^2) _, θ_) = f(y, θ)/gradf(y, θ)

I need the separation of variables as components of the vector.

Thank you very much.

linear algebra – be $ C[0,1]Let $ be the real vector space of all continuous real-valued functions

Given that Let $ C (0.1) $ be the real vector space of all continuous real-valued functions $ (0.1) $ To let $ T $ be the linear operator on it and defined by

$$ (Tf) (x) = int_0 ^ 1 sin (x + y) f (y) ; dy ; ; ; x in (0.1) $$

you will find the dimensions of the area space from $ T $

I tried it-The specified transformation is an operator, so it is defined as follows $$ T: C (0.1) rightarrow C (0.1) $$ After that, I have no idea how to solve it. Please give me a hint

Thank you very much

Vector valued functions and tangents [closed]

Need help with these 3 questions. Can't seem to find how to change the curve equation to a vector value.

A particle moves along the curve 2y ^ 3 = 3x ^ 2 at a constant speed of 10 units / second.

a) Find the slope of the tangent at the point (4 / sqrt (3), 2)

b) Use the slope of the tangent found in a) to determine the unit direction vector at the point (4 / sqrt (3), 2).

c) At a speed of 10 units / second, enter the speed vector of this particle here.

Any help is appreciated, thanks!

List manipulation – fixed point of a vector

It seems to me that FixedPoint is designed to work with a certain value, but what if you want it to work with a vector instead?

I start with an nxn matrix mat and the function:

f[vec_]:=Exp[-vec]/Total[Exp[-vec]]

I want to find a vector of the probabilities vec = {p [1], p [2], …, p [n]} so that:

vec==f[mat.vec],

where each p [i]> 0 and the sum of p [i] 1.

Is there a way to do this in general? Or let's take a certain matrix:

test={{0.5, 0.44, 0.58}, {0.56, 0.5, 0.41}, {0.42, 0.59, 0.5}}

Can I find a vector of probabilities {p1, p2, p3} that works here?

This appears to be a FixedPoint problem, but I would settle for any solution, e.g. B. with NSolve or a module / block. I puzzled over it for a while, so any help would be appreciated.

c ++ – delete many vector elements when running with & # 39; auto & # 39;

Let's say I did vector of pairs where each pair Corresponds to the indices (row and column) of a particular matrix that I am working on

vector> vec;

I wanted to go with auto, go through the entire vector and immediately delete all pairs that meet certain conditions, such as something like

for (auto& x : vec) {
    if (x.first == x.second) {
        vec.erase(x); 
    }
}

but it doesn't work as i suppose vec.erase() should have an iterator as an argument and x is actually a pair that's an element of the vector vecnot iterator. I've tried changing it in a few ways, but I'm not sure how to deal with container elements auto works exactly and how can I fix it.

Can I just change the code above to make it work and delete multiple vector elements as I work through it? auto? Or should I change my approach?

At the moment it is just a vector of pairs, but it will be much worse later, so I would love to use it auto for the sake of simplicity.

Draw a vector field from spherical coordinates

I'm trying to draw an integral in spherical coordinates, but I'm a bit lost. I think my only problem is switching to Cartesian. Everything I saw about it went a bit over the head. Here is my code (sorry for formatting):

$$
vec {E} = sigma k int_0 ^ R int_0 ^ {2 pi} ( frac {(r sin theta cos phi-r & # 39; cos phi & # 39;) textbf {i} + (r sin theta sin phi-r & # 39; sin phi & # 39;) textbf {j} + (r cos theta) textbf {k}} {( r ^ 2 + r & # 39; ^ 2-2rr & # 39; cos phi cos phi & # 39; sin theta-2rr & # 39; sin theta sin phi sin phi & # 39;) ^ {3/2}}) r & # 39; d phi & # 39; dr & # 39;
$$

(ScriptR)((Phi)_, r_, (Theta)_, (Phi)1_, 
   r1_) := {r*Sin((Theta))*Cos((Phi)) - r1*Cos((Phi)1), 
   r*Sin((Theta))*Sin((Phi)) - r1*Sin((Phi)1), r*Cos((Theta))};

(ScriptR)Norm((Phi)_, r_, (Theta)_, (Phi)1_, r1_) := 
  Sqrt((r*Sin((Theta))*Cos((Phi)) - 
        r1*Cos((Phi)1))^2 + (r*Sin((Theta))*Sin((Phi)) - 
        r1*Sin((Phi)1))^2 + (r*Cos((Theta)))^2) // Simplify;

ele((Phi)_?NumericQ, r_?NumericQ, (Theta)_?NumericQ) := (Sigma)*k*
   NIntegrate(((ScriptR)((Phi), r, (Theta), (Phi)1, 
        r1)/(ScriptR)Norm((Phi), r, (Theta), (Phi)1, r1)^3)*
     r1, {(Phi)1, 0, 2*(Pi)}, {r1, 0, R});

VectorPlot3D(
 ele((Phi), r, (Theta)) /. {(Sigma) -> 200, k -> 9*10^9, R -> 0.5, 
   r*Sin((Theta))*Cos((Phi)) -> x, r*Sin((Theta))*Sin((Phi)) -> y,
    r*Cos((Theta)) -> z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1})

I'm concerned that part of my problem is in the function I created, but I'm very sure that calling "Replace All" in this way is not a viable method for transforming coordinates.

Edit: Added integral that I am trying to solve. The (ScriptR) is the vector in the numerator, and the (ScriptR) norm is the cube root of the denominator

c ++ – Find the missing element in the vector

I solve this simple challenge:

For a vector A with N unique elements larger than 0 and smaller than N + 1, find the missing element. Example:

A = (1,3,2,5) -> missing number 4
A = (1,3,5,4) -> missing number 2

I came to the following solution. I am interested in thoughts and ideas on how to write it as expressively as possible:

Option 1, compact, but not very meaningful:

int solution_1(std::vector &v) {
    sort(v.begin(), v.end());
    for (std::size_t i = 0; i < v.size(); ++i) {
        if (v(i) != i+1) return i+1;
    }
    return v.size()+1;
}

Option 2

int solution_2(std::vector &v) {
    sort(v.begin(), v.end());
    auto missing_element = std::find_if( 
        v.begin(), v.end(), 
        (index=1)(auto& element) mutable { 
            if (element != index++) {
                return true;
            } else {
                return false;
            }
        });
    if (missing_element == v.end()) {
        return v.size() + 1;
    } else {
        return *missing_element - 1;
    }
}

Any ideas on how to improve this or make it more expressive?

Can you help formulate a problem with vector projections?

I have some vectors and I am trying to get a certain combination of them. I managed to work out the solution using trigonometry, but it would be cleaner if I could only do this with vector arithmetic and vector projections.

I have three vectors: $ q, n $ and $ v $, I want to get the projection from $ q $ to the hyperplane (which runs through the origin) to which $ n $ is normal "along" the direction $ v $, In other words, I want a vector $ u $ in order to:

  • $ u cdot n = 0 $ ($ u $ lies in the hyperplane)
  • $ q-u = lambda v $ ($ u $ lies "along" the direction of $ v $ of $ q $)

Here is an illustration. Note that $ q $ and $ u $ are to scale, but $ v $ and $ n $ are of any (e.g. unit) length. In other words, $ q + v neq u $ generally. Also note that $ q $. $ n $ and $ v $ can be of a high dimension.

Enter image description here

If it is helpful, use trigonometry and the projection of $ q $ on to $ n $, I got that:

$$ u = q – frac {q cdot n} {v cdot n} v $$

But I only want to use vector operations in my arguments to get this result if possible. How can we use geometric arguments to get this result from projections and vector arithmetic?

Draw – Can I draw a time-dependent 3D vector?

I wanted to know if I could draw a 3D vector (with x, y and z components) in which each component is time dependent. For more context, I would like to draw the function:

E (t) = 3cos (ωt) (x_hat) + (3cos (ωt) – 4sin (ωt)) (y_hat) – 6cos (ωt – π / 4) (z_hat)

Which is represented by a pointer in the time domain. I think the best way is to keep the time constant and plot the function at a specific point in time, but I've also seen my professor create a chart that gradually plots a variable n by itself or by moving one Bar changes. How do I do this or is there a better way to draw this function? Again, this is not part of my homework, but I want to create a diagram to better understand what I am doing for my homework and how it looks plotted.

Thank you in advance.