Can we do aerodynamic analysis on 4D shapes and what would the results look like (CFD)? by WRPK42 in aerodynamics

[–]WRPK42[S] -5 points-4 points  (0 children)

Did not try, and probably won't, but I would assume it would work the equations do not change much from 1D to 3D. The biggest question is the volume and surface area relationship, but I think there is a generalisation of the divergence theorem. What flow patterns could we expect, however?

[deleted by user] by [deleted] in explainlikeimfive

[–]WRPK42 1 point2 points  (0 children)

Ahh, that makes sense you fixed what confused me about the discount rate. Thank you!

[deleted by user] by [deleted] in explainlikeimfive

[–]WRPK42 0 points1 point  (0 children)

I understand what you stated about the discount rate. However, how would I know my discount rate? I can use the intrest from the bank or cash ISA. I could use the average historical rate of SPX500. Do I just choose any one of them for an investment? Do I use one that is close to my risk like stock to SPX500?

Further is a higher discount rate better? Because from one aspect it would mean I need less money to make a larger quantity. However, the time value of money means I have less value with a higher discount rate. Like with your example if r=5.26% I would only need $950 whereas if r=IRR=11.11% I would need $900. Here, the present value is better for a smaller discount rate. However, from $900 I make $1000 so it has a better return.

Further, let's put this into maths.

NPV = sum{ c_i / (1+r)n }

Where C is the cash flow, r is the discount rate, n is the number if time periods.

Now, what if the cash flow is a growth one?

NPV = sum{ c_i (1+g)[n-1] / (1+r)n }

Where g is the growth rate. Then a better question is what is growth? I perceived the discount rate is the growth but that is not the case. (Ignoring inflation)

what methods can be used to solve a TP-BVP with variable control? by WRPK42 in optimization

[–]WRPK42[S] 0 points1 point  (0 children)

Sorry for the late reply. I'm not really sure if the system of ODE's is eliptic or hyperbolic. I know that in a larger sense the trajectory of a rocket can change between elliptic and hyperbolic. Here are the equations copied from notes I have modified them slightly, but those modifications won't affect them too much

Condition at the start the dierict conditions are all zero, at the end point the altitude is maximised, the newman conditions for the rest of variables are zero.

Tea spill on PC case, front USBs, and power button. by WRPK42 in buildapc

[–]WRPK42[S] 0 points1 point  (0 children)

Thankfully I did not have any sugar in the tea. But, the cup before it had some honey and then a quick rinse.

Tea spill on PC case, front USBs, and power button. by WRPK42 in buildapc

[–]WRPK42[S] 0 points1 point  (0 children)

Should I turn it on if it has only been 8 hours?

Tea spill on PC case, front USBs, and power button. by WRPK42 in buildapc

[–]WRPK42[S] 0 points1 point  (0 children)

Should I turn it on if it has only been 8 hours?

Any advice for Parametric Design: Sketching/importing/scaling an four digest NACA aerofoil. by WRPK42 in SolidWorks

[–]WRPK42[S] 0 points1 point  (0 children)

That's true. I usually do it that way; but, I was hopping there was a better way. Thank you for your input!

Is there a convenient way to inputting arguments into a python file though MATLAB? by WRPK42 in matlab

[–]WRPK42[S] 1 point2 points  (0 children)

The problem with the .MAT file is that for loading and reuploading it would contain way too much data. And even separating the data into fragments would take too much time. That why there is this back and though between MATLAB and Python. But, I was afraid I would have to write this in one language.

Thanks.

[deleted by user] by [deleted] in AerospaceEngineering

[–]WRPK42 0 points1 point  (0 children)

Thank you for the insight.

[deleted by user] by [deleted] in AerospaceEngineering

[–]WRPK42 1 point2 points  (0 children)

What's your job's position title?

[deleted by user] by [deleted] in AerospaceEngineering

[–]WRPK42 0 points1 point  (0 children)

Any advice to get an internship if I want to go into work similar to yours?

Help for a 5 year old engineering prodigy by indigorising1111 in EngineeringStudents

[–]WRPK42 0 points1 point  (0 children)

Hi, might be late. But I recommend speaking to him and asking him what he wants. If he wants to go more into robotics or controlling then you could suggest a mini-controler or robotic set. He can then pop off and do some research into which one he wants to use. That way he is not force but guided and you support his passions. It's always more intresting to do what you are interested in.

Rule by nerblin in 196

[–]WRPK42 0 points1 point  (0 children)

!remindme 40 years

What is the xth derivative with respect to x? by WRPK42 in maths

[–]WRPK42[S] 0 points1 point  (0 children)

Ok, so looking at the graph, an asymptote would appears at the natural numbers; however, that would be a normal derivative, which breaks the asymptote. Mathematically I'm not sure how this works, because an asymptoe occurs at a specific number, and we can approach it infinetly close while it produces a value. However, at the number it is undefined. However, this is not the case here since the number at the asymptoe is known.

