## Help with function accepting real values

Thanks for contributing an answer to Mathematica Stack Exchange!

• Please be sure to answer the question. Provide details and share your research!

But avoid

• Asking for help, clarification, or responding to other answers.
• Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

## php – Error: Call to a member function connection() on null

resulta que estaba haciendo pruebas con phpunit dentro de Laravel 7, y en un momento con una prueba de lo más simple para crear un nuevo producto, me apareció el error:

TestsUnitProductsTest::testCreateProduct
Error: Call to a member function connection() on null

Este es el código del test:

<?php

namespace TestsUnit;

use AppProduct;
use PHPUnitFrameworkTestCase;

class ProductsTest extends TestCase
{
public function testCreateProduct()
{
Product::create((
'name' => 'Yuca',
'stock' => 40
));
$products = Product::getAllProducts();$this->assertCount(1, \$products);
}
}


Si alguien conoce como solucionar el error estaré muy agradecido :).

## confused about returning a value or not in this simple python function

I’m writing a few python scripts to get started. There is sometimes the assumption that most functions should return a value, but some cases are confusing to me.

The next function use *args, an equivalent to the rest operator in javascript, to put all the arguments (any number) into an array named args. If those directories do not exist, they should be created. (I know bash is probably the way to go here, but this is just an example).

def make_multidir(*args):
# *args is like a rest operator in js, ...dirs
for directory in args:
if not os.path.exists(directory):
os.makedirs(directory)
else:
print( "folder %s already exists" %(directory))


If you have any other recommendation here for the code, I’ll be eager to learn.

## differentiability – How to write a custom function to judge whether a binary function is differentiable at a certain point

We know that the necessary and sufficient conditions for a function of two variables to be differentiable at a certain point are complex.

Suppose the function $$z = f (x_ 1, x_ 2, …, x_n)$$ is defined in the neighborhood $$U$$ of the point $$P_ 0 (x_ {10}, x_ {20}, …, x_{n0})$$ , then the sufficient and necessary conditions for the function $$z = f (x_ 1, x_ 2, …, x_n)$$ to be differentiable at the point $$P_ 0 (x_ {10}, x_ {20}, …, x_{n0})$$ are: The n first-order partial derivatives of the function $$z = f (x_ 1, x_ 2, …, x_n)$$ at the point $$P_ 0 (x_ {10}, x_ {20}, …, x_{n0})$$ all exist, and $$f (x_ 1, x_ 2, …, x_n) – f (x_ {10}, x_ 2, …, x_n) – f (x_ 1, x_ {20}, …, x_n) – f (x_ 1, x_ 2, …, x_{n0}) + f (x_ {10}, x_ {20}, …, x_{n0}) = O (rho)$$ ;

Where $$(x_ 1, x_ 2, …, x_n) in U$$, $$rho = sqrt{(x_ 1 – x_ {10})^2 + (x_ 2 – x_ {20})^2 + … + (x_n – x_ {n0})^2}$$.

I already know that the following binary function $$f(x,y)$$ is differentiable at point {0,0}, but its two first-order partial derivatives are not continuous at {0,0}:
$$f(x, y)=begin{cases}(x^2 + y^2) sin(frac{1}{(x^2 + y^2)}), &(x, y) neq (0, 0) cr 0 , &(x, y)=(0, 0)end{cases}$$

I want to write a custom function to judge whether any binary function is differentiable at a certain point. How should I write this function?

For example, through this custom function, we can judge that the following binary function is not differentiable at {0,0}:

$$f(x, y)=begin{cases}frac{x^2y}{x^4 + y^2}, &(x, y) neq (0, 0) cr 0, &(x, y)=(0, 0)end{cases}$$

## gn.general topology – Does a compact ANR have a local equiconnecting function which connects distinct points by simple paths?

It is known that if $$X$$ is a (metric) ANR, then $$X$$ is locally equiconnected, that is, there is a neighborhood $$V$$ of the diagonal $$Delta X subseteq X times X$$ and a continuous function $$f colon V times (0,1) rightarrow X$$
such that

1. For every $$(x,y) in V$$, the path $$f(x,y,-) colon (0,1) rightarrow X$$ starts at $$x$$ and ends at $$y$$.
2. For every $$x in X$$, the path $$f(x,x,-) colon (0,1) rightarrow X$$ is the constant path at $$x$$.

(Side note: Local equiconnectivity is equivalent to the diagonal map $$Delta colon X rightarrow X times X$$ being a Hurewicz cofibration.)

Let us also assume that $$X$$ is compact. My question is: Can we choose the $$U$$ and $$f$$ such that when $$x neq y$$ in the 1st condition, the path connecting them is a simple path?

