Skip to content

Tag: math

Rotate a line by a specific angle

I have a line with lenght of l and p1 and p2 and i want to rotate it by angle. I was using this matrix but it doesn’t work. matrix I have this code in python: Answer You first need to specify an origin point, the rotation will be created around that point. You can adapt your code and use

JAX: Getting rid of zero-gradient

Is there a way how to modify this function (MyFunc) so that it gives the same result, but its derivative is not zero gradient? EDIT: Similar function which doesn’t give zero gradient – but it doesn’t return 30/20/10 Answer The gradient of your function is zero because this is the correct result for the gradient as your function is defined.

how to detect a braking process in python dataframe

I have some trips, and for each trip contains different steps, the data frame looks like following: I want to know if, on a trip X, the cyclist has braked (speed has decreased by at least 30%). The problem is that the duration between every two steps is each time different. For example, in 6 seconds, the speed of a

Subtract specific value from a list (of numbers) by user input

I’m a begginer in Python and i’m trying to do a program when the user chooses a number from a list, then after you type by how you much want to reduce this chosed number and then print the list. I know that using list[specific index], check if matches with user input and repeating over and over again would do