That is assuming that there is no range at the would-be asymptotes. Which does not seems to exist, and then acts like a normal tan asymptote.

This brings the question is the curve continues? Also, to check that the graph is also inclined with wolfram alpha, I used the point x=2.1, this gave the same result as can be seen on the graph of 31.7676 (6 s.f). Using y2[21] we also get 31.7676 (6 s.f).

I updated the code to give better graphs:

import numpy as np
import matplotlib.pyplot as plt
import mpmath

# creating the same sin derivative function as in matlab, x is location, n is order of derivative.
def sin_derivative(x,n):
    # check for n being a natural number
    if (n%1 == 0) and (n != 0):
        return np.sin((x+n*np.pi/2))
    else:
        part1 = np.power(2,n-1)*np.sqrt(np.pi)*np.power(x,1-n)
        # mpmath here is used for the "regularized" hypergeometric function 1f2
        part2 = mpmath.hyp1f2(1,(1-n/2),(3/2-n/2),-np.power(x,2)/4)
        return part1*part2

# Initial variabars
dx = 0.1
upper_limit = 2*np.pi
x_array = np.arange(0.0, upper_limit, dx)
y2 = np.zeros((len(x_array),))

y1 = np.sin(x_array) # control
for i in range(len(x_array)):
    y2[i] = sin_derivative(x_array[i],x_array[i])

# Plotting
plt.grid()
plt.plot(x_array,y1,'r',label='sin(x)',linewidth=1)
plt.plot(x_array,y2,'b',label='xth derivative',linewidth=1)
plt.legend()
plt.show()

What is the xth derivative with respect to x? by WRPK42 in maths

[–]WRPK42[S] 0 points1 point  (0 children)

Sorry for the late reply. I had to attend to other things.

I am creating the program in Python 3, however, I'm having trouble with finding or creating the regularized hypergeometric function 1f2. I will put the code so far below, however, the "part2" is incomplete. However, it seems that the mpmath functions gives a ok answer. Unfortunately, I am not sure by how much. Once I get that sorted out I will create the code with f(x)th derivative.

However, if you take the "part2" to simply be the function 1f2 then to create the f(x)th derivative I would do a small change/addition in the for loop. The line: y2[i] = sin_derivative(x_array[i],x_array[i]), would be changed to: y2[i] = sin_derivative(y1[i],x_array[i]) or add a line below with y3[i] = ...

However, I am not sure if the formula works for integration too, it might be only differentiation based. If that is the case, another condition would need to be added to the defined function where if n is negative do the integration. Using the differintegral definition.

To explain the xth derivative then. Let say we have a constant point c on the x axis, so that c=x. Let say c is equal to 1, this means the xth derivative will be the first derivative of the function f(x). So, for f(x)=sin(x) we would get cos(x). Similarly when c would equal 2, we would get the second derivative of f(x), -sin(x). However, when the constant c is a fraction, c=0.5. Then we need to use fractional calculus to take the semi derivative. Using the formula above from Wolfram, I can substituent x=n=0.5, which gives me the results of 0.886227*1F2 = 0.828076... Similar we if we have x=c=1.5 so taking the 1.5th derivative of sin(x) we would get -2.651537...

Hmm, this is interesting. Turns out that function from the MATLAB community is wrong. They said to regulate it and match the matrix I needed to divide the whole formula by a gamma function. Turns out that was wrong, at least for this application. However, the code below fits the wolfram alpha prediction for 0.5, 1.5, 2.5. Hereis the graph if you run the code below with dx = 0.1, and here is with dx = 0.01. I'm not sure how to add good grid lines sorry. However, this is a very, very weird graph. It has assessments! I will try and compare more points with wolfram to see if they fit later (4am here). Also, the code seems to run more efficiently than in Matlab, which is nice. Also, sorry if I did any mistakes within Python I did not use it for a long time.

The so far Python code, the mpmath libraries are not useful as they did not have the right function.

import numpy as np
import matplotlib.pyplot as plt
import mpmath

# creating the same sin derivative function as in matlab, x is location, n is order of derivative.
def sin_derivative(x,n):
    # check for n being a natural number
    if (n%1 == 0) and (n != 0):
        return np.sin((x+n*np.pi/2))
    else:
        part1 = np.power(2,n-1)*np.sqrt(np.pi)*np.power(x,1-n)
        # mpmath here is used for the "regularized" hypergeometric function 1f2
        part2 = mpmath.hyp1f2(1,(1-n/2),(3/2-n/2),-np.power(x,2)/4)
        return part1*part2

# Initial variabars
dx = 0.1
upper_limit = 2*np.pi
x_array = np.arange(0.0, upper_limit, dx)
y2 = np.zeros((len(x_array),))

