calculate values from a field and insert them into custom fields when publishing or updating post

You can achieve this using the save_post hook, this is a hook that fires once a post has been saved. Below is an example addressing what you want to achieve:

function wpse253778_calculate_values( $post_id, $post ) {

    if ( 'post' !== $post->post_type )
        return;

    $field = get_post_meta( $post_id, 'FIELD_NAME', true ); //get field value

    $new_field_value="";//calculate new field value

    update_post_meta( $post_id, 'NEW_FIELD', $new_field_value );

}
add_action( 'save_post', 'wpse253778_calculate_values', 10, 2 );