fa.functional analysis – Decay estimate of Fourier transform of a compactly supported function

Assume $f(x), x in mathbb{R}$ is a function with a compact support such that its Fourier transform $hat{f}(xi)$ has a decay rate
$$hat{f}(xi) lesssim frac{1}{|xi|^gamma + 1}$$
for some $gamma ge 1$.
Now set $$h(x) = xf(x).$$ Since $f$ has a compact support, $h$ should have similar or better regularity than $f$. Can we now get the following decay estimate of the Fourier transform of $h$ ?
$$hat{h}(xi) lesssim frac{1}{|xi|^gamma + 1}$$
I know now we have $hat{h}(xi) = -ipartial_xi hat{f}(xi)$, but it seems hard to only use this relation to get the decay estimate.

Fourier transform from a data

The following table gives the values of function $f(t)$ plotted with respect to $t$:

tab = {0.007748748337080668`, 0.018728887205619795`, 
   0.16612793350707483`, 0.8211540341958035`, 1.5709799858884597`, 
   2.1493355484921244`, 2.5652500043266624`, 2.8740927779566072`, 
   3.062630342648813`, 3.1496542199027333`, 3.180110395568108`, 
   3.185577463584589`, 3.181998788957615`, 3.1763272420353`, 
   3.171176662078008`, 3.1672552668412233`, 3.164528404074683`, 
   3.1627369082638936`, 3.1616058165950616`, 3.160912679452945`, 
   3.160497775905026`, 3.1602541256719108`, 3.1601133013892646`, 
   3.1600330092259306`, 3.159987760699207`, 3.1599625249135483`, 
   3.159948573959092`, 3.159940925757831`, 3.1599367604346607`, 
   3.159934508915358`, 3.1599333004416414`, 3.159932651942184`, 
   3.159932308236647`, 3.1599321266428007`, 3.1599320287602777`, 
   3.159931979379674`, 3.159931952486559`, 3.1599319380000352`, 
   3.159931932432338`, 3.1599319265680155`, 3.1599319269322605`, 
   3.159931925838243`, 3.1599319258440115`, 3.159931925070726`, 
   3.159931925108342`, 3.1599319236032946`, 3.1599319254133764`, 
   3.159931924444941`, 3.1599319232182985`, 3.1599319233992347`, 
   3.1599319240398427`, 3.1599319233861562`, 3.159931924521807`, 
   3.159931923269772`, 3.159931925809474`, 3.159931922968669`, 
   3.1599319244766146`, 3.159931924146517`, 3.1599319241011408`, 
   3.1599319242530903`, 3.1599319236804195`, 3.159931923686976`, 
   3.159931923502647`, 3.159931925398617`, 3.1599319244699533`, 
   3.159931923059247`, 3.159931923489684`, 3.159931924887364`, 
   3.159931924978025`, 3.1599319248292064`, 3.1599319253014935`, 
   3.159931924262908`, 3.159931923240859`, 3.159931924033091`, 
   3.1599319251137725`, 3.159931923282546`, 3.1599319250750906`, 
   3.1599319256380918`, 3.159931924136819`, 3.1599319238877595`, 
   3.159931925197908`, 3.159931923321391`, 3.1599319244245323`, 
   3.1599319231175573`, 3.159931924796906`, 3.1599319246769024`, 
   3.159931923347286`, 3.159931923463679`, 3.1599319246739093`, 
   3.1599319233277336`, 3.159931926032649`, 3.1599319227685583`, 
   3.159931923327834`, 3.1599319241756625`, 3.159931922787695`, 
   3.1599319233989687`, 3.1599319242048813`, 3.159931924738758`, 
   3.1599319252855484`, 3.159931923502507`};

ListPlot(tab, PlotRange -> All, AxesLabel -> {"time (t)", "f(t)"})

Is there any method to know the Fourier transform of $f(t)$ from this data?

integration – Is there a closed form expression for entropy on tanh transform of gaussian random variable?

so my question is if there’s a closed form (analytical?) expression for entropy for a variable $u$ defined as the $tanh$ of an gaussian random variable $x$. The reason I need an closed form solution, is that this is part of an neural network and I need to be able to derive(find gradient) based on the mean $mu$ and std $sigma$ of $x$.

For an random variable from gaussian distribution $x sim mathcal{N}(mu, sigma) $, I know that the entropy is: $h(X)=frac{1}{2}log(2pi sigma^2) + frac{1}{2}$, which is closed form.