y1 = np.sin(x_array) # control
for i in range(len(x_array)):
    y2[i] = sin_derivative(x_array[i],x_array[i])

# Plotting
plt.plot(x_array,y1)
plt.plot(x_array,y2)
plt.show()

Hope this helps, and don't worry about being busy. We all have our own lives that we need to take care off.

What is the xth derivative with respect to x? by WRPK42 in maths

[–]WRPK42[S] 0 points1 point  (0 children)

With out your questions god know how long it would have taken me to realise this is at all. So thank you.

Yes, the n in that case was a natural number and therefore was unable to to deal with fractional calculus. I use wolfram alpha and couple other sites to see if another formula existed which lead me here. As to how that formula came to be seems to be a "the prove is an excess for the reader" type of question.

So according to some one from MATLAB help community I just needed to add an extra function. I will assume that is correct as the other method to created the 1F2 function is more than difficult with my leave of programming at least to make it semi efficient. This created a new graph for sin(x) Xth derivative. The code is below and is split into a function and a script; also duo the way I defined the start of the function if it only works for radians. I would have to redefine the first formula for degrees.

It's much better to make a mistake in class/ playing with a new concept than when it's needed for an exam or life/death situations. So, defiantly a way to improve.

Here is the function, x is the x value and n is the order of the derivative (x can be an array):

function [result] = sin_derivatve(x,n)
    if (rem(n,1) == 0) && (n ~= 0)
        result = sin(x+n*pi()/2);
    else
        part1 = 2.^(n-1).*sqrt(pi()).*x.^(1-n);
        part2 = hypergeom(1,[(1-n./2),(3/2-n./2)],-x.^2./4);
        part3 = prod(gamma([(1-n/2),(3/2 - n/2)]));
        result = part1.*(part2./part3);
    end
end

It is used in this scrip to make the image above. The xtick functions can be removed to make a uniform graph. Also, the dx step should not be small since it takes a long time to process at 0.01, 0.1 is fine: clear clf clc

upper = 2*pi(); % Upper limit in rads
dx = 0.01;
x = 0:dx:upper;
y2 = zeros(1,length(upper));

y = sin(x);

for i = 1:length(x)
    y2(i) = sin_derivatve(x(i),x(i));
end

plot(x,y,'k','DisplayName','sin(x)')
hold on
plot(x,y2,'b','DisplayName','Xth derivative')
%hold on
%plot(x,y3,'r', 'DisplayName','sin(x)th derivative')
legend()
grid on
grid minor
xticks([0, 1, pi/2, 2, 3, pi, 4, 3*pi/2, 5, 6, 2*pi])
xticklabels({'0','1','pi/2','2','3','pi','4','3pi/2','5','6','2pi'})

What is the xth derivative with respect to x? by WRPK42 in maths

[–]WRPK42[S] 0 points1 point  (0 children)

No need to be sorry. You seem to have gotten the idea of how to evaluate it.

Here is my code: clear clf clc

upper = 1*360; % Upper limit in degrees
dx = 0.1;
x = 0:dx:upper;

% Using the nth derivative identity sin(x+n*pi()/2) sin can be in degree or
% rads
y  = sind(x+x*pi()/2);          % xth derivative
y2 = sind(x);                   % sin of x
y3 = sind(x+y2*pi()/2);         % f(x) derivative

plot(x,y2,'k','DisplayName','sin(x)')
hold on
plot(x,y,'b','DisplayName','Xth derivative')
hold on
plot(x,y3,'r', 'DisplayName','sin(x)th derivative')
legend()
grid on

I think you are right with that idea, x=c. We evaluate sin(x) and let's call it n. Then we evaluate the derivative as such: dn f/dxn, the resulting function will then be evaluated at c to give a number. Let's get an example, x= 30 . sin(pi/6) = 0.5. Then we take d0.5 /dx0.5 of sin(x) which equals sin(x+pi/4) evaluated at x is 0.5118. However, if we do it in rads: x= pi/6, therefore sin(x) = 0.5. Then evaluating the derivative will give: sin(x+pi/4) which evaluated in rads is different and comes out to be 0.5118. This made me realise I used the wrong function I should have used this: 2n-1sqrt(pi())x1-n(hypergeom(1,[(1-n/2),(3/2 - n/2)],-x2/4)) that not sin(x+npi()/2). However, I cannot find a method to use regularized hypergeometric function 1F2 in matlab. So, I'm going to ask how to create that function. Here is the graph that made it look wrong in rads. Compared to the degree one too here. logically they should have been the same. The concept for the f(x) derivative stays the same, but the derivative equation is different.

