M
M
Matef2021-05-12 19:59:05
Mathematics
Matef, 2021-05-12 19:59:05

How to read formulas and write them into code?

In general, they gave the task of writing programs using a formula, please tell me how to read them and how to describe it in code, I don’t need a ready-made solution, I just want to understand how to read and describe them, examples can be
609c09477bfeb033769229.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wataru, 2021-05-12
@Matef

I mean, how to read? From left to right, following the order of operations.
Here is the first formula r= ... - this means that the value of the variable r is calculated from the expression on the right. Variables p, g participate there, the values ​​of which are given to you.
There is a fraction, the numerator is the sum of p and g. The denominator is one plus the logarithm squared of the sum of the root of pg+p and g^2. Expand the brackets and get (p+g)/(1+log(...)*log(...))
Similarly, the second formula for y in terms of p,g,r and z (three of them are given to you, r is calculated in previous action).
Squaring - depends on the programming language. Or the sqr() function, or **2, or just write (expression)*(expression). lg() - call the built-in logarithm function. Again, it depends on the language, how exactly it is called for you. The square root is the sqrt() function.

H
hint000, 2021-05-13
@hint000

As I understand it, the main problem is that the school didn’t properly explain how to write fractions in one line? Those. the equivalence of a horizontal slash and a forward slash (slash).
https://en.wikipedia.org/wiki/Fraction_(mathematics)
609c8e242567e532823948.png
Maybe you still need to master the abstract concept of a mathematical function and how it relates to functions in programming languages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question