I have the transform: $u= tanh(x)$, and I’d like to get the entropy of this random variable. I know from Differential Entropy wiki page that I can formulate the entropy for $u$ as:

$$ h(U) = h(X) + int f(x) log|frac{d (tanh(x))}{dx}| dx$$

with $f(x)=frac{1}{sigma sqrt{2pi}}e^{-frac{1}{2}(frac{x-mu}{sigma})^2}$ as the probability density function of the gaussian distribution. I’ve tried to solve the integral term in the right hand but haven’t been able to figure it out. I tried (with my limited knowledge of) wolfram alpha, without any success. Is there any closed form expression, and if so, do you know how it looks?

Many thanks in advance!

openGL – Updating instanced model transform in vbo every frame

I am using OpenGL to render a large number of models by instanced rendering (using LWJGL wrapper).
As far as I can tell I have implemented the instancing correctly, although, after profiling, I’ve come upon an issue.

The program is able to render a million cubes at 60fps when their model (world) transformations are not changing. Once I make them all spin though, the performance drops significantly. I deduced from the profiler that this is due to the way I write the matrix data to the VBO.

My current approach is to give each unique mesh a new VAO (so all instances of cubes come under 1 VAO), have 1 VBO for vertex positions, textures, and normals and 1 instance array (VBO) for storing instance model matrices. All VBOs are interwoven.

In order to make the cubes spin, I need to update the instance VBO every frame. I do that by iterating through every instance and copying the matrix values into the VBO.

The code is something like this:

float() matrices = new float(models_by_mesh.get(mesh).size() * 16);

for (int i = 0; i < models.size(); i++){
    Model cube = models.get(i);
    float() matrix = new float(16);
    cube.getModelMatrix(matrix);    //store model matrix into array
    System.arraycopy(matrix, 0, matrices, i * 16, 16);
}

