jquery – contact form 7 repeatable fields calculations

I had been trying to calculate cost and quantity using the following reply from (Calculate Repeater Meta Box Input Field Values and Display Total) RiddleMeThis and another reply by Filipeelia (https://stackoverflow.com/questions/35710039/how-to-make-a-sum-of-number-fields-to-single-field-in-contact-form-7-in-wordpres) to work:

calculate = function(){
var total = 0;
$(‘.wpp-repeater-input’).each(function () {
total += parseInt($(this).val());
});

document.getElementById('wpp_investment_total').value = parseInt(total);

}

my code:
jQuery (function ($) {
var $qty = $(‘.iqty’),
$total = $(‘#item-total’);

$qty.on('input', function(e) {
    var final_value = 1;
    $qty.each(function() {
        var value = $(this).val();
        if (!isNaN(value) && value > 0) final_value += parseInt(value);
    });
    $ttl.val(final_value);
})

});

It works for the first field but not the subsequent.

I have tried using class instead of ID, placing the function top-most on the header, but it doesn’t work.

I am not able to understand why it shouldn’t work as it is working for the first field.

My view is that the subsequent repeated fields are not loaded along with the page hence do not call the function.

I am not sure of that as I am still at a beginner’s stage. Also, even if I am right with the notion, I tried to search and came across init() and DOM events sorts, which I am not very sure of.

It would be great if someone can point me to some direction.

Many thanks in advance

Is there a way to tell what mathematical calculations are being done by this online form?

Is there any way to tell what mathematical calculations are being done by this online form for estimating cancer risk?

I can fill out the form and it gives me a cancer risk estimation but I would like to see the actual calculations that are taking place. I figure there might be a way to inspect the website to find this out but CS is not really my field so, I thought I would ask here. I hope I am in the right place. Apologies if not.

Thanks!

calculations – Calculate lens FOV difference between Full-frame and APS-C sensors?

Shuttermuse has a rudimentary formula, but ScanTips has a more detailed explanation as well as a calculator.

In general, you can take the 35mm full-frame focal length and multiply it by the crop factor to find what the APS-C focal length will be. So for a 20mm lens:

20mm x 1.5 crop factor = 30mm APS-C focal length

Google Form to sheet to Doc, with calculations after pushing to sheet

NOTE! I am not a programmer I’m just fumbling through this! I’ve gotten as far as I can with searches, getting lost on multiple steps as most responses don’t integrate on thing to the next.

Background
Google Form pushes to Google Sheets and outputs a Google Doc prefilled template using GAS. This is for purchase order creation: Success It won’t let me post the code though…

Problem
I need the sheet to do some work once the form data populates (as an order PO, the form entry is quantity and price of each item and I need the total on the output PO). I need the resulting data to ALSO push to the Google Doc. This is where I’m getting stuck.

A.
Assign each line a unique ID using an array in an added column to the form response sheet
Successful in creating the ID, although it doesn’t push to the doc with the other data. Defining the variable with the others doesn’t work here.

Is this a var definition issue, or does this have to do with order of operations/triggers? Maybe the only data being sent is the FORM DATA, not the CREATED DATA IN SHEETS from the form.

The array formula that populates “poID” upon submitting the form data:

=arrayformula( if( len(A2:A), "" & text(row(A2:A) - row(A2) + 2, "1100")))

Google sheet form response tab

B.
On the third tab I created new cells to do calculations using the passed data from the form.

The data autofilled from the form doesn’t trigger the formulas on the second tab at all, as if the cells referenced were still empty (they are not).

Rows 2-6 are only populated in this image because I was making sure the formulas were correct, manually. When I took this screenshot there were already more form data lines on the response page that you can’t see on this tab.

Calculation Sheet

Obviously since these are not calculating on their own, there is nothing to pass to the form. Also cannot define those variables in the script.

Summary
I think this requires multiple scripts and/or multiple functions for this sheet.

Guessing since the array and calculations happen technically after the form has been submitted, it’s not passing. I can’t sort out how to:

  • define these variables (new script? new function?) and then,
  • perform calculations using that data, automatically (this must be an array thing like the poID is) and then,
  • get them to populate the same output document that the form data populates (new trigger?).

Any help here would be massively appreciated.

WooCommerce Plugin needed or Code/function to do VAT calculations

I am trying to set up sales taxes paid on a product. I want be able to charge zero VAT for a customer from the USA if they are buying for a company, but charge 20% VAT if they are buying as an individual. Also I need to charge 20% VAT for any customer from the UK. These are not physical products but courses delivered online.

I would like the software to fill this out automatically at checkout

I can set it up to charge VAT if select UK in checkout country drop down and not charge if from the US – but cannot work out how it would be automatically charged if they do not say they are buying on behalf of a company.

Any suggestions welcome – I bought a plugin ‘Conditional Checkout Fields for WooCommerce’ but couldn’t see how to make this work contacted them and they said it couldn’t be done with this plugin 🙁

URL below is a dev site where I am trying to get this to work

thanks Pete Rossetti

The page I need help with: https://petetheportal.com/usd

More specifically

The key is if they are a business or not. B2B or B2C

All B2C customers anywhere in the world get charged VAT

All B2B customer anywhere in the world are VAT exempt APART from the UK

Is it possible to setup something which

  1. checks buying from UK:- Yes or No
    Yes charge Vat 20% –
    No ask another question:

  2. ‘Are the buying for a Company’ :- Yes or No
    Yes:- Vat zero rated
    No:- Vat charged at 20%

Rendevouz Calculations

Say you have two objects in a vacuum with no forces acting on them.

The objects may or may not be moving.

Object A’s acceleration is not equal in all directions, and object B may change its acceleration over time.

Knowns:
A position
A velocity
A acceleration
A max acceleration for a given vector
B position
B velocity
B acceleration

So for object A, how can I iteratively calculate the the direction of thrust needed to go to B’s position and match B’s velocity in the smallest amount of time?

approximation theory – Examples of Back of Envelope Calculations Leading to Good Intuition in Mathematics?

Some time ago, I read about an “approximate approach” to the Stirling’s formula in M.Sanjoy’s Street Fighting Mathematics. In summary, the book used a integral estimation heuristic from spectroscopy

$int_{mathbb{R_{ge 0}}} f(x) dx approx max(f) * (text{point where} frac{1}{2} max(f) text{is achieved}) $

to estimate the Gamma function with $f(x) = f_t(x) = x^{t}e^{-x} $. This leads to the estimate

$Gamma(n) = int_{mathbb{R}_{ge 0}} x^{n}e^{-x} dx approx sqrt{8 n} left(frac{n}{e}right)^n$

which is an extremely good estimate (the “proportionality constant” $sqrt{8}$ is correct to within 10% with correct order of growth.) This heuristic was very helpful in understanding the growth of the actual formula $Gamma(n) approx sqrt{2pi n} left(frac{n}{e}right)^n$.

I think approximations of this sort is useful because

  • It gives a sense of what the answer “ought” to be.
  • When the approximation deviates from the actual answer, it’s interesting to think about which part of the approximation failed.

Another “back-of-envelope calculation” is the calculation for the Prime Number Theorem in Courant and Robbins, What is Mathematics?

My Question. I am looking for similar instances in mathematics where “back-of-envelope calculations” such as the above leading to good intuition in mathematics.

For the purpose of my question, let’s require that the calculation:

  1. Does not require anything beyond, say undergraduate mathematics
  2. Addresses questions in pure mathematics (so, no physics, engineering, etc. since there seems to already be plenty of literature on this)
  3. Does not formalize into a rigorous proof

I am adding the last condition to distinguish my question from questions such as “what are nice theorems with intuitive/clever/short/elementary proofs”? (Both examples above satisfy criteria 1~3, to the best of my knowledge.)

differential equations – recursive time dependent NDSolve calculations but full kernel

I would like to make a very long time dependent NDSolve calculation, but the program indicates a full kernel after a while. How can I make the calculations by steps, saving the results at a time and restart the recursive calculations from the preceding calculations ?

How to finish the last calculations in the problem?

Solve the system of equations

enter image description here

where a = 6, b = 11

evaluate the value of the expression

enter image description here

for every solution

enter image description here

system and find the minimum among them. In the answer, indicate the minimum value found, if necessary, round it to two decimal places

my solution:

The second equation of the system:

x ^ 2 + y ^ 2 + 2a (y-x) + 2a ^ 2 = 0

(x-a) ^ 2 + (y + a) ^ 2 = 0

x = a; y = -a; if a = 6, then x = 6, y = -6.

Then the 1st equation:

z ^ 4 + 6z-6z-11 = 0

z ^ 4-11 = 0

z = ± ∜ 11.

We got two solutions: (6; -6; ∜ 11) and (6; -6; -∜ 11).