math

Calculate the derivative of a vector

匆匆过客 提交于 2020-01-27 03:08:29
问题 I have the following function (Viviani's curve): Phi = @(t)[ cos(t)^2, cos(t)*sin(t), sin(t) ] Just a check that it's valid: s = linspace(0,T,1000); plot3(cos(s).^2, cos(s).*sin(s), sin(s)); How to derivate the function Phi (maybe multiple times), which represents Viviani's curve in a point t where t goes from 0 to 2*pi ? Did I defined Phi suitable for such a derivative? I've tried diff , but it did not keep the Phi as I would need it. If the second derivative would be Phi_d2 , I need to get

Calculate the derivative of a vector

a 夏天 提交于 2020-01-27 03:08:26
问题 I have the following function (Viviani's curve): Phi = @(t)[ cos(t)^2, cos(t)*sin(t), sin(t) ] Just a check that it's valid: s = linspace(0,T,1000); plot3(cos(s).^2, cos(s).*sin(s), sin(s)); How to derivate the function Phi (maybe multiple times), which represents Viviani's curve in a point t where t goes from 0 to 2*pi ? Did I defined Phi suitable for such a derivative? I've tried diff , but it did not keep the Phi as I would need it. If the second derivative would be Phi_d2 , I need to get

points of intersection of horizontal line with a function [duplicate]

烂漫一生 提交于 2020-01-26 04:46:25
问题 This question already has answers here : Intersection of two graphs in Python, find the x value (8 answers) Closed 8 months ago . i have this code that generate the following (image), how would i proceed to detect the intersections of the line with the function ?` import numpy as np import matplotlib.pyplot as plt y = 0.4*np.ones(100) x = np.arange(0, 100) t = np.linspace(0,100,100) Fs = 6000 f = 200 func = np.sin(2 * np.pi * f * t / Fs) idx = np.where(func == y) # how i think i should do to

Android Studio: How to get an ImageView to move in the direction of rotation

亡梦爱人 提交于 2020-01-25 17:21:46
问题 This question has been stuck on my mind for a while, and im wondering if im missing a method or something.Im trying to figure out how i can get an imageview in Android Studio(IDE) to move in the direction of its rotation, though this image probably best explains my question 回答1: So I found out how to do it with the help of some links and i formulated my own solution. First, I calculate how much I am adding/subtracting from the image's x and y using its current rotation with some Trig. The

Time complexity of the Math.cbrt(a) method in java.math library

不羁的心 提交于 2020-01-25 16:23:31
问题 I have written java code for finding taxicab numbers using math.cbrt(a) function. I assumed the complexity of math.cbrt(a) is constant. I am really interested in knowing the complexity of this function such that I can know how good my algorithm works. Visit Finding taxicab Numbers 回答1: This method is native, so exact call depends on VM implementation. Eg. OpenJDK use fdlibm as you can check here http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/StrictMath.c

Time complexity of the Math.cbrt(a) method in java.math library

牧云@^-^@ 提交于 2020-01-25 16:20:47
问题 I have written java code for finding taxicab numbers using math.cbrt(a) function. I assumed the complexity of math.cbrt(a) is constant. I am really interested in knowing the complexity of this function such that I can know how good my algorithm works. Visit Finding taxicab Numbers 回答1: This method is native, so exact call depends on VM implementation. Eg. OpenJDK use fdlibm as you can check here http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/StrictMath.c

Inverse Interpolation with angles greater than Pi?

六月ゝ 毕业季﹏ 提交于 2020-01-25 11:27:06
问题 I'm making an API for skeletal animation. Right now it works fine, except Lets say you want to go from 2.0f to 1.0f. It will end up doing almost a full circle when it should only do about 1/6th of one. I think I've got a way to find it it should go counter clockwise but I'm not sure how to use it with this: bool CCW = fmod( (endKeyFrame->getAngle() - startKeyFrame->getAngle() + TWO_PI), TWO_PI) > 3.141592; remainingInterpolationFrames = endKeyFrame->getFrame() - startKeyFrame->getFrame(); /

Inverse Interpolation with angles greater than Pi?

感情迁移 提交于 2020-01-25 11:23:04
问题 I'm making an API for skeletal animation. Right now it works fine, except Lets say you want to go from 2.0f to 1.0f. It will end up doing almost a full circle when it should only do about 1/6th of one. I think I've got a way to find it it should go counter clockwise but I'm not sure how to use it with this: bool CCW = fmod( (endKeyFrame->getAngle() - startKeyFrame->getAngle() + TWO_PI), TWO_PI) > 3.141592; remainingInterpolationFrames = endKeyFrame->getFrame() - startKeyFrame->getFrame(); /

Nullcline Plot for Nonlinear System of ODEs

流过昼夜 提交于 2020-01-25 11:13:01
问题 I am attempting to plot the nullcline (steady state) curves of the Oregonator model to assert the existence of a limit cycle by applying the Poincare-Bendixson Theorem. I am close, but for some reason the plot that is produced shows two straight lines. I think it has something to do with the plotting stage. Any ideas? Also any hints for how to construct a quadrilateral to apply the theorem with would be most appreciated. Code: import numpy as np import matplotlib.pyplot as plt # Dimensionless

Nullcline Plot for Nonlinear System of ODEs

对着背影说爱祢 提交于 2020-01-25 11:12:48
问题 I am attempting to plot the nullcline (steady state) curves of the Oregonator model to assert the existence of a limit cycle by applying the Poincare-Bendixson Theorem. I am close, but for some reason the plot that is produced shows two straight lines. I think it has something to do with the plotting stage. Any ideas? Also any hints for how to construct a quadrilateral to apply the theorem with would be most appreciated. Code: import numpy as np import matplotlib.pyplot as plt # Dimensionless