Zero function on Dynamo to get the result of a particular equation

Hello there, I need to get the result of equations that are solvable only through trials. I thought at a For Cycle. I’m still trying but nothing works…

Hello, here is a possibility, try to show your research (Principle 1 of the Forum) also when you post

-a..a..0.1;
y=2*x*x+3*x-5;

Line.ByStartPointDirectionLength(
Point.ByCoordinates(-a,0),
Vector.ByCoordinates(1,0,0),
2*a);

Cordially
christianstan

1 Like

Can you give an example of what you are trying? Often there is an easy solution which we just aren’t seeing yet due to the lack of clarity in terms of how Dynamo works vs how we used to work.

You need to use a while loop, the algorithm itself is known as goal-seek. You could also use optioneering using the generative design features in Autodesk which is essentially the same thing. The downside is this type of problem is better suited to text-based programming, especially if you need recurison.

This is what I should solve. The only variable we have is X

I’m trying to use this style, thanks to @Thomas_Mahon hint

Hard to read which of those are constants, which are Dynamic variables, and which are numbers. What is the formula for? Without knowing exactly it looks like the Formula node might be of use here.

Dynamo Dictionary)

The previous website for this seems to have gone under, but I think everything was ported over to this github: GitHub - ncalc/ncalc: Mathematical Expressions Evaluator for .NET

The only variable is X. This is the Italian formula (NTC18) to verify column pressoflexion. I’m a novel on Dynamo, so I’ll take a look on the websites you linked. Thanks

So what is K1? K2? O1?

Likely the NTC18 gets us there, but I’d need a copy in English. :frowning:

Those are just the name I gave to the Moments for trying to not get you wrong with the symbols. Anyway, just forget which number represents what (I’m going to post the NTC18, but I think it exists the only Italian Version). Let’s try to solve this equation, more simple, but the principle is the same.

x^2 - 3x- 2 = 0

I thought on a for cycle, but I dont really know hot to do this :frowning:

1 Like

Home.dyn (5.5 KB)
Where is the problem?? :frowning:

you are trying to solve algebraic expressions.

I would look at newtons’ method or something general like sympy.
https://patrickwalls.github.io/mathematicalpython/root-finding/newton/
https://docs.sympy.org/latest/modules/solvers/solvers.html

1 Like

Yes, but how to translate this in a script? I’m sorry but I’m a novel in Dynamo, I still need to get confidence with Python

Assuming the answer for your x^2 - 3x- 2 = 0 formula is 3.561552, or at least close enough to it, this should get you started:

Certainly not as accurate as an external calculation tool, but it is well within construction tolerances at -8 significant digits.

2 Likes

That’s another solution. For first I did not think that could be useful for my situation, but I found the way to use even your method. Than you and greetings

2 Likes