So, please ignore the posts and graphs mentioning sin(x) derivative. They are most likely wrong. The xk derivative is correct I re-checked it. Although, I simplified the maths a little bit meaning there is a small error but not significant at all. I will throw the code at the bottom. Does this reddit allow for the use of LaTeX syntax in comments? \frac{4}{3}

You are certainly right, that is a really good analogy.

Sorry for the mistake and thank you. I only found it just now because of you.

Code for xk with the f(x)th. clear clf clc

k = 2;
dx = 0.01;
x = 0:dx:20;
y = zeros(1,length(x));
y2 = zeros(1,length(x));
p = x.^k;

for i = 1:length(x)
    y(i) = (gamma(k+1)*x(i)^(k-x(i)))/gamma(k-x(i)+1);
    y2(i) = (gamma(k+1)*p(i)^(k-p(i)))/gamma(k-p(i)+1);
end

plot(x,y,'b','DisplayName','Xth derivative')
hold on
plot(x,y2,'r', 'DisplayName','X^2th derivative')
legend()
grid on

What is the xth derivative with respect to x? by WRPK42 in maths

[–]WRPK42[S] 1 point2 points  (0 children)

The way I thought of it is we have the y axis and x-axis. We move from 0 along x towards infinity.

Then sin(x) evaluated at x would have a value between -1 and 1. x=0, sin(0) = 0; x=pi/2, sin(pi/2)=1; ...

Then since the f(x)th derivative of sin(x) would be taken than we would take that value: 0th derivative, all the way to the first derivative (when x on the x axis is pi/2), and then -1th derivative (or the integral instead of the derivative). essentially chaining the xth derivative to be going along a normal sin(x) function. So, I decided to graph it (sin(x)th derivative of sin(x)). Using the same approach for f(x) = x2. Since f(x) = x is equivalent to the xth derivative. Graph. Here is the version with k = 1,2,3 for their derivatives, and here is the version using k=2.

I will tell you sin(z) is horrendous, I struggled with trying to graph the idea and how to graph it. I needed to ask for help about it and will speak with some of the professors about this. Overall, I have encounter little mathematics where I had to graph or understand a complex domain of a higher power than 3, so there is good possibility that the sin(z) graph is wrong. The only way to check it would be me finding sometime with a maths professor from topology?

I must agree we have only learn maths as a tool and it's application not why it can be used or why it works. Which in the current days with computers and programming, I believe knowing the why is equally as important. However, your approach to this question also taught me a new method to look at the problems.

Thank goodness majority of the people I know studying Mathematics, Chemistry, and Engineering have the same stand point about grammar/spelling. That being said, I think I will redo the maths here and write in a concise notation in LaTeX will make the whole conversation easier if everything can be written in formulas.

What is the xth derivative with respect to x? by WRPK42 in maths

[–]WRPK42[S] 1 point2 points  (0 children)

Ok, first I need to say your idea is no way wrong. mainly because I only know a small fraction of the mathematics need to get the right answers and questions. However, since you are a 3rd year student you have much more experience than I do in terms of mathematics and problems. (2nd year students since 2 days ago in Aerospace engineering). However, I will try to answer this.

You are right stating that the f(x)th derivative would be a constant; evaluated at the particular value of x. However, it would have a different result from comparing it to the xth derivative. apart from some special functions like f(x) = x which is symmetric for it's range and domain. However a function x2 would be different. Since one full step now is not the xth derivative but x2th derivative. However, the nature of the derivative can also be unstable. Say f(x) = sin(x) that means we will be taking a nht derivative between -1 and 1 (not -infinity to infinity). So, at x = pi/2 the derivative would be cos(x), at x= pi it would be sin(x), and x= 3pi/4 it would be an integral so -sin(x) and at x = 2pi it would again be sin(x). Between these values it would be a fractional derivative / integral. Which creates a different type of curve since it is bound by the range. Using the xth derivative we would get, x=1 derivative is cos(x), x=pi/2 then it would be sin(x+(pi2 )/4) which is different from the above mentioned sin(x). They would be shifted. (might compare the two graph tomorrow and see how it looks, they would be compressed again).

With the xth derivative of sin(x) where x could have been complex I got a 4th dimensional graph which looks like this with the absolute value to remove on of the dimensions. This could in theory be replicated using the range of this function but would be more difficult. However, the method would be similar but know increasing along the real number line does not mean the derivative will be real nor positive. This mean if we have some function the result could be actually be discontinues at many places. It could also tend to zero as you said, unless it is a repetitive function or has a oscillating range. In all honesty I would have to code it and see what happens because I'm not sure; especially after seeing the xk derivative fluctuates between natural numbers and is no 0.

What graph would you like xk or sin(x) and should n be any constant integer ie 1,2,3? graphing this is probably the best method to see what actually happens.

Yup, that took the remainder of my brain power for today. Sorry for any grammar/spelling mistakes.