## Plotting a well defined function displays nothing for two-thirds of the range required

The plot in question concerns the second derivative of an inverse Laplace transform (ILT) of a function with five parameters. Here is the ILT

ClearAll["Global*"] prod = (s - cr1) (s - cr2) (s - cr3) (s - cr4); LW = (1 + s)^2/(si prod); Print["symbolic W'=", Wp = D[InverseLaplaceTransform[LW, s, x], x]] 

Four parameters are functions of the fifth parameter "si", defined as the roots of a fourth order equation

cr = {cr1, cr2, cr3, cr4} =     s /. Solve[si s^2 + 107 s/5 + 10 ((1 + s)^(-2) - 1) - 1/10 == 0,       s]; 

Plotting the first derivative of the ILT takes .64

lx = 13; Timing[  pd = Plot[Evaluate[Wp /. si -> 1], {x, 0, lx},     PlotRange -> {{0, lx}, {0.0225, .0275}}]] 

Plotting of the second derivative of the ILT takes 14.84 and displays nothing for two-thirds of the range lx

    Wd = D[Wp, x]; Timing[Plot[(Wd /. si -> 1), {x, 0, lx},   PlotRange -> {{0, lx}, {-0.002, .002}}]] 

## Find maximal subset with interesting weight function

You are given $$n$$ rows of positive integers of length $$k$$. We define a weight function for every subset of given $$n$$ rows as follows – for every $$i = 1, 2, \dots, k$$ take the maximum value of $$i$$-th column (), then add up all the maximums.

For example, for $$n = 4$$, $$k = 2$$ and rows $$(1, 4), (2, 3), (3, 2), (4, 1)$$ the weight of subset $$(1, 4), (2, 3), (3, 2)$$ is $$\max\{1, 2, 3\} + \max\{4, 3, 2\} = 3 + 4 = 7$$.

The question is, having $$m \leq n$$, find the subset of size $$m$$ (from given $$n$$ rows) with maximal weight.

The problem looks trivial when $$m \geq k$$, but how can one solve it for $$m < k$$? Looks like dynamic programming on subsets could work for small $$k$$, isn’t it? Are there other ways to do it?

Posted on Categories proxies

## Add post featured image to default WP search results page function snippet

I did search a lot for such a snippet, but did not find any. Could anyone assist?

## How does the Avatar spell function if my character worships a god that isn’t listed under the spell?

more questions concerning Pathfinder Second Ed, but it’s something that I won’t need the answer to until MUCH later down the road. Right now, I’m about to start a 3rd level campaign centered around upper-class intrigue and pirates, so I figured I’d try playing a Cleric of Ng to fit a setting with implicitly ambiguous morals. However, I’m looking both online and in the physical copy I have of Lost Omens: Gods and Magic and cannot find any mention of what additional benefits you gain for casting the Avatar spell while worshiping this god and its contemporaries in the Eldest Pantheon. In addition, I was ecstatic when I discovered that Grundinnar (the first God I played a Cleric of back in PF1e) was included as a part of the Dwarven Pantheon, but he’s in the same boat as the Eldest since the Avatar spell does not specify either Grundinnar directly or the Dwarven Pantheon in general.

So my question is If a Cleric casts the Avatar Spell and their Deity isn’t listed under its effect, what happens?

Posted on Categories Best Proxies

## For every imperative function, is there a functional counterpart with identical performance or even instructions?

Currently, I haven’t learned about a functional language that can achieve the same performance as C/C++. And I have learned that some languages that favor functional programming to imperative programming, such as Scala and Rust, use imperative ways to implement their library functions for better efficiency.

So here comes my question, on today’s comptuters that execute imperative instructions, is this a limitation of the compiler or functional programming itself? For every imperative function with no side effects, either in a language without GC such as C/C++/Rust/assembly or one with GC such as Java, is there a pure functional counterpart in Haskell, Scala, etc. that can be compiled to run with identical performance in time and space (not just asymptotic but exactly the same) or even to the same instructions, with an optimal functional compiler that utilizes all modern and even undiscovered optimization techniques such as tail recursion, laziness, static analysis, formal verification, and so on which I don’t know about?

I am aware of the equivalence between λ-computable and Turing computable, but but I couldn’t find an answer to this question online. If there is, please share a compiler example or a proof. If not, please explain why and show a counter-example. Or is this a non-trivial open question?

