mathematica打包java_使用Mathematica将解决方案绘制到方程式中

我有一个函数 f(x,t) ,我想使用Mathematica绘制 f(x(t),t)=0 解决方案的功能 x(t) . 我该怎么做?

Mathematica通常与我可以使用的其他编程语言完全不同 . 通常,我会尝试看起来像:

Create arrays X, T

For t in T do

solve (numerically) f(x,t)=0, append the solution to X

Plot X

但是,我不太清楚如何在Mathematica中使用循环,对于数组也是如此,所以我在这方面遇到了严重的问题 .

Mathematica是否有一些快速,直接的方法来解决这个问题?如果没有,有人可以帮我解决这个问题吗?

此外,是否有人有更好的问题 Headers ?

Edit: 根据@LutzL的建议,我会尝试以下内容:

Table[FindRoot[f[x,t]==0,{x,x_0}],{t,start,stop,step}]

这会正常吗?

我还有一个问题,因为我的函数 f(x,t) 是高度非线性的,因此我想为每个 t 输入一个好的起点 . 具体来说,我知道 t=0 的解决方案,我想用于时间步 t_{n+1} t_n 的解决方案 . 有没有办法做到这一点?

Edit 2: 我通过以下方式解决了问题:

tmax = 10; nsteps = 100*tmax;

thrust = {v/2 - g}; angle = {Pi/2};

For[i = 1, i <= nsteps, i++,

sol = {thr, \[Theta]} /.

FindRoot[{eq1[i*tmax/nsteps],

eq2[i*tmax/nsteps]}, {{thr, Last[thrust]}, {\[Theta],

Last[angle]}}]; AppendTo[thrust, sol[[1]]];

AppendTo[angle, sol[[2]]]];

ListPlot[Table[{i*tmax/nsteps, thrust[[i + 1]]}, {i, 0, nsteps}]]

ListPlot[Table[{i*tmax/nsteps, angle[[i + 1]]/Pi}, {i, 0, nsteps}]]

其中 eq1 和 eq2 是我的方程式, thrust 和 angle 是解决方案

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值