Remark: It follows from Lemma 2.1 of the paper “A remark on simple path fields in polyhedra of characteristic zero” by Fadell that the answer is yes when $$X$$ is a finite simplicial complex. I am interested in a (strict) generalization of this result.

## what is the laplace transform of product of function of two variable

if i have a function say U(x,t) and its partial derivative as frac{partial U(x,t)}{partial x}.then what will be the laplace transform of their product i.e laplace {U(x,t)*frac{partial U(x,t)}{partial x}?

## proof techniques – Recurrence relation for the number of “references” to two mutually recursive function

I was going through the Dynamic Programming section of Introduction to Algorithms(2nd Edition) by Cormen et. al. where I came across the following recurrence relations in the assembly line scheduling portion.

$$(1),(2),(3)$$ are three relations as shown.

$$f_{1}(j) = begin{cases} e_1+a_{1,1} &quadtext{if } j=1\ min(f_1(j-1)+a_{1,j},f_2(j-1)+t_{2,j-1}+a_{1,j})&quadtext{if} jgeq2\ end{cases}tag 1$$

Symmetrically,

$$f_{2}(j) = begin{cases} e_2+a_{2,1} &quadtext{if } j=1\ min(f_2(j-1)+a_{2,j},f_1(j-1)+t_{1,j-1}+a_{2,j})&quadtext{if} jgeq2\ end{cases}tag 2$$

(where $$e_i,a_{i,j},t_{2,j-1}$$ are constants for $$i=1,2$$ and $$j=1,2,3,…,n$$)

$$f^star=min(f_1(n)+x_1,f_2(n)+x_2)tag 3$$

The text tries to find the recurrence relation of the number of times $$f_i(j)$$ ($$i=1,2$$ and $$j=1,2,3,…,n$$) is referenced if we write a mutual recursive code for $$f_1(j)$$ and $$f_2(j)$$. Let $$r_i(j)$$ denote the number of times $$f_i(j)$$ is referenced.

They say that,

From $$(3)$$,

$$r_1(n)=r_2(n)=1.tag4$$

From $$(1)$$ and $$(2)$$,

$$r_1(j)=r_2(j)=r_1(j+1)+r_2(j+1)tag 5$$

I could not quite understand how the relations of $$(4)$$ and $$(5)$$ are obtained from the three corresponding relations.

Thought I could make out intuitively that as there is only one place where $$f_1(n)$$ and $$f_2(n)$$ are called, which is in $$f^star$$, so probably in $$(4)$$ we get the required relation.

But as I had not encountered such concept before I do not quite know how to proceed. I would be grateful if someone guides me with the mathematical prove of the derivation as well as the intuition, however I would prefer an alternative to mathematical induction as it is a mechanical cookbook method without giving much insight into the problem though (but if in case there is no other way out, then I shall appreciate mathematical induction as well provided the intuition is explained to me properly).

## javascript – what is the best way to unsubscribe of function in method?

Working on dialog component with angular js and now I find out that my function is subscribed and in if condition do not quit method, but continuously executing another function afterClosed() , here is example of code :

  openCreateNewContentDialog(): void {
const oldData = this.dataSource.data;
const dialogConfig = AppConstants.matDialogConfig();
const dialog = this.dialog.open(LicenseDialogComponent, dialogConfig);

dialog.beforeClosed().subscribe(licenceDate => {
for (const datesToCheck of oldData) {
const newDateFrom = new Date(licenceDate.expirationDateFrom);
const oldDateTo = new Date(datesToCheck.expirationDateTo.toString());
if (newDateFrom <= oldDateTo) {
// console.log('return?');
return;
}
}
});

dialog.afterClosed().subscribe(licence => {
if (licence) {
this._value.push(licence);
this.dataSource.data = this.value;
this.change();
}
});
}


What is the best and optimized way to unsubscribe beforeClosed() function?

## list manipulation – Binning of numerical 2d function

I have a set of data {x_i,y_i,z_i} organized as 3-member sublists in a large (~4000 sublists) list. The z_i are functions of (x_i,y_i): z_i = f(x_i,y_i), but the function f is known only numerically.
I want to bin the x_i values into prescribed, not necessarily equal length, bins, integrate over x in each of these bins and then plot within each bin z as a function of y.
How can I do that?

## measure theory – A function to a joint probability distribution over product of discrete and continuous spaces

I have a function that maps some space $$X$$ to a joint probability distribution over elements in $$A times B$$.

If both spaces were discrete then the function would take the form of $$f:Xto Delta(Atimes B)$$ where $$Delta(cdot)$$ is the probability simplex (the space of all probability mass functions on $$Atimes B$$).

Question: What is the proper notation for the function when one of the spaces, say $$B$$, is uncountably infinite?