所以我尝试使用sympy的dsolve函数来解决简单谐波运动的非常简单的情况,即:
我是这样做的:
w = sympy.symbols('ω', real = True, positive=True, nonzero=True)
t = sympy.symbols('t', real = True)
x = sympy.symbols('x')
eq = sympy.diff(sympy.diff(x(t), t), t) + w**2*x
sympy.pprint(sympy.dsolve(eq, x(t)))
当我这样做时,我得到以下解决方案:
而不是我期望的或。
为什么会这样?
答案 0 :(得分:2)
您尚未定义d.e.正常。它应该是
.diff
请注意,您可以使用更具可读性的eq = x(t).diff(t,2) + w**2*x(t)
方法
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
char gen;
char edu[3];
int exi;
float yos;
printf("This program finds out the salary of an employee\nnow if you are graduate then enter g and if you post graduate then enter pg here :- ");
scanf("%s",edu);
printf("now enter the yers of service of an employee here :- ");
scanf("%f",&yos);
printf("now if you are female then enter f and if you are male then enter m here :- ");
scanf(" %c",&gen);
printf("salary of an employee is ");
if (gen == 'm')
{
if((strcmp(edu, "pg") == 0) && yos>=10)
printf("1500");
else if((strcmp(edu, "g") == 0) && yos>=10)
printf("1000");
else if((strcmp(edu, "pg") == 0) && yos<10)
printf("10000");
else if((strcmp(edu, "g") == 0) && yos<10)
printf("7000");
}
else
{
if((strcmp(edu, "pg") == 0) && yos>=10)
printf("12000");
else if((strcmp(edu, "g") == 0) && yos>=10 )
printf("9000");
else if(yos <10 && (strcmp(edu, "pg") == 0))
printf("10000");
else if((strcmp(edu, "g") == 0) && yos <10)
printf("6000");
else
printf("i dont know!!!!! ");
}
printf("\nnow enter any digit to exit\n");
scanf("%d",&exi);
printf("you enterd %d , thus good bye",exi);
return 0;
}