glBindBuffer(GL_ARRAY_BUFFER, instance_buffers_by_mesh.get(mesh);
glBufferData(GL_ARRAY_BUFFER, matrices, GL_STATIC_DRAW);

//render

I realise that I create new buffer storage and float array every frame by calling glBufferData instead of glBufferSubData but when I write:

//outside loop soon after VBO creation
glBufferData(GL_ARRAY_BUFFER, null, GL_DYNAMIC_DRAW); //or stream

//when updating models
glBufferSubData(GL_ARRAY_BUFFER, 0, matrices)

nothing is displaying; I’m not sure why, perhaps I’m misusing subData but that’s another issue.

I have been looking at examples of particle simulators (in OpenGL) and most of them update the instance VBO the same way as me.

I’m not sure what the problem could be and I can’t think of a more efficient way of updating the VBO. I’m asking for suggestions / potential improvements with my code.

Many thanks 🙂

parameters – Different FourierParameters for different dimensions of discrete Fourier transform

This question asks for a way to implement different FourierParameters for different dimensions of a discrete Fourier transform. The question received no answers, but a workaround was mentioned in the comments for the particular case considered by the OP.

I am faced with essentially the same problem, but in my case I would like to use non-integer values for FourierParameters, for which the aforementioned workaround doesn’t help. Given that several years have passed since the linked question was posed, I wonder if there might now be a better solution to the problem of assigning different FourierParameters to different dimensions of a Fourier transform?

dnd 5e – Would allowing Shillelagh to transform your staff into another weapon be unbalanced?

I am planning a (not explicitly optimised) Ranger/Monk character, that uses Druidic Warrior to cast Shillelagh:

Druidic Warrior

You learn two cantrips of your choice from the druid spell list. They count as ranger spells for you, and Wisdom is your spellcasting ability for them.

The spell in question:

The wood of a club or quarterstaff you are holding is imbued with nature’s power. For the duration, you can use your spellcasting ability instead of Strength for the attack and damage rolls of melee attacks using that weapon, and the weapon’s damage die becomes a d8. The weapon also becomes magical, if it isn’t already. The spell ends if you cast it again or if you let go of the weapon.

No where does it say it stops being a club or quarterstaff. Would it be unbalanced it transforms into a sword as part of the spell (while retaining the 1d8 damage)? The only thing I can think of us the damage type changes from bludgeoning the slashing.

Part of motivation is flavour: magical weapon cool; magical transforming weapon, way cooler.

The other part is that if I picked Kensei as my monk subclass, I could pick Longsword as my Kensei weapon, and have my Shillelagh count.

unity – How can I make the transform to rotate facing the moving direction the transform move?

The goal is to make the transform to rotate smooth when the moving direction is change.

In this case there are some cubes and the cubes facing direction the blue axis is not the same as the transform move. The transform is moving up then back down but never rotate because he is facing the cubes directions. but I want that the transform will rotate facing the direction he is moving so on the start he should rotate first time facing up then at the end he should rotate facing down.

not when the transform get to the last waypoint but when he change direction.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class MoveOnCurvedLines : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public float speed;
    public bool go = false;
    public bool moveToFirstPositionOnStart = false;
    public float rotSpeed;
    public bool random = false;
    public int currentCurvedLinePointIndex;

    private Vector3() positions;
    private Vector3() pos;
    private int index = 0;
    private bool goForward = true;
    private List<GameObject> curvedLinePoints = new List<GameObject>();
    private int numofposbetweenpoints;
    private bool getPositions = false;
    int randomIndex;
    int curvedPointsIndex;

    // Start is called before the first frame update
    void Start()
    {
        curvedLinePoints = GameObject.FindGameObjectsWithTag("Curved Line Point").ToList();

        if (curvedLinePoints != null && curvedLinePoints.Count > 0)
        {
            transform.rotation = curvedLinePoints(1).transform.rotation;
        }

        if (random)
            GetNewRandomIndex();
    }

    Vector3() GetLinePointsInWorldSpace()
    {
        positions = new Vector3(lineRenderer.positionCount);
        //Get the positions which are shown in the inspector 
        lineRenderer.GetPositions(positions);


        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if (lineRenderer.positionCount > 0 && getPositions == false)
        {
            pos = GetLinePointsInWorldSpace();
            numofposbetweenpoints = pos.Length / curvedLinePoints.Count;

            if (moveToFirstPositionOnStart == true)
            {
                transform.position = pos(index);
            }

            getPositions = true;
        }

        if (go == true && lineRenderer.positionCount > 0)
        {
            Move();

            transform.localRotation = Quaternion.RotateTowards(transform.localRotation, curvedLinePoints(c).transform.localRotation, Time.deltaTime * rotSpeed);
        }

        var dist = Vector3.Distance(transform.position, curvedLinePoints(curvedPointsIndex).transform.position);
        if (dist < 0.1f)
        {
            if (curvedPointsIndex < curvedLinePoints.Count - 1)
                curvedPointsIndex++;

            currentCurvedLinePointIndex = curvedPointsIndex;
        }
    }

    int counter = 0;
    int c = 1;
    void Move()
    {
        Vector3 newPos = transform.position;
        float distanceToTravel = speed * Time.deltaTime;

        bool stillTraveling = true;
        while (stillTraveling)
        {
            Vector3 oldPos = newPos;

            newPos = Vector3.MoveTowards(oldPos, pos(index), distanceToTravel);

            distanceToTravel -= Vector3.Distance(newPos, oldPos);
            if (newPos == pos(index)) // Vector3 comparison is approximate so this is ok
            {
                // when you hit a waypoint:
                if (goForward)
                {
                    bool atLastOne = index >= pos.Length - 1;
                    if (!atLastOne)
                    {
                        index++;
                        counter++;
                        if (counter == numofposbetweenpoints)
                        {
                            c++;
                            
                            counter = 0;
                        }
                        if (c == curvedLinePoints.Count - 1)
                        {
                            c = 0;
                        }
                    }
                    else { index--; goForward = false; }
                }
                else
                { // going backwards:
                    bool atFirstOne = index <= 0;
                    if (!atFirstOne)
                    {
                        index--;

                        counter++;
                        if (counter == numofposbetweenpoints)
                        {
                            c++;
                            
                            counter = 0;
                        }
                        if (c == curvedLinePoints.Count - 1)
                        {
                            c = 0;
                        }
                    }
                    else { index++; goForward = true; }
                }
            }
            else
            {
                stillTraveling = false;
            }
        }

        transform.position = newPos;
    }

    void GetNewRandomIndex()
    {
        randomIndex = UnityEngine.Random.Range(0, curvedLinePoints.Count);
    }
}

This is the line for the rotation that should make it rotating to the moving direction but it’s not.

transform.localRotation = Quaternion.RotateTowards(transform.localRotation, curvedLinePoints(c).transform.localRotation, Time.deltaTime * rotSpeed);

In this screenshot the platform is moving up but facing to the left like the other cubes.
and I want the transform(platform) to rotate to be facing to the moving direction.

Platform

I tried this instead in the rotation part :

