I am trying to create function using numpy something like f=(x-a1)^2+(y-a2)^2+a3

Where a1,a2,a3 are random generated numbers and x,y are parameters.

But I cant work with it, I want to find f(0,0) where [0,0] is [x,y] and [a1,a2,a3] were set before,but my code doesnt work.
And then I want to convert this function to tensorflow tensor.Here is my code, string with "##" dont work.

```
import tensorflow as tf
from random import random, seed
import numpy as np

def mypolyval(x, min_point, min_value):
    res = min_value
    for i in range(len(min_point)):
        res += (x[i] - min_point[i]) ** 2
    return res

class FunGen:
    def __init__(self, dim, n):
        self.dim = dim
        self.n = n
        self.functions = []
        self.x = []

    def c2(self):
        seed(10)
        for _ in range(self.n):
            min_point = [random() for _ in range(self.dim)]
            min_value = random()
            f = np.vectorize(mypolyval, excluded=['x'])

            ##print(f(x=np.array([0, 0]), min_point=min_point, min_value=min_value))
            self.functions.append((f, min_point, min_value))
        return self.functions

functions = FunGen(2, 1).c2()
for i in functions:
    print(type(i[0]))
    f=i[0]
   ## print(f(x=[0, 0], min_value=i[1], min_point=i[2]))
    ##a=tf.convert_to_tensor(f,dtype=np.float32)

```
['https://Stackoverflow.com/questions/48735135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8895598/']
Please note that as of November of 2018, there has been a [breaking change to MetaMask](https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8) where MetaMask will no longer automatically inject web3 into the browser. Instead users must grant the DApp access to their accounts via accepting a prompt dialog created by window.ethereum.enable(). See the below code for handling MetaMask in both modern DApp browsers as well as legacy DApp browsers.

```js
// Modern DApp Browsers
if (window.ethereum) {
   web3 = new Web3(window.ethereum);
   try { 
      window.ethereum.enable().then(function() {
          // User has allowed account access to DApp...
      });
   } catch(e) {
      // User has denied account access to DApp...
   }
}
// Legacy DApp Browsers
else if (window.web3) {
    web3 = new Web3(window.web3.currentProvider);
}
// Non-DApp Browsers
else {
    alert('You have to install MetaMask !');
}

```
You should use web3 provider like MetaMask in browser.
This is script that I use for web3 detection:

```
window.addEventListener('load', function () {
    if (typeof web3 !== 'undefined') {        
        window.web3 = new Web3(window.web3.currentProvider)

        if (window.web3.currentProvider.isMetaMask === true) {
            window.web3.eth.getAccounts((error, accounts) => {
                if (accounts.length == 0) {
                    // there is no active accounts in MetaMask
                }
                else {
                    // It's ok
                }
            });
        } else {
            // Another web3 provider
        }
    } else {
        // No web 3 provider
    }    
});

```