Codice in scrittura

buongiorno a tutti
come si fa a scrivere un codice del genere?
(((-0,0000336713*((°C9/5)+32)^4+0,0105207916((°C9/5)+32)^3-1,2495985607((°C9/5)+32)^2+67,0024722564((°C9/5)+32)-1374,6540546564)LN(1%)+ (-0,000003773((°C9/5)+32)^4 + 0,0011788625*((°C9/5)+32)^3 - 0,1400139318((°C9/5)+32)^2 + 7,5072379375((°C9/5)+32) - 154,0188143761))-((-0,0000336713((°C9/5)+32)^4+0,0105207916((°C9/5)+32)^3-1,2495985607((°C9/5)+32)^2+67,0024722564((°C9/5)+32)-1374,6540546564)LN(40%)+ (-0,000003773((°C9/5)+32)^4 + 0,0011788625*((°C9/5)+32)^3 - 0,1400139318((°C9/5)+32)^2 + 7,5072379375((°C*9/5)+32) - 154,0188143761)))/(LN(4000%)/LN(2)))))

Google Translate
how do you write such a code?

We have to do some successive transformations to simplify this expression.

  • LN(x) in math is log(x) in AI2.
  • Commas should be replaced with decimal points in AI2.
  • ((°C *9/5)+32) should be replaced with a function call degF(degC) where the input variable degC is a Centigrade reading being returned as a Fahrenheit reading.
  • x% values should be replaced with x/100.

So here is the first step ...

(((-0.0000336713degF^4+0.0105207916 degF^3-1.2495985607* degF^2+67.0024722564* degF-1374.6540546564) LN(.01)+ (-0.000003773 degF^4 + 0.0011788625degF^3 - 0.1400139318 degF^2 + 7.5072379375* degF - 154.0188143761))-((-0.0000336713* degF^4+0.0105207916* degF^3-1.2495985607* degF^2 + 67.0024722564 * degF - 1374.6540546564) LN(.040)+ (-0.000003773 degF^4 + 0.0011788625degF^3 - 0.1400139318 degF^2 + 7.5072379375* degF - 154.0188143761)))/(LN(40)/LN(2)))))

1 Like

The next step is to work from the inside to the outside, replacing expressions with their blocks, saving the outermost ( ) groupings for the last and hoping we come out with a balance of ( and ) .

Note: If we read the initial expression from left to right, counting up from 0 at '(' and counting down at ')', we come out negative 3. So the initial expression is out of balance. I leave it to the Original Poster to match the final blocks against a more readable version of his formula.

I am using a global variable for degrees Centigrade and having the function degrees Fahrenheit depend on that value, for convenience. A production version of this formula should take degC as an input parameter.

global degC degF

(
sumpart1
*LN(.01)+
sumpart2
) -
(
sumpart3
*LN(.040)+
sumpart4
)
)/
log40overlog2
)))

Next we hope to balance this ...

1 Like

So here is my final result, probably wrong because the given formula was out of balance.
These blocks are draggable, so you should be able to rearrange them once you find the correctly balanced original formula.

global degC degF

2 Likes

:clap::clap::clap: @ABG

Well done sir!

1 Like

Grazie mille
Puoi mandarmi il codice scritto?
Posso mettere il link per il codice originale? É un file in excel per il calcolo del lievito partendo dalla temperatura e dalle ore di lievitazione. A me serve immettere i gradi in centigradi

The original excel file would make more sense than the improperly balanced formula you posted.

My blocks were draggable, so you could drag them directly from this board into the Blocks Editor.

https://docs.google.com/spreadsheet/ccc?key=0AuvMQbzk5INUdGZScWx6U2lYSEtZVkJuVGJiR19NaXc#gid=0

grazie mille sono riuscito a lavorarlo.
per avere solo due numero dopo il. come devo fare?
esempio
14.34567 come trasformalo in 14.35?

From Math section Try:
Screenshot_20200701-071253_Chrome