Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import math #read initiali values of x0 , y0 and alpha and beta x0 = float(input(Enter x0: )) alpha = float(input(Enter alpha: )) y0 =

import math #read initiali values of x0 , y0 and alpha and beta x0 = float(input("Enter x0: ")) alpha = float(input("Enter alpha: ")) y0 = float(input("Enter y0: ")) beta = float(input("Enter beta: ")) #set x to x0 , y to y0 and time to 0 and delta of time to 0.5 x = x0 y = y0 t = 0 delta_t = 0.5 for i in range(0,5): #calculate x and y at time t x = x0*math.exp((-((alpha*beta)**0.5))*t) y = y0*math.exp((-((alpha*beta)**0.5))*t) #print x and y at time t print("x = %f" %x) print("y = %f" %y) #TODO print time print("t = ",t) #increment time t = t+delta_t

Add to the Python code above to solve the question below. The homework problem is below. Make changes to the code above to solve the homework problem.

The customer and yourself are satisfied with the initial battle simulator as a basis for further elaboration. They want to evaluate troop reinforcement policies that add more troops during a battle. Include the capability to add new troops modeled as instantaneous pulses of reinforcements. Each reinforcement may also have a different lethality coefficient ascribed to the new troops. Model the combined effect of lethality portions on the sides. Each side will be limited to a maximum of 3 reinforcements of specified levels. Elicit the inputs from the user and/or read them from a file. The replacement policies shall be specified as: - # of reinforcement events (0-3) - % of initial force level at which a reinforcement occurs (10% - 80%) - reinforcement force size as % of initial force level (10% - 50%) - lethality coefficient of the new troops. Troop reinforcements only occur when the reduction condition is met, thus less may occur than the maximum potential number provided. You may make other improvements to your initial program. Submit your source code file(s), evidence of successful execution, and other files used (if any). Provide any special instructions necessary to run your program.

image text in transcribed

This output shows example for 2 X reinforcements at .95 initial level threshold Your model should be teste d with well-designed test case s to dempnstrate that it implements logic conditions correctly E.g., this output demonstrates only 2 reinforcements are mde as specified (vs. 3 or more) by setting X troop threshold high with high relative opposing lethality. 1200 1000 800 600 400 200 10 0.00 0.25 0.50 0.75 1.00 1.25 1.50 Time This output shows example for 2 X reinforcements at .95 initial level threshold Your model should be teste d with well-designed test case s to dempnstrate that it implements logic conditions correctly E.g., this output demonstrates only 2 reinforcements are mde as specified (vs. 3 or more) by setting X troop threshold high with high relative opposing lethality. 1200 1000 800 600 400 200 10 0.00 0.25 0.50 0.75 1.00 1.25 1.50 Time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How can the Internet be helpful in a job search? (Objective 2)

Answered: 1 week ago