## recursive functions – python

I’ve watched multiple videos and read articles about recursion but I’m still confused. I’ve got this problem here but I’m unsure how to answer it. Could someone help explain? Thanks ## Are type abstraction values and universal types not for non functions, but only for functions?

In Types and Programming Languages by Pierce, Chapter 23 Universal Types has a summary of System F in the following figure, in particular, “type abstraction values” and their types “universal types”.

In all the examples I have seen so far in the chapter, in particular Section 23.4 Examples, (not sure if I miss any example):

• all the type abstraction values are parametrically polymorphic functions, by allowing the types of their arguments to have any type, and
• all the universal types, i.e. the types of type abstraction values, are types of parametrically polymorphic functions.

Are type abstraction values and their universal types not for non functions, but only for functions?

More specifically, in any type abstraction value, say $$\lambda X.t$$, must $$t$$ have a function type, not a non-function type?

In Section 23.4 Examples, values of base types and of recursive types are type abstraction values, because their definitions in the section are functions by Church encodings.

Thanks. Posted on Categories proxies

## Minimization of superlinear functions

Let $$A\in\mathbb N_+$$, and let $$f:\mathbb N_+\to\mathbb N_+$$ be non-decreasing function that satisfies $$f(n)\in \Omega(n)$$ .

Is it true that

$$\displaystyle\min_{a\in\{1,\dots,A\}}\{f(a)+f(A-a)\}=f\Big(\Big\lceil\frac A 2\Big\rceil\Big)+f\Big(\Big\lfloor\frac A 2\Big\rfloor\Big)$$ ?

Posted on Categories proxies

## Why are non-collision-resistant hash functions considered insecure for signatures

Let we have a hash function that is second preimage resistant but not collision-resistant.

Then an adversary can create a pair of different messages M and M’, M is benign and M’ is malicious, for both of which the signature will be valid.

I don’t understand why it is an issue in the setting where signatures are used to authenticate origin of data created by the same entity. So if one signs some software he claims “I have created this content myself, if it contains malware, blame me”. And for keys: “this public key has a corresponding private key, I have access to it”.

If one crafts a collision and signs self-generated data … he still claims the above statements.

So should such hash functions be considered secure for things like self-signed certificates and code signing?

Posted on Categories proxies

## Which algorithm would be better to integrate “step” like functions

I have a function f[wr], in which the appearance is step like, first of all, the NIntegrate function is not handling this function, so I decided to do the integration algorithm by hand. Without joined in plot I have tried to integrate f[wr] using Riemann’s sum

data[mu_] :=   Module[{Te = 300., sum = 0., sum1 = 0., kb = 8.61*10^-5, a},    Do[    sum = sum + (f[wr] 0.01);     sum1 = sum1 + (f[wr] (wr - mu) 0.01);, {wr, mu - 30 kb Te,      mu + 30 kb Te, 0.01}]; sum1/(Te*sum)] 

and then, evaluate it with

Table[{data[mu],{mu,-1,1}] 

I think the results could be better if I try other algorithm. Could you suggest one?

edit: f[wr] algorithm https://pastebin.com/tfbGmhDa

Posted on Categories cheapest proxies

## How to pass objects between functions in PnP PowerShell

I have to functions. In the first, I create a reference to a SharePoint list. I would like to pass the list to a second function. In the second functions list of parameters, I declare it as String

This doesn’t work. How do I declare the parameter as being a list?

function GetList() {     param(     [string] $listID, [string]$  listName     )     Write-Host "Provided ListName: " $listName -ForegroundColor Cyan Write-Host "The list id is: "$  listID -ForegroundColor Red      $list = Get-PnPList -Identity$  listName       CreateView -list $list } function CreateView() { param( [string]$  list     )      Add-PnpView -Title "Test View" -List $list -Fields "Title" Write-Host "Creating New View" }  Posted on Categories buying proxies ## multiple functions with same filter I want to use the same filter hook in different locations, and I just want to make sure this is OK to do so ( preliminary test shows it works, but I am not 100% sure it is OK to do so). So the add_filter(‘check_powers’, …. ) is in one location only ( not that it matters) function define_user_powers() { if ( user_is_powerful() ){ add_filter('check_powers', 'give_super_power'); } } function give_super_power($  powers ){   $powers = true; return$  powers; } 

But the apply_filters(‘check_powers’) is in several locations:

function kick_ass() {   $powers = apply_filters('check_powers', false ); if ($  powers ) {    do_smthng();   }  }  function fly() {   $powers = apply_filters('check_powers', false ); if ($  powers ) {    do_smthng_else();   } } 

All questions i have found relates to the other way around ( multiple add_filter to same hook).

## Plotting Integral of Exponential functions

I am trying to Plot an integral equation that involves exponential function. My code is as follow,

L[\[Alpha]_] :=    NIntegrate[    1/(k + I*0.1) (     Exp[I*k*x] (Exp[Sqrt[k^2 + \[Alpha]/w^2]*w] - 1) (Exp[k*w] - 1 +         I*0.1) Sqrt[      k^2 + \[Alpha]/       w^2])/((Sqrt[k^2 + \[Alpha]/w^2] + k) (Exp[         Sqrt[k^2 + \[Alpha]/w^2]*w - Exp[k*w]]) + (Sqrt[         k^2 + \[Alpha]/w^2] -          k) (Exp[(k + Sqrt[k^2 + \[Alpha]/w^2]) w] -          1)), {k, -100, 100}]; Plot[{Re[L], Re[L], Re[L]}, {x, -0.45, 0.45},   PlotRange -> Full].  

But this integral gives a lot of oscillations which it should not. This is fig 2 in this article “https://arxiv.org/pdf/1508.00836.pdf” that I am trying to plot. Any help will be highly appreciated.

Posted on Categories cheapest proxies

## How can we convert between a program using call/cc and a program using functions written in CPS?

The Scheme Programming Language says

It turns out that any program that uses call/cc can be rewritten in CPS without call/cc, but a total rewrite of the program (sometimes including even system-defined primitives) might be necessary.

What are the general techniques to

• convert a program using call/cc to a program using functions written in CPS

• convert in the reverse direction?

Posted on Categories proxies