Posted on Categories proxies

## Understanding growth function of closed intervals in $\mathbb{R}$

I as studying VCdimensions and growth functions and found the following example on Wikipedia:

The domain is the real like $$\mathbb{R}$$. The set H contains all the real intervals, i.e., all sets of form $$\{c \in [x_1, x_2] | x \in \mathbb{R}\}$$ for some $$x_{0, 1} \in \mathbb{R}$$.

For any set C of m real numbers, the intersection $$H \cap C$$ contains all runs of between 0 and m consecutive elements of C. The number of such runs of $${m+1 \choose 2} + 1$$, so Growth(H, m) = $${m+1 \choose 2} + 1$$.

Can anyone please explain to me what does the term "all runs of between 0 and m" refer to here and why the growth function is $${m+1 \choose 2} + 1$$ and not $${m+1 \choose 2}$$?

Thank you very much!

Posted on Categories proxies

## How to calculate Sum of a function over a list

tlist = Table[i, {i, 1, 10}]

tlist:{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

f = E^(-((2 t)/T));

Sum[f, {t, {tlist[[i]], {i, 1, 8}}}]

How to calculate Sum of a function over a list?

One way to do this is by defining f[t_]:= E^(-((2 t)/T));` Is there a way to do it in any other manner. Because I have to do this for various functions with a higher level of complexity.

## Which function results from primitive recursion of the functions g and h?

Which function results from primitive recursion of the functions $$g$$ and $$h$$?

1. $$f_1=PR(g,h)$$ with $$g=succ\circ zero_0, h=zero_2$$
2. $$f_2=PR(g,h)$$ with $$g=zero_0, h=f_1\circ P_1^{(2)}$$
3. $$f_3=PR(g,h)$$ with $$g=P_1^{(2)}, h=P_2^{(4)}$$
4. $$f_4=PR(g,h)$$ with $$g=f_3\left(f_1(x),succ(x),f_2(x)\right)$$

(1.) $$g:N^0\to N$$, $$h:N^2\to N$$
$$f(0)=1$$
$$f(0+1)=h(0,f(0))=h(0,1)=0$$
$$f(1+1)=h(1,f(1))=h(1,0)=0$$
$$\forall n\in N_{>0}:f(n+1)=h(n,f(n))=0$$, $$f_1$$ is defined as $$f_1:N^1\to N$$ with $$f_1(x)=\begin{cases}1, x=0\ 0, x>0\end{cases}$$

(2.) $$g:N^0\to N$$, $$h:N^2\to N$$
$$f(0)=0$$
$$f(0+1)=h(0,f(0))=h(0,0)=1$$ $$f(1+1)=h(1,f(1))=h(1,1)=0$$ $$\forall n\in N_{>0}: f(n+1)=h(n,f(n))=0$$, $$f_2$$ is defined the same as $$f_1$$, $$f_1(x)=f_2(x)$$

(3.) $$g:N^2\to N$$, $$h:N^4\to N$$
$$f(x,y,0)=x$$
$$f(x,y,0+1)=h(x,y,0,f(x,y,0))=h(x,y,0,x)=y$$ $$f(x,y,1+1)=h(x,y,1,f(x,y,1))=h(x,y,1,y)=y$$ $$\forall z \in N_{>0}: f(x,y,z+1)=h(x,y,z,f(x,y,z))=y$$, $$f_3$$ is defined as $$f_3:N^3\to N$$ with $$f_3(x,y,z)=\begin{cases}x, z=0\ y, z>0\end{cases}$$

Is this correct up to here? It looks way too easy, that’s why I’m not sure.

Posted on Categories proxies

## Programming a function of traingle [closed]

I have a problem of programming as following-

Write a program that defines structure of a traingle having three sides a,b,c.

The program should have a user defined function,which will take a structure variable as a parameter and determine is it a triangle or not based on value of three sides

Posted on Categories proxies

## Recurrence with a function of n times T()

The master method works well on problems like $$T(n)=kT(an)+cn$$, but it does not handle problems like $$T(n)=n^{\frac{1}{3}}T(n^{\frac{2}{3}})+n^2$$ With the number of branches for each partition is a function of $$n$$. I wonder if there’s a good solution to this kind of problems, I have no idea how to solve this, any help is appreciated!