How to print float number in python using for loop?
i=0
j=0
for i in range (0,3,0.1):
for j in range (0,4,0.1):
print(i,j)
TypeError: 'float' object cannot be interpreted as an integer
The range() function can only work with integers (whole numbers, not decimals/floats).
The easiest way is to use numpy.arange or numpy.linspace option and python's enumerate().
Though using nested for loops isn't the ideal case, consider using numpy.meshgrid() and numpy.reshape().
See attached.
see
range function in python cannot take float number as a step value. You can write your own generator or else use numpy like below
import numpy as np
for i in np.arange(0.0,3.0,0.1):
for j in np.arange (0.0,4.0,0.1):
There are plenty of ways to achieve this (you may also want to use round function to round the resulting float values).
Both proposed solutions work well. The last one the most straight forward and intuitive but as said there are many ways of doing this and the best depends on how you will use the results later. I presume that the print is just to test the structure.
Thank you all for your support.
How to apply surface traction boundary condition as internal pressure in pipe bend analysis in abaqus.
03 April 2019 8,496 1 View
In pipe bend analysis, I am carrying out two step analysis. In first step, internal pressure applied and in second step rotation is applied. Now, how to extract their moment-end-rotation data?...
02 March 2019 2,015 5 View
How to import Numpy package (Python 3.6) to Abaqus 2017?
04 May 2018 1,291 0 View
I am working on Pipe bend analysis. I am having some FEA results for collapse moment. I need to form empirical formula. How to do that?
02 March 2018 6,083 4 View
I am studying research papers relevant pipe bend/elbow analysis. In most of the papers closed form solution has been given. How this closed form solution are obtained I just didn't understood....
01 February 2018 9,696 3 View
I have done some analysis of pipe bend. To calculate the limit load Moment vs Rotation curve is must. Anybody please explain how to obtain it?
01 February 2018 5,678 2 View
I'm studying the pipe elbow but i don't know how to assign Elbow element in ABAQUS/CAE. I am not able to find ELBOW elements. Can anyone suggest about it? i dont know where to find it in abaqus...
11 December 2017 2,394 3 View
I am modelling and analyzing the pipe bend in ABAQUS/CAE and element type is C3D20R.. How can i add uniform pressure in initial step?
11 December 2017 4,707 3 View
I'm dealing with a mediation model and am using the PROCESS module in SPSS. Due to SPSS and PROCESS being limited in the imputation methods - being unable to handle multiple imputation - the other...
02 March 2021 4,362 1 View
Is There Any Feasible Method To Test The Efficiency Of Fluorescent Compounds Other Than UV Spectrometers ? Suggestions Would Be Appreciated !
02 March 2021 5,785 3 View
Hi, I am trying to construct a multi-layer fibril structure from a single layer in PyMol by translating the layer along the fibril axis. For now, I am able to use the Translate command in PyMol...
02 March 2021 4,569 4 View
I want to do a parameter study of a aixsymmetric cylinder in Abaqus. I want to create several jobs where I get the stresses for 3 different points in my model. These points are defined. I wrote a...
01 March 2021 10,078 1 View
Which is suitable for use with Python? MySQL or SQL Server? What is your suggestion?
01 March 2021 3,422 3 View
Please, if Gaussian Parameter optimization is possible in this code structure
28 February 2021 278 3 View
I wanted to add an extra parameter to the existing Johnson cook equation in the ABAQUS simulation. How to add those extra parameters. Ref: A modified Johnson-Cook material model with strain...
28 February 2021 4,841 3 View
I'm currently working on a piece which asks to conduct an ANOVA - looking at the effect of sporting group (2 levels), and exercise trials (two trials with six levels). I've computed this all...
27 February 2021 9,626 4 View
System Description Cuda 11.2 GeForce GTX 1080ti tensorflow version 2.4.1 keras version 2.2.0 python version 3.8 I was getting the below error when I try to run my code on the...
25 February 2021 6,673 2 View
I have obtained Partial Eta Squared Numbers through Two-Way Mixed Anova Analysis. My results for different constructs are: .105, .135, .038, .068, .061 respectively. I wanted to know, whether...
24 February 2021 7,122 1 View