Vector3 relativePos = curvedLinePoints(c).transform.position - transform.position;
Quaternion rotation = Quaternion.LookRotation(relativePos);
transform.rotation = rotation;

but now when it’s moving up it’s facing up but then when moving down in the middle it’s changing the facing direction to up again still moving down but facing up.

The curvedLinePoints is List of the cubes.

fourier analysis – Limiting case of linear canonical transform

From what I understand based on reading the Wikipedia article, for $g=big(begin{smallmatrix}a&b\c&eend{smallmatrix}big)inmathrm{SL}_2mathbb{C}$ the linear canonical transform $X(u)$ of a suitable $x(t)$ is an integral transform $X(u)=int_{mathbb{R}} K_g(u,t)x(t),mathrm{d}t$ with the kernel given by

$$ K_g(u,t) =
begin{cases}
(ib)^{-1/2} expbig(frac{pi i}{b}(du^2-2ut+at^2)big) & bne0 \(4pt)
d^{1/2} expbig(pi i cdu^2big)delta(t-du) & b=0
end{cases} $$

What I don’t get, is how is the integral transform with $b=0$ a limiting case of the one with $bne0$?

The Wikipedia article on delta says it’s a limiting case of $delta_p(x)=frac{1}{|p|sqrt{pi}} expbig(-(frac{x}{p})^2big)$, but the formula for $K_g$ (for real $g$) has purely imaginary exponent, and it’s also distributionally given by $delta(x-alpha)=int_{mathbb{R}}expbig(2pi ip(x-alpha)big)mathrm{d}p$, but the formula for $K_g$ (in itself) doesn’t have an integral (even though applying it does). Any ideas?

unity – Sticking the Rigidbody2D player to a moving platform without parenting & transform fiddling

I have a player entity with Rigidbody2D component and I have a moving platform which is a kinematic Rigidbody2D. Player movement is done by setting it’s velocity (body.velocity = newVelocity) and platform is moved via body.MovePosition.

I’ve made it so that the platform has a sensor which, when triggered, catches the Rigidbody2D of the entity that is on (currently only does that for player) and then I tried the following:

  1. Moving the player along the platform with caughtRigidbody.MovePosition. This keeps the player on the platform but the player is unable to move. It seems that MovePosition overrides any velocity change on the player and keeps him on the platform indefinitely. This would be ideal if I could have this behavior but keeping player movement.

  2. Moving the caught rigidbody by adding platform velocity to the body but it seems jittery and also happens to behave strangely when platform direction changes.

I got the player movement how I want it so I’m not willing to tear out the whole movement code and change the player to kinematic or something like that.

This is the relevant platform code:

public class MovingPlatform
{
    private void FixedUpdate()
    {
        // Only one node (initial position). Nowhere to move to
        if (worldNodes.Length == 1)
        {
            return;
        }

        // Target position reached?
        if (body.position == worldNodes(index))
        {
            // Is last (or first in backwards direction) target?
            if (direction == Direction.Forwards && index == worldNodes.Length - 1 ||
                direction == Direction.Backwards && index == 0)
            {
                // Change direction (forwards = 1, backwards = -1)
                direction = (Direction) ((int) direction * -1);
            }

            // set next target index
            index += (int) direction;
        }

        // Get target
        Vector2 target = worldNodes(index);
        // Get current platform position
        Vector2 position = body.position;
        // Calculate single-frame movement towards target
        Vector2 movementThisFrame = Vector2.MoveTowards(position, target, settings.Speed * Time.deltaTime);
        // Move platform by calculated movement
        body.MovePosition(movementThisFrame);
        // Calculate platform movement velocity (displacement / time delta)
        velocity = (movementThisFrame - position) / Time.deltaTime;
        MoveCaughtRigidbodies();
    }

    private void MoveCaughtRigidbodies()
    {
        foreach (Rigidbody2D caughtRigidbody in caughtRigidbodies)
        {
            // This keeps the player on the platform without jittering, but the player cant move
            //caughtRigidbody.MovePosition(caughtRigidbody.position + body.position - lastPosition);

            // This is spotty. It launches the player off the platform sometime when the platform changes direction
            // if (caughtRigidbody.velocity != velocity)
            // {
            //     caughtRigidbody.velocity += velocity;   
            // }
        }

        lastPosition = body.position;
    }
}

Inverse Laplace transform of F(s)=1 / (s(s^2+s+1))?

F(s)=1 / (s(s^2+s+1)) ? Can you help me?